Documentation ¶
Index ¶
- Constants
- Variables
- func GetProxyToken(host string, username string, password string) (string, error)
- type ApiError
- type Client
- func (this *Client) Copy() *Client
- func (this *Client) Export() *ExportService
- func (this *Client) Group() *GroupService
- func (this *Client) Host() *HostService
- func (this *Client) Initiator() *InitiatorService
- func (this *Client) LastError() ApiError
- func (this *Client) Project() *ProjectService
- func (this *Client) Search(path string) ([]Resource, error)
- func (this *Client) Task() *TaskService
- func (this *Client) VArray() *VArrayService
- func (this *Client) VPool() *VPoolService
- func (this *Client) Volume() *VolumeService
- func (this *Client) Workflow() *WorkflowService
- type Export
- type ExportService
- func (this *ExportService) Array(array string) *ExportService
- func (this *ExportService) Create() (*Export, error)
- func (this *ExportService) Delete() error
- func (this *ExportService) Id(id string) *ExportService
- func (this *ExportService) Initiators(itrs ...string) *ExportService
- func (this *ExportService) Name(name string) *ExportService
- func (this *ExportService) Project(project string) *ExportService
- func (this *ExportService) Query() (*Export, error)
- func (this *ExportService) Search(query string) (*Export, error)
- func (this *ExportService) Type(t ExportType) *ExportService
- func (this *ExportService) Volumes(vols ...string) *ExportService
- type ExportType
- type ExportVolume
- type Group
- type GroupService
- type Host
- type HostService
- func (this *HostService) Create(host string) (*Host, error)
- func (this *HostService) Discover(host, username, password string, port int, ssl bool) (*Host, error)
- func (this *HostService) Id(id string) *HostService
- func (this *HostService) Initiators() ([]Initiator, error)
- func (this *HostService) Name(name string) *HostService
- func (this *HostService) OSVersion(v string) *HostService
- func (this *HostService) Query() (*Host, error)
- func (this *HostService) Search(query string) (*Host, error)
- func (this *HostService) Tenant(id string) *HostService
- func (this *HostService) Type(t HostType) *HostService
- type HostType
- type Initiator
- type InitiatorService
- type InitiatorType
- type NamedResource
- type Project
- type ProjectService
- type Resource
- type ResourceId
- type ResourceLink
- type SearchResult
- type StorageObject
- type Task
- type TaskService
- type TaskState
- type VArray
- type VArrayBlockSettings
- type VArrayObjectSettings
- type VArrayService
- type VPool
- type VPoolService
- type Volume
- type VolumeService
- func (this *VolumeService) Array(array string) *VolumeService
- func (this *VolumeService) Create(size uint64) (*Volume, error)
- func (this *VolumeService) Delete(force bool) error
- func (this *VolumeService) Group(group string) *VolumeService
- func (this *VolumeService) Id(id string) *VolumeService
- func (this *VolumeService) List() ([]string, error)
- func (this *VolumeService) Name(name string) *VolumeService
- func (this *VolumeService) Pool(pool string) *VolumeService
- func (this *VolumeService) Project(project string) *VolumeService
- func (this *VolumeService) Query() (*Volume, error)
- func (this *VolumeService) Search(query string) (*Volume, error)
- func (this *VolumeService) WWN(wwn string) *VolumeService
- type Workflow
- type WorkflowService
- type WorkflowState
Constants ¶
const ( ErrCodeOK = 0 ErrCodeInvalidParam = 1008 ErrCodeCreateNotAllowed = 1054 )
const (
ExportTypeExclusive = "Exclusive"
)
Variables ¶
var ( ErrLoginFailed = errors.New("Login failed") ErrAuthFailed = errors.New("Authorization failed") )
var ( // ErrCreateResponse is returned when the api call returns an unexptected result ErrCreateResponse = errors.New("Invalid create response received") )
var (
ErrResourceNotFound = errors.New("resource not found")
)
var (
ErrTaskWaitTimeout = errors.New("WaitDone timeout")
)
var (
ErrWorkflowWaitTimeout = errors.New("WaitDone timeout")
)
Functions ¶
Types ¶
type ApiError ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient returns a new coprhd rest api client using the specified proxy token The proxy token can be generated programmatically using the GetProxyToken method or better using the `coprtop` tool
func (*Client) Export ¶
func (this *Client) Export() *ExportService
Export gets an instance to the ExportService
func (*Client) Group ¶
func (this *Client) Group() *GroupService
func (*Client) Host ¶
func (this *Client) Host() *HostService
Host returns an instance of the HostService
func (*Client) Initiator ¶
func (this *Client) Initiator() *InitiatorService
func (*Client) LastError ¶
LastError return the last ApiError If a method returns an error object, you can check this to get more specific details
func (*Client) Project ¶
func (this *Client) Project() *ProjectService
Project returns an instances the ProjectService
func (*Client) Task ¶
func (this *Client) Task() *TaskService
func (*Client) VArray ¶
func (this *Client) VArray() *VArrayService
func (*Client) VPool ¶
func (this *Client) VPool() *VPoolService
func (*Client) Volume ¶
func (this *Client) Volume() *VolumeService
Volume returns an instance of the VolumeService
func (*Client) Workflow ¶
func (this *Client) Workflow() *WorkflowService
type Export ¶
type Export struct { StorageObject `json:",inline"` Volumes []ExportVolume `json:"volumes"` Initiators []Initiator `json:"initiators"` Hosts []NamedResource `json:"hosts"` Clustsers []NamedResource `json:"clusters"` GeneratedName string `json:"generated_name"` PathParams []string `json:"path_parameters"` }
Export represents a storage export group
type ExportService ¶
type ExportService struct { *Client // contains filtered or unexported fields }
ExportService provices a means for querying or creating volume export groups
func (*ExportService) Array ¶
func (this *ExportService) Array(array string) *ExportService
func (*ExportService) Create ¶
func (this *ExportService) Create() (*Export, error)
Create creates and export with the specfied name
func (*ExportService) Delete ¶
func (this *ExportService) Delete() error
func (*ExportService) Id ¶
func (this *ExportService) Id(id string) *ExportService
Id sets the id urn for the export group, use for query, ignored for create
func (*ExportService) Initiators ¶
func (this *ExportService) Initiators(itrs ...string) *ExportService
func (*ExportService) Name ¶
func (this *ExportService) Name(name string) *ExportService
Name sets the name for the export group
func (*ExportService) Project ¶
func (this *ExportService) Project(project string) *ExportService
func (*ExportService) Query ¶
func (this *ExportService) Query() (*Export, error)
func (*ExportService) Type ¶
func (this *ExportService) Type(t ExportType) *ExportService
func (*ExportService) Volumes ¶
func (this *ExportService) Volumes(vols ...string) *ExportService
type ExportVolume ¶
type ExportVolume struct { ResourceId `json:",inline"` Lun int `json:"lun,omitempty"` }
type Group ¶
type Group struct {
StorageObject `json:",inline"`
}
type GroupService ¶
type GroupService struct { *Client // contains filtered or unexported fields }
func (*GroupService) Id ¶
func (this *GroupService) Id(id string) *GroupService
func (*GroupService) Name ¶
func (this *GroupService) Name(name string) *GroupService
func (*GroupService) Query ¶
func (this *GroupService) Query() (*Group, error)
type Host ¶
type Host struct { StorageObject `json:",inline"` Type HostType `json:"type"` OSVersion string `json:"os_version,omitempty"` HostName string `json:"host_name"` Port int `json:"port_number,omitempty"` Username string `json:"user_name,omitempty"` SSL bool `json:"use_ssl,omitempty"` Discoverable bool `json:"discoverable"` RegistrationStatus string `json:"registration_status"` Tenant Resource `json:"tenant"` Cluster Resource `json:"cluster,omitempty"` }
Host represents a physical host resource
type HostService ¶
type HostService struct { *Client // contains filtered or unexported fields }
HostService provides host creation and querying
func (*HostService) Create ¶
func (this *HostService) Create(host string) (*Host, error)
Create creates a new host with the name and host
func (*HostService) Discover ¶
func (this *HostService) Discover(host, username, password string, port int, ssl bool) (*Host, error)
Discover creates and attempts to discover a new host
func (*HostService) Id ¶
func (this *HostService) Id(id string) *HostService
Id sets the id for the host query
func (*HostService) Initiators ¶
func (this *HostService) Initiators() ([]Initiator, error)
Initiators returns a slice of Initiator objects for the host
func (*HostService) Name ¶
func (this *HostService) Name(name string) *HostService
Name sets the name for the host creation or query
func (*HostService) OSVersion ¶
func (this *HostService) OSVersion(v string) *HostService
OSVersion sets the os version string for the creation
func (*HostService) Query ¶
func (this *HostService) Query() (*Host, error)
Query locates a Host record by id or name
func (*HostService) Search ¶
func (this *HostService) Search(query string) (*Host, error)
Search performs a search for the host using the query string
func (*HostService) Tenant ¶
func (this *HostService) Tenant(id string) *HostService
Tenant sets the tenant id for the creation
func (*HostService) Type ¶
func (this *HostService) Type(t HostType) *HostService
Type sets the HostType for the creation
type Initiator ¶
type Initiator struct { StorageObject `json:",inline"` Host Resource `json:"host"` Protocol InitiatorType `json:"protocol"` Status string `json:"registration_status"` Hostname string `json:"hostname"` Node string `json:"initiator_node"` Port string `json:"initiator_port"` }
type InitiatorService ¶
type InitiatorService struct { *Client // contains filtered or unexported fields }
func (*InitiatorService) Id ¶
func (this *InitiatorService) Id(id string) *InitiatorService
func (*InitiatorService) Port ¶
func (this *InitiatorService) Port(port string) *InitiatorService
func (*InitiatorService) Query ¶
func (this *InitiatorService) Query() (*Initiator, error)
type InitiatorType ¶
type InitiatorType string
const ( InitiatorTypeISCSI InitiatorType = "iSCSI" InitiatorTypeFC InitiatorType = "FC" InitiatorTypeScaleIO = "ScaleIO" )
type NamedResource ¶
NameResource is a resource with a name
type Project ¶
type Project struct {
StorageObject `json:",inline"`
}
Project represents a storage project object
type ProjectService ¶
type ProjectService struct { *Client // contains filtered or unexported fields }
ProjectService provides an interface for querying projects
func (*ProjectService) Id ¶
func (this *ProjectService) Id(id string) *ProjectService
Id sets the id urn for the query
func (*ProjectService) Name ¶
func (this *ProjectService) Name(name string) *ProjectService
Name sets the name for the query
func (*ProjectService) Query ¶
func (this *ProjectService) Query() (*Project, error)
Query locates a Project by id or name
type Resource ¶
type Resource struct { ResourceId `json:",inline"` Link ResourceLink `json:"link,omitempty"` }
Resource is a resource id with a link
type ResourceId ¶
type ResourceId struct {
Id string `json:"id"`
}
ResourceId contains an id string urn for a resource
type ResourceLink ¶
ResourceLink represents the uri for a urn
type SearchResult ¶
type SearchResult struct {
Resources []Resource `json:"resource"`
}
type StorageObject ¶
type StorageObject struct { NamedResource `json:",inline"` Inactive bool `json:"inactive"` Global bool `json:"global"` Remote bool `json:"remote"` Vdc Resource `json:"vdc"` Tags []string `json:"tags"` Internal bool `json:"internal"` Project Resource `json:"project,omitempty"` Tenant Resource `json:"tenant,omitempty"` CreationTime int64 `json:"creation_time"` VArray Resource `json:"varray,omitempty"` Owner string `json:"owner,omitempty"` Type string `json:"type,omitempty"` }
StorageObject is the base object structure for the storageos platform
type TaskService ¶
type TaskService struct {
*Client
}
type TaskState ¶
type TaskState string
const ( TaskPollDelay = time.Millisecond * 250 TaskStatePending TaskState = "pending" TaskStateError TaskState = "error" TaskStateReady TaskState = "ready" )
type VArray ¶
type VArray struct { StorageObject `json:",inline"` BlockSettings VArrayBlockSettings `json:"block_settings"` ObjectSettings VArrayObjectSettings `json:"object_settings"` AutoSanZoning bool `json:"auto_san_zoning"` }
type VArrayBlockSettings ¶
type VArrayBlockSettings struct {
AutoSanZoning bool `json:"auto_san_zoning"`
}
type VArrayObjectSettings ¶
type VArrayService ¶
type VArrayService struct { *Client // contains filtered or unexported fields }
func (*VArrayService) Id ¶
func (this *VArrayService) Id(id string) *VArrayService
func (*VArrayService) Name ¶
func (this *VArrayService) Name(name string) *VArrayService
func (*VArrayService) Query ¶
func (this *VArrayService) Query() (*VArray, error)
type VPool ¶
type VPool struct { StorageObject `json:",inline"` Protocols []InitiatorType `json:"protocols"` }
func (*VPool) HasProtocol ¶
func (this *VPool) HasProtocol(p InitiatorType) bool
type VPoolService ¶
type VPoolService struct { *Client // contains filtered or unexported fields }
func (*VPoolService) Id ¶
func (this *VPoolService) Id(id string) *VPoolService
func (*VPoolService) Name ¶
func (this *VPoolService) Name(name string) *VPoolService
func (*VPoolService) Query ¶
func (this *VPoolService) Query() (*VPool, error)
type Volume ¶
type Volume struct { StorageObject `json:",inline"` WWN string `json:"wwn"` Protocols []string `json:"protocols"` Protection interface{} `json:"protection"` ConsistencyGroup string `json:"consistency_group,omitempty"` StorageController string `json:"storage_controller"` DeviceLabel string `json:"device_label"` NativeId string `json:"native_id"` ProvisionedCapacity string `json:"provisioned_capacity_gb"` AllocatedCapacity string `json:"allocated_capacity_gb"` RequestedCapacity string `json:"requested_capacity_gb"` PreAllocationSize string `json:"pre_allocation_size_gb"` IsComposite bool `json:"is_composite"` ThinlyProvisioned bool `json:"thinly_provisioned"` HABackingVolumes []string `json:"high_availability_backing_volumes"` AccessState string `json:"access_state"` StoragePool Resource `json:"storage_pool"` }
Volume is a complete coprhd volume object
type VolumeService ¶
type VolumeService struct { *Client // contains filtered or unexported fields }
VolumeService is used to create, search, and query for volumes
func (*VolumeService) Array ¶
func (this *VolumeService) Array(array string) *VolumeService
Array sets the varray urn for the VolumeService instance
func (*VolumeService) Create ¶
func (this *VolumeService) Create(size uint64) (*Volume, error)
Create creates a new volume with the specified name and size using the volume service
func (*VolumeService) Delete ¶
func (this *VolumeService) Delete(force bool) error
Delete deactivates the volume using the volume service
func (*VolumeService) Group ¶
func (this *VolumeService) Group(group string) *VolumeService
Group sets the consistency group urn for the VolumeService instance
func (*VolumeService) Id ¶
func (this *VolumeService) Id(id string) *VolumeService
Id sets the volume id urn for the VolumeService instance
func (*VolumeService) List ¶
func (this *VolumeService) List() ([]string, error)
func (*VolumeService) Name ¶
func (this *VolumeService) Name(name string) *VolumeService
Name sets the volume name for the VolumeService instance
func (*VolumeService) Pool ¶
func (this *VolumeService) Pool(pool string) *VolumeService
Pool sets the vpool urn for the VolumeService instance
func (*VolumeService) Project ¶
func (this *VolumeService) Project(project string) *VolumeService
Project sets the project urn for the VolumeService instance
func (*VolumeService) Query ¶
func (this *VolumeService) Query() (*Volume, error)
Query returns the volume object using the specified id
func (*VolumeService) Search ¶
func (this *VolumeService) Search(query string) (*Volume, error)
Search searches for a volume using the specified query string For example:
Search("name=foo")
func (*VolumeService) WWN ¶
func (this *VolumeService) WWN(wwn string) *VolumeService
type Workflow ¶
type Workflow struct { StorageObject `json:",inline"` Completed bool `json:"completed"` State WorkflowState `json:"completion_state"` Message string `json:"completion_message"` }
type WorkflowService ¶
type WorkflowService struct {
*Client
}
func (*WorkflowService) Query ¶
func (this *WorkflowService) Query(id string) (Workflow, error)
Query returns the task object
func (*WorkflowService) WaitDone ¶
func (this *WorkflowService) WaitDone(id string, state WorkflowState, to time.Duration) error
WaitDone does a busy poll to wait for a task to reach the specified state with the timeout
type WorkflowState ¶
type WorkflowState string
const ( WorkflowPollDelay = time.Millisecond * 250 WorkflowStateError WorkflowState = "ERROR" WorkflowStateSuccess WorkflowState = "SUCCESS" )