shares

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BssParam

type BssParam struct {
	// The number of cycles for prepaid.
	// + minimum: 1
	// + maximum: 11
	PeriodNum int `json:"period_num" required:"true"`
	// The prepaid type.
	// + 2: month
	// + 3: year
	PeriodType int `json:"period_type" require:"true"`
	// Whether to automatically renew.
	// + 0: manual renew.
	// + 1: automatic renew.
	IsAutoRenew *int `json:"is_auto_renew,omitempty"`
	// Whether to pay automatically.
	// + 0: manual payment.
	// + 1: automatic payment.
	IsAutoPay *int `json:"is_auto_pay,omitempty"`
}

BssParam is an object that represents the prepaid configuration.

type BssParamExtend

type BssParamExtend struct {
	// Whether to pay automatically.
	// + 0: manual payment.
	// + 1: automatic payment.
	IsAutoPay *int `json:"is_auto_pay,omitempty"`
}

BssParamExtend is an object that represents the payment detail.

type CreateOpts

type CreateOpts struct {
	// Turbo configuration details.
	Share Share `json:"share" required:"share"`
	// The configuration of pre-paid billing mode.
	BssParam *BssParam `json:"bss_param,omitempty"`
}

CreateOpts is the structure used to create a new SFS Turbo resource.

