instances

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAvailabilityZone = "nova"

Variables

This section is empty.

Functions

func AttachInterface

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

AttachInterface adds a interface to the instance.

func Create

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

Create creates an instance.

func Delete

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

func DetachInterface

func DetachInterface(client *gcorecloud.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 added in v0.5.0

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

func ExtractInstancePortInto added in v0.4.51

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

func ExtractMetadata(r pagination.Page) ([]metadata.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 ExtractMetadataInto

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

func ListAvailableFlavors added in v0.4.24

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

ListAvailableFlavors get available flavors for the instance to resize into.

func ListInterfaces

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

ListInterfaces retrieves network interfaces for instance

func ListPorts added in v0.4.51

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

ListPorts retrieves ports for instance

func ListSecurityGroups

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

ListSecurityGroups retrieves security groups interfaces for instance

func ListSecurityGroupsAll

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

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

func MetadataList

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

func MetadataListAll

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

func Resize

func Resize(client *gcorecloud.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

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" validate:"dive"`
	Interfaces     []InterfaceInstanceCreateOpts `json:"interfaces" required:"true" validate:"required,dive"`
	SecurityGroups []gcorecloud.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

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 */
	Metadata            map[string]string  `json:"metadata,omitempty" validate:"omitempty"`
	DeleteOnTermination bool               `json:"delete_on_termination,omitempty"`
}

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 added in v0.4.24

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         *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	CreatedAt         gcorecloud.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 *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific instance based on its unique ID.

func RenameInstance added in v0.4.36

func RenameInstance(client *gcorecloud.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        gcorecloud.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   []gcorecloud.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"`
	DdosProfile      *ddos.Profile                `json:"ddos_profile"`
}

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 *gcorecloud.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 added in v0.4.24

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 added in v0.4.24

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              gcorecloud.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 added in v0.4.51

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

func ExtractInstancePorts added in v0.4.51

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 added in v0.4.51

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

ListPortsAll is a convenience function that returns all instance ports.

type InstancePortsPage added in v0.4.51

type InstancePortsPage struct {
	pagination.LinkedPageBase
}

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

func (InstancePortsPage) IsEmpty added in v0.4.51

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

IsEmpty checks whether a InstancePortsPage struct is empty.

func (InstancePortsPage) NextPageURL added in v0.4.51

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          gcorecloud.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 *gcorecloud.ServiceClient, id string) ([]Interface, error)

ListInterfacesAll is a convenience function that returns all instance interfaces.

type InterfaceActionResult

type InterfaceActionResult struct {
	gcorecloud.ErrResult
}

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

type InterfaceInstanceCreateOpts added in v0.5.0

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

func (InterfaceInstanceCreateOpts) ToInterfaceActionMap added in v0.5.1

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

ToInterfaceActionMap builds a request body from InterfaceOpts.

func (InterfaceInstanceCreateOpts) Validate added in v0.5.0

func (opts InterfaceInstanceCreateOpts) Validate() error

Validate

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"`
	IPFamily   types.IPFamilyType                `json:"ip_family,omitempty" validate:"omitempty,enum"`
	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

type InterfaceOptsBuilder

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

InterfaceOptsBuilder allows extensions to add parameters to the interface request.

type ListInstanceLocationOpts added in v0.4.24

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

ListInstanceLocationOpts set parameters for search instance location operation

func (ListInstanceLocationOpts) ToListInstanceLocationQuery added in v0.4.24

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

ToListInstanceLocationQuery formats a ListInstanceLocationOpts into a query string.

func (*ListInstanceLocationOpts) Validate added in v0.4.24

func (opts *ListInstanceLocationOpts) Validate() error

type ListInstanceLocationOptsBuilder added in v0.4.24

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

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

type ListMetricsOpts added in v0.4.24

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 added in v0.4.24

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

ToListMetricsMap builds a request body from ListMetricsOpts.

func (ListMetricsOpts) Validate added in v0.4.24

func (opts ListMetricsOpts) Validate() error

type ListMetricsOptsBuilder added in v0.4.24

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

ListMetricsOptsBuilder builds parameters or change flavor request.

type ListMetricsResult added in v0.4.24

type ListMetricsResult struct {
	gcorecloud.Result
}

func ListInstanceMetrics added in v0.4.24

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

ListInstanceMetrics retrieves instance's metrics.

func (ListMetricsResult) Extract added in v0.4.24

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

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

func (ListMetricsResult) ExtractInto added in v0.4.24

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"`
	WithDdos          bool              `q:"with_ddos" 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 MetadataActionResult

type MetadataActionResult struct {
	gcorecloud.ErrResult
}

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

func MetadataCreate

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

MetadataCreate creates a metadata for an instance.

func MetadataDelete

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

MetadataDelete deletes defined metadata key for an instance.

func MetadataUpdate

func MetadataUpdate(client *gcorecloud.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

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 *gcorecloud.ServiceClient, id string, key string) (r MetadataResult)

MetadataGet gets defined metadata key for an instance.

func (MetadataResult) Extract

func (r MetadataResult) Extract() (*metadata.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

type NetworkDetail

type NetworkDetail struct {
	Mtu           int                      `json:"mtu"`
	UpdatedAt     *gcorecloud.JSONRFC3339Z `json:"updated_at"`
	CreatedAt     gcorecloud.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

type PortSecurityGroupNames added in v0.5.0

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

type RemoteConsole added in v0.4.24

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

type RemoteConsoleResult added in v0.4.24

type RemoteConsoleResult struct {
	gcorecloud.Result
}

func GetInstanceConsole added in v0.4.24

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

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

func GetSpiceConsole added in v0.4.24

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

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

func (RemoteConsoleResult) Extract added in v0.4.24

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

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

func (RemoteConsoleResult) ExtractInto added in v0.4.24

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

type RenameInstanceOpts added in v0.4.36

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

func (RenameInstanceOpts) ToRenameInstanceActionMap added in v0.4.36

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

ToRenameInstanceActionMap builds a request body from RenameInstanceOpts.

func (RenameInstanceOpts) Validate added in v0.4.36

func (opts RenameInstanceOpts) Validate() error

Validate.

type RenameInstanceOptsBuilder added in v0.4.36

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

RenameInstanceOptsBuilder allows extensions to add parameters to rename instance request.

type SearchLocationResult added in v0.4.24

type SearchLocationResult struct {
	gcorecloud.Result
}

func ListInstanceLocation added in v0.4.24

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

ListInstanceLocation get flavors available for the instance to resize into.

func (SearchLocationResult) Extract added in v0.4.24

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

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

func (SearchLocationResult) ExtractInto added in v0.4.24

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

type SecurityGroupActionResult

type SecurityGroupActionResult struct {
	gcorecloud.ErrResult
}

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

func AssignSecurityGroup

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

AssignSecurityGroup adds a security groups to the instance.

func UnAssignSecurityGroup

func UnAssignSecurityGroup(client *gcorecloud.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.

type SecurityGroupOptsBuilder

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

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

type SubPort added in v0.3.37

type SubPort struct {
	PortID            string         `json:"port_id"`
	MacAddress        gcorecloud.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     gcorecloud.IPVersion     `json:"ip_version"`
	EnableDHCP    bool                     `json:"enable_dhcp"`
	Cidr          gcorecloud.CIDR          `json:"cidr"`
	CreatedAt     gcorecloud.JSONRFC3339Z  `json:"created_at"`
	UpdatedAt     *gcorecloud.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 *gcorecloud.ServiceClient, id string) (r UpdateResult)

PowerCycle instance.

func Reboot

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

Reboot instance.

func Resume

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

Resume instance.

func Start

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

Start instance.

func Stop

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

Stop instance.

func Suspend

func Suspend(client *gcorecloud.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