tencent

package
v0.0.0-...-d5b31fc Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 22 Imported by: 0

README

See More:

Tencent OpenAPI Docs

https://cloud.tencent.com/document/api

Refs

https://github.com/TencentCloud/tencentcloud-sdk-go

Limits

每个可用区每个月可购买的按量计费的CMV个数在20-30个
https://cloud.tencent.com/document/product/213/2664

Documentation

Overview

Package tencent ... this file rewrap existing methods to implement the cloudsvr.Handler interface

Index

Constants

This section is empty.

Variables

View Source
var (
	// OsImage is exported to make pass golint
	OsImage = "img-dkwyg6sr"
	// NodeName is exported to make pass golint
	NodeName = "inf-agent-tencent-node"
	// NodeLabels is exported to make pass golint
	NodeLabels = map[string]string{cloudsvr.CLOUDFLAGKEY: CloudType}
)
View Source
var (
	// CloudType is exported
	CloudType = "tencent"
)
View Source
var (
	// DefaultAPIEndPoint is exported
	DefaultAPIEndPoint = "https://cvm.tencentcloudapi.com"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	EndPoint  string `json:"endpoint,omitempty"`
	AccessID  string `json:"access_id"`
	AccessKey string `json:"access_key"`
}

Config is exported

func (*Config) Valid

func (cfg *Config) Valid() error

Valid is exported

type SDK

type SDK struct {
	// contains filtered or unexported fields
}

SDK is an implement of CloudSvr

func Setup

func Setup(cfg *Config) (*SDK, error)

Setup is exported

func (*SDK) APIEndPoint

func (sdk *SDK) APIEndPoint() string

APIEndPoint is exported

func (*SDK) APIHost

func (sdk *SDK) APIHost() string

APIHost is exported

func (*SDK) AccessID

func (sdk *SDK) AccessID() string

AccessID is exported

func (*SDK) AccessKey

func (sdk *SDK) AccessKey() string

AccessKey is exported

func (*SDK) InspectEcs

func (sdk *SDK) InspectEcs(region, ecsID string) (*cvm.Instance, error)

InspectEcs show details of a given ecs instance

func (*SDK) InspectNode

func (sdk *SDK) InspectNode(id, regionOrZone string) (interface{}, error)

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) ListEcses

func (sdk *SDK) ListEcses(region string, lbs map[string]string) ([]*cvm.Instance, error)

ListEcses show all of ecs instances for a specified region (regionID parameter set) or all of regions (regionID parameter empty)

func (*SDK) ListInstanceTypes

func (sdk *SDK) ListInstanceTypes(minCPU, maxCPU, minMem, maxMem int) ([]*cvm.InstanceTypeConfig, error)

ListInstanceTypes show all of instance types tencent supported support cpu / memory minimal/maximize filter parameters

func (*SDK) ListNodes

func (sdk *SDK) ListNodes() ([]*cloudsvr.CloudNode, error)

ListNodes list all tencent ecs instances with labels key: CLOUDFLAGKEY the nodes listed does NOT have any auth fields `User` `Password`

func (*SDK) ListRegions

func (sdk *SDK) ListRegions() ([]*cvm.RegionInfo, error)

ListRegions show all of regions tencent supported

func (*SDK) ListZones

func (sdk *SDK) ListZones(region string) ([]*cvm.ZoneInfo, error)

ListZones show all of zones under given region

func (*SDK) NewEcs

func (sdk *SDK) NewEcs(region string, req *cvm.RunInstancesRequest) (string, 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 tencent ecs instance, try to use prefered attributes firstly Note: only 20-30 `POSTPAID_BY_HOUR` cvm instances could be bought per-zone / per-month / per-user See: https://cloud.tencent.com/document/product/213/2664

func (*SDK) PickupZone

func (sdk *SDK) PickupZone(region string) string

PickupZone pick up the first avaliable zone under a specified region

func (*SDK) Ping

func (sdk *SDK) Ping() error

Ping verify the cloudsvr settings could be working fine

func (*SDK) RemoveEcs

func (sdk *SDK) RemoveEcs(region, ecsID string) error

RemoveEcs remove the specified ecs instance

func (*SDK) RemoveNode

func (sdk *SDK) RemoveNode(node *cloudsvr.CloudNode) error

RemoveNode remove tencent ecs instance

func (*SDK) Type

func (sdk *SDK) Type() string

Type implement Handler

func (*SDK) Verify

func (sdk *SDK) Verify() error

Verify verifies configs about aliyun endpoint & access id & access key

func (*SDK) WaitEcs

func (sdk *SDK) WaitEcs(region, ecsID, expectStatus string, maxWait time.Duration) error

WaitEcs wait ecs instance status reached to expected status until maxWait timeout expectStatus could be:

  • PENDING
  • LAUNCH_FAILED
  • RUNNING
  • STOPPED
  • STARTING
  • STOPPING
  • REBOOTING
  • SHUTDOWN
  • TERMINATING

Jump to

Keyboard shortcuts

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