func (CreateOpts) ToShareCreateMap

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

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

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToShareCreateMap() (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(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new SFS Turbo file system based on the values in CreateOpts. To extract the Share object from the response, call the Extract method on the CreateResult.

func (CreateResult) Extract

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

Extract will get the Turbo response object from the CreateResult

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

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

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (r DeleteResult)

Delete will delete an existing SFS Trubo file system with the given UUID.

type ExpandOpts

type ExpandOpts struct {
	// Specifies the extend object.
	Extend ExtendOpts `json:"extend" required:"true"`
}

ExpandOpts contains the options for expanding a SFS Turbo. This object is passed to shares.Expand().

func (ExpandOpts) ToShareExpandMap

func (opts ExpandOpts) ToShareExpandMap() (map[string]interface{}, error)

ToShareExpandMap assembles a request body based on the contents of a ExpandOpts.

type ExpandOptsBuilder

type ExpandOptsBuilder interface {
	ToShareExpandMap() (map[string]interface{}, error)
}

ExpandOptsBuilder allows extensions to add additional parameters to the Expand request.

type ExpandResult

type ExpandResult struct {
	golangsdk.ErrResult
}

ExpandResult contains the response body and error from a Expand request.

func Expand

func Expand(client *golangsdk.ServiceClient, shareId string, opts ExpandOptsBuilder) (r ExpandResult)

Expand will expand a SFS Turbo based on the values in ExpandOpts.

func (ExpandResult) Extract

func (r ExpandResult) Extract() (*TurboExpandResponse, error)

Extract will get the Turbo expand response from the ExpandResult

type ExtendOpts

type ExtendOpts struct {
	// Specifies the post-expansion capacity (GB) of the shared file system.
	NewSize int `json:"new_size" required:"true"`
	// The configuration of pre-paid billing mode.
	BssParam *BssParamExtend `json:"bss_param,omitempty"`
}

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(client *golangsdk.ServiceClient, id string) (r GetResult)

Get will get a single SFS Trubo file system with given UUID

func (GetResult) Extract

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

Extract will get the Turbo object from the GetResult

type ListOpts

type ListOpts struct {
	// 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"`
}

ListOpts holds options for listing Volumes. It is passed to the volumes.List function.

func (ListOpts) ToVolumeListQuery

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

ToVolumeListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type Metadata

type Metadata struct {
	ExpandType            string `json:"expand_type,omitempty"`
	CryptKeyID            string `json:"crypt_key_id,omitempty"`
	DedicatedFlavor       string `json:"dedicated_flavor,omitempty"`
	MasterDedicatedHostID string `json:"master_dedicated_host_id,omitempty"`
	SlaveDedicatedHostID  string `json:"slave_dedicated_host_id,omitempty"`
	DedicatedStorageID    string `json:"dedicated_storage_id,omitempty"`
}

Metadata specifies the metadata information

type PagedList

type PagedList struct {
	Count  int     `json:"count"`
	Shares []Turbo `json:"shares"`
}

func ListPage

func ListPage(client *golangsdk.ServiceClient, opts ListOptsBuilder) (*PagedList, error)

ListPage returns one page limited by the conditions provided in Opts.

type Share

type Share struct {
	// Defines the SFS Turbo file system name
	Name string `json:"name" required:"true"`
	// Defines the SFS Turbo file system protocol to use, the vaild value is NFS.
	ShareProto string `json:"share_proto,omitempty"`
	// ShareType defines the file system type. the vaild values are STANDARD and PERFORMANCE.
	ShareType string `json:"share_type" required:"true"`
	// Size in GB, range from 500 to 32768.
	Size int `json:"size" required:"true"`
	// The availability zone of the SFS Turbo file system
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// The VPC ID
	VpcID string `json:"vpc_id" required:"true"`
	// The subnet ID
	SubnetID string `json:"subnet_id" required:"true"`
	// The security group ID
	SecurityGroupID string `json:"security_group_id" required:"true"`
	// The enterprise project ID
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
	// The backup ID
	BackupID string `json:"backup_id,omitempty"`
	// Share description
	Description string `json:"description,omitempty"`
	// The metadata information
	Metadata Metadata `json:"metadata,omitempty"`
}

CreateOpts contains the options for create an SFS Turbo. This object is passed to shares.Create().

type Turbo

type Turbo struct {
	// The UUID of the SFS Turbo file system
	ID string `json:"id"`
	// The name of the SFS Turbo file system
	Name string `json:"name"`
	// Size of the share in GB
	Size string `json:"size"`
	// The statue of the SFS Turbo file system
	Status string `json:"status"`
	// The sub-statue of the SFS Turbo file system
	SubStatus string `json:"sub_status"`
	// The version ID of the SFS Turbo file system
	Version string `json:"version"`
	// The mount location
	ExportLocation string `json:"export_location"`
	// The creation progress of the SFS Turbo file system
	Actions []string `json:"actions"`
	// The protocol type of the SFS Turbo file system
	ShareProto string `json:"share_proto"`
	// The type of the SFS Turbo file system, STANDARD or PERFORMANCE.
	ShareType string `json:"share_type"`
	// The region of the SFS Turbo file system
	Region string `json:"region"`
	// The code of the availability zone
	AvailabilityZone string `json:"availability_zone"`
	// The name of the availability zone
	AZName string `json:"az_name"`
	// The VPC ID
	VpcID string `json:"vpc_id"`
	// The subnet ID
	SubnetID string `json:"subnet_id"`
	// The security group ID
	SecurityGroupID string `json:"security_group_id"`
	// The avaliable capacity if the SFS Turbo file system
	AvailCapacity string `json:"avail_capacity"`
	// bandwidth is returned for an enhanced file system
	ExpandType string `json:"expand_type"`
	// The ID of the encryption key
	CryptKeyID string `json:"crypt_key_id"`
	// The billing mode, 0 indicates pay-per-use, 1 indicates yearly/monthly subscription
	PayModel string `json:"pay_model"`
	// Timestamp when the share was created
	CreatedAt time.Time `json:"-"`
	// The enterprise project ID
	EnterpriseProjectId string `json:"enterprise_project_id"`
}

Turbo contains all information associated with an SFS Turbo file system

func ExtractTurbos

func ExtractTurbos(r pagination.Page) ([]Turbo, error)

ExtractTurbos accepts a Page struct, specifically a TurboPage struct, and extracts the elements into a slice of share structs. In other words, a generic collection is mapped into a relevant slice.

func List

func List(c *golangsdk.ServiceClient) ([]Turbo, error)

List returns a Pager which allows you to iterate over a collection of SFS Turbo resources.

func (*Turbo) UnmarshalJSON

func (r *Turbo) UnmarshalJSON(b []byte) error

type TurboExpandResponse

type TurboExpandResponse struct {
	// The ID of the SFS Turbo file system.
	ID string `json:"id"`
	// The name of the SFS Turbo file system.
	Name string `json:"name"`
	// The order ID.
	OrderId string `json:"orderId"`
}

type TurboPage

type TurboPage struct {
	pagination.LinkedPageBase
}

TurboPage is the page returned by a pager when traversing over a collection of Shares.

func (TurboPage) IsEmpty

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

IsEmpty returns true if a ListResult contains no Shares.

func (TurboPage) NextPageURL

func (r TurboPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of shares has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type TurboResponse

type TurboResponse struct {
	// The ID of the SFS Turbo file system.
	ID string `json:"id"`
	// The name of the SFS Turbo file system.
	Name string `json:"name"`
	// The status of the SFS Turbo file system.
	Status string `json:"status"`
	// The order ID.
	OrderId string `json:"orderId"`
}

TurboResponse contains the information of creating response

Jump to

Keyboard shortcuts

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