cinder

package
v3.0.0-...-1c69814 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: LGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Cinder client.

func Basic

func Basic(endpoint *url.URL, tenantId string, token TokenFn) *Client

Basic returns a basic Cinder client which will handle authorization of requests, and routing to the correct endpoint.

func BasicTLSConfig

func BasicTLSConfig(endpoint *url.URL, tenantId string, token TokenFn, tlsConfig *tls.Config) *Client

BasicTLSConfig returns a basic Cinder client which will handle authorization of requests where CACerts are required, and routing to the correct endpoint.

func NewClient

func NewClient(tenantId string, endpoint *url.URL, handleRequest RequestHandlerFn) *Client

NewClient is the most flexible way to instantiate a Cinder Client. The handleRequest function will be responsible for modifying requests and dispatching them as needed. For an example of how to utilize this method, see the Basic function.

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(args CreateSnapshotSnapshotParams) (*CreateSnapshotResults, error)

CreateSnapshot creates a snapshot, which is a point-in-time complete copy of a volume. You can create a volume from the snapshot.

func (*Client) CreateVolume

func (c *Client) CreateVolume(args CreateVolumeVolumeParams) (*CreateVolumeResults, error)

CreateVolume creates a volume. To create a bootable volume, include the image ID and set the bootable flag to true in the request body.

Preconditions:

  • The user must have enough volume storage quota remaining to create a volume of size requested.

Asynchronous Postconditions:

  • With correct permissions, you can see the volume status as available through API calls.
  • With correct access, you can see the created volume in the storage system that OpenStack Block Storage manages.

Troubleshooting:

  • If volume status remains creating or shows another error status, the request failed. Ensure you meet the preconditions then investigate the storage backend.
  • Volume is not created in the storage system which OpenStack Block Storage manages.
  • The storage node needs enough free storage space to match the specified size of the volume creation request.

func (*Client) CreateVolumeType

CreateVolumeType creates a volume type.

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(snapshotId string) error

DeleteSnapshot deletes a specified snapshot.

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volumeId string) error

DeleteVolume flags a volume for deletion. The volume managed by OpenStack Block Storage is not deleted from the storage system.

func (*Client) DeleteVolumeType

func (c *Client) DeleteVolumeType(volumeTypeId string) error

DeleteVolumeType deletes a specified volume type.

func (*Client) GetServices

func (c *Client) GetServices() (*GetServicesResults, error)

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(snapshotId string) (*GetSnapshotResults, error)

GetSnapshot shows information for a specified snapshot.

func (*Client) GetSnapshotsDetail

func (c *Client) GetSnapshotsDetail() (*GetSnapshotsDetailResults, error)

GetSnapshotsDetail lists detailed information for all Block Storage snapshots that the tenant who submits the request can access.

func (*Client) GetSnapshotsSimple

func (c *Client) GetSnapshotsSimple(allTenants bool) (*GetSnapshotsSimpleResults, error)

GetSnapshotsSimple lists summary information for all Block Storage snapshots that the tenant who submits the request can access.

func (*Client) GetVolume

func (c *Client) GetVolume(volumeId string) (*GetVolumeResults, error)

GetVolume lists information about the volume with the given volumeId.

func (*Client) GetVolumeType

func (c *Client) GetVolumeType(volumeTypeId string) (*GetVolumeTypeResults, error)

GetVolumeType shows information about a specified volume type.

func (*Client) GetVolumeTypes

func (c *Client) GetVolumeTypes() (*GetVolumeTypesResults, error)

GetVolumeTypes lists volume types.

func (*Client) GetVolumesDetail

func (c *Client) GetVolumesDetail(allTenants bool) (*GetVolumesDetailResults, error)

GetVolumesDetail lists detailed information for all Block Storage volumes that the tenant who submits the request can access.

func (*Client) GetVolumesSimple

func (c *Client) GetVolumesSimple(allTenants bool) (*GetVolumesSimpleResults, error)

GetVolumesSimple lists summary information for all Block Storage volumes that the tenant who submits the request can access.

func (*Client) ListExtensionsCinderV2

func (c *Client) ListExtensionsCinderV2() (*ListExtensionsCinderV2Results, error)

ListExtensionsCinderV2 lists Block Storage API extensions.

func (*Client) ListVersions

func (c *Client) ListVersions() (*ListVersionsResults, error)

ListVersion lists information about all Block Storage API versions.

func (*Client) SetVolumeMetadata

