bcc

package
v0.0.0-...-10df587 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// InstanceStatusRunning status
	InstanceStatusRunning string = "Running"
	// InstanceStatusStarting status
	InstanceStatusStarting string = "Starting"
	// InstanceStatusStopping status
	InstanceStatusStopping string = "Stopping"
	// InstanceStatusStopped status
	InstanceStatusStopped string = "Stopped"
	// InstanceStatusDeleted status
	InstanceStatusDeleted string = "Deleted"
	// InstanceStatusScaling status
	InstanceStatusScaling string = "Scaling"
	// InstanceStatusExpired status
	InstanceStatusExpired string = "Expired"
	// InstanceStatusError status
	InstanceStatusError string = "Error"
	// InstanceStatusSnapshotProcessing status
	InstanceStatusSnapshotProcessing string = "SnapshotProcessing"
	// InstanceStatusImageProcessing statu
	InstanceStatusImageProcessing string = "ImageProcessing"
)

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 Client

type Client struct {
	*bce.Client
}

Client is the BCC client implemention for Baidu Cloud BCC API.

func NewClient

func NewClient(config *bce.Config) *Client

NewClient returns client for BCC

func (*Client) CreateInstances

func (c *Client) CreateInstances(args *CreateInstanceArgs, option *bce.SignOption) ([]string, error)

CreateInstances create instances according to args

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(instanceID string, option *bce.SignOption) error

DeleteInstance delete a instance

func (*Client) DescribeInstance

func (c *Client) DescribeInstance(instanceID string, option *bce.SignOption) (*Instance, error)

DescribeInstance describe a instance

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 BCC API.

func (*Client) ListInstances

func (c *Client) ListInstances(option *bce.SignOption) ([]Instance, error)

ListInstances gets all Instances.

type CreateCdsModel

type CreateCdsModel struct {
	StorageType StorageType `json:"storageType,storageType"`
	SnapshotID  string      `json:"snapshotId,omitempty"`
	CdsSizeInGB int         `json:"cdsSizeInGB,omitempty"`
}

CreateCdsModel json

type CreateInstanceArgs

type CreateInstanceArgs struct {
	ImageID               string           `json:"imageId"`
	Billing               billing.Billing  `json:"billing"`
	InstanceType          string           `json:"instanceType,omitempty"`
	CPUCount              int              `json:"cpuCount"`
	MemoryCapacityInGB    int              `json:"memoryCapacityInGB"`
	RootDiskSizeInGB      int              `json:"rootDiskSizeInGb,omitempty"`
	RootDiskStorageType   int              `json:"rootDiskStorageType,omitempty"`
	LocalDiskSizeInGB     int              `json:"localDiskSizeInGB,omitempty"` // deprecated now
	EphemeralDisks        []EphemeralDisk  `json:"ephemeralDisks,omitempty"`
	CreateCdsList         []CreateCdsModel `json:"createCdsList,omitempty"`
	NetworkCapacityInMbps int              `json:"networkCapacityInMbps,omitempty"`
	DedicatedHostID       int              `json:"dedicatedHostId,omitempty"`
	PurchaseCount         int              `json:"purchaseCount,omitempty"`
	Name                  string           `json:"name,omitempty"`
	AdminPass             string           `json:"adminPass,omitempty"`
	ZoneName              string           `json:"zoneName,omitempty"`
	SubnetID              string           `json:"subnetId,omitempty"`
	SecurityGroupID       string           `json:"securityGroupId,omitempty"`
	GPUCard               string           `json:"gpuCard,omitempty"`
	FPGACard              string           `json:"fpgaCard,omitempty"`
	CardCount             string           `json:"cardCount,omitempty"`
}

CreateInstanceArgs is args to create instances refers to https://cloud.baidu.com/doc/BCC/API.html#.E5.88.9B.E5.BB.BA.E5.AE.9E.E4.BE.8B

type CreateInstanceResponse

type CreateInstanceResponse struct {
	InstanceIDs []string `json:"instanceIds"`
}

CreateInstanceResponse is response of create instances

type EphemeralDisk

type EphemeralDisk struct {
	StorageType  StorageType `json:"storageType,storageType"`
	SizeInGB     int         `json:"sizeInGB,omitempty"`
	FreeSizeInGB int         `json:"freeSizeInGB,omitempty"`
}

EphemeralDisk json

type GetInstanceResponse

type GetInstanceResponse struct {
	Ins Instance `json:"instance"`
}

GetInstanceResponse json

type Instance

type Instance 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:"cpuCount"`
	GPUCount              int    `json:"gpuCount"`
	MemoryCapacityInGB    int    `json:"memoryCapacityInGB"`
	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"`
}

Instance define instance model

type ListInstancesResponse

type ListInstancesResponse struct {
	Marker      string     `json:"marker"`
	IsTruncated bool       `json:"isTruncated"`
	NextMarker  string     `json:"nextMarker"`
	MaxKeys     int        `json:"maxKeys"`
	Instances   []Instance `json:"instances"`
}

ListInstancesResponse json

type StorageType

type StorageType string

StorageType type

Jump to

Keyboard shortcuts

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