servergroups

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractServerGroupsInto

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

Types

type CreateOpts

type CreateOpts struct {
	Name   string            `json:"name" required:"true"`
	Policy ServerGroupPolicy `json:"policy" required:"true" validate:"enum"`
}

CreateOpts represents options used to create a server group.

func (CreateOpts) ToServerGroupCreateMap

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

ToServerGroupCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToServerGroupCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the request.

type DeleteResult

type DeleteResult struct {
	gcorecloud.ErrResult
}

DeleteResult represents the result of a delete operation

func Delete

func Delete(c *gcorecloud.ServiceClient, serverGroupID string) (r DeleteResult)

Delete accepts a unique ID and deletes the server group associated with it.

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

func Create

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

func Get

func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific server group based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a server group resource.

func (GetResult) ExtractInto

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

type ServerGroup

type ServerGroup struct {
	ServerGroupID string                `json:"servergroup_id"`
	ProjectID     int                   `json:"project_id"`
	RegionID      int                   `json:"region_id"`
	Region        string                `json:"region"`
	Name          string                `json:"name"`
	Instances     []ServerGroupInstance `json:"instances"`
	Policy        ServerGroupPolicy     `json:"policy"`
}

ServerGroup represents a server group.

func ExtractServerGroups

func ExtractServerGroups(r pagination.Page) ([]ServerGroup, error)

ExtractServerGroups accepts a Page struct, specifically a ServerGroupPage struct, and extracts the elements into a slice of ServerGroup structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(c *gcorecloud.ServiceClient) ([]ServerGroup, error)

ListAll returns all SGs

type ServerGroupInstance

type ServerGroupInstance struct {
	InstanceID   string `json:"instance_id"`
	InstanceName string `json:"instance_name"`
}

ServerGroupInstance represent an instances in server group

type ServerGroupPage

type ServerGroupPage struct {
	pagination.LinkedPageBase
}

ServerGroupPage is the page returned by a pager when traversing over a collection of server groups.

func (ServerGroupPage) IsEmpty

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

IsEmpty checks whether a ServerGroup struct is empty.

func (ServerGroupPage) NextPageURL

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

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

type ServerGroupPolicy string
const (
	AffinityPolicy     ServerGroupPolicy = "affinity"
	AntiAffinityPolicy ServerGroupPolicy = "anti-affinity"
)

func (ServerGroupPolicy) IsValid

func (s ServerGroupPolicy) IsValid() error

func (ServerGroupPolicy) List

func (*ServerGroupPolicy) MarshalJSON

func (s *ServerGroupPolicy) MarshalJSON() ([]byte, error)

MarshalJSON - implements Marshaler interface for ServerGroupPolicy

func (ServerGroupPolicy) String

func (s ServerGroupPolicy) String() string

func (ServerGroupPolicy) StringList

func (s ServerGroupPolicy) StringList() []string

func (*ServerGroupPolicy) UnmarshalJSON

func (s *ServerGroupPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON - implements Unmarshaler interface for ServerGroupPolicy

func (ServerGroupPolicy) ValidOrNil

func (s ServerGroupPolicy) ValidOrNil() (*ServerGroupPolicy, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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