ecs

package
v0.0.0-...-4fa2da9 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*ecs.Client
}

Client struct

func New

func New() *Client

New creates a new ECS client

func (*Client) QueryAllHostgroupIP

func (c *Client) QueryAllHostgroupIP() (map[string][]string, error)

QueryAllHostgroupIP will query all IP of existing running instances Returns map["tkp-hostgroup"] = []string{"IP_1", "IP_2", ...}

func (*Client) QueryIPList

func (c *Client) QueryIPList(hostgroup string) ([]IPInfo, error)

QueryIPList will query IP of instances with matched hostgroup tag The other tags are static: "Environment=production" and "Datacenter=alisg"

func (*Client) QueryInstanceList

func (c *Client) QueryInstanceList(hostgroup string) ([]InstanceInfo, error)

QueryInstanceList will query info of instances with matched hostgroup tag The other tags are static: "Environment=production" and "Datacenter=alisg"

type Hour

type Hour struct {
	Price  string `json:"price"`
	Period string `json:"period"`
}

Hour contains price per hour

type IPInfo

type IPInfo struct {
	IP        string
	ConsulTag string
	IsRunning bool
}

IPInfo contains IP along with its associated consul_tags if available

type InstanceInfo

type InstanceInfo struct {
	IP           string
	CPU          int
	Memory       int
	InstanceName string
	InstanceType string
	CreationTime string
}

InstanceInfo contains information about an instance

type InstancePrice

type InstancePrice struct {
	RegionID     string
	InstanceType string
	OSType       string
	PricePerHour float64
}

InstancePrice contains price of an instance type

func QueryPriceList

func QueryPriceList(instancePriceURL string) ([]InstancePrice, error)

QueryPriceList returns price list for all instances type from all region

type Price

type Price struct {
	Currency        string                 `json:"currency"`
	Version         string                 `json:"version"`
	PublicationDate string                 `json:"publicationDate"`
	PricingInfo     map[string]PricingInfo `json:"pricingInfo"`
	Disclaimer      string                 `json:"disclaimer"`
	Type            string                 `json:"type"`
	Site            string                 `json:"site"`
	Description     string                 `json:"description"`
}

Price contains detailed pricing info of a pricing document

type PricingInfo

type PricingInfo struct {
	Hours  []Hour `json:"hours"`
	Months []Hour `json:"months"`
	Years  []Hour `json:"years"`
}

PricingInfo contains pricing details

Jump to

Keyboard shortcuts

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