Documentation ¶
Index ¶
- Constants
- Variables
- func FromProviderToLibVolume(vpcVolume *models.Volume, logger *zap.Logger) (libVolume *provider.Volume)
- func IsValidVolumeIDFormat(volID string) bool
- func NewProvider(conf *config.Config, logger *zap.Logger) (local.Provider, error)
- func SetRetryParameters(maxAttempts int, maxGap int)
- func ToInt(valueInInt string) int
- func ToInt64(valueInInt string) int64
- func WaitForValidVolumeState(vpcs *VPCSession, volumeID string) (err error)
- type Error
- type Fault
- type FaultResponse
- type VPCBlockProvider
- type VPCSession
- func (vpcs *VPCSession) AttachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
- func (vpcs *VPCSession) AuthorizeVolume(volumeAuthorization provider.VolumeAuthorization) error
- func (*VPCSession) Close()
- func (vpcs *VPCSession) CreateSnapshot(volumeRequest *provider.Volume, tags map[string]string) (*provider.Snapshot, error)
- func (vpcs *VPCSession) CreateVolume(volumeRequest provider.Volume) (volumeResponse *provider.Volume, err error)
- func (vpcs *VPCSession) CreateVolumeFromSnapshot(snapshot provider.Snapshot, tags map[string]string) (*provider.Volume, error)
- func (vpcs *VPCSession) DeleteSnapshot(snapshot *provider.Snapshot) error
- func (vpcs *VPCSession) DeleteVolume(volume *provider.Volume) (err error)
- func (vpcs *VPCSession) DetachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) (*http.Response, error)
- func (vpcs *VPCSession) GetProviderDisplayName() provider.VolumeProvider
- func (vpcs *VPCSession) GetSnapshot(snapshotID string) (*provider.Snapshot, error)
- func (vpcs *VPCSession) GetSnapshotWithVolumeID(volumeID string, snapshotID string) (*provider.Snapshot, error)
- func (vpcs *VPCSession) GetVolume(id string) (respVolume *provider.Volume, err error)
- func (vpcs *VPCSession) GetVolumeAttachment(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
- func (vpcs *VPCSession) GetVolumeByName(name string) (respVolume *provider.Volume, err error)
- func (vpcs *VPCSession) GetVolumeByRequestID(requestID string) (*provider.Volume, error)
- func (vpcs *VPCSession) ListAllSnapshots(volumeID string) ([]*provider.Snapshot, error)
- func (vpcs *VPCSession) ListSnapshots() ([]*provider.Snapshot, error)
- func (vpcs *VPCSession) ListVolumes(tags map[string]string) ([]*provider.Volume, error)
- func (vpcs *VPCSession) OrderSnapshot(volumeRequest provider.Volume) error
- func (vpcs *VPCSession) ProviderName() provider.VolumeProvider
- func (vpcs *VPCSession) Type() provider.VolumeType
- func (vpcs *VPCSession) WaitForAttachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
- func (vpcs *VPCSession) WaitForDetachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) error
Constants ¶
const ( VpcVolumeAttachment = "vpcVolumeAttachment" StatusAttached = "attached" StatusAttaching = "attaching" StatusDetaching = "detaching" )
VpcVolumeAttachment ...
const ( // VPC storage provider VPC = provider.VolumeProvider("VPC") // VolumeType ... VolumeType = provider.VolumeType("vpc-block") // SnapshotMask ... SnapshotMask = "" /* 337-byte string literal not displayed */ )
Variables ¶
var (
// DeleteVolumeReason ...
DeleteVolumeReason = "deleted by ibm-volume-lib on behalf of user request"
)
Functions ¶
func FromProviderToLibVolume ¶
func FromProviderToLibVolume(vpcVolume *models.Volume, logger *zap.Logger) (libVolume *provider.Volume)
FromProviderToLibVolume converting vpc provider volume type to generic lib volume type
func IsValidVolumeIDFormat ¶
IsValidVolumeIDFormat validating
func NewProvider ¶
NewProvider initialises an instance of an IaaS provider.
func SetRetryParameters ¶ added in v0.0.2
SetRetryParameters sets the retry logic parameters
func WaitForValidVolumeState ¶ added in v0.0.2
func WaitForValidVolumeState(vpcs *VPCSession, volumeID string) (err error)
WaitForValidVolumeState checks the volume for valid status
Types ¶
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) Properties ¶
Properties satisfies 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 VPCBlockProvider ¶
type VPCBlockProvider struct { ClientProvider riaas.RegionalAPIClientProvider APIConfig riaas.Config // contains filtered or unexported fields }
VPCBlockProvider implements provider.Provider
func (*VPCBlockProvider) ContextCredentialsFactory ¶
func (vpcp *VPCBlockProvider) ContextCredentialsFactory(zone *string) (local.ContextCredentialsFactory, error)
ContextCredentialsFactory ...
func (*VPCBlockProvider) OpenSession ¶
func (vpcp *VPCBlockProvider) OpenSession(ctx context.Context, contextCredentials provider.ContextCredentials, ctxLogger *zap.Logger) (provider.Session, error)
OpenSession opens a session on the provider
type VPCSession ¶
type VPCSession struct { VPCAccountID string Config *config.VPCProviderConfig ContextCredentials provider.ContextCredentials VolumeType provider.VolumeType Provider provider.VolumeProvider Apiclient riaas.RegionalAPI APIClientVolAttachMgr instances.VolumeAttachManager APIVersion string Logger *zap.Logger }
VPCSession implements lib.Session
func (*VPCSession) AttachVolume ¶
func (vpcs *VPCSession) AttachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
AttachVolume attach volume based on given volume attachment request
func (*VPCSession) AuthorizeVolume ¶
func (vpcs *VPCSession) AuthorizeVolume(volumeAuthorization provider.VolumeAuthorization) error
AuthorizeVolume allows aceess to volume based on given authorization
func (*VPCSession) CreateSnapshot ¶
func (vpcs *VPCSession) CreateSnapshot(volumeRequest *provider.Volume, tags map[string]string) (*provider.Snapshot, error)
CreateSnapshot Create snapshot from given volume
func (*VPCSession) CreateVolume ¶
func (vpcs *VPCSession) CreateVolume(volumeRequest provider.Volume) (volumeResponse *provider.Volume, err error)
CreateVolume Get the volume by using ID
func (*VPCSession) CreateVolumeFromSnapshot ¶
func (vpcs *VPCSession) CreateVolumeFromSnapshot(snapshot provider.Snapshot, tags map[string]string) (*provider.Volume, error)
CreateVolumeFromSnapshot creates the volume by using ID
func (*VPCSession) DeleteSnapshot ¶
func (vpcs *VPCSession) DeleteSnapshot(snapshot *provider.Snapshot) error
DeleteSnapshot delete snapshot
func (*VPCSession) DeleteVolume ¶
func (vpcs *VPCSession) DeleteVolume(volume *provider.Volume) (err error)
DeleteVolume deletes the volume
func (*VPCSession) DetachVolume ¶
func (vpcs *VPCSession) DetachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) (*http.Response, error)
DetachVolume detach volume based on given volume attachment request
func (*VPCSession) GetProviderDisplayName ¶
func (vpcs *VPCSession) GetProviderDisplayName() provider.VolumeProvider
GetProviderDisplayName returns the name of the VPC provider
func (*VPCSession) GetSnapshot ¶
func (vpcs *VPCSession) GetSnapshot(snapshotID string) (*provider.Snapshot, error)
GetSnapshot get snapshot
func (*VPCSession) GetSnapshotWithVolumeID ¶
func (vpcs *VPCSession) GetSnapshotWithVolumeID(volumeID string, snapshotID string) (*provider.Snapshot, error)
GetSnapshotWithVolumeID get snapshot
func (*VPCSession) GetVolume ¶
func (vpcs *VPCSession) GetVolume(id string) (respVolume *provider.Volume, err error)
GetVolume gets the volume by using ID
func (*VPCSession) GetVolumeAttachment ¶
func (vpcs *VPCSession) GetVolumeAttachment(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
GetVolumeAttachment get the volume attachment based on the request
func (*VPCSession) GetVolumeByName ¶
func (vpcs *VPCSession) GetVolumeByName(name string) (respVolume *provider.Volume, err error)
GetVolumeByName ...
func (*VPCSession) GetVolumeByRequestID ¶
func (vpcs *VPCSession) GetVolumeByRequestID(requestID string) (*provider.Volume, error)
GetVolumeByRequestID get volume by volume ID
func (*VPCSession) ListAllSnapshots ¶
func (vpcs *VPCSession) ListAllSnapshots(volumeID string) ([]*provider.Snapshot, error)
ListAllSnapshots list all snapshots
func (*VPCSession) ListSnapshots ¶
func (vpcs *VPCSession) ListSnapshots() ([]*provider.Snapshot, error)
ListSnapshots list all snapshots
func (*VPCSession) ListVolumes ¶
ListVolumes list all volumes
func (*VPCSession) OrderSnapshot ¶
func (vpcs *VPCSession) OrderSnapshot(volumeRequest provider.Volume) error
OrderSnapshot order snapshot
func (*VPCSession) ProviderName ¶
func (vpcs *VPCSession) ProviderName() provider.VolumeProvider
ProviderName ...
func (*VPCSession) WaitForAttachVolume ¶
func (vpcs *VPCSession) WaitForAttachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error)
WaitForAttachVolume waits for volume to be attached to node. e.g waits till status becomes attached
func (*VPCSession) WaitForDetachVolume ¶
func (vpcs *VPCSession) WaitForDetachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) error
WaitForDetachVolume waits for volume to be detached from node. e.g waits till no volume attachment is found
Source Files ¶
- attach_volume.go
- authorize_volume.go
- create_snapshot.go
- create_volume.go
- create_volume_from_snapshot.go
- delete_snapshot.go
- delete_volume.go
- detach_volume.go
- error.go
- get_snapshot.go
- get_volume.go
- get_volume_attachment.go
- get_volume_with_request_id.go
- list_all_snapshots.go
- list_snapshots.go
- list_volumes.go
- order_snapshot.go
- provider.go
- session.go
- token_generator.go
- util.go
- wait_for_attach_volume.go
- wait_for_detach_volume.go
- wait_for_valid_volume_state.go