blockstorage

package
v0.0.0-...-bb8f566 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoogleCloudZone            = "CLOUDSDK_COMPUTE_ZONE"
	GoogleCloudCreds           = "GOOGLE_APPLICATION_CREDENTIALS"
	GoogleProjectID            = "projectID"
	GoogleServiceKey           = "serviceKey"
	AzureStorageAccount        = "AZURE_STORAGE_ACCOUNT_NAME"
	AzureStorageKey            = "AZURE_STORAGE_ACCOUNT_KEY"
	AzureSubscriptionID        = "AZURE_SUBSCRIPTION_ID"
	AzureTenantID              = "AZURE_TENANT_ID"
	AzureClientID              = "AZURE_CLIENT_ID"
	AzureClientSecret          = "AZURE_CLIENT_SECRET"
	AzureResurceGroup          = "AZURE_RESOURCE_GROUP"
	AzureResurceMgrEndpoint    = "AZURE_RESOURCE_MANAGER_ENDPOINT"
	AzureMigrateStorageAccount = "AZURE_MIGRATE_STORAGE_ACCOUNT_NAME"
	AzureMigrateStorageKey     = "AZURE_MIGRATE_STORAGE_ACCOUNT_KEY"
	AzureMigrateResourceGroup  = "AZURE_MIGRATE_RESOURCE_GROUP"
	AzureActiveDirEndpoint     = "AZURE_AD_ENDPOINT"
	AzureActiveDirResourceID   = "AZURE_AD_RESOURCE"
	AzureCloudEnvironmentID    = "AZURE_CLOUD_ENV_ID"
)

Google Cloud environment variable names

View Source
const (
	BytesInGi = 1024 * 1024 * 1024
	BytesInMi = 1024 * 1024
)

Variables

This section is empty.

Functions

func Int

func Int(i *int) int

Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil.

func Int32

func Int32(i *int32) int32

Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a pointer to the passed int32.

func Int64

func Int64(i *int64) int64

Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil.

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to the passed int.

func KeyValueToMap

func KeyValueToMap(kv []*KeyValue) map[string]string

KeyValueToMap converts a KeyValue slice to a map

func MapToString

func MapToString(m map[string]string, entrySep string, kvSep string, keyPrefix string) string

MapToString creates a string representation of a map with the entries separated by entrySep, and the key separated from the value using kvSep

func SanitizeTags

func SanitizeTags(tags map[string]string) map[string]string

SanitizeTags are used to sanitize the tags

func SizeInGi

func SizeInGi(sizeInBytes int64) int64

SizeInGi converts bytes to GiBs

func SliceStringPtr

func SliceStringPtr(s []string) []*string

SliceStringPtr returns a slice of string pointers from the passed string slice.

func StringFromPtr

func StringFromPtr(s *string) string

String returns a string value for the passed string pointer. It returns the empty string if the pointer is nil.

func StringMap

func StringMap(msp map[string]*string) map[string]string

StringMap returns a map of strings built from the map of string pointers. The empty string is used for nil pointers.

func StringMapPtr

func StringMapPtr(ms map[string]string) *map[string]*string

StringMapPtr returns a pointer to a map of string pointers built from the passed map of strings.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the passed string.

func StringSlice

func StringSlice(s *[]string) []string

StringSlice returns a string slice value for the passed string slice pointer. It returns a nil slice if the pointer is nil.

Types

type KeyValue

type KeyValue struct {

	// Key or index name
	Key string

	// Value string
	Value string
}

KeyValue String key-value pairs

func MapToKeyValue

func MapToKeyValue(stringMap map[string]string) []*KeyValue

MapToKeyValue converts a map to a KeyValue slice

type Provider