func (c *Client) SetVolumeMetadata(volumeId string, metadata map[string]string) (map[string]string, error)

SetVolumeMetadata sets metadata on a server. Replaces metadata items that match keys - doesn't modify items that aren't in the request. Returns the complete, updated metadata for the volume.

func (*Client) ShowSnapshotMetadata

func (c *Client) ShowSnapshotMetadata(snapshotId string) (*ShowSnapshotMetadataResults, error)

ShowSnapshotMetadata shows the metadata for a specified snapshot.

func (*Client) SnapshotStatusNotifier

func (c *Client) SnapshotStatusNotifier(snapId, status string, numAttempts int, waitDur time.Duration) <-chan error

SnapshotStatusNotifier will check a volume's status to determine whether it matches the given status. After a check, it waits for "waitDur" before attempting again. If the status does not match after "numAttempts", an error is returned.

func (*Client) UpdateSnapshot

func (c *Client) UpdateSnapshot(snapshotId string, args UpdateSnapshotSnapshotParams) (*UpdateSnapshotResults, error)

UpdateSnapshot updates a specified snapshot.

func (*Client) UpdateSnapshotMetadata

func (c *Client) UpdateSnapshotMetadata(snapshotId, key string) (*UpdateSnapshotMetadataResults, error)

UpdateSnapshotMetadata updates the metadata for a specified snapshot.

func (*Client) UpdateVolume

func (c *Client) UpdateVolume(volumeId string, args UpdateVolumeVolumeParams) (*UpdateVolumeResults, error)

UpdateVolume updates a volume.

func (*Client) UpdateVolumeType

func (c *Client) UpdateVolumeType(volumeTypeId, volumeType string) (*UpdateVolumeTypeResults, error)

UpdateVolumeType updates a volume type.

func (*Client) UpdateVolumeTypeExtraSpecs

func (c *Client) UpdateVolumeTypeExtraSpecs(volumeTypeId, volumeType, extraSpecs string) (*UpdateVolumeTypeExtraSpecsResults, error)

UpdateVolumeTypeExtraSpecs updates the extra specifications assigned to a volume type.

func (*Client) VersionDetails

func (c *Client) VersionDetails() (*VersionDetailsResults, error)

VersionDetails shows details for Block Storage API v2.

func (*Client) VolumeStatusNotifier

func (c *Client) VolumeStatusNotifier(volId, status string, numAttempts int, waitDur time.Duration) <-chan error

VolumeStatusNotifier will check a volume's status to determine whether it matches the given status. After a check, it waits for "waitDur" before attempting again. If the status does not match after "numAttempts", an error is returned.

type CreateSnapshotParams

