api

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FCInitiatorType     types.InitiatorType = "1"
	ISCSCIInitiatorType types.InitiatorType = "2"
)

InitiatorType constants

View Source
const (
	MaxResourceNameLength = 63

	AuthorizationHeader = "Authorization"
	XEmcRestClient      = "X-EMC-REST-CLIENT"

	UnityAPIInstanceTypeResources = unityAPITypes + "/%s" + "/instances"

	UnityAPIGetTenantURI = UnityAPIInstanceTypeResources + "?&compact=true&fields=%s"

	UnityAPIInstanceTypeResourcesWithFields = UnityAPIInstanceTypeResources + "?fields=%s"

	UnityAPIInstancesURI = unityRootAPI + "/instances"

	// UnityAPIGetResourceURI GETS RESOURCE BY RESOURCE ID {1}=type of resource, {2}=resource id
	UnityAPIGetResourceURI = UnityAPIInstancesURI + "/%s/%s"

	// UnityAPIGetResourceByNameURI GETS RESOURCE BY RESOURCE NAME {1}=type of resource, {2}=name of the resource
	UnityAPIGetResourceByNameURI = UnityAPIInstancesURI + "/%s/name:%s"

	// UnityAPIGetResourceWithFieldsURI GETS RESOURCE BY RESOURCE ID {1}=type of resource, {2}=resource id, {3}=fields
	UnityAPIGetResourceWithFieldsURI = UnityAPIGetResourceURI + "?fields=%s"

	// UnityAPIGetResourceByNameWithFieldsURI GETS RESOURCE BY RESOURCE NAME {1}=type of resource, {2}=name of the resource, {3}=fields
	UnityAPIGetResourceByNameWithFieldsURI = UnityAPIGetResourceByNameURI + "?fields=%s"

	// UnityAPILoginSessionInfoURI LOGINS resource URIs
	UnityAPILoginSessionInfoURI = unityAPITypes + "/loginSessionInfo"

	// UnityAPIBasicSysInfoURI gets BasicSystemInfo URI
	UnityAPIBasicSysInfoURI = unityAPITypes + "/basicSystemInfo/instances"

	// UnityAPIStorageResourceInstanceActionURI gets StorageResource instance Action URI
	UnityAPIStorageResourceInstanceActionURI = UnityAPIInstancesURI + "/storageResource/%s/action"

	// UnityAPIModifyLunURI Modify Volume URIs
	UnityAPIModifyLunURI = UnityAPIStorageResourceInstanceActionURI + "/modifyLun"

	// UnityAPICreateLunThinCloneURI Create LUN Thin Clone
	UnityAPICreateLunThinCloneURI = UnityAPIStorageResourceInstanceActionURI + "/createLunThinClone"

	// UnityAPIModifyStorageResourceURI gets StorageResource resource URIs
	UnityAPIModifyStorageResourceURI = UnityAPIInstancesURI + "/storageResource/%s"
	// UnityAPIStorageResourceActionURI gets StorageResource Action resource URI
	UnityAPIStorageResourceActionURI = unityAPITypes + "/storageResource/action/%s"

	// UnityModifyLunURI Modify Lun URIs
	UnityModifyLunURI = UnityAPIModifyStorageResourceURI + "/action/modifyLun"

	// UnityModifyFilesystemURI Modify Filesystem URIs
	UnityModifyFilesystemURI = UnityAPIModifyStorageResourceURI + "/action/modifyFilesystem"

	// UnityModifyNFSShareURI Modify NFS Share URIs
	UnityModifyNFSShareURI = UnityAPIGetResourceURI + "/action/modify"

	// UnityModifySnapshotURI Snapshot Action resource URIs
	UnityModifySnapshotURI = UnityAPIGetResourceURI + "/action/modify"

	// UnityCopySnapshotURI does Snapshot Copy Action
	UnityCopySnapshotURI = UnityAPIGetResourceURI + "/action/copy"

	// UnityAPIGetMaxVolumeSize gets the maximum volume size of an array {1}=unique identifier of the systemLimit instance, {2}=fields
	UnityAPIGetMaxVolumeSize = UnityAPIInstancesURI + "/systemLimit/%s?fields=%s"

	// UnityListHostInitiatorsURI gets Host Initiator URIs
	UnityListHostInitiatorsURI = unityAPITypes + "/hostInitiator/instances?fields="
	UnityModifyHostInitiators  = unityRootAPI + "/instances/hostInitiator/%s/action/modify"

	// UnityInstancesFilter does Unity Instance Filter
	UnityInstancesFilter = UnityAPIInstanceTypeResources + "?filter=%s"

	UnityMetric              = "metric"
	UnityMetricQueryResult   = "metricQueryResult"
	UnityMetricRealTimeQuery = "metricRealTimeQuery"

	// UnitySystemCapacity is used to get capacity metrics for Unity XT
	UnitySystemCapacity = "systemCapacity"

	LunAction               = "lun"
	CreateLunAction         = "createLun"
	FileSystemAction        = "filesystem"
	CreateFSAction          = "createFilesystem"
	NfsShareAction          = "nfsShare"
	StorageResourceAction   = "storageResource"
	HostAction              = "host"
	IPInterface             = "ipInterface"
	SnapAction              = "snap"
	PoolAction              = "pool"
	IOLimitPolicy           = "ioLimitPolicy"
	LicenseAction           = "license"
	HostInitiatorPathAction = "hostInitiatorPath"
	HostInitiatorAction     = "hostInitiator"
	HostIPPortAction        = "hostIPPort"
	NasServerAction         = "nasServer"
	TenantAction            = "tenant"
)