type Provider interface {
	// Type returns the underlying storage type
	Type() Type
	// Volume operations
	VolumeCreate(context.Context, Volume) (*Volume, error)
	VolumeCreateFromSnapshot(ctx context.Context, snapshot Snapshot, tags map[string]string) (*Volume, error)
	VolumeDelete(context.Context, *Volume) error
	VolumeGet(ctx context.Context, id string, zone string) (*Volume, error)
	// Snapshot operations
	SnapshotCopy(ctx context.Context, from Snapshot, to Snapshot) (*Snapshot, error)
	// SnapshotCopyWithArgs func is invoked to perform migration when there is a need to provide
	// additional params such as creds of target cluster to carry out the
	// Snapshot copy action, use SnapshotCopy func otherwise.
	// Currently used by Azure only.
	SnapshotCopyWithArgs(ctx context.Context, from Snapshot, to Snapshot, args map[string]string) (*Snapshot, error)
	SnapshotCreate(ctx context.Context, volume Volume, tags map[string]string) (*Snapshot, error)
	SnapshotCreateWaitForCompletion(context.Context, *Snapshot) error
	SnapshotDelete(context.Context, *Snapshot) error
	SnapshotGet(ctx context.Context, id string) (*Snapshot, error)
	// Others
	SetTags(ctx context.Context, resource interface{}, tags map[string]string) error
	VolumesList(ctx context.Context, tags map[string]string, zone string) ([]*Volume, error)
	SnapshotsList(ctx context.Context, tags map[string]string) ([]*Snapshot, error)
}

Provider abstracts actions on underlying storage

type RestoreTargeter

type RestoreTargeter interface {
	// SnapshotRestoreTargets returns whether a snapshot can be restored globally.
	// If not globally restorable, returns a map of the regions and zones to which snapshot can be restored.
	SnapshotRestoreTargets(context.Context, *Snapshot) (global bool, regionsAndZones map[string][]string, err error)
}

RestoreTargeter implements the SnapshotRestoreTargets method

type Snapshot

type Snapshot struct {

	// Time stamp when snapshot creation was initiated
	CreationTime TimeStamp

	// Snapshot is encrypted
	Encrypted bool

	// A unique identifier generated by the storage provider
	ID string

	// Snapshot availability region
	Region string

	// The size of the snapshot, in Bytes
	SizeInBytes int64

	// tags
	Tags SnapshotTags

	// Storage type of the source volume for this snapshot
	Type Type

	// volume
	Volume *Volume

	// ProvisioningState is snapshot's provisioning state.
	ProvisioningState string
}

Snapshot of Volume

func FilterSnapshotsWithTags

func FilterSnapshotsWithTags(snapshots []*Snapshot, tags map[string]string) []*Snapshot

FilterSnapshotsWithTags filters a list of snapshots with the given tags.

type SnapshotTags

type SnapshotTags []*KeyValue

SnapshotTags snapshot tags

type TimeStamp

type TimeStamp strfmt.DateTime

TimeStamp Time stamp for an event related to an object, for example when the object was created.

type Type

type Type string

Type is the type of storage supported

const (
	// TypeAD captures enum value "AD"
	TypeAD Type = "AD"
	// TypeEBS captures enum value "EBS"
	TypeEBS Type = "EBS"
	// TypeGPD captures enum value "GPD"
	TypeGPD Type = "GPD"
	// TypeCinder captures enum value "Cinder"
	TypeCinder Type = "Cinder"
	// TypeGeneric captures enum value "Generic"
	TypeGeneric Type = "Generic"
	// TypeCeph captures enum value "Ceph"
	TypeCeph Type = "Ceph"
	// TypeEFS captures enum value "EFS"
	TypeEFS Type = "EFS"
	// TypeFCD capture enum value for "VMWare FCD"
	TypeFCD Type = "FCD"
)

type Volume

type Volume struct {

	// Availability zone
	Az string

	// Time stamp when volume creation was initiated
	CreationTime TimeStamp

	// Volume is encrypted
	Encrypted bool

	// A unique identifier generated by the storage provider
	ID string

	// Volume IOPS, if specified for this volume
	Iops int64

	// The size of the volume, in Bytes
	SizeInBytes int64

	// tags
	Tags VolumeTags

	// Storage type for this volume
	Type Type

	// Volume type
	VolumeType string

	// Attributes specific to the provider
	Attributes map[string]string
}

Volume A storage provider volume

type VolumeTags

type VolumeTags []*KeyValue

VolumeTags volume tags

Directories

Path Synopsis
TODO: Switch to using the latest azure sdk and remove nolint.
TODO: Switch to using the latest azure sdk and remove nolint.

Jump to

Keyboard shortcuts

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