zapi

package
v2.0.0-...-22a6e85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package zapi provides type Client for connecting to a C-dot or 7-mode ONTAP cluster and sending API requests using the ZAPI protocol.

Package zapi Copyright NetApp Inc, 2021 All rights reserved

Index

Constants

View Source
const (
	DefaultAPIVersion = "1.3"
	DefaultTimeout    = "30s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Logger *slog.Logger

	Metadata *util.Metadata
	// contains filtered or unexported fields
}

func New

func New(poller *conf.Poller, c *auth.Credentials) (*Client, error)

func NewTestClient

func NewTestClient() *Client

NewTestClient It's used for unit test only

func (*Client) BuildRequest

func (c *Client) BuildRequest(request *node.Node) error

BuildRequest builds an API request from the node query root element of the request is usually the API name (e.g. "volume-get-iter") and its children are the attributes requested

func (*Client) BuildRequestString

func (c *Client) BuildRequestString(request string) error

BuildRequestString builds an API request from the request. request is usually the API name (e.g. "system-get-info") without any attributes

func (*Client) ClusterUUID

func (c *Client) ClusterUUID() string

ClusterUUID returns the cluster UUID of a c-mode system and system-id for 7-mode

func (*Client) Info

func (c *Client) Info() string

Info returns a string with details about the ONTAP system identity

func (*Client) Init

func (c *Client) Init(retries int, remote conf.Remote) error

Init connects to the cluster and retrieves system info it will give up after retries

func (*Client) Invoke

func (c *Client) Invoke(testFilePath string) (*node.Node, error)

Invoke is used for two purposes If testFilePath is non-empty -> Used only from unit test Else -> will issue the API request and return server response this method should only be called after building the request

func (*Client) InvokeBatchRequest

func (c *Client) InvokeBatchRequest(request *node.Node, tag string, testFilePath string, headers ...map[string]string) (Response, error)

InvokeBatchRequest is used for two purposes If testFilePath is non-empty -> Used only from unit test Else -> will issue API requests in series, once there are no more instances returned by the server, returned results will be nil Use the returned tag for subsequent calls to this method

func (*Client) InvokeBatchWithTimers

func (c *Client) InvokeBatchWithTimers(request *node.Node, tag string, headers ...map[string]string) (*node.Node, string, time.Duration, time.Duration, error)

InvokeBatchWithTimers does the same as InvokeBatchRequest, but it also returns API time and XML parse time

func (*Client) InvokeRequest

func (c *Client) InvokeRequest(request *node.Node) (*node.Node, error)

InvokeRequest builds a request from request and invokes it

func (*Client) InvokeRequestString

func (c *Client) InvokeRequestString(request string) (*node.Node, error)

InvokeRequestString builds a request from request and invokes it

func (*Client) InvokeWithTimers

func (c *Client) InvokeWithTimers(testFilePath string, headers ...map[string]string) (*node.Node, time.Duration, time.Duration, error)

InvokeWithTimers is used for two purposes If testFilePath is non-empty -> Used only from unit test Else -> invokes the request and returns parsed XML response and timers: API wait time and XML parse time. This method should only be called after building the request

func (*Client) InvokeZapiCall

func (c *Client) InvokeZapiCall(request *node.Node) ([]*node.Node, error)

InvokeZapiCall will issue API requests with batching

func (*Client) IsClustered

func (c *Client) IsClustered() bool

IsClustered returns true if ONTAP is clustered or false if it's a 7-mode system

func (*Client) Name

func (c *Client) Name() string

Name returns the name of the Cluster

func (*Client) Release

func (c *Client) Release() string

Release returns string with long release info of the ONTAP system

func (*Client) Remote

func (c *Client) Remote() conf.Remote

func (*Client) Serial

func (c *Client) Serial() string

Serial returns the serial number of the ONTAP system

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout string)

func (*Client) TraceLogSet

func (c *Client) TraceLogSet(collectorName string, config *node.Node)

func (*Client) Version

func (c *Client) Version() string

Version returns version of the ONTAP server (generation, major and minor)

type Response

type Response struct {
	Result *node.Node
	Tag    string
	Rd     time.Duration
	Pd     time.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL