provider

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	VpcVolumeAttachment = "vpcVolumeAttachment"
	StatusAttached      = "attached"
	StatusAttaching     = "attaching"
	StatusDetaching     = "detaching"
)

VpcVolumeAttachment ...

View Source
const (
	// VPC storage provider
	VPC = provider.VolumeProvider("VPC")
	// VolumeType ...
	VolumeType = provider.VolumeType("vpc-block")
	// SnapshotMask ...
	SnapshotMask = "" /* 337-byte string literal not displayed */
)

Variables

View Source
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

func IsValidVolumeIDFormat(volID string) bool

IsValidVolumeIDFormat validating

func NewProvider

func NewProvider(conf *config.Config, logger *zap.Logger) (local.Provider, error)

NewProvider initialises an instance of an IaaS provider.

func SetRetryParameters added in v0.0.2

func SetRetryParameters(maxAttempts int, maxGap int)

SetRetryParameters sets the retry logic parameters

func ToInt

func ToInt(valueInInt string) int

ToInt ...

func ToInt64

func ToInt64(valueInInt string) int64

ToInt64 ...

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) 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 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) Close

func (*VPCSession) Close()

Close at present does nothing

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

func (vpcs *VPCSession) ListVolumes(tags map[string]string) ([]*provider.Volume, error)

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) Type

func (vpcs *VPCSession) Type() provider.VolumeType

Type ...

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

Jump to

Keyboard shortcuts

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