Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReqID

func NewReqID() int

NewReqID generates a random id for a request

Types

type Account

type Account struct {
	AccountID       int64       `json:"accountID,omitempty"`
	Username        string      `json:"username,omitempty"`
	Status          string      `json:"status,omitempty"`
	Volumes         []int64     `json:"volumes,omitempty"`
	InitiatorSecret string      `json:"initiatorSecret,omitempty"`
	TargetSecret    string      `json:"targetSecret,omitempty"`
	Attributes      interface{} `json:"attributes,omitempty"`
}

Account

type AddAccountRequest

type AddAccountRequest struct {
	Username        string      `json:"username"`
	InitiatorSecret string      `json:"initiatorSecret,omitempty"`
	TargetSecret    string      `json:"targetSecret,omitempty"`
	Attributes      interface{} `json:"attributes,omitempty"`
}

AddAccountRequest

type AddAccountResult

type AddAccountResult struct {
	ID     int `json:"id"`
	Result struct {
		AccountID int64 `json:"accountID"`
	} `json:"result"`
}

AddAccountResult

type AddInitiatorsToVolumeAccessGroupRequest

type AddInitiatorsToVolumeAccessGroupRequest struct {
	Initiators []string `json:"initiators"`
	VAGID      int64    `json:"volumeAccessGroupID"`
}

AddInitiatorsToVolumeAccessGroupRequest

type AddVolumesToVolumeAccessGroupRequest

type AddVolumesToVolumeAccessGroupRequest struct {
	VolumeAccessGroupID int64   `json:"volumeAccessGroupID"`
	Volumes             []int64 `json:"volumes"`
}

AddVolumesToVolumeAccessGroupRequest

type Client

type Client struct {
	SVIP             string
	Endpoint         string
	Config           *Config
	DefaultAPIPort   int
	VolumeTypes      *[]VolType
	AccessGroups     []int64
	DefaultBlockSize int64
	DebugTraceFlags  map[string]bool
	AccountID        int64
}

Client is used to send API requests to a SolidFire system

func NewFromParameters

func NewFromParameters(pendpoint, psvip string, pcfg Config) (c *Client, err error)

NewFromParameters is a factory method to create a new sfapi.Client object using the supplied parameters

func (*Client) AddAccount

func (c *Client) AddAccount(ctx context.Context, req *AddAccountRequest) (accountID int64, err error)

AddAccount tbd

func (*Client) AddInitiatorsToVolumeAccessGroup

func (c *Client) AddInitiatorsToVolumeAccessGroup(
	ctx context.Context, r *AddInitiatorsToVolumeAccessGroupRequest,
) error

AddInitiatorsToVolumeAccessGroup tbd

func (*Client) AddVolumesToAccessGroup

func (c *Client) AddVolumesToAccessGroup(ctx context.Context, req *AddVolumesToVolumeAccessGroupRequest) (err error)

AddVolumesToAccessGroup tbd

func (*Client) CloneVolume

func (c *Client) CloneVolume(ctx context.Context, req *CloneVolumeRequest) (Volume, error)

CloneVolume invokes the supplied clone volume request. It waits for the source volume (which itself may be new in a test scenario) to be ready to be cloned, and it waits for the clone to exist.

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(ctx context.Context, req *CreateSnapshotRequest) (snapshot Snapshot, err error)

func (*Client) CreateVolume

func (c *Client) CreateVolume(ctx context.Context, createReq *CreateVolumeRequest) (Volume, error)

CreateVolume tbd

func (*Client) CreateVolumeAccessGroup

func (c *Client) CreateVolumeAccessGroup(ctx context.Context, r *CreateVolumeAccessGroupRequest) (vagID int64,
	err error,
)

CreateVolumeAccessGroup tbd

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(ctx context.Context, snapshotID int64) (err error)

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(ctx context.Context, volumeID int64) (err error)

DeleteVolume tbd

func (*Client) DetachVolume

