Documentation ¶
Overview ¶
Package linode ... this file rewrap existing methods to implement the cloudsvr.Handler interface
Index ¶
- Variables
- type BaseResponse
- type Config
- type CreateInstancesInput
- type DescribeInstancesOutput
- type DescribeRegionsOutput
- type DescribeTypesOutput
- type ErrResponse
- type ErrorResponse
- type Instance
- type InstanceType
- type LnAPIError
- type Region
- type SDK
- func (sdk *SDK) APIEndPoint() string
- func (sdk *SDK) AccessKey() string
- func (sdk *SDK) InspectEcs(id int) (*Instance, error)
- func (sdk *SDK) InspectNode(id, regionOrZone string) (interface{}, error)
- func (sdk *SDK) ListCloudRegions() ([]*cloudsvr.CloudRegion, error)
- func (sdk *SDK) ListCloudTypes(region string) ([]*cloudsvr.CloudNodeType, error)
- func (sdk *SDK) ListEcses() ([]*Instance, error)
- func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) ([]*InstanceType, error)
- func (sdk *SDK) ListNodes() ([]*cloudsvr.CloudNode, error)
- func (sdk *SDK) ListRegions() ([]*Region, error)
- func (sdk *SDK) NewEcs(req *CreateInstancesInput) (int, error)
- func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
- func (sdk *SDK) Ping() error
- func (sdk *SDK) RemoveEcs(id int) error
- func (sdk *SDK) RemoveNode(node *cloudsvr.CloudNode) error
- func (sdk *SDK) Type() string
- func (sdk *SDK) Verify() error
- func (sdk *SDK) WaitEcs(id int, expectStatus string, maxWait time.Duration) error
- type Spec
Constants ¶
This section is empty.
Variables ¶
var ( // OsImage is exported OsImage = "linode/centos7" // NodeLabelPrefix is exported NodeLabelPrefix = "inf-agent-linode-node" )
var (
// CloudType is exported
CloudType = "linode"
)
var (
// DefaultAPIEndPoint is exported
DefaultAPIEndPoint = "https://api.linode.com/v4"
)
Functions ¶
This section is empty.
Types ¶
type BaseResponse ¶
type BaseResponse struct { Results int `json:"results"` Pages int `json:"pages"` Page int `json:"page"` }
BaseResponse is exported
type Config ¶
type Config struct { EndPoint string `json:"endpoint,omitempty"` AccessKey string `json:"access_key"` }
Config is exported
type CreateInstancesInput ¶
type CreateInstancesInput struct { Region string `json:"region"` // must Type string `json:"type"` // must Label string `json:"label"` // must be uniq, length: [3-32] Distribution string `json:"distribution"` RootPass string `json:"root_pass"` Booted bool `json:"booted"` }
CreateInstancesInput is exported
func (*CreateInstancesInput) Validate ¶
func (req *CreateInstancesInput) Validate() error
Validate is exported
type DescribeInstancesOutput ¶
type DescribeInstancesOutput struct { BaseResponse Data []*Instance `json:"data"` }
DescribeInstancesOutput is exported
type DescribeRegionsOutput ¶
type DescribeRegionsOutput struct { BaseResponse Data []*Region `json:"data"` }
DescribeRegionsOutput is exported
type DescribeTypesOutput ¶
type DescribeTypesOutput struct { BaseResponse Data []*InstanceType `json:"data"` }
DescribeTypesOutput is exported
type ErrResponse ¶
ErrResponse is exported
type ErrorResponse ¶
type ErrorResponse struct {
Errors []*ErrResponse `json:"errors"`
}
ErrorResponse is exported
type Instance ¶
type Instance struct { ID int `json:"id"` Region string `json:"region"` Image string `json:"image"` Group string `json:"group"` Distribution string `json:"distribution"` IPv4 []string `json:"ipv4"` IPv6 string `json:"ipv6"` Label string `json:"label"` Type string `json:"type"` // instance type Status string `json:"status"` // offline,booting,running,shutting_down,rebooting,provisioning,deleting,migrating Hypervisor string `json:"hypervisor"` // kvm, xen Created string `json:"created"` Updated string `json:"updated"` Specs *Spec `json:"specs"` }
Instance is exported
type InstanceType ¶
type InstanceType struct { ID string `json:"id"` Memory int `json:"memory"` // by MiB VCpus int `json:"vcpus"` Disk int `json:"disk"` // by MiB Transfer int `json:"transfer"` // outbound transfer in MB NetworkOut int `json:"network_out"` // Mbits outbound bandwidth Label string `json:"label"` Class string `json:"class"` }
InstanceType is exported
type LnAPIError ¶
LnAPIError is exported
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is an implement of CloudSvr
func (*SDK) InspectEcs ¶
InspectEcs show details of a given ecs instance
func (*SDK) InspectNode ¶
InspectNode show details of one given ecs instance
func (*SDK) ListCloudRegions ¶
func (sdk *SDK) ListCloudRegions() ([]*cloudsvr.CloudRegion, error)
ListCloudRegions implement cloudsvr.Handler
func (*SDK) ListCloudTypes ¶
func (sdk *SDK) ListCloudTypes(region string) ([]*cloudsvr.CloudNodeType, error)
ListCloudTypes implement cloudsvr.Handler
func (*SDK) ListInstanceTypes ¶
func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) ([]*InstanceType, error)
ListInstanceTypes show all of instance types under given zone support cpu / memory minimal/maximize filter parameters note: public api, do NOT require auth
func (*SDK) ListNodes ¶
ListNodes list all linode ecs instances with label prefix: NodeLabelPrefix the nodes listed does NOT have any auth fields `User` `Password`
func (*SDK) ListRegions ¶
ListRegions show all of regions linode supported note: public api, do NOT require auth
func (*SDK) NewEcs ¶
func (sdk *SDK) NewEcs(req *CreateInstancesInput) (int, error)
NewEcs create a new ecs instance with given settings
func (*SDK) NewNode ¶
func (sdk *SDK) NewNode(prefer *cloudsvr.PreferAttrs) (*cloudsvr.CloudNode, *cloudsvr.PreferAttrs, error)
NewNode create linode ecs instance, try to use prefered attributes firstly
func (*SDK) RemoveNode ¶
RemoveNode remove linode ecs instance