cds

package
v0.0.0-...-5b6f272 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

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 AttachVolumeArgs

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

AttachCDSVolumeArgs describe attachcds args

type AttachVolumeResponse

type AttachVolumeResponse 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 CDS client implemention for Baidu Cloud CDS API.

func NewClient

func NewClient(config *bce.Config) *Client

func (*Client) AttachVolume

func (c *Client) AttachVolume(args *AttachVolumeArgs, option *bce.SignOption) (*VolumeAttachment, error)

AttachCDSVolume attach a cds to vm

func (*Client) CreateVolumes

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

CreateVolumes create a volume

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volumeId string, option *bce.SignOption) error

DeleteVolume Delete a volume

func (*Client) DescribeVolume

func (c *Client) DescribeVolume(id string, option *bce.SignOption) (*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) DetachVolume

func (c *Client) DetachVolume(args *AttachVolumeArgs, option *bce.SignOption) error

DetachCDSVolume detach a cds TODO: if a volume is detaching, 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 CDS API.

func (*Client) GetVolumeList

func (c *Client) GetVolumeList(args *GetVolumeListArgs, option *bce.SignOption) ([]Volume, error)

GetVolumeList get all volumes

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