func (c *Client) DetachVolume(ctx context.Context, v Volume) error

DetachVolume tbd

func (*Client) GetAccountByID

func (c *Client) GetAccountByID(ctx context.Context, req *GetAccountByIDRequest) (account Account, err error)

GetAccountByID tbd

func (*Client) GetAccountByName

func (c *Client) GetAccountByName(ctx context.Context, req *GetAccountByNameRequest) (account Account, err error)

GetAccountByName tbd

func (*Client) GetClusterCapacity

func (c *Client) GetClusterCapacity(ctx context.Context) (capacity *ClusterCapacity, err error)

Get cluster capacity stats

func (*Client) GetClusterHardwareInfo

func (c *Client) GetClusterHardwareInfo(ctx context.Context) (*ClusterHardwareInfo, error)

Get cluster hardware info

func (*Client) GetDefaultQoS

func (c *Client) GetDefaultQoS(ctx context.Context) (*QoS, error)

Get default QoS information

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(ctx context.Context, snapID, volID int64, sfName string) (s Snapshot, err error)

func (*Client) GetVolumeByID

func (c *Client) GetVolumeByID(ctx context.Context, volID int64) (Volume, error)

GetVolumeByID returns the volume with the specified ID.

func (*Client) ListSnapshots

func (c *Client) ListSnapshots(ctx context.Context, req *ListSnapshotsRequest) (snapshots []Snapshot, err error)

func (*Client) ListVolumeAccessGroups

func (c *Client) ListVolumeAccessGroups(
	ctx context.Context, r *ListVolumeAccessGroupsRequest,
) (vags []VolumeAccessGroup, err error)

ListVolumeAccessGroups tbd

func (*Client) ListVolumes

func (c *Client) ListVolumes(ctx context.Context, listVolReq *ListVolumesRequest) (volumes []Volume, err error)

ListVolumes returns all volumes using the specified request object.

func (*Client) ListVolumesForAccount

func (c *Client) ListVolumesForAccount(
	ctx context.Context, listReq *ListVolumesForAccountRequest,
) (volumes []Volume, err error)

ListVolumesForAccount tbd

func (*Client) ModifyVolume

func (c *Client) ModifyVolume(ctx context.Context, req *ModifyVolumeRequest) (err error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method string, params interface{}, id int) ([]byte, error)

Request performs a json-rpc POST to the configured endpoint

func (*Client) RollbackToSnapshot

func (c *Client) RollbackToSnapshot(ctx context.Context, req *RollbackToSnapshotRequest) (newSnapID int64, err error)

func (*Client) WaitForVolumeByID

func (c *Client) WaitForVolumeByID(ctx context.Context, volID int64) (Volume, error)

WaitForVolumeByID polls for the volume with specified ID to appear, with backoff retry logic.

type CloneVolumeRequest

type CloneVolumeRequest struct {
	VolumeID   int64       `json:"volumeID"`
	Name       string      `json:"name"`
	SnapshotID int64       `json:"snapshotID"`
	Attributes interface{} `json:"attributes"`
}

type CloneVolumeResult

type CloneVolumeResult struct {
	ID     int `json:"id"`
	Result struct {
		CloneID     int64 `json:"cloneID"`
		VolumeID    int64 `json:"volumeID"`
		AsyncHandle int64 `json:"asyncHandle"`
	} `json:"result"`
}

type ClusterCapacity

