instances

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultAvailabilityZone = "nova"

Variables

This section is empty.

Functions

func AddServerGroup added in v0.1.1

func AddServerGroup(client *edgecloud.ServiceClient, id string, opts ServerGroupOptsBuilder) (r tasks.Result)

AddServerGroup adds a server group to the instance.

func AttachInterface

func AttachInterface(client *edgecloud.ServiceClient, id string, opts InterfaceOptsBuilder) (r tasks.Result)

AttachInterface adds a interface to the instance.

func Create

func Create(client *edgecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)

Create creates an instance.

func Delete

func Delete(client *edgecloud.ServiceClient, instanceID string, opts DeleteOptsBuilder) (r tasks.Result)

func DetachInterface

func DetachInterface(client *edgecloud.ServiceClient, id string, opts InterfaceOptsBuilder) (r tasks.Result)

DetachInterface removes a interface from the instance.

func ExtractInstanceIDFromTask

func ExtractInstanceIDFromTask(task *tasks.Task) (string, error)

func ExtractInstanceInterfacesInto

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

func ExtractInstancePortIDFromTask

func ExtractInstancePortIDFromTask(task *tasks.Task) (string, error)

func ExtractInstancePortInto

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

func ExtractInstanceSecurityGroupInto

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

func ExtractInstanceSecurityGroups

func ExtractInstanceSecurityGroups(r pagination.Page) ([]edgecloud.ItemIDName, error)

ExtractInstanceSecurityGroups accepts a Page struct, specifically a InstanceSecurityGroupPage struct, and extracts the elements into a slice of instance security group structs. In other words, a generic collection is mapped into a relevant slice.

func ExtractInstancesInto

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

func ExtractMetadataInto

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

func ListAvailableFlavors

func ListAvailableFlavors(client *edgecloud.ServiceClient, id string, opts flavors.ListOptsBuilder) (r flavors.ListResult)

ListAvailableFlavors get available flavors for the instance to resize into.

func ListInterfaces

func ListInterfaces(client *edgecloud.ServiceClient, id string) pagination.Pager

ListInterfaces retrieves network interfaces for instance.

func ListPorts

func ListPorts(client *edgecloud.ServiceClient, id string) pagination.Pager

ListPorts retrieves ports for instance.

func ListSecurityGroups

func ListSecurityGroups(client *edgecloud.ServiceClient, id string) pagination.Pager

ListSecurityGroups retrieves security groups interfaces for instance.

func ListSecurityGroupsAll

func ListSecurityGroupsAll(client *edgecloud.ServiceClient, id string) ([]edgecloud.ItemIDName, error)

ListSecurityGroupsAll is a convenience function that returns all instance security groups.

func MetadataList

func MetadataList(client *edgecloud.ServiceClient, id string) pagination.Pager

func RemoveServerGroup added in v0.1.1

func RemoveServerGroup(client *edgecloud.ServiceClient, id string) (r tasks.Result)

RemoveServerGroup removes a server group from the instance.

func Resize

func Resize(client *edgecloud.ServiceClient, id string, opts ChangeFlavorOptsBuilder) (r tasks.Result)

Resize instance.

Types

type ChangeFlavorOpts

type ChangeFlavorOpts struct {
	FlavorID string `json:"flavor_id" required:"true" validate:"required"`
}

func (ChangeFlavorOpts) ToChangeFlavorActionMap

func (opts ChangeFlavorOpts) ToChangeFlavorActionMap() (map[string]interface{}, error)

ToChangeFlavorActionMap builds a request body from ChangeFlavorOpts.

func (ChangeFlavorOpts) Validate

func (opts ChangeFlavorOpts) Validate() error

type ChangeFlavorOptsBuilder

type ChangeFlavorOptsBuilder interface {
	ToChangeFlavorActionMap() (map[string]interface{}, error)
}

ChangeFlavorOptsBuilder builds parameters or change flavor request.

type CreateNewInterfaceFloatingIPOpts

