regions

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 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 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) (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 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"`
}

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) ([]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