type ClusterCapacity struct {
	ActiveBlockSpace             int64  `json:"activeBlockSpace"`
	ActiveSessions               int64  `json:"activeSessions"`
	AverageIOPS                  int64  `json:"averageIOPS"`
	ClusterRecentIOSize          int64  `json:"clusterRecentIOSize"`
	CurrentIOPS                  int64  `json:"currentIOPS"`
	MaxIOPS                      int64  `json:"maxIOPS"`
	MaxOverProvisionableSpace    int64  `json:"maxOverProvisionableSpace"`
	MaxProvisionedSpace          int64  `json:"maxProvisionedSpace"`
	MaxUsedMetadataSpace         int64  `json:"maxUsedMetadataSpace"`
	MaxUsedSpace                 int64  `json:"maxUsedSpace"`
	NonZeroBlocks                int64  `json:"nonZeroBlocks"`
	PeakActiveSessions           int64  `json:"peakActiveSessions"`
	PeakIOPS                     int64  `json:"peakIOPS"`
	ProvisionedSpace             int64  `json:"provisionedSpace"`
	Timestamp                    string `json:"timestamp"`
	TotalOps                     int64  `json:"totalOps"`
	UniqueBlocks                 int64  `json:"uniqueBlocks"`
	UniqueBlocksUsedSpace        int64  `json:"uniqueBlocksUsedSpace"`
	UsedMetadataSpace            int64  `json:"usedMetadataSpace"`
	UsedMetadataSpaceInSnapshots int64  `json:"usedMetadataSpaceInSnapshots"`
	UsedSpace                    int64  `json:"usedSpace"`
	ZeroBlocks                   int64  `json:"zeroBlocks"`
}

type ClusterHardwareInfo

type ClusterHardwareInfo struct {
	Drives interface{} `json:"drives"`
	Nodes  interface{} `json:"nodes"`
}

type Config

type Config struct {
	TenantName       string
	EndPoint         string
	MountPoint       string
	SVIP             string
	InitiatorIFace   string // iface to use of iSCSI initiator
	Types            *[]VolType
	LegacyNamePrefix string
	AccessGroups     []int64
	DefaultBlockSize int64
	DebugTraceFlags  map[string]bool
}

Config holds the configuration data for the Client to communicate with a SolidFire storage system

type CreateSnapshotRequest

type CreateSnapshotRequest struct {
	VolumeID                int64       `json:"volumeID"`
	SnapshotID              int64       `json:"snapshotID"`
	Name                    string      `json:"name"`
	EnableRemoteReplication bool        `json:"enableRemoteReplication"`
	Retention               string      `json:"retention"`
	Attributes              interface{} `json:"attributes"`
}

type CreateSnapshotResult

type CreateSnapshotResult struct {
	ID     int `json:"id"`
	Result struct {
		SnapshotID int64  `json:"snapshotID"`
		Checksum   string `json:"checksum"`
	} `json:"result"`
}

type CreateVolumeAccessGroupRequest

type CreateVolumeAccessGroupRequest struct {
	Name       string   `json:"name"`
	Volumes    []int64  `json:"volumes,omitempty"`
	Initiators []string `json:"initiators,omitempty"`
}

CreateVolumeAccessGroupRequest

type CreateVolumeAccessGroupResult

type CreateVolumeAccessGroupResult struct {
	ID     int `json:"id"`
	Result struct {
		VagID int64 `json:"volumeAccessGroupID"`
	} `json:"result"`
}

CreateVolumeAccessGroupResult

type CreateVolumeRequest

type CreateVolumeRequest struct {
	Name       string      `json:"name"`
	AccountID  int64       `json:"accountID"`
	TotalSize  int64       `json:"totalSize"`
	Enable512e bool        `json:"enable512e"`
	Qos        QoS         `json:"qos,omitempty"`
	Attributes interface{} `json:"attributes"`
}

CreateVolumeRequest

type CreateVolumeResult

type CreateVolumeResult struct {
	ID     int `json:"id"`
	Result struct {
		VolumeID int64 `json:"volumeID"`
	} `json:"result"`
}

CreateVolumeResult

type DefaultQoSRequest

type DefaultQoSRequest struct{}

type DefaultQoSResult

type DefaultQoSResult struct {
	ID     int `json:"id"`
	Result struct {
		BurstIOPS int64 `json:"burstIOPS"`
		MaxIOPS   int64 `json:"maxIOPS"`
		MinIOPS   int64 `json:"minIOPS"`
	} `json:"result"`
}

