volumetypes

package
v2.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package volumetypes provides information and interaction with volume types in the OpenStack Block Storage service. A volume type is a collection of specs used to define the volume capabilities.

Example to list Volume Types

allPages, err := volumetypes.List(client, volumetypes.ListOpts{}).AllPages(context.TODO())
if err != nil{
	panic(err)
}
volumeTypes, err := volumetypes.ExtractVolumeTypes(allPages)
if err != nil{
	panic(err)
}
for _,vt := range volumeTypes{
	fmt.Println(vt)
}

Example to show a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumeType, err := volumetypes.Get(context.TODO(), client, typeID).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumeType)

Example to create a Volume Type

volumeType, err := volumetypes.Create(context.TODO(), client, volumetypes.CreateOpts{
	Name:"volume_type_001",
	IsPublic:true,
	Description:"description_001",
}).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumeType)

Example to delete a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
err := volumetypes.Delete(context.TODO(), client, typeID).ExtractErr()
if err != nil{
	panic(err)
}

Example to update a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumetype, err = volumetypes.Update(context.TODO(), client, typeID, volumetypes.UpdateOpts{
	Name: "volume_type_002",
	Description:"description_002",
	IsPublic:false,
}).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumetype)

Example to Create Extra Specs for a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"

createOpts := volumetypes.ExtraSpecsOpts{
	"capabilities": "gpu",
}
createdExtraSpecs, err := volumetypes.CreateExtraSpecs(context.TODO(), client, typeID, createOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v", createdExtraSpecs)

Example to Get Extra Specs for a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"

extraSpecs, err := volumetypes.ListExtraSpecs(context.TODO(), client, typeID).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v", extraSpecs)

Example to Get specific Extra Spec for a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"

extraSpec, err := volumetypes.GetExtraSpec(context.TODO(), client, typeID, "capabilities").Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v", extraSpec)

Example to Update Extra Specs for a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"

updateOpts := volumetypes.ExtraSpecsOpts{
	"capabilities": "capabilities-updated",
}
updatedExtraSpec, err := volumetypes.UpdateExtraSpec(context.TODO(), client, typeID, updateOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v", updatedExtraSpec)

Example to Delete an Extra Spec for a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
err := volumetypes.DeleteExtraSpec(context.TODO(), client, typeID, "capabilities").ExtractErr()
if err != nil {
	panic(err)
}

Example to List Volume Type Access

typeID := "e91758d6-a54a-4778-ad72-0c73a1cb695b"

allPages, err := volumetypes.ListAccesses(client, typeID).AllPages(context.TODO())
if err != nil {
	panic(err)
}

allAccesses, err := volumetypes.ExtractAccesses(allPages)
if err != nil {
	panic(err)
}

for _, access := range allAccesses {
	fmt.Printf("%+v", access)
}

Example to Grant Access to a Volume Type

typeID := "e91758d6-a54a-4778-ad72-0c73a1cb695b"

accessOpts := volumetypes.AddAccessOpts{
	Project: "15153a0979884b59b0592248ef947921",
}

err := volumetypes.AddAccess(context.TODO(), client, typeID, accessOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to Remove/Revoke Access to a Volume Type

typeID := "e91758d6-a54a-4778-ad72-0c73a1cb695b"

accessOpts := volumetypes.RemoveAccessOpts{
	Project: "15153a0979884b59b0592248ef947921",
}

err := volumetypes.RemoveAccess(context.TODO(), client, typeID, accessOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to Create the Encryption of a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumeType, err := volumetypes.CreateEncryption(context.TODO(), client, typeID, .CreateEncryptionOpts{
	KeySize:      256,
	Provider:    "luks",
	ControlLocation: "front-end",
	Cipher:  "aes-xts-plain64",
}).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumeType)

Example to Delete the Encryption of a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
encryptionID := ""81e069c6-7394-4856-8df7-3b237ca61f74
err := volumetypes.DeleteEncryption(context.TODO(), client, typeID, encryptionID).ExtractErr()
if err != nil{
	panic(err)
}

Example to Update the Encryption of a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumetype, err = volumetypes.UpdateEncryption(context.TODO(), client, typeID, volumetypes.UpdateEncryptionOpts{
	KeySize:      256,
	Provider:    "luks",
	ControlLocation: "front-end",
	Cipher:  "aes-xts-plain64",
}).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumetype)

Example to Show an Encryption of a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumeType, err := volumetypes.GetEncrytpion(client, typeID).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumeType)

Example to Show an Encryption Spec of a Volume Type

typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
key := "cipher"
volumeType, err := volumetypes.GetEncrytpionSpec(client, typeID).Extract()
if err != nil{
	panic(err)
}
fmt.Println(volumeType)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVolumeTypesInto

func ExtractVolumeTypesInto(r pagination.Page, v interface{}) error

ExtractVolumeTypesInto similar to ExtractInto but operates on a `list` of volume types

func List

func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns Volume types.

func ListAccesses

func ListAccesses(client *gophercloud.ServiceClient, id string) pagination.Pager

ListAccesses retrieves the tenants which have access to a volume type.

Types

type AccessPage

type AccessPage struct {
	pagination.SinglePageBase
}

AccessPage contains a single page of all VolumeTypeAccess entries for a volume type.

func (AccessPage) IsEmpty

func (page AccessPage) IsEmpty() (bool, error)

IsEmpty indicates whether an AccessPage is empty.

type AddAccessOpts

type AddAccessOpts struct {
	// Project is the project/tenant ID to grant access.
	Project string `json:"project"`
}

AddAccessOpts represents options for adding access to a volume type.

func (AddAccessOpts) ToVolumeTypeAddAccessMap

func (opts AddAccessOpts) ToVolumeTypeAddAccessMap() (map[string]interface{}, error)

ToVolumeTypeAddAccessMap constructs a request body from AddAccessOpts.

type AddAccessOptsBuilder

type AddAccessOptsBuilder interface {
	ToVolumeTypeAddAccessMap() (map[string]interface{}, error)
}

AddAccessOptsBuilder allows extensions to add additional parameters to the AddAccess requests.

type AddAccessResult

type AddAccessResult struct {
	gophercloud.ErrResult
}

AddAccessResult is the response from a AddAccess request. Call its ExtractErr method to determine if the request succeeded or failed.

func AddAccess

func AddAccess(ctx context.Context, client *gophercloud.ServiceClient, id string, opts AddAccessOptsBuilder) (r AddAccessResult)

AddAccess grants a tenant/project access to a volume type.

type CreateEncryptionOpts

type CreateEncryptionOpts struct {
	// The size of the encryption key.
	KeySize int `json:"key_size"`
	// The class of that provides the encryption support.
	Provider string `json:"provider" required:"true"`
	// Notional service where encryption is performed.
	ControlLocation string `json:"control_location"`
	// The encryption algorithm or mode.
	Cipher string `json:"cipher"`
}

CreateEncryptionOpts contains options for creating an Encryption Type object. This object is passed to the volumetypes.CreateEncryption function. For more information about these parameters,see the Encryption Type object.

func (CreateEncryptionOpts) ToEncryptionCreateMap

func (opts CreateEncryptionOpts) ToEncryptionCreateMap() (map[string]interface{}, error)

ToEncryptionCreateMap assembles a request body based on the contents of a CreateEncryptionOpts.

type CreateEncryptionOptsBuilder

type CreateEncryptionOptsBuilder interface {
	ToEncryptionCreateMap() (map[string]interface{}, error)
}

CreateEncryptionOptsBuilder allows extensions to add additional parameters to the Create Encryption request.

type CreateEncryptionResult

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

func CreateEncryption

func CreateEncryption(ctx context.Context, client *gophercloud.ServiceClient, id string, opts CreateEncryptionOptsBuilder) (r CreateEncryptionResult)

CreateEncryption will creates an Encryption Type object based on the CreateEncryptionOpts. To extract the Encryption Type object from the response, call the Extract method on the EncryptionCreateResult.

func (CreateEncryptionResult) Extract

func (r CreateEncryptionResult) Extract() (*EncryptionType, error)

func (CreateEncryptionResult) ExtractInto

func (r CreateEncryptionResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume type struct

type CreateExtraSpecsOptsBuilder

type CreateExtraSpecsOptsBuilder interface {
	ToVolumeTypeExtraSpecsCreateMap() (map[string]interface{}, error)
}

CreateExtraSpecsOptsBuilder allows extensions to add additional parameters to the CreateExtraSpecs requests.

type CreateExtraSpecsResult

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

CreateExtraSpecsResult contains the result of a Create operation. Call its Extract method to interpret it as a map[string]interface.

func CreateExtraSpecs

func CreateExtraSpecs(ctx context.Context, client *gophercloud.ServiceClient, volumeTypeID string, opts CreateExtraSpecsOptsBuilder) (r CreateExtraSpecsResult)

CreateExtraSpecs will create or update the extra-specs key-value pairs for the specified volume type.

func (CreateExtraSpecsResult) Extract

func (r CreateExtraSpecsResult) Extract() (map[string]string, error)

Extract interprets any extraSpecsResult as ExtraSpecs, if possible.

type CreateOpts

type CreateOpts struct {
	// The name of the volume type
	Name string `json:"name" required:"true"`
	// The volume type description
	Description string `json:"description,omitempty"`
	// the ID of the existing volume snapshot
	IsPublic *bool `json:"os-volume-type-access:is_public,omitempty"`
	// Extra spec key-value pairs defined by the user.
	ExtraSpecs map[string]string `json:"extra_specs,omitempty"`
}

CreateOpts contains options for creating a Volume Type. This object is passed to the volumetypes.Create function. For more information about these parameters, see the Volume Type object.

func (CreateOpts) ToVolumeTypeCreateMap

func (opts CreateOpts) ToVolumeTypeCreateMap() (map[string]interface{}, error)

ToVolumeTypeCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToVolumeTypeCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult contains the response body and error from a Create request.

func Create

func Create(ctx context.Context, client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new Volume Type based on the values in CreateOpts. To extract the Volume Type object from the response, call the Extract method on the CreateResult.

func (CreateResult) Extract

func (r CreateResult) Extract() (*VolumeType, error)

Extract will get the Volume Type object out of the commonResult object.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume type struct

type DeleteEncryptionResult

type DeleteEncryptionResult struct {
	gophercloud.ErrResult
}

DeleteEncryptionResult contains the response body and error from a DeleteEncryprion request.

func DeleteEncryption

func DeleteEncryption(ctx context.Context, client *gophercloud.ServiceClient, id, encryptionID string) (r DeleteEncryptionResult)

Delete will delete an encryption type for an existing Volume Type with the provided ID.

type DeleteExtraSpecResult

type DeleteExtraSpecResult struct {
	gophercloud.ErrResult
}

DeleteExtraSpecResult contains the result of a Delete operation. Call its ExtractErr method to determine if the call succeeded or failed.

func DeleteExtraSpec

func DeleteExtraSpec(ctx context.Context, client *gophercloud.ServiceClient, volumeTypeID, key string) (r DeleteExtraSpecResult)

DeleteExtraSpec will delete the key-value pair with the given key for the given volume type ID.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult contains the response body and error from a Delete request.

func Delete

func Delete(ctx context.Context, client *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete will delete the existing Volume Type with the provided ID.

type EncryptionType

type EncryptionType struct {
	// Unique identifier for the volume type.
	VolumeTypeID string `json:"volume_type_id"`
	// Notional service where encryption is performed.
	ControlLocation string `json:"control_location"`
	// Unique identifier for encryption type.
	EncryptionID string `json:"encryption_id"`
	// Size of encryption key.
	KeySize int `json:"key_size"`
	// Class that provides encryption support.
	Provider string `json:"provider"`
	// The encryption algorithm or mode.
	Cipher string `json:"cipher"`
}

type ExtraSpecsOpts

type ExtraSpecsOpts map[string]string

ExtraSpecsOpts is a map that contains key-value pairs.

func (ExtraSpecsOpts) ToVolumeTypeExtraSpecUpdateMap

func (opts ExtraSpecsOpts) ToVolumeTypeExtraSpecUpdateMap() (map[string]string, string, error)

ToVolumeTypeExtraSpecUpdateMap assembles a body for an Update request based on the contents of a ExtraSpecOpts.

func (ExtraSpecsOpts) ToVolumeTypeExtraSpecsCreateMap

func (opts ExtraSpecsOpts) ToVolumeTypeExtraSpecsCreateMap() (map[string]interface{}, error)

ToVolumeTypeExtraSpecsCreateMap assembles a body for a Create request based on the contents of ExtraSpecsOpts.

type GetEncryptionResult

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

func GetEncryption

func GetEncryption(ctx context.Context, client *gophercloud.ServiceClient, id string) (r GetEncryptionResult)

GetEncryption retrieves the encryption type for an existing VolumeType with the provided ID.

func (GetEncryptionResult) Extract

func (r GetEncryptionResult) Extract() (*GetEncryptionType, error)

Extract interprets any extraSpecResult as an ExtraSpec, if possible.

type GetEncryptionSpecResult

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

func GetEncryptionSpec

func GetEncryptionSpec(ctx context.Context, client *gophercloud.ServiceClient, id, key string) (r GetEncryptionSpecResult)

GetEncryptionSpecs retrieves the encryption type specs for an existing VolumeType with the provided ID.

func (GetEncryptionSpecResult) Extract

func (r GetEncryptionSpecResult) Extract() (map[string]interface{}, error)

Extract interprets any empty interface Result as an empty interface.

type GetEncryptionType

type GetEncryptionType struct {
	// Unique identifier for the volume type.
	VolumeTypeID string `json:"volume_type_id"`
	// Notional service where encryption is performed.
	ControlLocation string `json:"control_location"`
	// Shows if the resource is deleted or Notional
	Deleted bool `json:"deleted"`
	// Shows the date and time the resource was created.
	CreatedAt string `json:"created_at"`
	// Shows the date and time when resource was updated.
	UpdatedAt string `json:"updated_at"`
	// Unique identifier for encryption type.
	EncryptionID string `json:"encryption_id"`
	// Size of encryption key.
	KeySize int `json:"key_size"`
	// Class that provides encryption support.
	Provider string `json:"provider"`
	// Shows the date and time the reousrce was deleted.
	DeletedAt string `json:"deleted_at"`
	// The encryption algorithm or mode.
	Cipher string `json:"cipher"`
}

type GetExtraSpecResult

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

GetExtraSpecResult contains the result of a Get operation. Call its Extract method to interpret it as a map[string]interface.

func GetExtraSpec

func GetExtraSpec(ctx context.Context, client *gophercloud.ServiceClient, volumeTypeID string, key string) (r GetExtraSpecResult)

GetExtraSpec requests an extra-spec specified by key for the given volume type ID

func (GetExtraSpecResult) Extract

func (r GetExtraSpecResult) Extract() (map[string]string, error)

Extract interprets any extraSpecResult as an ExtraSpec, if possible.

type GetResult

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

GetResult contains the response body and error from a Get request.

func Get

func Get(ctx context.Context, client *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves the Volume Type with the provided ID. To extract the Volume Type object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

func (r GetResult) Extract() (*VolumeType, error)

Extract will get the Volume Type object out of the commonResult object.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume type struct

type ListExtraSpecsResult

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

ListExtraSpecsResult contains the result of a Get operation. Call its Extract method to interpret it as a map[string]interface.

func ListExtraSpecs

func ListExtraSpecs(ctx context.Context, client *gophercloud.ServiceClient, volumeTypeID string) (r ListExtraSpecsResult)

ListExtraSpecs requests all the extra-specs for the given volume type ID.

func (ListExtraSpecsResult) Extract

func (r ListExtraSpecsResult) Extract() (map[string]string, error)

Extract interprets any extraSpecsResult as ExtraSpecs, if possible.

type ListOpts

type ListOpts struct {
	// Comma-separated list of sort keys and optional sort directions in the
	// form of <key>[:<direction>].
	Sort string `q:"sort"`
	// Requests a page size of items.
	Limit int `q:"limit"`
	// Used in conjunction with limit to return a slice of items.
	Offset int `q:"offset"`
	// The ID of the last-seen item.
	Marker string `q:"marker"`
}

ListOpts holds options for listing Volume Types. It is passed to the volumetypes.List function.

func (ListOpts) ToVolumeTypeListQuery

func (opts ListOpts) ToVolumeTypeListQuery() (string, error)

ToVolumeTypeListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToVolumeTypeListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type RemoveAccessOpts

type RemoveAccessOpts struct {
	// Project is the project/tenant ID to remove access.
	Project string `json:"project"`
}

RemoveAccessOpts represents options for removing access to a volume type.

func (RemoveAccessOpts) ToVolumeTypeRemoveAccessMap

func (opts RemoveAccessOpts) ToVolumeTypeRemoveAccessMap() (map[string]interface{}, error)

ToVolumeTypeRemoveAccessMap constructs a request body from RemoveAccessOpts.

type RemoveAccessOptsBuilder

type RemoveAccessOptsBuilder interface {
	ToVolumeTypeRemoveAccessMap() (map[string]interface{}, error)
}

RemoveAccessOptsBuilder allows extensions to add additional parameters to the RemoveAccess requests.

type RemoveAccessResult

type RemoveAccessResult struct {
	gophercloud.ErrResult
}

RemoveAccessResult is the response from a RemoveAccess request. Call its ExtractErr method to determine if the request succeeded or failed.

func RemoveAccess

func RemoveAccess(ctx context.Context, client *gophercloud.ServiceClient, id string, opts RemoveAccessOptsBuilder) (r RemoveAccessResult)

RemoveAccess removes/revokes a tenant/project access to a volume type.

type UpdateEncryptionOpts

type UpdateEncryptionOpts struct {
	// The size of the encryption key.
	KeySize int `json:"key_size"`
	// The class of that provides the encryption support.
	Provider string `json:"provider"`
	// Notional service where encryption is performed.
	ControlLocation string `json:"control_location"`
	// The encryption algorithm or mode.
	Cipher string `json:"cipher"`
}

Update Encryption Opts contains options for creating an Update Encryption Type. This object is passed to the volumetypes.UpdateEncryption function. For more information about these parameters, see the Update Encryption Type object.

func (UpdateEncryptionOpts) ToUpdateEncryptionMap

func (opts UpdateEncryptionOpts) ToUpdateEncryptionMap() (map[string]interface{}, error)

ToEncryptionCreateMap assembles a request body based on the contents of a UpdateEncryptionOpts.

type UpdateEncryptionOptsBuilder

type UpdateEncryptionOptsBuilder interface {
	ToUpdateEncryptionMap() (map[string]interface{}, error)
}

UpdateEncryptionOptsBuilder allows extensions to add additional parameters to the Update encryption request.

type UpdateEncryptionResult

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

UpdateResult contains the response body and error from an UpdateEncryption request.

func UpdateEncryption

func UpdateEncryption(ctx context.Context, client *gophercloud.ServiceClient, id, encryptionID string, opts UpdateEncryptionOptsBuilder) (r UpdateEncryptionResult)

Update will update an existing encryption for a Volume Type based on the values in UpdateEncryptionOpts. To extract the UpdateEncryption Type object from the response, call the Extract method on the UpdateEncryptionResult.

func (UpdateEncryptionResult) Extract

func (r UpdateEncryptionResult) Extract() (*EncryptionType, error)

func (UpdateEncryptionResult) ExtractInto

func (r UpdateEncryptionResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume type struct

type UpdateExtraSpecOptsBuilder

type UpdateExtraSpecOptsBuilder interface {
	ToVolumeTypeExtraSpecUpdateMap() (map[string]string, string, error)
}

UpdateExtraSpecOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateExtraSpecResult

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

UpdateExtraSpecResult contains the result of an Update operation. Call its Extract method to interpret it as a map[string]interface.

func UpdateExtraSpec

func UpdateExtraSpec(ctx context.Context, client *gophercloud.ServiceClient, volumeTypeID string, opts UpdateExtraSpecOptsBuilder) (r UpdateExtraSpecResult)

UpdateExtraSpec will updates the value of the specified volume type's extra spec for the key in opts.

func (UpdateExtraSpecResult) Extract

func (r UpdateExtraSpecResult) Extract() (map[string]string, error)

Extract interprets any extraSpecResult as an ExtraSpec, if possible.

type UpdateOpts

type UpdateOpts struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	IsPublic    *bool   `json:"is_public,omitempty"`
}

UpdateOpts contain options for updating an existing Volume Type. This object is passed to the volumetypes.Update function. For more information about the parameters, see the Volume Type object.

func (UpdateOpts) ToVolumeTypeUpdateMap

func (opts UpdateOpts) ToVolumeTypeUpdateMap() (map[string]interface{}, error)

ToVolumeTypeUpdateMap assembles a request body based on the contents of an UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToVolumeTypeUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult contains the response body and error from an Update request.

func Update

func Update(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update will update the Volume Type with provided information. To extract the updated Volume Type from the response, call the Extract method on the UpdateResult.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*VolumeType, error)

Extract will get the Volume Type object out of the commonResult object.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume type struct

type VolumeType

type VolumeType struct {
	// Unique identifier for the volume type.
	ID string `json:"id"`
	// Human-readable display name for the volume type.
	Name string `json:"name"`
	// Human-readable description for the volume type.
	Description string `json:"description"`
	// Arbitrary key-value pairs defined by the user.
	ExtraSpecs map[string]string `json:"extra_specs"`
	// Whether the volume type is publicly visible.
	IsPublic bool `json:"is_public"`
	// Qos Spec ID
	QosSpecID string `json:"qos_specs_id"`
	// Volume Type access public attribute
	PublicAccess bool `json:"os-volume-type-access:is_public"`
}

VolumeType contains all the information associated with an OpenStack Volume Type.

func ExtractVolumeTypes

func ExtractVolumeTypes(r pagination.Page) ([]VolumeType, error)

ExtractVolumeTypes extracts and returns Volumes. It is used while iterating over a volumetypes.List call.

type VolumeTypeAccess

type VolumeTypeAccess struct {
	// VolumeTypeID is the unique ID of the volume type.
	VolumeTypeID string `json:"volume_type_id"`

	// ProjectID is the unique ID of the project.
	ProjectID string `json:"project_id"`
}

VolumeTypeAccess represents an ACL of project access to a specific Volume Type.

func ExtractAccesses

func ExtractAccesses(r pagination.Page) ([]VolumeTypeAccess, error)

ExtractAccesses interprets a page of results as a slice of VolumeTypeAccess.

type VolumeTypePage

type VolumeTypePage struct {
	pagination.LinkedPageBase
}

VolumeTypePage is a pagination.pager that is returned from a call to the List function.

func (VolumeTypePage) IsEmpty

func (r VolumeTypePage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no Volume Types.

func (VolumeTypePage) NextPageURL

func (page VolumeTypePage) NextPageURL() (string, error)

Directories

Path Synopsis
volume_types
volume_types

Jump to

Keyboard shortcuts

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