provider

package
v1.0.2-beta03 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: Apache-2.0 Imports: 3 Imported by: 28

Documentation

Index

Constants

View Source
const (
	// IaaSAPIKey is an IaaS-native user ID and API key
	IaaSAPIKey = AuthType("IAAS_API_KEY")

	// IAMAPIKey is an IAM account ID and API key
	IAMAPIKey = AuthType("IAM_API_KEY")

	// IAMAccessToken indicates the credential is an IAM access token
	IAMAccessToken = AuthType("IAM_ACCESS_TOKEN")
)
View Source
const (
	// SUCCESS ...
	SUCCESS = "Success"
	// FAILURE ...
	FAILURE = "Failure"
	// NOTSUPPORTED ...
	NOTSUPPORTED = "Not supported"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType string

AuthType ...

type Context

Context represents the volume provider management API for individual account, user ID, etc.

type ContextCredentials

type ContextCredentials struct {
	AuthType       AuthType
	DefaultAccount bool
	Region         string
	IAMAccountID   string
	UserID         string `json:"-"` // Do not trace
	Credential     string `json:"-"` // Do not trace

	// ContextID is an optional request/context/correlation identifier for diagnostics (need not be unique)
	ContextID string
}

ContextCredentials represents user credentials (e.g. API key) for volume operations from IaaS provider

type Error

type Error struct {
	// Fault ...
	Fault Fault
}

Error implements the error interface for a Fault. Most easily constructed using util.NewError() or util.NewErrorWithProperties()

func (Error) Code

func (err Error) Code() reasoncode.ReasonCode

Code satisfies the legacy provider.Error interface

func (Error) Error

func (err Error) Error() string

Error satisfies the error contract

func (Error) Properties

func (err Error) Properties() map[string]string

Properties satisfies the legacy provider.Error interface

func (Error) Wrapped

func (err Error) Wrapped() []string

Wrapped mirrors the legacy provider.Error interface

type Fault

type Fault struct {
	// Message is the fault message (required)
	Message string `json:"msg"`

	// ReasonCode is fault reason code (required)  //TODO: will have better reasoncode mechanism
	ReasonCode reasoncode.ReasonCode `json:"code"`

	// WrappedErrors contains wrapped error messages (if applicable)
	Wrapped []string `json:"wrapped,omitempty"`

	// Properties contains diagnostic properties (if applicable)
	Properties map[string]string `json:"properties,omitempty"`
}

Fault encodes a fault condition. Does not implement the error interface so that cannot be accidentally misassigned to error variables when returned in a function response.

type FaultResponse

type FaultResponse struct {
	Fault *Fault `json:"fault,omitempty"`
}

FaultResponse is an optional Fault

type GenerationType

type GenerationType string

GenerationType ...

func (GenerationType) String

func (i GenerationType) String() string

String ...

type IKSVolumeAttachment

type IKSVolumeAttachment struct {
	ClusterID *string `json:"clusterID,omitempty"`
}

IKSVolumeAttachment encapulates IKS related attachment parameters

type Profile

type Profile struct {
	Href string `json:"href,omitempty"`
	Name string `json:"name,omitempty"`
	CRN  string `json:"crn,omitempty"`
}

Profile ...

type RequestIDType

type RequestIDType string

RequestIDType ... Context won't allow keys as "string" type

const (
	// RequestID ...
	RequestID RequestIDType = RequestIDType("request-id")
)

type ResourceGroup

type ResourceGroup struct {
	Href string `json:"href,omitempty"`
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

ResourceGroup ...

type Session

type Session interface {
	Context

	// GetProviderDisplayName returns the name of the provider that is being used
	GetProviderDisplayName() VolumeProvider

	// Close is called when the Session is nolonger required
	Close()
}

Session is an Context that is notified when it is no longer required

type Snapshot

type Snapshot struct {
	Volume

	// a unique Snapshot ID which created by the provider
	SnapshotID string `json:"snapshotID,omitempty"`

	// The size of the snapshot, in GiB
	SnapshotSize *int `json:"snapshotSize,omitempty"`

	// Time stamp when snapshot creation was initiated
	SnapshotCreationTime time.Time `json:"snapCreationTime,omitempty"`

	// tags for the snapshot
	SnapshotTags SnapshotTags `json:"tags,omitempty"`
}

Snapshot ...

type SnapshotManager

type SnapshotManager interface {
	// Create snapshot space
	OrderSnapshot(VolumeRequest Volume) error

	// Snapshot operations
	// Create the snapshot on the volume
	CreateSnapshot(volume *Volume, tags map[string]string) (*Snapshot, error)

	// Delete the snapshot
	DeleteSnapshot(*Snapshot) error

	// Get the snapshot
	GetSnapshot(snapshotID string) (*Snapshot, error)

	// Get the snapshot with volume ID
	GetSnapshotWithVolumeID(volumeID string, snapshotID string) (*Snapshot, error)

	// Snapshot list by using tags
	ListSnapshots() ([]*Snapshot, error)

	//List all the  snapshots for a given volume
	ListAllSnapshots(volumeID string) ([]*Snapshot, error)
}

SnapshotManager ...

type SnapshotTags

type SnapshotTags map[string]string

SnapshotTags ...

type VPCVolume

type VPCVolume struct {
	Href                string               `json:"href,omitempty"`
	ResourceGroup       *ResourceGroup       `json:"resource_group,omitempty"`
	VolumeEncryptionKey *VolumeEncryptionKey `json:"encryption_key,omitempty"`
	Profile             *Profile             `json:"profile,omitempty"`
	Tags                []string             `json:"volume_tags,omitempty"`
	VolumeAttachments   *[]VolumeAttachment  `json:"volume_attachments,omitempty"`
	CRN                 string               `json:"crn,omitempty"`
}

VPCVolume specific parameters

type Volume

type Volume struct {
	// ID of the storage volume, for which we can track the volume
	VolumeID string `json:"volumeID,omitempty"` // order id should be there in the pv object as k10 looks for that in pv object

	// volume provider name
	Provider VolumeProvider `json:"provider"`

	// volume type block or file
	VolumeType VolumeType `json:"volumeType"`

	// Volume provider type i.e  Endurance or Performance or any other name
	ProviderType VolumeProviderType `json:"providerType,omitempty"`

	// The Capacity of the volume, in GiB
	Capacity *int `json:"capacity"`

	// The size of the snapshot space, in GiB
	SnapshotSpace *int `json:"snapshotSpace,omitempty"`

	// Volume IOPS for performance storage type only
	Iops *string `json:"iops"`

	// for endurance storage type only
	Tier *string `json:"tier"`

	// region of the volume
	Region string `json:"region,omitempty"`

	// Availability zone/datacenter/location of the storage volume
	Az string `json:"az,omitempty"`

	// billing type monthly or hourly
	BillingType string `json:"billingType,omitempty"`

	// Time stamp when volume creation was initiated
	CreationTime time.Time `json:"creationTime"`

	// storage_as_a_service|enterprise|performance     default from SL is storage_as_a_service
	ServiceOffering *string `json:"serviceOffering,omitempty"`

	// Name of a device
	Name *string `json:"name,omitempty"`

	// Backend Ipaddress  OR Hostname of a device. Applicable for file storage only
	BackendIPAddress *string `json:"backendIpAddress,omitempty"`

	// Service address for  mounting NFS volume  Applicable for file storage only
	FileNetworkMountAddress *string `json:"fileNetworkMountAddress,omitempty"`

	// VolumeNotes notes field as a map for all note fileds
	// will keep   {"plugin":"ibm-file-plugin-56f7bd4db6-wx4pd","region":"us-south","cluster":"3a3fd80459014aca84f8a7e58e7a3ded","type":"Endurance","pvc":"one30","pv":"pvc-c7b4d6bd-63c5-11e8-811c-3a16fc403383","storgeclass":"ibmc-file-billing","reclaim":"Delete"}
	VolumeNotes map[string]string `json:"volumeNotes,omitempty"`

	// LunID the lun of volume, Only for Softlayer block
	LunID string `json:"lunId,omitempty"`

	// Attributes map of specific storage provider volume attributes
	Attributes map[string]string `json:"attributes,omitempty"`

	// IscsiTargetIPAddresses list of target IP addresses for iscsi. Applicable for Iscsi block storage only
	IscsiTargetIPAddresses []string `json:"iscsiTargetIpAddresses,omitempty"`

	// Only for VPC volume provider
	VPCVolume
}

Volume ...

type VolumeAttachManager

type VolumeAttachManager interface {
	//Attach method attaches a volume/ fileset to a server
	//Its non bloking call and does not wait to complete the attachment
	AttachVolume(attachRequest VolumeAttachmentRequest) (*VolumeAttachmentResponse, error)
	//Detach detaches the volume/ fileset from the server
	//Its non bloking call and does not wait to complete the detachment
	DetachVolume(detachRequest VolumeAttachmentRequest) (*http.Response, error)

	//WaitForAttachVolume waits for the volume to be attached to the host
	//Return error if wait is timed out OR there is other error
	WaitForAttachVolume(attachRequest VolumeAttachmentRequest) (*VolumeAttachmentResponse, error)

	//WaitForDetachVolume waits for the volume to be detached from the host
	//Return error if wait is timed out OR there is other error
	WaitForDetachVolume(detachRequest VolumeAttachmentRequest) error

	//GetAttachAttachment retirves the current status of given volume attach request
	GetVolumeAttachment(attachRequest VolumeAttachmentRequest) (*VolumeAttachmentResponse, error)
}

VolumeAttachManager ...

type VolumeAttachment

type VolumeAttachment struct {
	Href string `json:"href,omitempty"`
	// ID volume attachment identifier
	ID string `json:"id,omitempty"`
	// Name volume attachment named
	Name string `json:"name,omitempty"`
	// Type of the volume - boot,data
	Type string `json:"type,omitempty"`
	// If set to true, when deleting the instance the volume will also be deleted
	DeleteVolumeOnInstanceDelete bool `json:"delete_volume_on_instance_delete,omitempty"`
	// device path for attachment
	DevicePath string `json:"device_path,omitempty"`
}

VolumeAttachment ...

type VolumeAttachmentRequest

type VolumeAttachmentRequest struct {
	VolumeID   string `json:"volumeID"`
	InstanceID string `json:"instanceID"`
	// Only for SL provider
	SoftlayerOptions map[string]string `json:"softlayerOptions,omitempty"`
	// Only for VPC provider
	VPCVolumeAttachment *VolumeAttachment `json:"vpcVolumeAttachment"`
	// Only IKS provider
	IKSVolumeAttachment *IKSVolumeAttachment `json:"iksVolumeAttachment"`
}

VolumeAttachmentRequest used for both attach and detach operation

type VolumeAttachmentResponse

type VolumeAttachmentResponse struct {
	VolumeAttachmentRequest
	//Status status of the volume attachment success, failed, attached, attaching, detaching
	Status    string     `json:"status,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

VolumeAttachmentResponse used for both attach and detach operation

type VolumeAuthorization

type VolumeAuthorization struct {
	// Volume to update the authorization
	Volume Volume `json:"volume"`
	// List of subnets to authorize. It might be SubnetIDs or CIDR based on the providers implementaions
	// For example, IBM Softlyaer provider  expects SubnetIDs to be passed
	Subnets []string `json:"subnets,omitempty"`
	// List of HostIPs to authorize
	HostIPs []string `json:"hostIPs,omitempty"`
}

VolumeAuthorization capture details of autorization to be made

type VolumeEncryptionKey

type VolumeEncryptionKey struct {
	CRN string `json:"crn,omitempty"`
}

VolumeEncryptionKey ...

type VolumeManager

type VolumeManager interface {
	// Provider name
	ProviderName() VolumeProvider

	// Type returns the underlying volume type
	Type() VolumeType

	// Volume operations
	// Create the volume with authorization by passing required information in the volume object
	CreateVolume(VolumeRequest Volume) (*Volume, error)

	// Create the volume from snapshot with snapshot tags
	CreateVolumeFromSnapshot(snapshot Snapshot, tags map[string]string) (*Volume, error)

	// Delete the volume
	DeleteVolume(*Volume) error

	// Get the volume by using ID  //
	GetVolume(id string) (*Volume, error)

	// Get the volume by using Name,
	// actually some of providers(like VPC) has the capability to provide volume
	// details by usig user provided volume name
	GetVolumeByName(name string) (*Volume, error)

	// Others
	// Get volume lists by using snapshot tags
	ListVolumes(tags map[string]string) ([]*Volume, error)

	// GetVolumeByRequestID fetch the volume by request ID.
	// Request Id is the one that is returned when volume is provsioning request is
	// placed with Iaas provider.
	GetVolumeByRequestID(requestID string) (*Volume, error)

	//AuthorizeVolume allows aceess to volume  based on given authorization
	AuthorizeVolume(volumeAuthorization VolumeAuthorization) error
}

VolumeManager ...

type VolumeProvider

type VolumeProvider string

VolumeProvider ...

type VolumeProviderType

type VolumeProviderType string

VolumeProviderType ...

type VolumeType

type VolumeType string

VolumeType ...

Jump to

Keyboard shortcuts

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