Documentation ¶
Index ¶
- func Delete(c *gcorecloud.ServiceClient, serverGroupID string) (r tasks.Result)
- func ExtractServerGroupsInto(r pagination.Page, v interface{}) error
- func List(c *gcorecloud.ServiceClient) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type DeleteResult
- type GetResult
- type ServerGroup
- type ServerGroupInstance
- type ServerGroupPage
- type ServerGroupPolicy
- func (s ServerGroupPolicy) IsValid() error
- func (s ServerGroupPolicy) List() []ServerGroupPolicy
- func (s *ServerGroupPolicy) MarshalJSON() ([]byte, error)
- func (s ServerGroupPolicy) String() string
- func (s ServerGroupPolicy) StringList() []string
- func (s *ServerGroupPolicy) UnmarshalJSON(data []byte) error
- func (s ServerGroupPolicy) ValidOrNil() (*ServerGroupPolicy, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(c *gcorecloud.ServiceClient, serverGroupID string) (r tasks.Result)
Delete accepts a unique ID and deletes the server group associated with it.
func ExtractServerGroupsInto ¶
func ExtractServerGroupsInto(r pagination.Page, v interface{}) error
func List ¶
func List(c *gcorecloud.ServiceClient) pagination.Pager
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 ¶
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
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 ¶
func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r GetResult)
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 (s ServerGroupPolicy) List() []ServerGroupPolicy
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)