sfapi

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatVolume

func FormatVolume(device, fsType string) error

func GetFSType

func GetFSType(device string) string

func GetInitiatorIqns

func GetInitiatorIqns() ([]string, error)

func LoginWithChap

func LoginWithChap(tiqn, portal, username, password, iface string) error

func Mount

func Mount(device, mountpoint string) error

func NewReqID

func NewReqID() int

func Umount

func Umount(mountpoint string) error

Types

type APIError

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

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"`
}

type AddAccountRequest

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

type AddAccountResult

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

type AddInitiatorsToVolumeAccessGroupRequest

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

type AddVolumesToVolumeAccessGroupRequest

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

type Client

type Client struct {
	SVIP              string
	Endpoint          string
	DefaultAPIPort    int
	DefaultVolSize    int64 //bytes
	DefaultAccountID  int64
	DefaultTenantName string
	VolumeTypes       *[]VolType
	Config            *Config
}

func New

func New() (c *Client, err error)

func NewFromConfig

func NewFromConfig(configFile string) (c *Client, err error)

func NewFromOpts added in v1.3.2

func NewFromOpts(ep string, dSize int64, storageIP string, acct string) (c *Client, err error)

func (*Client) AddAccount

func (c *Client) AddAccount(req *AddAccountRequest) (accountID int64, err error)

func (*Client) AddInitiatorsToVolumeAccessGroup

func (c *Client) AddInitiatorsToVolumeAccessGroup(r *AddInitiatorsToVolumeAccessGroupRequest) error

func (*Client) AddVolumeToAccessGroup

func (c *Client) AddVolumeToAccessGroup(groupID int64, volIDs []int64) (err error)

func (*Client) AttachVolume

func (c *Client) AttachVolume(v *Volume, iface string) (path, device string, err error)

func (*Client) CloneVolume

func (c *Client) CloneVolume(req *CloneVolumeRequest) (vol Volume, err error)

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(req *CreateSnapshotRequest) (snapshot Snapshot, err error)

func (*Client) CreateVolume

func (c *Client) CreateVolume(createReq *CreateVolumeRequest) (vol Volume, err error)

func (*Client) CreateVolumeAccessGroup

func (c *Client) CreateVolumeAccessGroup(r *CreateVolumeAccessGroupRequest) (vagID int64, err error)

func (*Client) DeleteRange

func (c *Client) DeleteRange(startID, endID int64)

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(snapshotID int64) (err error)

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volumeID int64) (err error)

func (*Client) DetachVolume

func (c *Client) DetachVolume(v Volume) (err error)

func (*Client) GetAccountByID

func (c *Client) GetAccountByID(req *GetAccountByIDRequest) (account Account, err error)

func (*Client) GetAccountByName

func (c *Client) GetAccountByName(req *GetAccountByNameRequest) (account Account, err error)

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(sfID int64, sfName string) (s Snapshot, err error)

func (*Client) GetVolumeByID

func (c *Client) GetVolumeByID(volID int64) (v Volume, err error)

func (*Client) GetVolumeByName

func (c *Client) GetVolumeByName(n string, acctID int64) (v Volume, err error)

func (*Client) GetVolumesByName

func (c *Client) GetVolumesByName(sfName string, acctID int64) (v []Volume, err error)

func (*Client) ListActiveVolumes

func (c *Client) ListActiveVolumes(listVolReq *ListActiveVolumesRequest) (volumes []Volume, err error)

func (*Client) ListSnapshots

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

func (*Client) ListVolumeAccessGroups

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

func (*Client) ListVolumesForAccount

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

func (*Client) MergeQoS added in v1.3.2

func (c *Client) MergeQoS(theType string, rQos string) QoS

func (*Client) ModifyVolume added in v1.3.2

func (c *Client) ModifyVolume(modReq *ModifyVolumeRequest) (err error)

func (*Client) Request

func (c *Client) Request(method string, params interface{}, id int) (response []byte, err error)

func (*Client) RollbackToSnapshot

func (c *Client) RollbackToSnapshot(req *RollbackToSnapshotRequest) (newSnapID int64, err error)

type CloneVolumeRequest

type CloneVolumeRequest struct {
	VolumeID     int64       `json:"volumeID"`
	Name         string      `json:"name"`
	NewAccountID int64       `json:"newAccountID,omitempty"`
	NewSize      int64       `json:"newSize,omitempty"`
	Access       string      `json:"access,omitempty"`
	SnapshotID   int64       `json:"snapshotID,omitempty"`
	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 Config

type Config struct {
	TenantName     string
	EndPoint       string
	DefaultVolSz   int64 //Default volume size in GiB
	MountPoint     string
	SVIP           string
	InitiatorIFace string //iface to use of iSCSI initiator
	Types          *[]VolType
}

func ProcessConfig

func ProcessConfig(fname string) (Config, error)

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"`
}

type CreateVolumeAccessGroupResult

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

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"`
}

type CreateVolumeResult

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

type DeleteSnapshotRequest

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

type DeleteVolumeRequest

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

type EmptyResponse

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

type GetAccountByIDRequest

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

type GetAccountByNameRequest

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

type GetAccountResult

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

type ISCSITarget

type ISCSITarget struct {
	Ip        string
	Port      string
	Portal    string
	Iqn       string
	Lun       string
	Device    string
	Discovery string
}

type ListActiveVolumesRequest

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

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"`
}

type ListVolumesAccessGroupsResult

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

type ListVolumesForAccountRequest

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

type ListVolumesResult

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

type ModifyVolumeRequest added in v1.3.2

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

type QoS

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

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
}

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"`
}

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"`
}

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"`
}

Jump to

Keyboard shortcuts

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