type DeleteSnapshotRequest

type DeleteSnapshotRequest struct {
	SnapshotID int64 `json:"snapshotID"`
}

type DeleteVolumeRequest

type DeleteVolumeRequest struct {
	VolumeID int64 `json:"volumeID"`
}

DeleteVolumeRequest

type EmptyResponse

type EmptyResponse struct {
	ID     int      `json:"id"`
	Result struct{} `json:"result"`
}

EmptyResponse

type Error

type Error struct {
	ID     int `json:"id"`
	Fields struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
		Name    string `json:"name"`
	} `json:"error"`
}

Error wrapper

func (Error) Error

func (e Error) Error() string

type GetAccountByIDRequest

type GetAccountByIDRequest struct {
	AccountID int64 `json:"accountID"`
}

GetAccountByIDRequest

type GetAccountByNameRequest

type GetAccountByNameRequest struct {
	Name string `json:"username"`
}

GetAccountByNameRequest

type GetAccountResult

type GetAccountResult struct {
	ID     int `json:"id"`
	Result struct {
		Account Account `json:"account"`
	} `json:"result"`
}

GetAccountResult

type GetClusterCapacityRequest

type GetClusterCapacityRequest struct{}

type GetClusterCapacityResult

type GetClusterCapacityResult struct {
	ID     int `json:"id"`
	Result struct {
		ClusterCapacity ClusterCapacity `json:"clusterCapacity"`
	} `json:"result"`
}

type GetClusterHardwareInfoResult

type GetClusterHardwareInfoResult struct {
	ID     int `json:"id"`
	Result struct {
		ClusterHardwareInfo ClusterHardwareInfo `json:"clusterHardwareInfo"`
	} `json:"result"`
}

type ListActiveVolumesRequest

type ListActiveVolumesRequest struct {
	StartVolumeID int64 `json:"startVolumeID"`
	Limit         int64 `json:"limit"`
}

ListActiveVolumesRequest

type ListSnapshotsRequest

type ListSnapshotsRequest struct {
	VolumeID int64 `json:"volumeID"`
}

type ListSnapshotsResult

type ListSnapshotsResult struct {
	ID     int `json:"id"`
	Result struct {
		Snapshots []Snapshot `json:"snapshots"`
	} `json:"result"`
}

type ListVolumeAccessGroupsRequest

type ListVolumeAccessGroupsRequest struct {
	StartVAGID int64 `json:"startVolumeAccessGroupID,omitempty"`
	Limit      int64 `json:"limit,omitempty"`
}

ListVolumeAccessGroupsRequest

type ListVolumesAccessGroupsResult

type ListVolumesAccessGroupsResult struct {
	ID     int `json:"id"`
	Result struct {
		Vags []VolumeAccessGroup `json:"volumeAccessGroups"`
	} `json:"result"`
}

ListVolumesAccessGroupsResult

type ListVolumesForAccountRequest

type ListVolumesForAccountRequest struct {
	AccountID int64 `json:"accountID"`
}

ListVolumesForAccountRequest

type ListVolumesRequest

type ListVolumesRequest struct {
	Accounts      []int64 `json:"accounts"`
	StartVolumeID *int64  `json:"startVolumeID,omitempty"`
	Limit         *int64  `json:"limit,omitempty"`
}

ListVolumesRequest

type ListVolumesResult

type ListVolumesResult struct {
	ID     int `json:"id"`
	Result struct {
		Volumes []Volume `json:"volumes"`
	} `json:"result"`
}

ListVolumesResult

type ModifyVolumeRequest

type ModifyVolumeRequest struct {
	VolumeID   int64       `json:"volumeID"`
	AccountID  int64       `json:"accountID,omitempty"`
	Access     string      `json:"access,omitempty"`
	Qos        QoS         `json:"qos,omitempty"`
	TotalSize  int64       `json:"totalSize,omitempty"`
	Attributes interface{} `json:"attributes,omitempty"`
}