type CreateNewInterfaceFloatingIPOpts struct {
	Source             types.FloatingIPSource `json:"source" validate:"required,enum"`
	ExistingFloatingID string                 `json:"existing_floating_id" validate:"rfe=Source:existing,sfe=Source:new,omitempty,uuid"`
}

func (CreateNewInterfaceFloatingIPOpts) Validate

func (opts CreateNewInterfaceFloatingIPOpts) Validate() error

Validate CreateNewInterfaceFloatingIPOpts.

type CreateOpts

type CreateOpts struct {
	Flavor         string                        `json:"flavor" required:"true"`
	Names          []string                      `json:"names,omitempty" validate:"required_without=NameTemplates"`
	NameTemplates  []string                      `json:"name_templates,omitempty" validate:"required_without=Names"`
	Volumes        []CreateVolumeOpts            `json:"volumes" required:"true" validate:"required,dive"`
	Interfaces     []InterfaceInstanceCreateOpts `json:"interfaces" required:"true" validate:"required,dive"`
	SecurityGroups []edgecloud.ItemID            `json:"security_groups,omitempty" validate:"omitempty,dive,uuid4"`
	Keypair        string                        `json:"keypair_name,omitempty"`
	Password       string                        `json:"password" validate:"omitempty,required_with=Username"`
	Username       string                        `json:"username" validate:"omitempty,required_with=Password"`
	UserData       string                        `json:"user_data" validate:"omitempty,base64"`
	Metadata       *MetadataSetOpts              `json:"metadata,omitempty" validate:"omitempty,dive"`
	Configuration  *MetadataSetOpts              `json:"configuration,omitempty" validate:"omitempty,dive"`
	AllowAppPorts  bool                          `json:"allow_app_ports,omitempty"`
	ServerGroupID  string                        `json:"servergroup_id,omitempty" validate:"omitempty,uuid4"`
}

CreateOpts represents options used to create a instance.

func (CreateOpts) ToInstanceCreateMap

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

ToInstanceCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToInstanceCreateMap() (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 Instance.

func (CreateResult) Extract

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

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

func (CreateResult) ExtractInto

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

type CreateVolumeOpts

type CreateVolumeOpts struct {
	Source        types.VolumeSource `json:"source" required:"true" validate:"required,enum"`
	BootIndex     int                `json:"boot_index"`
	Size          int                `json:"size,omitempty" validate:"rfe=Source:image;new-volume,sfe=Source:snapshot;existing-volume"`
	TypeName      volumes.VolumeType `json:"type_name,omitempty" validate:"omitempty"`
	AttachmentTag string             `json:"attachment_tag,omitempty" validate:"omitempty"`
	Name          string             `json:"name,omitempty" validate:"omitempty"`
	ImageID       string             `` /* 156-byte string literal not displayed */
	SnapshotID    string             `` /* 156-byte string literal not displayed */
	VolumeID      string             `` /* 156-byte string literal not displayed */
}

CreateVolumeOpts represents options used to create a volume.

func (*CreateVolumeOpts) Validate

func (opts *CreateVolumeOpts) Validate() error

type DeleteOpts

type DeleteOpts struct {
	Volumes         []string `q:"volumes" validate:"omitempty,dive,uuid4" delimiter:"comma"`
	DeleteFloatings bool     `q:"delete_floatings" validate:"omitempty,allowed_without=FloatingIPs"`
	FloatingIPs     []string `q:"floatings" validate:"omitempty,allowed_without=DeleteFloatings,dive,uuid4" delimiter:"comma"`
}

DeleteOpts Set parameters for delete operation.

func (DeleteOpts) ToInstanceDeleteQuery

func (opts DeleteOpts) ToInstanceDeleteQuery() (string, error)

ToInstanceDeleteQuery formats a DeleteOpts into a query string.

func (*DeleteOpts) Validate

func (opts *DeleteOpts) Validate() error

type DeleteOptsBuilder

type DeleteOptsBuilder interface {
	ToInstanceDeleteQuery() (string, error)
}

DeleteOptsBuilder allows extensions to add additional parameters to the Delete request.

type DeleteResult

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

DeleteResult represents the result of a delete operation.

func (DeleteResult) Extract

func (r DeleteResult) Extract() (*Instance, error)

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

func (DeleteResult) ExtractInto

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

type DiskMetrics

type DiskMetrics struct {
	BpsRead   float64 `json:"disk_Bps_read"`
	BpsWrite  float64 `json:"disk_Bps_write"`
	IOPSRead  float64 `json:"disk_iops_read"`
	IOPSWrite float64 `json:"disk_iops_write"`
	Name      string  `json:"disk_name"`
}

type FloatingIP

type FloatingIP struct {
	FloatingIPAddress net.IP                  `json:"floating_ip_address"`
	RouterID          string                  `json:"router_id"`
	SubnetID          string                  `json:"subnet_id"`
	Status            string                  `json:"status"`
	ID                string                  `json:"id"`
	PortID            string                  `json:"port_id"`
	DNSDomain         string                  `json:"dns_domain"`
	DNSName           string                  `json:"dns_name"`
	FixedIPAddress    net.IP                  `json:"fixed_ip_address"`
	UpdatedAt         *edgecloud.JSONRFC3339Z `json:"updated_at"`
	CreatedAt         edgecloud.JSONRFC3339Z  `json:"created_at"`
	CreatorTaskID     *string                 `json:"creator_task_id"`
	ProjectID         int                     `json:"project_id"`
	RegionID          int                     `json:"region_id"`
	Region            string                  `json:"region"`
	Metadata          []metadata.Metadata     `json:"metadata"`
}

FloatingIP represents a floating ip of instance port.

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 Instance.

func Get

func Get(client *edgecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific instance based on its unique ID.

func RenameInstance

func RenameInstance(client *edgecloud.ServiceClient, id string, opts RenameInstanceOptsBuilder) (r GetResult)

RenameInstance rename instance.

func (GetResult) Extract

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

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

func (GetResult) ExtractInto

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

type Instance

type Instance struct {
	ID               string                       `json:"instance_id"`
	Name             string                       `json:"instance_name"`
	Description      string                       `json:"instance_description"`
	CreatedAt        edgecloud.JSONRFC3339ZZ      `json:"instance_created"`
	Status           string                       `json:"status"`
	VMState          string                       `json:"vm_state"`
	TaskState        *string                      `json:"task_state"`
	Flavor           flavors.Flavor               `json:"flavor"`
	Metadata         map[string]interface{}       `json:"metadata"`
	Volumes          []InstanceVolume             `json:"volumes"`
	Addresses        map[string][]InstanceAddress `json:"addresses"`
	SecurityGroups   []edgecloud.ItemName         `json:"security_groups"`
	CreatorTaskID    *string                      `json:"creator_task_id"`
	TaskID           *string                      `json:"task_id"`
	ProjectID        int                          `json:"project_id"`
	RegionID         int                          `json:"region_id"`
	Region           string                       `json:"region"`
	AvailabilityZone string                       `json:"availability_zone"`
}

Instance represents a instance structure.

func ExtractInstances

func ExtractInstances(r pagination.Page) ([]Instance, error)

ExtractInstances accepts a Page struct, specifically a InstancePage struct, and extracts the elements into a slice of instance structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *edgecloud.ServiceClient, opts ListOptsBuilder) ([]Instance, error)

ListAll is a convenience function that returns all instances.

func (*Instance) UnmarshalJSON

func (i *Instance) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface.

type InstanceAddress

type InstanceAddress struct {
	Type       types.AddressType `json:"type"`
	Address    net.IP            `json:"addr"`
	SubnetID   *string           `json:"subnet_id,omitempty"`
	SubnetName *string           `json:"subnet_name,omitempty"`
}

type InstanceInterfacePage

type InstanceInterfacePage struct {
	pagination.LinkedPageBase
}

InstanceInterfacePage is the page returned by a pager when traversing over a collection of instance interfaces.

func (InstanceInterfacePage) IsEmpty

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

IsEmpty checks whether a InstanceInterfacePage struct is empty.

func (InstanceInterfacePage) NextPageURL

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

NextPageURL is invoked when a paginated collection of instance interfaces 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 InstanceLocation

type InstanceLocation struct {
	ID          string `json:"id"`
	ProjectID   string `json:"project_id"`
	ProjectName string `json:"project_name"`
	Name        string `json:"name"`
	RegionID    string `json:"region_id"`
	RegionName  string `json:"region_name"`
	ClientID    int    `json:"client_id"`
}

type InstanceMetrics

type InstanceMetrics struct {
	CPUUtil           float64                 `json:"cpu_util"`
	Disks             []DiskMetrics           `json:"disks"`
	MemoryUtil        float64                 `json:"memory_util"`
	NetworkBPSEgress  float64                 `json:"network_Bps_egress"`
	NetworkBPSIngress float64                 `json:"network_Bps_ingress"`
	NetworkPPSEgress  float64                 `json:"network_pps_egress"`
	NetworkPPSIngress float64                 `json:"network_pps_ingress"`
	Time              edgecloud.JSONRFC3339ZZ `json:"time"`
}

InstanceMetrics represent a instance metrics struct.

type InstancePage

type InstancePage struct {
	pagination.LinkedPageBase
}

InstancePage is the page returned by a pager when traversing over a collection of instances.

func (InstancePage) IsEmpty

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

IsEmpty checks whether a InstancePage struct is empty.

func (InstancePage) NextPageURL

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

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

type InstancePorts struct {
	ID             string                 `json:"id"`
	Name           string                 `json:"name"`
	SecurityGroups []edgecloud.ItemIDName `json:"security_groups"`
}

func ExtractInstancePorts

func ExtractInstancePorts(r pagination.Page) ([]InstancePorts, error)

ExtractInstancePorts accepts a Page struct, specifically a InstancePortsPage struct, and extracts the elements into a slice of instance security group structs. In other words, a generic collection is mapped into a relevant slice.

func ListPortsAll

func ListPortsAll(client *edgecloud.ServiceClient, id string) ([]InstancePorts, error)

ListPortsAll is a convenience function that returns all instance ports.

type InstancePortsPage

type InstancePortsPage struct {
	pagination.LinkedPageBase
}

InstancePortsPage is the page returned by a pager when traversing over a collection of instance ports.

func (InstancePortsPage) IsEmpty

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

IsEmpty checks whether a InstancePortsPage struct is empty.

func (InstancePortsPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of instance ports 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 InstanceSecurityGroupPage

type InstanceSecurityGroupPage struct {
	pagination.LinkedPageBase
}

InstanceSecurityGroupPage is the page returned by a pager when traversing over a collection of instance security groups.

func (InstanceSecurityGroupPage) IsEmpty

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

IsEmpty checks whether a InstanceSecurityGroupPage struct is empty.

func (InstanceSecurityGroupPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of instance security groups 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 InstanceTaskResult

type InstanceTaskResult struct {
	Instances   []string `json:"instances"`
	Volumes     []string `json:"volumes"`
	FloatingIPs []string `json:"floating_ips"`
	Ports       []string `json:"ports"`
}

type InstanceVolume

type InstanceVolume struct {
	ID                  string `json:"id"`
	DeleteOnTermination bool   `json:"delete_on_termination"`
}

type Interface

type Interface struct {
	PortID              string        `json:"port_id"`
	MacAddress          edgecloud.MAC `json:"mac_address"`
	NetworkID           string        `json:"network_id"`
	PortSecurityEnabled bool          `json:"port_security_enabled"`
	IPAssignments       []PortIP      `json:"ip_assignments"`
	NetworkDetails      NetworkDetail `json:"network_details"`
	FloatingIPDetails   []FloatingIP  `json:"floatingip_details"`
	SubPorts            []SubPort     `json:"sub_ports"`
}

Interface represents a instance port interface.

func ExtractInstanceInterfaces

func ExtractInstanceInterfaces(r pagination.Page) ([]Interface, error)

ExtractInstanceInterfaces accepts a Page struct, specifically a InstanceInterfacePage struct, and extracts the elements into a slice of instance interface structs. In other words, a generic collection is mapped into a relevant slice.

func ListInterfacesAll

func ListInterfacesAll(client *edgecloud.ServiceClient, id string) ([]Interface, error)

ListInterfacesAll is a convenience function that returns all instance interfaces.

type InterfaceActionResult

type InterfaceActionResult struct {
	edgecloud.ErrResult
}

InterfaceActionResult represents the result of a actions operation(no content).

type InterfaceInstanceCreateOpts

type InterfaceInstanceCreateOpts struct {
	InterfaceOpts
	SecurityGroups []edgecloud.ItemID `json:"security_groups"`
}

func (InterfaceInstanceCreateOpts) ToInterfaceActionMap

func (opts InterfaceInstanceCreateOpts) ToInterfaceActionMap() (map[string]interface{}, error)

ToInterfaceActionMap builds a request body from InterfaceOpts.

func (InterfaceInstanceCreateOpts) Validate

func (opts InterfaceInstanceCreateOpts) Validate() error

Validate InterfaceInstanceCreateOpts.

type InterfaceOpts

type InterfaceOpts struct {
	Type       types.InterfaceType               `json:"type,omitempty" validate:"omitempty,enum"`
	NetworkID  string                            `json:"network_id,omitempty" validate:"rfe=Type:any_subnet,omitempty,uuid4"`
	SubnetID   string                            `json:"subnet_id,omitempty" validate:"rfe=Type:subnet,omitempty,uuid4"`
	PortID     string                            `json:"port_id,omitempty" validate:"rfe=Type:reserved_fixed_ip,allowed_without_all=NetworkID SubnetID,omitempty,uuid4"`
	IPAddress  string                            `json:"ip_address,omitempty" validate:"allowed_without_all=Type NetworkID SubnetID FloatingIP,omitempty"`
	FloatingIP *CreateNewInterfaceFloatingIPOpts `json:"floating_ip,omitempty" validate:"omitempty,dive"`
}

func (InterfaceOpts) ToInterfaceActionMap

func (opts InterfaceOpts) ToInterfaceActionMap() (map[string]interface{}, error)

ToInterfaceActionMap builds a request body from InterfaceOpts.

func (InterfaceOpts) Validate

func (opts InterfaceOpts) Validate() error

Validate InterfaceOpts.

type InterfaceOptsBuilder

type InterfaceOptsBuilder interface {
	ToInterfaceActionMap() (map[string]interface{}, error)
}

InterfaceOptsBuilder allows extensions to add parameters to the interface request.

type ListInstanceLocationOpts

type ListInstanceLocationOpts struct {
	Name string `q:"name"`
	ID   string `q:"id"`
}

ListInstanceLocationOpts set parameters for search instance location operation.

func (ListInstanceLocationOpts) ToListInstanceLocationQuery

func (opts ListInstanceLocationOpts) ToListInstanceLocationQuery() (string, error)

ToListInstanceLocationQuery formats a ListInstanceLocationOpts into a query string.

func (*ListInstanceLocationOpts) Validate

func (opts *ListInstanceLocationOpts) Validate() error

Validate ListInstanceLocationOpts.

type ListInstanceLocationOptsBuilder

type ListInstanceLocationOptsBuilder interface {
	ToListInstanceLocationQuery() (string, error)
}

ListInstanceLocationOptsBuilder allows extensions to add additional parameters to the ListInstanceLocation request.

type ListMetricsOpts

type ListMetricsOpts struct {
	TimeUnit     types.MetricsTimeUnit `json:"time_unit" required:"true" validate:"required,enum"`
	TimeInterval int                   `json:"time_interval" required:"true" validate:"required"`
}

func (ListMetricsOpts) ToListMetricsMap

func (opts ListMetricsOpts) ToListMetricsMap() (map[string]interface{}, error)

ToListMetricsMap builds a request body from ListMetricsOpts.

func (ListMetricsOpts) Validate

func (opts ListMetricsOpts) Validate() error

type ListMetricsOptsBuilder

type ListMetricsOptsBuilder interface {
	ToListMetricsMap() (map[string]interface{}, error)
}

ListMetricsOptsBuilder builds parameters or change flavor request.

type ListMetricsResult

type ListMetricsResult struct {
	edgecloud.Result
}

func ListInstanceMetrics

func ListInstanceMetrics(client *edgecloud.ServiceClient, id string, opts ListMetricsOptsBuilder) (r ListMetricsResult)

ListInstanceMetrics retrieves instance's metrics.

func (ListMetricsResult) Extract

func (r ListMetricsResult) Extract() ([]InstanceMetrics, error)

Extract is a function that accepts a result and extracts a instance's metrics resource.

func (ListMetricsResult) ExtractInto

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

type ListOpts

type ListOpts struct {
	ExcludeSecGroup   string            `q:"exclude_secgroup"`
	AvailableFloating bool              `q:"available_floating"`
	IncludeBaremetal  bool              `q:"include_baremetal"`
	Name              string            `q:"name"`
	FlavorID          string            `q:"flavor_id"`
	Limit             int               `q:"limit" validate:"omitempty,gt=0"`
	Offset            int               `q:"offset" validate:"omitempty,gt=0"`
	Metadata          map[string]string `q:"metadata_kv" validate:"omitempty"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

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 Metadata

type Metadata struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	ReadOnly bool   `json:"read_only"`
}

func ExtractMetadata

func ExtractMetadata(r pagination.Page) ([]Metadata, error)

ExtractMetadata accepts a Page struct, specifically a MetadataPage struct, and extracts the elements into a slice of instance metadata structs. In other words, a generic collection is mapped into a relevant slice.

func MetadataListAll

func MetadataListAll(client *edgecloud.ServiceClient, id string) ([]Metadata, error)

type MetadataActionResult

type MetadataActionResult struct {
	edgecloud.ErrResult
}

MetadataActionResult represents the result of a create, delete or update operation(no content).

func MetadataCreate

func MetadataCreate(client *edgecloud.ServiceClient, id string, opts MetadataSetOpts) (r MetadataActionResult)

MetadataCreate creates a metadata for an instance.

func MetadataDelete

func MetadataDelete(client *edgecloud.ServiceClient, id string, key string) (r MetadataActionResult)

MetadataDelete deletes defined metadata key for an instance.

func MetadataUpdate

func MetadataUpdate(client *edgecloud.ServiceClient, id string, opts MetadataSetOpts) (r MetadataActionResult)

MetadataUpdate updates a metadata for an instance.

type MetadataOpts

type MetadataOpts struct {
	Key   string `json:"key" validate:"required,max=255"`
	Value string `json:"value" validate:"required,max=255"`
}

MetadataOpts Set parameters for Create or Update operation.

func (MetadataOpts) Validate

func (opts MetadataOpts) Validate() error

Validate MetadataOpts.

type MetadataOptsBuilder

type MetadataOptsBuilder interface {
	ToMetadataMap() (string, error)
}

MetadataOptsBuilder allows extensions to add additional parameters to the metadata Create and Update request.

type MetadataPage

type MetadataPage struct {
	pagination.LinkedPageBase
}

MetadataPage is the page returned by a pager when traversing over a collection of instance metadata objects.

func (MetadataPage) IsEmpty

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

IsEmpty checks whether a MetadataPage struct is empty.

func (MetadataPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of instance metadata objects 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 MetadataResult

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

MetadataResult represents the result of a get operation.

func MetadataGet

func MetadataGet(client *edgecloud.ServiceClient, id string, key string) (r MetadataResult)

MetadataGet gets defined metadata key for an instance.

func (MetadataResult) Extract

func (r MetadataResult) Extract() (*Metadata, error)

Extract is a function that accepts a result and extracts a instance metadata resource.

func (MetadataResult) ExtractInto

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

type MetadataSetOpts

type MetadataSetOpts struct {
	Metadata []MetadataOpts `json:"metadata" validate:"required,min=1,dive"`
}

MetadataSetOpts Set parameters for Create or Update operation.

func (MetadataSetOpts) ToMetadataMap

func (opts MetadataSetOpts) ToMetadataMap() (map[string]interface{}, error)

ToMetadataMap builds a request body from MetadataSetOpts.

func (MetadataSetOpts) Validate

func (opts MetadataSetOpts) Validate() error

Validate MetadataSetOpts.

type NetworkDetail

type NetworkDetail struct {
	Mtu           int                     `json:"mtu"`
	UpdatedAt     *edgecloud.JSONRFC3339Z `json:"updated_at"`
	CreatedAt     edgecloud.JSONRFC3339Z  `json:"created_at"`
	ID            string                  `json:"id"`
	External      bool                    `json:"external"`
	Default       bool                    `json:"default"`
	Name          string                  `json:"name"`
	Shared        bool                    `json:"shared"`
	Subnets       []Subnet                `json:"subnets"`
	ProjectID     int                     `json:"project_id"`
	RegionID      int                     `json:"region_id"`
	Region        string                  `json:"region"`
	TaskID        *string                 `json:"task_id"`
	CreatorTaskID *string                 `json:"creator_task_id"`
}

NetworkDetail represents a NetworkDetails of instance port.

type PortIP

type PortIP struct {
	IPAddress net.IP `json:"ip_address"`
	SubnetID  string `json:"subnet_id"`
}

PortIP represents an IPAddress and a SubnetID.

type PortSecurityGroupNames

type PortSecurityGroupNames struct {
	PortID             *string  `json:"port_id"`
	SecurityGroupNames []string `json:"security_group_names"`
}

type RemoteConsole

type RemoteConsole struct {
	URL      string `json:"url"`
	Type     string `json:"type"`
	Protocol string `json:"protocol"`
}

type RemoteConsoleResult

type RemoteConsoleResult struct {
	edgecloud.Result
}

func GetInstanceConsole

func GetInstanceConsole(client *edgecloud.ServiceClient, id string) (r RemoteConsoleResult)

GetInstanceConsole retrieves a specific spice console based on instance unique ID.

func GetSpiceConsole

func GetSpiceConsole(client *edgecloud.ServiceClient, id string) (r RemoteConsoleResult)

GetSpiceConsole retrieves a specific spice console based on instance unique ID.

func (RemoteConsoleResult) Extract

func (r RemoteConsoleResult) Extract() (*RemoteConsole, error)

Extract is a function that accepts a result and extracts a remote console resource.

func (RemoteConsoleResult) ExtractInto

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

type RenameInstanceOpts

type RenameInstanceOpts struct {
	Name string `json:"name" required:"true" validate:"required"`
}

func (RenameInstanceOpts) ToRenameInstanceActionMap

func (opts RenameInstanceOpts) ToRenameInstanceActionMap() (map[string]interface{}, error)

ToRenameInstanceActionMap builds a request body from RenameInstanceOpts.

func (RenameInstanceOpts) Validate

func (opts RenameInstanceOpts) Validate() error

Validate RenameInstanceOpts.

type RenameInstanceOptsBuilder

type RenameInstanceOptsBuilder interface {
	ToRenameInstanceActionMap() (map[string]interface{}, error)
}

RenameInstanceOptsBuilder allows extensions to add parameters to rename instance request.

type SearchLocationResult

type SearchLocationResult struct {
	edgecloud.Result
}

func ListInstanceLocation

func ListInstanceLocation(client *edgecloud.ServiceClient, opts ListInstanceLocationOptsBuilder) (r SearchLocationResult)

ListInstanceLocation get flavors available for the instance to resize into.

func (SearchLocationResult) Extract

func (r SearchLocationResult) Extract() ([]InstanceLocation, error)

Extract is a function that accepts a result and extracts a instance's location resource.

func (SearchLocationResult) ExtractInto

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

type SecurityGroupActionResult

type SecurityGroupActionResult struct {
	edgecloud.ErrResult
}

SecurityGroupActionResult represents the result of a actions operation(no content).

func AssignSecurityGroup

func AssignSecurityGroup(client *edgecloud.ServiceClient, id string, opts SecurityGroupOptsBuilder) (r SecurityGroupActionResult)

AssignSecurityGroup adds a security groups to the instance.

func UnAssignSecurityGroup

func UnAssignSecurityGroup(client *edgecloud.ServiceClient, id string, opts SecurityGroupOptsBuilder) (r SecurityGroupActionResult)

UnAssignSecurityGroup removes a security groups from the instance.

type SecurityGroupOpts

type SecurityGroupOpts struct {
	Name                    string                   `json:"name,omitempty"`
	PortsSecurityGroupNames []PortSecurityGroupNames `json:"ports_security_group_names,omitempty"`
}

func (SecurityGroupOpts) ToSecurityGroupActionMap

func (opts SecurityGroupOpts) ToSecurityGroupActionMap() (map[string]interface{}, error)

ToSecurityGroupActionMap builds a request body from SecurityGroupOpts.

func (SecurityGroupOpts) Validate

func (opts SecurityGroupOpts) Validate() error

Validate SecurityGroupOpts.

type SecurityGroupOptsBuilder

type SecurityGroupOptsBuilder interface {
	ToSecurityGroupActionMap() (map[string]interface{}, error)
}

SecurityGroupOptsBuilder allows extensions to add parameters to the security groups request.

type ServerGroupOpts added in v0.1.1

type ServerGroupOpts struct {
	ServerGroupID string `json:"servergroup_id" required:"true" validate:"required"`
}

func (ServerGroupOpts) ToServerGroupActionMap added in v0.1.1

func (opts ServerGroupOpts) ToServerGroupActionMap() (map[string]interface{}, error)

ToServerGroupActionMap builds a request body from ServerGroupOpts.

func (ServerGroupOpts) Validate added in v0.1.1

func (opts ServerGroupOpts) Validate() error

type ServerGroupOptsBuilder added in v0.1.1

type ServerGroupOptsBuilder interface {
	ToServerGroupActionMap() (map[string]interface{}, error)
}

ServerGroupOptsBuilder builds parameters or change server group request.

type SubPort

type SubPort struct {
	PortID            string        `json:"port_id"`
	MacAddress        edgecloud.MAC `json:"mac_address"`
	NetworkID         string        `json:"network_id"`
	IPAssignments     []PortIP      `json:"ip_assignments"`
	NetworkDetails    NetworkDetail `json:"network_details"`
	FloatingIPDetails []FloatingIP  `json:"floatingip_details"`
	SegmentationID    int           `json:"segmentation_id"`
	SegmentationType  string        `json:"segmentation_type"`
}

SubPort represent a instance sub port interface.

type Subnet

type Subnet struct {
	ID            string                  `json:"id"`
	Name          string                  `json:"name"`
	IPVersion     edgecloud.IPVersion     `json:"ip_version"`
	EnableDHCP    bool                    `json:"enable_dhcp"`
	Cidr          edgecloud.CIDR          `json:"cidr"`
	CreatedAt     edgecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt     *edgecloud.JSONRFC3339Z `json:"updated_at"`
	NetworkID     string                  `json:"network_id"`
	TaskID        *string                 `json:"task_id"`
	CreatorTaskID *string                 `json:"creator_task_id"`
	ProjectID     int                     `json:"project_id"`
	RegionID      int                     `json:"region_id"`
	Region        string                  `json:"region"`
}

Subnet port subnet.

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 Instance.

func PowerCycle

func PowerCycle(client *edgecloud.ServiceClient, id string) (r UpdateResult)

PowerCycle instance.

func Reboot

func Reboot(client *edgecloud.ServiceClient, id string) (r UpdateResult)

Reboot instance.

func Resume

func Resume(client *edgecloud.ServiceClient, id string) (r UpdateResult)

Resume instance.

func Start

func Start(client *edgecloud.ServiceClient, id string) (r UpdateResult)

Start instance.

func Stop

func Stop(client *edgecloud.ServiceClient, id string) (r UpdateResult)

Stop instance.

func Suspend

func Suspend(client *edgecloud.ServiceClient, id string) (r UpdateResult)

Suspend instance.

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractInto

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

Directories

Path Synopsis
instances unit tests
instances unit tests

Jump to

Keyboard shortcuts

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