regions

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractRegionsInto

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

Types

type CreateOpts

type CreateOpts struct {
	DisplayName       string             `json:"display_name" required:"true" validate:"required"`
	KeystoneName      string             `json:"keystone_name" required:"true" validate:"required"`
	State             types.RegionState  `json:"state" required:"true" validate:"required,enum"`
	EndpointType      types.EndpointType `json:"endpoint_type,omitempty" validate:"omitempty,enum"`
	ExternalNetworkID string             `json:"external_network_id" required:"true" validate:"required,uuid4"`
	SpiceProxyURL     *gcorecloud.URL    `json:"spice_proxy_url,omitempty"`
	KeystoneID        int                `json:"keystone_id" required:"true" validate:"required"`
}

CreateOpts represents options used to create a region.

func (CreateOpts) ToRegionCreateMap

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

ToRegionCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToRegionCreateMap() (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 represents the result of a create operation. Call its Extract method to interpret it as a Region.

func Create

Create accepts a CreateOpts struct and creates a new region using the values provided.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a region resource.

func (CreateResult) ExtractInto

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

type GetOpts

type GetOpts struct {
	ShowVolumeTypes bool `json:"show_volume_types,omitempty" validate:"omitempty"`
}

func (GetOpts) ToInstanceGetQuery

func (opts GetOpts) ToInstanceGetQuery() (string, error)

ToInstanceGetQuery formats a GetOpts into a query string.

type GetOptsBuilder

type GetOptsBuilder interface {
	ToInstanceGetQuery() (string, error)
}

GetOptsBuilder allows extensions to add additional parameters to the Get request.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Region.

func Get

func Get(c *gcorecloud.ServiceClient, id int, opts GetOptsBuilder) (r GetResult)

Get retrieves a specific region based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a region resource.

func (GetResult) ExtractInto

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

type ListOpts

type ListOpts struct {
	ShowVolumeTypes bool `json:"show_volume_types,omitempty" validate:"omitempty"`
}

func (ListOpts) ToInstanceListQuery

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

ToInstanceListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type Region

type Region struct {
	ID                   int                       `json:"id"`
	DisplayName          string                    `json:"display_name"`
	KeystoneName         string                    `json:"keystone_name"`
	State                types.RegionState         `json:"state"`
	TaskID               *string                   `json:"task_id"`
	EndpointType         types.EndpointType        `json:"endpoint_type"`
	ExternalNetworkID    string                    `json:"external_network_id"`
	SpiceProxyURL        gcorecloud.URL            `json:"spice_proxy_url"`
	CreatedOn            gcorecloud.JSONRFC3339NoZ `json:"created_on"`
	KeystoneID           int                       `json:"keystone_id"`
	Keystone             keystones.Keystone        `json:"keystone"`
	HasBaremetal         bool                      `json:"has_baremetal"`
	AvailableVolumeTypes []string                  `json:"available_volume_types"`
	Zone                 string                    `json:"zone"`
}

Region represents a region structure.

func ExtractRegions

func ExtractRegions(r pagination.Page) ([]Region, error)

ExtractRegion accepts a Page struct, specifically a RegionPage struct, and extracts the elements into a slice of Region structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Region, error)

ListAll is a convenience function that returns all regions.

type RegionPage

type RegionPage struct {
	pagination.LinkedPageBase
}

RegionPage is the page returned by a pager when traversing over a collection of regions.

func (RegionPage) IsEmpty

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

IsEmpty checks whether a RegionPage struct is empty.

func (RegionPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of regions 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 UpdateOpts

type UpdateOpts struct {
	DisplayName       string             `json:"display_name,omitempty" validate:"required_without_all=State EndpointType ExternalNetworkID SpiceProxyURL,omitempty"`
	State             types.RegionState  `` /* 126-byte string literal not displayed */
	EndpointType      types.EndpointType `` /* 127-byte string literal not displayed */
	ExternalNetworkID string             `` /* 129-byte string literal not displayed */
	SpiceProxyURL     *gcorecloud.URL    `json:"spice_proxy_url,omitempty" validate:"required_without_all=DisplayName State EndpointType ExternalNetworkID,omitempty"`
}

UpdateOpts represents options used to update a region.

func (UpdateOpts) ToRegionUpdateMap

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

ToRegionUpdateMap builds a request body from UpdateOpts.

func (UpdateOpts) Validate

func (opts UpdateOpts) Validate() error

Validate

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToRegionUpdateMap() (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 represents the result of an update operation. Call its Extract method to interpret it as a Region.

func Update

Update accepts a UpdateOpts struct and updates an existing region using the values provided.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a region resource.

func (UpdateResult) ExtractInto

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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