Documentation ¶
Overview ¶
Package openstack snapshots provides an implementation of Cinder Snapshot features cinder functions using Gophercloud.
Index ¶
- Constants
- func GetConfigFromEnv() (gophercloud.AuthOptions, gophercloud.EndpointOpts, error)
- func InitOpenStackProvider(cfg string)
- type Config
- type IMetadata
- type IOpenStack
- type OpenStack
- func (os *OpenStack) AttachVolume(instanceID, volumeID string) (string, error)
- func (os *OpenStack) CreateSnapshot(name, volID, description string, tags *map[string]string) (*snapshots.Snapshot, error)
- func (os *OpenStack) CreateVolume(name string, size int, vtype, availability string, snapshotID string, ...) (string, string, int, error)
- func (os *OpenStack) DeleteSnapshot(snapID string) error
- func (os *OpenStack) DeleteVolume(volumeID string) error
- func (os *OpenStack) DetachVolume(instanceID, volumeID string) error
- func (os *OpenStack) GetAttachmentDiskPath(instanceID, volumeID string) (string, error)
- func (os *OpenStack) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
- func (os *OpenStack) GetSnapshotByNameAndVolumeID(n string, volumeId string) ([]snapshots.Snapshot, error)
- func (os *OpenStack) GetVolume(volumeID string) (Volume, error)
- func (os *OpenStack) GetVolumesByName(n string) ([]Volume, error)
- func (os *OpenStack) ListSnapshots(limit, offset int, filters map[string]string) ([]snapshots.Snapshot, error)
- func (os *OpenStack) ListVolumes() ([]Volume, error)
- func (os *OpenStack) WaitDiskAttached(instanceID string, volumeID string) error
- func (os *OpenStack) WaitDiskDetached(instanceID string, volumeID string) error
- func (os *OpenStack) WaitSnapshotReady(snapshotID string) error
- type OpenStackMock
- func (_m *OpenStackMock) AttachVolume(instanceID string, volumeID string) (string, error)
- func (_m *OpenStackMock) CreateSnapshot(name string, volID string, description string, tags *map[string]string) (*snapshots.Snapshot, error)
- func (_m *OpenStackMock) CreateVolume(name string, size int, vtype string, availability string, snapshotID string, ...) (string, string, int, error)
- func (_m *OpenStackMock) DeleteSnapshot(snapID string) error
- func (_m *OpenStackMock) DeleteVolume(volumeID string) error
- func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error
- func (_m *OpenStackMock) GetAttachmentDiskPath(instanceID string, volumeID string) (string, error)
- func (_m *OpenStackMock) GetAvailabilityZone() (string, error)
- func (_m *OpenStackMock) GetInstanceID() (string, error)
- func (_m *OpenStackMock) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
- func (_m *OpenStackMock) GetSnapshotByNameAndVolumeID(n string, volumeId string) ([]snapshots.Snapshot, error)
- func (_m *OpenStackMock) GetVolumesByName(name string) ([]Volume, error)
- func (_m *OpenStackMock) ListSnapshots(limit int, offset int, filters map[string]string) ([]snapshots.Snapshot, error)
- func (_m *OpenStackMock) ListVolumes() ([]Volume, error)
- func (_m *OpenStackMock) WaitDiskAttached(instanceID string, volumeID string) error
- func (_m *OpenStackMock) WaitDiskDetached(instanceID string, volumeID string) error
- func (_m *OpenStackMock) WaitSnapshotReady(snapshotID string) error
- type Volume
Constants ¶
const ( VolumeAvailableStatus = "available" VolumeInUseStatus = "in-use" VolumeDeletedStatus = "deleted" VolumeErrorStatus = "error" )
const (
SnapshotReadyStatus = "available"
)
Variables ¶
This section is empty.
Functions ¶
func GetConfigFromEnv ¶
func GetConfigFromEnv() (gophercloud.AuthOptions, gophercloud.EndpointOpts, error)
GetConfigFromEnv retrieves config options from env
func InitOpenStackProvider ¶
func InitOpenStackProvider(cfg string)
Types ¶
type Config ¶
type Config struct { Global struct { AuthUrl string `gcfg:"auth-url"` Username string UserId string `gcfg:"user-id"` Password string TenantId string `gcfg:"tenant-id"` TenantName string `gcfg:"tenant-name"` DomainId string `gcfg:"domain-id"` DomainName string `gcfg:"domain-name"` Region string CAFile string `gcfg:"ca-file"` } }
func GetConfigFromFile ¶
func GetConfigFromFile(configFilePath string) (Config, gophercloud.EndpointOpts, error)
GetConfigFromFile retrieves config options from file
type IMetadata ¶
IMetadata implements GetInstanceID & GetAvailabilityZone
var MetadataService IMetadata
MetadataService instance of IMetadata
func GetMetadataProvider ¶
GetMetadataProvider retrieves instance of IMetadata
type IOpenStack ¶
type IOpenStack interface { CreateVolume(name string, size int, vtype, availability string, snapshotID string, tags *map[string]string) (string, string, int, error) DeleteVolume(volumeID string) error AttachVolume(instanceID, volumeID string) (string, error) ListVolumes() ([]Volume, error) WaitDiskAttached(instanceID string, volumeID string) error DetachVolume(instanceID, volumeID string) error WaitDiskDetached(instanceID string, volumeID string) error GetAttachmentDiskPath(instanceID, volumeID string) (string, error) GetVolumesByName(name string) ([]Volume, error) CreateSnapshot(name, volID, description string, tags *map[string]string) (*snapshots.Snapshot, error) ListSnapshots(limit, offset int, filters map[string]string) ([]snapshots.Snapshot, error) DeleteSnapshot(snapID string) error GetSnapshotByNameAndVolumeID(n string, volumeId string) ([]snapshots.Snapshot, error) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error) WaitSnapshotReady(snapshotID string) error }
var OsInstance IOpenStack = nil
func CreateOpenStackProvider ¶
func CreateOpenStackProvider() (IOpenStack, error)
CreateOpenStackProvider creates Openstack Instance
func GetOpenStackProvider ¶
func GetOpenStackProvider() (IOpenStack, error)
GetOpenStackProvider returns Openstack Instance
type OpenStack ¶
type OpenStack struct {
// contains filtered or unexported fields
}
func (*OpenStack) AttachVolume ¶
AttachVolume attaches given cinder volume to the compute
func (*OpenStack) CreateSnapshot ¶
func (os *OpenStack) CreateSnapshot(name, volID, description string, tags *map[string]string) (*snapshots.Snapshot, error)
CreateSnapshot issues a request to take a Snapshot of the specified Volume with the corresponding ID and returns the resultant gophercloud Snapshot Item upon success
func (*OpenStack) CreateVolume ¶
func (os *OpenStack) CreateVolume(name string, size int, vtype, availability string, snapshotID string, tags *map[string]string) (string, string, int, error)
CreateVolume creates a volume of given size
func (*OpenStack) DeleteSnapshot ¶
DeleteSnapshot issues a request to delete the Snapshot with the specified ID from the Cinder backend
func (*OpenStack) DeleteVolume ¶
DeleteVolume delete a volume
func (*OpenStack) DetachVolume ¶
DetachVolume detaches given cinder volume from the compute
func (*OpenStack) GetAttachmentDiskPath ¶
GetAttachmentDiskPath gets device path of attached volume to the compute
func (*OpenStack) GetSnapshotByID ¶
GetSnapshotByID returns snapshot details by id
func (*OpenStack) GetSnapshotByNameAndVolumeID ¶
func (os *OpenStack) GetSnapshotByNameAndVolumeID(n string, volumeId string) ([]snapshots.Snapshot, error)
GetVolumesByName is a wrapper around ListVolumes that creates a Name filter to act as a GetByName Returns a list of Volume references with the specified name
func (*OpenStack) GetVolumesByName ¶
GetVolumesByName is a wrapper around ListVolumes that creates a Name filter to act as a GetByName Returns a list of Volume references with the specified name
func (*OpenStack) ListSnapshots ¶
func (os *OpenStack) ListSnapshots(limit, offset int, filters map[string]string) ([]snapshots.Snapshot, error)
ListSnapshots retrieves a list of active snapshots from Cinder for the corresponding Tenant. We also provide the ability to provide limit and offset to enable the consumer to provide accurate pagination. In addition the filters argument provides a mechanism for passing in valid filter strings to the list operation. Valid filter keys are: Name, Status, VolumeID (TenantID has no effect)
func (*OpenStack) ListVolumes ¶
ListVolumes list all the volumes
func (*OpenStack) WaitDiskAttached ¶
WaitDiskAttached waits for attched
func (*OpenStack) WaitDiskDetached ¶
WaitDiskDetached waits for detached
func (*OpenStack) WaitSnapshotReady ¶
WaitSnapshotReady waits till snapshot is ready
type OpenStackMock ¶
OpenStackMock is an autogenerated mock type for the IOpenStack type ORIGINALLY GENERATED BY mockery with hand edits
func (*OpenStackMock) AttachVolume ¶
func (_m *OpenStackMock) AttachVolume(instanceID string, volumeID string) (string, error)
AttachVolume provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) CreateSnapshot ¶
func (_m *OpenStackMock) CreateSnapshot(name string, volID string, description string, tags *map[string]string) (*snapshots.Snapshot, error)
CreateSnapshot provides a mock function with given fields: name, volID, description, tags
func (*OpenStackMock) CreateVolume ¶
func (_m *OpenStackMock) CreateVolume(name string, size int, vtype string, availability string, snapshotID string, tags *map[string]string) (string, string, int, error)
CreateVolume provides a mock function with given fields: name, size, vtype, availability, tags
func (*OpenStackMock) DeleteSnapshot ¶
func (_m *OpenStackMock) DeleteSnapshot(snapID string) error
DeleteSnapshot provides a mock function with given fields: snapID
func (*OpenStackMock) DeleteVolume ¶
func (_m *OpenStackMock) DeleteVolume(volumeID string) error
DeleteVolume provides a mock function with given fields: volumeID
func (*OpenStackMock) DetachVolume ¶
func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error
DetachVolume provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) GetAttachmentDiskPath ¶
func (_m *OpenStackMock) GetAttachmentDiskPath(instanceID string, volumeID string) (string, error)
GetAttachmentDiskPath provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) GetAvailabilityZone ¶
func (_m *OpenStackMock) GetAvailabilityZone() (string, error)
func (*OpenStackMock) GetInstanceID ¶
func (_m *OpenStackMock) GetInstanceID() (string, error)
func (*OpenStackMock) GetSnapshotByID ¶
func (_m *OpenStackMock) GetSnapshotByID(snapshotID string) (*snapshots.Snapshot, error)
func (*OpenStackMock) GetSnapshotByNameAndVolumeID ¶
func (*OpenStackMock) GetVolumesByName ¶
func (_m *OpenStackMock) GetVolumesByName(name string) ([]Volume, error)
GetVolumesByName provides a mock function with given fields: name
func (*OpenStackMock) ListSnapshots ¶
func (_m *OpenStackMock) ListSnapshots(limit int, offset int, filters map[string]string) ([]snapshots.Snapshot, error)
ListSnapshots provides a mock function with given fields: limit, offset, filters
func (*OpenStackMock) ListVolumes ¶
func (_m *OpenStackMock) ListVolumes() ([]Volume, error)
ListVolumes provides a mock function without param
func (*OpenStackMock) WaitDiskAttached ¶
func (_m *OpenStackMock) WaitDiskAttached(instanceID string, volumeID string) error
WaitDiskAttached provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) WaitDiskDetached ¶
func (_m *OpenStackMock) WaitDiskDetached(instanceID string, volumeID string) error
WaitDiskDetached provides a mock function with given fields: instanceID, volumeID
func (*OpenStackMock) WaitSnapshotReady ¶
func (_m *OpenStackMock) WaitSnapshotReady(snapshotID string) error
type Volume ¶
type Volume struct { // ID of the instance, to which this volume is attached. "" if not attached AttachedServerId string // Device file path AttachedDevice string // Unique identifier for the volume. ID string // Human-readable display name for the volume. Name string // Current status of the volume. Status string // Volume size in GB Size int // Availability Zone the volume belongs to AZ string }