cce

package
v0.0.0-...-386b7fa Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InstanceStatusRunning status
	InstanceStatusRunning string = "RUNNING"
	// InstanceStatusCreating status
	InstanceStatusCreating string = "CREATING"
	// InstanceStatusDeleting status
	InstanceStatusDeleting string = "DELETING"
	// InstanceStatusDeleted status
	InstanceStatusDeleted string = "DELETED"
	// InstanceStatusCreateFailed status
	InstanceStatusCreateFailed string = "CREATE_FAILED"
	// InstanceStatusError status
	InstanceStatusError string = "ERROR"
)

Variables

View Source
var Endpoint = map[string]string{
	"bj": "bcc.bj.baidubce.com",
	"gz": "bcc.gz.baidubce.com",
	"su": "bcc.su.baidubce.com",
	"bd": "bcc.bd.baidubce.com",
	"hk": "bcc.hkg.baidubce.com",
}

Endpoint contains all endpoints of Baidu Cloud BCC.

Functions

This section is empty.

Types

type BccOrderConfig

type BccOrderConfig struct {
	// 付费类型,一期只支持postpay
	ProductType string `json:"productType,omitempty"`
	Region      string `json:"region,omitempty"`
	LogicalZone string `json:"logicalZone,omitempty"`
	// BCC类型,去掉omitempty
	InstanceType int `json:"instanceType"`
	// 这些参数默认就行 容器产品用不到
	FpgaCard string `json:"fpgaCard,omitempty"`
	GpuCard  int    `json:"gpuCard,omitempty"`
	GpuCount int    `json:"gpuCount,omitempty"`

	CPU    int `json:"cpu,omitempty"`
	Memory int `json:"memory,omitempty"`
	// 就一个镜像 ubuntu1604
	ImageType string `json:"imageType,omitempty"`
	// 系统类型
	OsType string `json:"osType,omitempty"`
	// 系统版本
	OsVersion string `json:"osVersion,omitempty"`
	// 系统盘大小
	DiskSize int `json:"diskSize"`
	// 暂时为空
	EbsSize []int `json:"ebsSize,omitempty"`
	// 是否需要购买EIP
	IfBuyEip int `json:"ifBuyEip,omitempty"`
	// eip名称
	EipName        string `json:"eipName,omitempty"`
	SubProductType string `json:"subProductType,omitempty"`
	// eip带宽
	BandwidthInMbps int `json:"bandwidthInMbps,omitempty"`

	SubnetUuiD      string `json:"subnetUuid,omitempty"`      // 子网uuid
	SecurityGroupID string `json:"securityGroupId,omitempty"` // 安全组id

	AdminPass        string `json:"adminPass,omitempty"`
	AdminPassConfirm string `json:"adminPassConfirm,omitempty"`
	PurchaseLength   int    `json:"purchaseLength,omitempty"`
	// 购买的虚机个数
	PurchaseNum int `json:"purchaseNum,omitempty"`

	AutoRenewTimeUnit   string                `json:"autoRenewTimeUnit,omitempty"`
	AutoRenewTime       int64                 `json:"autoRenewTime,omitempty"`
	CreateEphemeralList []CreateEphemeralList `json:"createEphemeralList,omitempty"`
	// 是否自动续费 默认即可 后付费不存在这个问题
	AutoRenew bool `json:"autoRenew,omitempty"`
	// 镜像id 用默认即可 固定是ubuntu1604
	ImageID           string `json:"imageId,omitempty"`
	OsName            string `json:"osName,omitempty"`
	SecurityGroupName string `json:"securityGroupName,omitempty"`
	// BCC
	ServiceType string `json:"serviceType,omitempty"`
}

BccOrderConfig define BCC order config

type CceCluster

type CceCluster struct {
	ClusterUuid string     `json:"clusterUuid"`
	NodeConfig  NodeConfig `json:"nodeConfig"`
}

CceCluster define cluster of cce

type CceInstance

type CceInstance struct {
	InstanceId            string `json:"id"`
	InstanceName          string `json:"name"`
	Description           string `json:"desc"`
	Status                string `json:"status"`
	PaymentTiming         string `json:"paymentTiming"`
	CreationTime          string `json:"createTime"`
	ExpireTime            string `json:"expireTime"`
	PublicIP              string `json:"publicIp"`
	InternalIP            string `json:"internalIp"`
	CpuCount              int    `json:"cpu"`
	GpuCount              int    `json:"gpu"`
	MemoryCapacityInGB    int    `json:"memory"`
	LocalDiskSizeInGB     int    `json:"localDiskSizeInGB"`
	ImageId               string `json:"imageId"`
	NetworkCapacityInMbps int    `json:"networkCapacityInMbps"`
	PlacementPolicy       string `json:"placementPolicy"`
	ZoneName              string `json:"zoneName"`
	SubnetId              string `json:"subnetId"`
	VpcId                 string `json:"vpcId"`
}

CceInstance define instance of cce

type CdsOrderConfig

type CdsOrderConfig struct {
	// 付费类型,一期只支持postpay
	ProductType string `json:"productType,omitempty"`
	// "zoneA"
	LogicalZone    string `json:"logicalZone,omitempty"`
	Region         string `json:"region,omitempty"`         // "bj"
	PurchaseNum    int    `json:"purchaseNum,omitempty"`    // 1
	PurchaseLength int    `json:"purchaseLength,omitempty"` // 1
	AutoRenewTime  int    `json:"autoRenewTime,omitempty"`  // 0
	// "month"
	AutoRenewTimeUnit string           `json:"autoRenewTimeUnit,omitempty"`
	CdsDiskSize       []DiskSizeConfig `json:"cdsDiskSize,omitempty"`
	// "CDS"
	ServiceType string `json:"serviceType,omitempty"`
}

