bcc

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceStatusRunning            string = "Running"
	InstanceStatusStarting           string = "Starting"
	InstanceStatusStopping           string = "Stopping"
	InstanceStatusStopped            string = "Stopped"
	InstanceStatusDeleted            string = "Deleted"
	InstanceStatusScaling            string = "Scaling"
	InstanceStatusExpired            string = "Expired"
	InstanceStatusError              string = "Error"
	InstanceStatusSnapshotProcessing string = "SnapshotProcessing"
	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",
}

Endpoint contains all endpoints of Baidu Cloud BCC.

Functions

This section is empty.

Types

type AttachCDSVolumeArgs

type AttachCDSVolumeArgs struct {
	VolumeId   string `json:"-"`
	InstanceId string `json:"instanceId"`
}

AttachCDSVolumeArgs describe attachcds args

type AttachCDSVolumeResponse

type AttachCDSVolumeResponse struct {
	VolumeAttachment *VolumeAttachment `json:"volumeAttachment"`
}

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 bos client implemention for Baidu Cloud BOS API.

func NewClient

func NewClient(config *Config) *Client

func (*Client) AttachCDSVolume

func (c *Client) AttachCDSVolume(args *AttachCDSVolumeArgs) (*VolumeAttachment, error)

AttachCDSVolume attach a cds to vm

func (*Client) CreateVolumes

func (c *Client) CreateVolumes(args *CreateVolumeArgs) ([]string, error)

CreateVolumes create a volume

func (*Client) DeleteCDS

func (c *Client) DeleteCDS(volumeID string) error

DeleteCDS delete a cds

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volumeId string) error

DeleteVolume Delete a volume

func (*Client) DescribeInstance

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

DescribeInstance describe a instance

func (*Client) DescribeVolume

func (c *Client) DescribeVolume(id string) (*Volume, error)

DescribeVolume describe a volume More info see https://cloud.baidu.com/doc/BCC/API.html#.E6.9F.A5.E8.AF.A2.E7.A3.81.E7.9B.98.E8.AF.A6.E6.83.85

func (*Client) DetachCDSVolume

func (c *Client) DetachCDSVolume(args *AttachCDSVolumeArgs) error

DetachCDSVolume detach a cds TODO: if a volume is ddetaching, need to wait

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

func (*Client) GetVolumeList

func (c *Client) GetVolumeList(args *GetVolumeListArgs) ([]Volume, error)

GetVolumeList get all volumes

func (*Client) ListInstances

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

ListInstances gets all Instances.

func (*Client) PurchaseReservedVolume

func (c *Client) PurchaseReservedVolume()

PurchaseReservedVolume purchaseReserved a volume TODO

func (*Client) RollbackVolume

func (c *Client) RollbackVolume()

RollbackVolume rollback a volume TODO

type Config

type Config struct {
	*bce.Config
}

Config contains all options for bos.Client.

func NewConfig

func NewConfig(config *bce.Config) *Config

type CreateVolumeArgs

type CreateVolumeArgs struct {
	PurchaseCount int          `json:"purchaseCount,omitempty"`
	CdsSizeInGB   int          `json:"cdsSizeInGB"`
	StorageType   StorageType  `json:"storageType"`
	Billing       *bce.Billing `json:"billing"`
	SnapshotId    string       `json:"snapshotId,omitempty"`
	ZoneName      string       `json:"zoneName,omitempty"`
}

type CreateVolumeResponse

type CreateVolumeResponse struct {
	VolumeIds []string `json:"volumeIds,omitempty"`
}

type DescribeVolumeResponse

type DescribeVolumeResponse struct {
	Volume *Volume `json:"volume"`
}

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 GetInstanceResponse

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

type GetVolumeListArgs

type GetVolumeListArgs struct {
	InstanceId string
	ZoneName   string
}

type GetVolumeListResponse

type GetVolumeListResponse struct {
	Volumes     []Volume `json:"volumes"`
	Marker      string   `json:"marker"`
	IsTruncated bool     `json:"isTruncated"`
	NextMarker  string   `json:"nextMarker"`
	MaxKeys     int      `json:"maxKeys"`
}

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"`
}

type StorageType

type StorageType string
const (
	STORAGE_TYPE_STD1 StorageType = "std1"
	STORAGE_TYPE_HP1  StorageType = "hp1"
	STORAGE_TYPE_SATA StorageType = "sata"
	STORAGE_TYPE_SSD  StorageType = "ssd"
)

type Volume

type Volume struct {
	Id             string             `json:"id"`
	Name           string             `json:"name"`
	DiskSizeInGB   int                `json:"diskSizeInGB"`
	PaymentTiming  string             `json:"paymentTiming"`
	CreateTime     string             `json:"createTime"`
	ExpireTime     string             `json:"expireTime"`
	Status         VolumeStatus       `json:"status"`
	VolumeType     VolumeType         `json:"type"`
	StorageType    StorageType        `json:"storageType"`
	Desc           string             `json:"desc"`
	Attachments    []VolumeAttachment `json:"attachments"`
	ZoneName       string             `json:"zoneName"`
	IsSystemVolume bool               `json:"isSystemVolume"`
}

type VolumeAttachment

type VolumeAttachment struct {
	VolumeId   string `json:"volumeId"`
	InstanceId string `json:"instanceId"`
	// mount path
	Device string `json:"device"`
}

VolumeAttachment define attach info

type VolumeStatus

type VolumeStatus string
const (
	VOLUMESTATUS_CREATE             VolumeStatus = "Creating"
	VOLUMESTATUS_AVAILABLE          VolumeStatus = "Available"
	VOLUMESTATUS_ATTACHING          VolumeStatus = "Attaching"
	VOLUMESTATUS_NOTAVALIABLE       VolumeStatus = "NotAvailable"
	VOLUMESTATUS_INUSE              VolumeStatus = "InUse"
	VOLUMESTATUS_DETACHING          VolumeStatus = "Detaching"
	VOLUMESTATUS_DELETING           VolumeStatus = "Deleting"
	VOLUMESTATUS_DELETED            VolumeStatus = "Deleted"
	VOLUMESTATUS_SCALING            VolumeStatus = "Scaling"
	VOLUMESTATUS_EXPIRED            VolumeStatus = "Expired"
	VOLUMESTATUS_ERROR              VolumeStatus = "Error"
	VOLUMESTATUS_SNAPSHOTPROCESSING VolumeStatus = "SnapshotProcessing"
	VOLUMESTATUS_IMAGEPROCESSING    VolumeStatus = "ImageProcessing"
)

type VolumeType

type VolumeType string
const (
	VOLUME_TYPE_SYSTEM    VolumeType = "System"
	VOLUME_TYPE_EPHEMERAL VolumeType = "Ephemeral"
	VOLUME_TYPE_CDS       VolumeType = "Cds"
)

Jump to

Keyboard shortcuts

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