type ModifyVolumeResult

type ModifyVolumeResult struct {
	Volume Volume `json:"volume,omitempty"`
	Curve  QoS    `json:"curve,omitempty"`
}

type QoS

type QoS struct {
	MinIOPS   int64 `json:"minIOPS,omitempty"`
	MaxIOPS   int64 `json:"maxIOPS,omitempty"`
	BurstIOPS int64 `json:"burstIOPS,omitempty"`
	BurstTime int64 `json:"-"`
}

QoS settings

type RollbackToSnapshotRequest

type RollbackToSnapshotRequest struct {
	VolumeID         int64       `json:"volumeID"`
	SnapshotID       int64       `json:"snapshotID"`
	SaveCurrentState bool        `json:"saveCurrentState"`
	Name             string      `json:"name"`
	Attributes       interface{} `json:"attributes"`
}

type RollbackToSnapshotResult

type RollbackToSnapshotResult struct {
	ID     int `json:"id"`
	Result struct {
		Checksum   string `json:"checksum"`
		SnapshotID int64  `json:"snapshotID"`
	} `json:"result"`
}

type Snapshot

type Snapshot struct {
	SnapshotID int64       `json:"snapshotID"`
	VolumeID   int64       `json:"volumeID"`
	Name       string      `json:"name"`
	Checksum   string      `json:"checksum"`
	Status     string      `json:"status"`
	TotalSize  int64       `json:"totalSize"`
	GroupID    int64       `json:"groupID"`
	CreateTime string      `json:"createTime"`
	Attributes interface{} `json:"attributes"`
}

type VolType

type VolType struct {
	Type string
	QOS  QoS
}

VolType holds quality of service configuration data

type Volume

type Volume struct {
	VolumeID           int64        `json:"volumeID"`
	Name               string       `json:"name"`
	AccountID          int64        `json:"accountID"`
	CreateTime         string       `json:"createTime"`
	Status             string       `json:"status"`
	Access             string       `json:"access"`
	Enable512e         bool         `json:"enable512e"`
	Iqn                string       `json:"iqn"`
	ScsiEUIDeviceID    string       `json:"scsiEUIDeviceID"`
	ScsiNAADeviceID    string       `json:"scsiNAADeviceID"`
	Qos                QoS          `json:"qos"`
	VolumeAccessGroups []int64      `json:"volumeAccessGroups"`
	VolumePairs        []VolumePair `json:"volumePairs"`
	DeleteTime         string       `json:"deleteTime"`
	PurgeTime          string       `json:"purgeTime"`
	SliceCount         int64        `json:"sliceCount"`
	TotalSize          int64        `json:"totalSize"`
	BlockSize          int64        `json:"blockSize"`
	VirtualVolumeID    string       `json:"virtualVolumeID"`
	Attributes         interface{}  `json:"attributes"`
}

Volume settings

func (*Volume) GetAttributesAsMap

func (v *Volume) GetAttributesAsMap() map[string]string

GetAttributesAsMap converts from an interface{} into a map[string]string

type VolumeAccessGroup

type VolumeAccessGroup struct {
	Initiators     []string    `json:"initiators"`
	Attributes     interface{} `json:"attributes"`
	DeletedVolumes []int64     `json:"deletedVolumes"`
	Name           string      `json:"name"`
	VAGID          int64       `json:"volumeAccessGroupID"`
	Volumes        []int64     `json:"volumes"`
}

VolumeAccessGroup

type VolumePair

type VolumePair struct {
	ClusterPairID    int64  `json:"clusterPairID"`
	RemoteVolumeID   int64  `json:"remoteVolumeID"`
	RemoteSliceID    int64  `json:"remoteSliceID"`
	RemoteVolumeName string `json:"remoteVolumeName"`
	VolumePairUUID   string `json:"volumePairUUID"`
}

VolumePair settings

Jump to

Keyboard shortcuts

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