CdsOrderConfig define CDS order config

type CdsPreMountInfo

type CdsPreMountInfo struct {
	MountPath string           `json:"mountPath"`
	CdsConfig []DiskSizeConfig `json:"cdsConfig"`
}

CdsPreMountInfo define premount

type Client

type Client struct {
	*bce.Client
}

Client is the cce client implemention for Baidu Cloud CCE API.

func NewClient

func NewClient(config *Config) *Client

NewClient client for CCE

func (*Client) DescribeCluster

func (c *Client) DescribeCluster(clusterID string) (*CceCluster, error)

DescribeCluster describe the cluster

func (*Client) GetURL

func (c *Client) GetURL(objectKey string, params map[string]string) string

GetURL generates the full URL of http request for Baidu Cloud CCE API.

func (*Client) ListInstances

func (c *Client) ListInstances(clusterID string) ([]CceInstance, error)

ListInstances gets all Instances of a cluster.

func (*Client) ScaleDownCluster

func (c *Client) ScaleDownCluster(args *ScaleDownClusterArgs) error

ScaleDownCluster scale down a cluster

func (*Client) ScaleUpCluster

func (c *Client) ScaleUpCluster(args *ScaleUpClusterArgs) (*ScaleUpClusterResponse, error)

ScaleUpCluster scaleup a cluster

type Config

type Config struct {
	*bce.Config
}

Config contains all options

func NewConfig

func NewConfig(config *bce.Config) *Config

NewConfig returns Config

type CreateEphemeralList

type CreateEphemeralList struct {
	// 磁盘存储类型 从页面创建虚机时 看到请求 默认是ssd
	StorageType string `json:"storageType,omitempty"`
	// 磁盘大小
	SizeInGB int `json:"sizeInGB,omitempty"`
}

CreateEphemeralList define storage

type DiskSizeConfig

type DiskSizeConfig struct {
	Size         string `json:"size"`
	SnapshotID   string `json:"snapshotID"`
	SnapshotName string `json:"snapshotName"`
	VolumeType   string `json:"volumeType"`
	StorageType  string `json:"storageType"`
	LogicalZone  string `json:"logicalZone"`
}

DiskSizeConfig define distsize config

type EipOrderConfig

type EipOrderConfig struct {
	// 付费类型,一期只支持postpay
	ProductType     string `json:"productType,omitempty"`
	BandwidthInMbps int    `json:"bandwidthInMbps,omitempty"` // 1000
	Region          string `json:"region,omitempty"`          // "bj"
	SubProductType  string `json:"subProductType,omitempty"`  // "netraffic",
	// EIP购买数量应该是购买BCC数量的总和
	PurchaseNum       int    `json:"purchaseNum,omitempty"`
	PurchaseLength    int    `json:"purchaseLength,omitempty"`    // 1
	AutoRenewTime     int    `json:"autoRenewTime,omitempty"`     // 0
	AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"` // "month",
	Name              string `json:"name,omitempty"`              // "kkk"
	ServiceType       string `json:"serviceType,omitempty"`       // "EIP"
}

EipOrderConfig define CDS order config

type ListInstancesResponse

type ListInstancesResponse struct {
	Instances []CceInstance `json:"instances"`
}

ListInstancesResponse define response of cce list

type NodeConfig

type NodeConfig struct {
	InstanceType int    `json:"instanceType"`
	CPU          int    `json:"cpu,omitempty"`
	Memory       int    `json:"memory,omitempty"`
	GpuCount     int    `json:"gpuCount,omitempty"`
	GpuCard      string `json:"gpuCard,omitempty"`
	DiskSize     int    `json:"diskSize,omitempty"`
}

NodeConfig is the config for node

type NodeInfo

type NodeInfo struct {
	InstanceID string `json:"instanceId"`
}

NodeInfo define instanceid

type OrderContent

type OrderContent struct {
	PaymentMethod []string    `json:"paymentMethod,omitempty"`
	Items         []OrderItem `json:"items,omitempty"`
}

OrderContent define bcc order content

type OrderItem

type OrderItem struct {
	Config        interface{} `json:"config,omitempty"`
	PaymentMethod []string    `json:"paymentMethod,omitempty"`
}

OrderItem define bcc order content item

type ScaleDownClusterArgs

type ScaleDownClusterArgs struct {
	ClusterID string     `json:"clusterUuid"`
	AuthCode  string     `json:"authCode"`
	NodeInfos []NodeInfo `json:"nodeInfo"`
}

ScaleDownClusterArgs define args

type ScaleDownClusterResponse

type ScaleDownClusterResponse struct {
	ClusterID string   `json:"clusterUuid"`
	OrderID   []string `json:"orderId"`
}

ScaleDownClusterResponse define args

type ScaleUpClusterArgs

type ScaleUpClusterArgs struct {
	ClusterID       string          `json:"clusterUuid,omitempty"`
	CdsPreMountInfo CdsPreMountInfo `json:"cdsPreMountInfo,omitempty"`
	OrderContent    OrderContent    `json:"orderContent,omitempty"`
}

ScaleUpClusterArgs define args

type ScaleUpClusterResponse

type ScaleUpClusterResponse struct {
	ClusterID string   `json:"clusterUuid"`
	OrderID   []string `json:"orderId"`
}

ScaleUpClusterResponse define args

Jump to

Keyboard shortcuts

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