type CreateSnapshotParams struct {

	// Snapshot is required.
	//  A partial representation of a snapshot used in the creation process.
	Snapshot CreateSnapshotSnapshotParams `json:"snapshot"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type CreateSnapshotResults

type CreateSnapshotResults struct {
	Snapshot Snapshot `json:"snapshot"`
}

type CreateSnapshotSnapshotParams

type CreateSnapshotSnapshotParams struct {

	//  [True/False] Indicate whether to snapshot, even if the volume is attached. Default==False.
	Force bool `json:"force,omitempty"`

	//  Name of the snapshot. The default is None.
	Name string `json:"name,omitempty"`

	//  Description of the snapshot. The default is None.
	Description string `json:"description,omitempty"`

	// VolumeId is required.
	//  To create a snapshot from an existing volume, specify the ID of the existing volume.
	VolumeId string `json:"volume_id"`
}

type CreateVolumeParams

type CreateVolumeParams struct {
	Volume CreateVolumeVolumeParams `json:"volume"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type CreateVolumeResults

type CreateVolumeResults struct {
	Volume Volume `json:"volume"`
}

type CreateVolumeTypeParams

type CreateVolumeTypeParams struct {

	// VolumeType is required.
	//  A partial representation of a volume type used in the creation process.
	VolumeType CreateVolumeTypeVolumeTypeParams `json:"volume_type"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type CreateVolumeTypeResults

type CreateVolumeTypeResults struct {
	VolumeType VolumeType `json:"volume_type"`
}

type CreateVolumeTypeVolumeTypeExtraSpecsParams

type CreateVolumeTypeVolumeTypeExtraSpecsParams struct {
	Capabilities string `json:"capabilities,omitempty"`
}

type CreateVolumeTypeVolumeTypeParams

type CreateVolumeTypeVolumeTypeParams struct {

	//  The name of the volume type.
	Name string `json:"name,omitempty"`

	ExtraSpecs CreateVolumeTypeVolumeTypeExtraSpecsParams `json:"extra_specs,omitempty"`
}

type CreateVolumeVolumeParams

type CreateVolumeVolumeParams struct {

	//  To create a volume from an existing volume, specify the ID of the existing volume. If specified, the volume is created with same size of the source volume.
	SourceVolid string `json:"source_volid,omitempty"`

	//  To create a volume from an existing snapshot, specify the ID of the existing volume snapshot. If specified, the volume is created in same availability zone and with same size of the snapshot.
	SnapshotId string `json:"snapshot_id,omitempty"`

	//  The ID of the image from which you want to create the volume. Required to create a bootable volume.
	ImageRef string `json:"imageRef,omitempty"`

	//  The associated volume type.
	VolumeType string `json:"volume_type,omitempty"`

	//  Enables or disables the bootable attribute. You can boot an instance from a bootable volume.
	Bootable bool `json:"bootable,omitempty"`

	//  One or more metadata key and value pairs to associate with the volume.
	Metadata interface{} `json:"metadata,omitempty"`

	//  The availability zone.
	AvailabilityZone string `json:"availability_zone,omitempty"`

	//  The volume description.
	Description string `json:"description,omitempty"`

	// Size is required.
	//  The size of the volume, in GBs.
	Size int `json:"size"`

	//  The volume name.
	Name string `json:"name,omitempty"`
}

type DeleteSnapshotParams

type DeleteSnapshotParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// SnapshotId is required.
	//
	// The unique identifier of an existing snapshot.
	SnapshotId string `json:"-"`
}

type DeleteSnapshotResults

type DeleteSnapshotResults struct {
}

type DeleteVolumeParams

type DeleteVolumeParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeId is required.
	//
	// The unique identifier of an existing volume.
	VolumeId string `json:"-"`
}

type DeleteVolumeResults

type DeleteVolumeResults struct {
}

type DeleteVolumeTypeParams

type DeleteVolumeTypeParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeTypeId is required.
	//
	// The unique identifier for an existing volume type.
	VolumeTypeId string `json:"-"`
}

type DeleteVolumeTypeResults

type DeleteVolumeTypeResults struct {
}

type Extension

type Extension struct {
	Alias       string        `json:"alias"`
	Description string        `json:"description"`
	Links       []interface{} `json:"links"`
	Name        string        `json:"name"`
	Namespace   string        `json:"namespace"`
	Updated     string        `json:"updated"`
}

type GetServicesResults

type GetServicesResults struct {
	Services []Service `json:"services"`
}

type GetSnapshotParams

type GetSnapshotParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// SnapshotId is required.
	//
	// The unique identifier of an existing snapshot.
	SnapshotId string `json:"-"`
}

type GetSnapshotResults

type GetSnapshotResults struct {
	Snapshot Snapshot `json:"snapshot"`
}

type GetSnapshotsDetailParams

type GetSnapshotsDetailParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type GetSnapshotsDetailResults

type GetSnapshotsDetailResults struct {
	Snapshots []Snapshot `json:"snapshots"`
}

type GetSnapshotsSimpleParams

type GetSnapshotsSimpleParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type GetSnapshotsSimpleResults

type GetSnapshotsSimpleResults struct {
	Snapshots []Snapshot `json:"snapshots"`
}

type GetVolumeParams

type GetVolumeParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeId is required.
	//
	// The unique identifier of an existing volume.
	VolumeId string `json:"-"`
}

type GetVolumeResults

type GetVolumeResults struct {
	Volume Volume `json:"volume"`
}

type GetVolumeTypeParams

type GetVolumeTypeParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeTypeId is required.
	//
	// The unique identifier for an existing volume type.
	VolumeTypeId string `json:"-"`
}

type GetVolumeTypeResults

type GetVolumeTypeResults struct {
	VolumeType VolumeType `json:"volume_type"`
}

type GetVolumeTypesParams

type GetVolumeTypesParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type GetVolumeTypesResults

type GetVolumeTypesResults struct {
	VolumeTypes []VolumeType `json:"volume_types"`
}

type GetVolumesDetailParams

type GetVolumesDetailParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type GetVolumesDetailResults

type GetVolumesDetailResults struct {
	Volumes []Volume `json:"volumes"`
}

type GetVolumesSimpleParams

type GetVolumesSimpleParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`
}

type GetVolumesSimpleResults

type GetVolumesSimpleResults struct {
	Volumes []Volume `json:"volumes"`
}

type ListExtensionsCinderV2Params

type ListExtensionsCinderV2Params struct {
}

type ListExtensionsCinderV2Results

type ListExtensionsCinderV2Results struct {
	Extensions []Extension `json:"extensions"`
}

type ListVersionsParams

type ListVersionsParams struct {
}

type ListVersionsResults

type ListVersionsResults struct {
	Versions []Version `json:"versions"`
}

type RequestHandlerFn

type RequestHandlerFn func(*http.Request) (*http.Response, error)

RequestHandlerFn specifies a function signature which wadl2go will use to process the http.Request. What this means is up to the implementor.

func AuthHeaderTSLConfigDoRequestFn

func AuthHeaderTSLConfigDoRequestFn(token TokenFn, tlsConfig *tls.Config) RequestHandlerFn

AuthHeaderTSLConfigDoRequestFn returns a RequestHandlerFn which sets the authentication headers for a given request and provides the client with a tls config.

func SetAuthHeaderFn

func SetAuthHeaderFn(token TokenFn, wrappedHandler RequestHandlerFn) RequestHandlerFn

SetAuthHeaderFn returns a RequestHandlerFn which sets the authentication headers for a given request.

func (RequestHandlerFn) RoundTrip

func (f RequestHandlerFn) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip is part of the http.RoundTripper interface.

type Service

type Service struct {
	Status            string      `json:"status"`
	Binary            string      `json:"binary"`
	Zone              string      `json:"zone"`
	State             string      `json:"state"`
	UpdatedAt         string      `json:"updated_at"`
	Host              string      `json:"host"`
	DisabledReason    interface{} `json:"disabled_reason"`
	Frozen            bool        `json:"frozen,omitempty"`
	Cluster           interface{} `json:"cluster,omitempty"`
	ReplicationStatus string      `json:"replication_status,omitempty"`
	ActiveBackendID   interface{} `json:"active_backend_id,omitempty"`
}

type ShowSnapshotMetadataParams

type ShowSnapshotMetadataParams struct {

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// SnapshotId is required.
	//
	// The unique identifier of an existing snapshot.
	SnapshotId string `json:"-"`
}

type ShowSnapshotMetadataResults

type ShowSnapshotMetadataResults struct {
	Snapshot Snapshot `json:"snapshot"`
}

type Snapshot

type Snapshot struct {
	CreatedAt   string `json:"created_at"`
	Description string `json:"description"`
	ID          string `json:"id"`
	Metadata    struct {
		Key string `json:"key"`
	} `json:"metadata"`
	Name                                      string `json:"name"`
	Size                                      int    `json:"size"`
	Status                                    string `json:"status"`
	VolumeID                                  string `json:"volume_id"`
	Os_Extended_Snapshot_Attributes_Progress  string `json:"os-extended-snapshot-attributes:progress"`
	Os_Extended_Snapshot_Attributes_ProjectID string `json:"os-extended-snapshot-attributes:project_id"`
}

type TokenFn

type TokenFn func() string

TokenFn represents a function signature which returns the user's authorization token when called.

type UpdateSnapshotMetadataMetadataParams

type UpdateSnapshotMetadataMetadataParams struct {
	Key string `json:"key"`
}

type UpdateSnapshotMetadataParams

type UpdateSnapshotMetadataParams struct {

	// Metadata is required.
	//  One or more metadata key and value pairs to set or unset for the snapshot. To unset a metadata key value, specify only the key name. To set a metadata key value, specify the key and value pair. The Block Storage server does not respect case-sensitive key names. For example, if you specify both "key": "v1" and "KEY": "V1", the server sets and returns only the KEY key and value pair.
	Metadata UpdateSnapshotMetadataMetadataParams `json:"metadata"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// SnapshotId is required.
	//
	// The unique identifier of an existing snapshot.
	SnapshotId string `json:"-"`
}

type UpdateSnapshotMetadataResults

type UpdateSnapshotMetadataResults struct {
	Metadata struct {
		Key string `json:"key"`
	} `json:"metadata"`
}

type UpdateSnapshotParams

type UpdateSnapshotParams struct {
	Snapshot UpdateSnapshotSnapshotParams `json:"snapshot"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// SnapshotId is required.
	//
	// The unique identifier of an existing snapshot.
	SnapshotId string `json:"-"`
}

type UpdateSnapshotResults

type UpdateSnapshotResults struct {
	Snapshot Snapshot `json:"snapshot"`
}

type UpdateSnapshotSnapshotParams

type UpdateSnapshotSnapshotParams struct {

	//  Describes the snapshot.
	Description string `json:"description,omitempty"`

	//  The name of the snapshot.
	Name string `json:"name,omitempty"`
}

type UpdateVolumeMetadataParams

type UpdateVolumeMetadataParams struct {
	// Key-value pairs to set in the volume metadata.
	Metadata map[string]string `json:"metadata"`
}

type UpdateVolumeParams

type UpdateVolumeParams struct {
	Volume UpdateVolumeVolumeParams `json:"volume"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeId is required.
	//
	// The unique identifier of an existing volume.
	VolumeId string `json:"-"`
}

type UpdateVolumeResults

type UpdateVolumeResults struct {
	Volume Volume `json:"volume"`
}

type UpdateVolumeTypeExtraSpecsParams

type UpdateVolumeTypeExtraSpecsParams struct {

	// VolumeType is required.
	//
	// A volume type offers a way to categorize or group volumes.
	VolumeType string `json:"volume_type"`

	// ExtraSpecs is required.
	//
	// A key:value pair that offers a way to show additional specifications associated with the volume type. Examples include capabilities, capacity, compression, and so on, depending on the storage driver in use.
	ExtraSpecs string `json:"extra_specs"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeTypeId is required.
	//
	// The unique identifier for an existing volume type.
	VolumeTypeId string `json:"-"`
}

type UpdateVolumeTypeExtraSpecsResults

type UpdateVolumeTypeExtraSpecsResults struct {
	VolumeType VolumeType `json:"volume_type"`
}

type UpdateVolumeTypeParams

type UpdateVolumeTypeParams struct {

	// VolumeType is required.
	//
	// A volume type offers a way to categorize or group volumes.
	VolumeType string `json:"volume_type"`

	//
	// The unique identifier of the tenant or account.
	TenantId string `json:"-"`

	// VolumeTypeId is required.
	//
	// The unique identifier for an existing volume type.
	VolumeTypeId string `json:"-"`
}

type UpdateVolumeTypeResults

type UpdateVolumeTypeResults struct {
	VolumeType VolumeType `json:"volume_type"`
}

type UpdateVolumeVolumeParams

type UpdateVolumeVolumeParams struct {
	Name string `json:"name,omitempty"`

	Description string `json:"description,omitempty"`
}

type Version

type Version struct {
	ID    string `json:"id"`
	Links []struct {
		Href string `json:"href"`
		Rel  string `json:"rel"`
	} `json:"links"`
	Media_Types []struct {
		Base string `json:"base"`
		Type string `json:"type"`
	} `json:"media-types"`
	Status  string `json:"status"`
	Updated string `json:"updated"`
}

type VersionDetailsParams

type VersionDetailsParams struct {
}

type VersionDetailsResults

type VersionDetailsResults struct {
	Version Version `json:"version"`
}

type Volume

type Volume struct {
	Attachments      []VolumeAttachment `json:"attachments"`
	AvailabilityZone string             `json:"availability_zone"`
	Bootable         string             `json:"bootable"`
	CreatedAt        string             `json:"created_at"`
	Description      string             `json:"description"`
	ID               string             `json:"id"`
	Links            []struct {
		Href string `json:"href"`
		Rel  string `json:"rel"`
	} `json:"links"`
	Metadata                    map[string]string `json:"metadata"`
	Name                        string            `json:"name"`
	Os_Vol_Host_Attr_Host       string            `json:"os-vol-host-attr:host"`
	Os_Vol_Tenant_Attr_TenantID string            `json:"os-vol-tenant-attr:tenant_id"`
	Size                        int               `json:"size"`
	SnapshotID                  interface{}       `json:"snapshot_id"`
	SourceVolid                 interface{}       `json:"source_volid"`
	Status                      string            `json:"status"`
	VolumeType                  string            `json:"volume_type"`
}

type VolumeAttachment

type VolumeAttachment struct {
	Device   string `json:"device"`
	Id       string `json:"id"`
	ServerId string `json:"server_id"`
	VolumeId string `json:"volume_id"`
}

type VolumeType

type VolumeType struct {
	ExtraSpecs struct {
		Capabilities string `json:"capabilities"`
	} `json:"extra_specs"`
	ID   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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