constants and URIs

View Source
const (
	HeaderKeyAccept          = "Accept"
	HeaderKeyContentType     = "Content-Type"
	HeaderValContentTypeJSON = "application/json"

	HeaderEMCCSRFToken = "EMC-CSRF-TOKEN"
)

Header Key constants

Variables

This section is empty.

Functions

func WriteIndented

func WriteIndented(w io.Writer, b []byte) error

WriteIndented indents all lines four spaces.

func WriteIndentedN

func WriteIndentedN(w io.Writer, b []byte, n int) error

WriteIndentedN indents all lines n spaces.

Types

type Client

type Client interface {
	// Get sends an HTTP request using the GET method to the API.
	Get(
		ctx context.Context,
		path string,
		headers map[string]string,
		resp interface{}) error

	// Post sends an HTTP request using the POST method to the API.
	Post(
		ctx context.Context,
		path string,
		headers map[string]string,
		body, resp interface{}) error

	// Put sends an HTTP request using the PUT method to the API.
	Put(
		ctx context.Context,
		path string,
		headers map[string]string,
		body, resp interface{}) error

	// Delete sends an HTTP request using the DELETE method to the API.
	Delete(
		ctx context.Context,
		path string,
		headers map[string]string,
		resp interface{}) error

	// ParseJSONError parses the JSON in r into an error object
	ParseJSONError(ctx context.Context, r *http.Response) error

	// DoWithHeaders sends HTTP request using the given method & headers.
	DoWithHeaders(
		ctx context.Context,
		method, uri string,
		headers map[string]string,
		body, resp interface{}) error

	// DoandGetResponseBody sends an HTTP request to the API and returns
	// the raw response body
	DoAndGetResponseBody(
		ctx context.Context,
		method, path string,
		headers map[string]string,
		body interface{}) (*http.Response, error)

	// SetToken sets the Auth token for the HTTP client
	SetToken(token string)

	// GetToken gets the Auth token for the HTTP client
	GetToken() string
}

Client Interface defines the methods.

func New

func New(ctx context.Context, host string, opts ClientOptions, debug bool) (Client, error)

New returns a new API client.

type ClientOptions

type ClientOptions struct {
	// Insecure is a flag that indicates whether or not to supress SSL errors.
	Insecure bool

	// Timeout specifies a time limit for requests made by this client.
	Timeout time.Duration

	// ShowHTTP is a flag that indicates whether or not HTTP requests and
	// responses should be logged to stdout
	ShowHTTP bool
}

ClientOptions are options for the API client.

Jump to

Keyboard shortcuts

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