api

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package api defines all APIs supported by the BBC service of BCE.

Package api defines all APIs supported by the BBC service of BCE.

Package api defines all APIs supported by the BBC service of BCE.

Package api defines all APIs supported by the BBC service of BCE.

Package api defines all APIs supported by the BBC service of BCE.

Package api defines all APIs supported by the BBC service of BCE.

util.go - define the utilities for api package of BBC service

Index

Constants

View Source
const (
	URI_PREFIX_V1 = bce.URI_PREFIX + "v1"
	URI_PREFIX_V2 = bce.URI_PREFIX + "v2"

	REQUEST_INSTANCE_URI = "/instance"
	REQUEST_SUBNET_URI   = "/vpcSubnet"

	REQUEST_IMAGE_URI = "/image"

	REQUEST_FLAVOR_URI      = "/flavor"
	REQUEST_FLAVOR_RAID_URI = "/flavorRaid"

	REQUEST_OPERATION_LOG_URI = "/operationLog"

	REQUEST_DEPLOY_SET_URI = "/deployset"
)

Variables

This section is empty.

Functions

func Aes128EncryptUseSecreteKey

func Aes128EncryptUseSecreteKey(sk string, data string) (string, error)

func DeleteDeploySet

func DeleteDeploySet(cli bce.Client, deploySetId string) error

DeleteDeploySet - delete a deploy set

PARAMS:

  • cli: the client agent which can perform sending request
  • deploySetId: the id of the deploy set

RETURNS:

  • error: nil if success otherwise the specific error

func DeleteImage

func DeleteImage(cli bce.Client, imageId string) error

DeleteImage - delete an image

PARAMS:

  • cli: the client agent which can perform sending request
  • imageId: the specific image ID

RETURNS:

  • error: nil if success otherwise the specific error

func ModifyInstanceDesc

func ModifyInstanceDesc(cli bce.Client, instanceId string, reqBody *bce.Body) error

ModifyInstanceDesc - modify a bbc instance desc

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func ModifyInstanceName

func ModifyInstanceName(cli bce.Client, instanceId string, reqBody *bce.Body) error

ModifyInstanceName - modify a bbc instance name

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func ModifyInstancePassword

func ModifyInstancePassword(cli bce.Client, instanceId string, reqBody *bce.Body) error

ModifyInstancePassword - modify a bbc instance password

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func RebootInstance

func RebootInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error

RebootInstance - reboot a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func RebuildInstance

func RebuildInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error

RebuildInstance - rebuild a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func ReleaseInstance

func ReleaseInstance(cli bce.Client, instanceId string) error

ReleaseInstance - release a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance

RETURNS:

  • error: nil if success otherwise the specific error

func StartInstance

func StartInstance(cli bce.Client, instanceId string) error

StartInstance - start a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance

RETURNS:

  • error: nil if success otherwise the specific error

func StopInstance

func StopInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error

StopInstance - stop a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

func UnbindTags

func UnbindTags(cli bce.Client, instanceId string, reqBody *bce.Body) error

UnbindTags - unbind a bbc instance tags

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance
  • reqBody: http request body

RETURNS:

  • error: nil if success otherwise the specific error

Types

type BbcNetworkModel

type BbcNetworkModel struct {
	BbcId  string      `json:"bbcId"`
	Vpc    VpcModel    `json:"vpc"`
	Subnet SubnetModel `json:"subnet"`
}

type Billing

type Billing struct {
	PaymentTiming PaymentTimingType `json:"paymentTiming,omitempty"`
	Reservation   *Reservation      `json:"reservation,omitempty"`
}

type CreateDeploySetArgs

type CreateDeploySetArgs struct {
	Strategy    string `json:"strategy"`
	Concurrency int    `json:"concurrency"`
	Name        string `json:"name,omitempty"`
	Desc        string `json:"desc,omitempty"`
	ClientToken string `json:"-"`
}

type CreateDeploySetResult

type CreateDeploySetResult struct {
	DeploySetId string `json:"deploySetId"`
}

func CreateDeploySet

func CreateDeploySet(cli bce.Client, clientToken string, reqBody *bce.Body) (*CreateDeploySetResult, error)

CreateDeploySet - create a deploy set

PARAMS:

  • cli: the client agent which can perform sending request
  • clientToken: idempotent token, an ASCII string no longer than 64 bits
  • reqBody: http request body

RETURNS:

  • *api.CreateDeploySetResult: results of creating a deploy set
  • error: nil if success otherwise the specific error

type CreateImageArgs

type CreateImageArgs struct {
	ImageName   string `json:"imageName"`
	InstanceId  string `json:"instanceId"`
	ClientToken string `json:"-"`
}

type CreateImageResult

type CreateImageResult struct {
	ImageId string `json:"imageId"`
}

func CreateImageFromInstanceId

func CreateImageFromInstanceId(cli bce.Client, clientToken string, reqBody *bce.Body) (*CreateImageResult, error)

CreateImageFromInstanceId - create image from specified instance

PARAMS:

  • cli: the client agent which can perform sending request
  • clientToken: idempotent token, an ASCII string no longer than 64 bits
  • reqBody: http request body

RETURNS:

  • *api.CreateImageResult: the result of create Image
  • error: nil if success otherwise the specific error

type CreateInstanceArgs

type CreateInstanceArgs struct {
	FlavorId         string  `json:"flavorId"`
	ImageId          string  `json:"imageId"`
	RaidId           string  `json:"raidId"`
	RootDiskSizeInGb int     `json:"rootDiskSizeInGb"`
	PurchaseCount    int     `json:"purchaseCount"`
	ZoneName         string  `json:"zoneName"`
	SubnetId         string  `json:"subnetId"`
	Billing          Billing `json:"billing"`
	Name             string  `json:"name,omitempty"`
	AdminPass        string  `json:"adminPass,omitempty"`
	DeploySetId      string  `json:"deploySetId,omitempty"`
	ClientToken      string  `json:"-"`
	SecurityGroupId  string  `json:"securityGroupId,omitempty"`
}

type CreateInstanceResult

type CreateInstanceResult struct {
	InstanceIds []string `json:"instanceIds"`
}

func CreateInstance

func CreateInstance(cli bce.Client, clientToken string, reqBody *bce.Body) (*CreateInstanceResult, error)

CreateInstance - create a bbc instance

PARAMS:

  • cli: the client agent which can perform sending request
  • clientToken: idempotent token, an ASCII string no longer than 64 bits
  • reqBody: http request body

RETURNS:

  • *CreateInstanceResult: results of creating a bbc instance
  • error: nil if success otherwise the specific error

type DeploySetModel

type DeploySetModel struct {
	Strategy     string   `json:"strategy"`
	InstanceList []string `json:"instanceList"`
	Concurrency  int      `json:"concurrency"`
	DeploySetId  string   `json:"deploySetId"`
}

type FlavorModel

type FlavorModel struct {
	FlavorId           string `json:"flavorID"`
	CpuCount           int    `json:"cpuCount"`
	CpuType            string `json:"cpuType"`
	MemoryCapacityInGB int    `json:"memoryCapacityInGb"`
	Disk               string `json:"disk"`
	NetworkCard        string `json:"networkCard"`
	Others             string `json:"others"`
}

type GetDeploySetResult

type GetDeploySetResult struct {
	DeploySetModel
}

func GetDeploySet

func GetDeploySet(cli bce.Client, deploySetId string) (*GetDeploySetResult, error)

GetDeploySet - get details of the deploy set

PARAMS:

  • cli: the client agent which can perform sending request
  • deploySetId: the id of the deploy set

RETURNS:

  • *api.GetDeploySetResult: the detail of the deploy set
  • error: nil if success otherwise the specific error

type GetFlavorDetailResult

type GetFlavorDetailResult struct {
	FlavorModel
}

func GetFlavorDetail

func GetFlavorDetail(cli bce.Client, flavorId string) (*GetFlavorDetailResult, error)

GetFlavorDetail - get details of the specified flavor

PARAMS:

  • cli: the client agent which can perform sending request
  • flavorId: the id of the flavor

RETURNS:

  • *api.GetFlavorDetailResult: the detail of the specified flavor
  • error: nil if success otherwise the specific error

type GetFlavorRaidResult

type GetFlavorRaidResult struct {
	FlavorId string      `json:"flavorId"`
	Raids    []RaidModel `json:"raids"`
}

func GetFlavorRaid

func GetFlavorRaid(cli bce.Client, flavorId string) (*GetFlavorRaidResult, error)

GetFlavorRaid - get the RAID detail and disk size of the specified flavor

PARAMS:

  • cli: the client agent which can perform sending request
  • flavorId: the id of the flavor

RETURNS:

  • *api.GetFlavorRaidResult: the detail of the raid of the specified flavor
  • error: nil if success otherwise the specific error

type GetImageDetailResult

type GetImageDetailResult struct {
	Image *ImageModel `json:"image"`
}

func GetImageDetail

func GetImageDetail(cli bce.Client, imageId string) (*GetImageDetailResult, error)

GetImageDetail - get an image's detail info

PARAMS:

  • cli: the client agent which can perform sending request
  • imageId: the specific image ID

RETURNS:

  • *api.GetImageDetailResult: the result of get image's detail
  • error: nil if success otherwise the specific error

type GetOperationLogArgs

type GetOperationLogArgs struct {
	Marker    string
	MaxKeys   int
	StartTime string
	EndTime   string
}

type GetOperationLogResult

type GetOperationLogResult struct {
	Marker        string              `json:"marker"`
	IsTruncated   bool                `json:"isTruncated"`
	NextMarker    string              `json:"nextMarker"`
	MaxKeys       int                 `json:"maxKeys"`
	OperationLogs []OperationLogModel `json:"operationLogs"`
}

func GetOperationLog

func GetOperationLog(cli bce.Client, args *GetOperationLogArgs) (*GetOperationLogResult, error)

GetOperationLog - get operation log

PARAMS:

  • cli: the client agent which can perform sending request
  • args: the arguments to get operation log

RETURNS:

  • *api.GetOperationLogResult: results of getting operation log
  • error: nil if success otherwise the specific error

type GetVpcSubnetArgs

type GetVpcSubnetArgs struct {
	BbcIds []string `json:"bbcIds"`
}

type GetVpcSubnetResult

type GetVpcSubnetResult struct {
	NetworkInfo []BbcNetworkModel `json:"networkInfo"`
}

func GetVpcSubnet

func GetVpcSubnet(cli bce.Client, reqBody *bce.Body) (*GetVpcSubnetResult, error)

GetVpcSubnet - get multi instances vpc and subnet

PARAMS:

  • cli: the client agent which can perform sending request
  • reqBody: http request body

RETURNS:

  • *GetVpcSubnetResult: result of vpc and subnet
  • error: nil if success otherwise the specific error

type ImageModel

type ImageModel struct {
	OsVersion      string      `json:"osVersion"`
	OsArch         string      `json:"osArch"`
	Status         ImageStatus `json:"status"`
	Desc           string      `json:"desc"`
	Id             string      `json:"id"`
	Name           string      `json:"name"`
	OsName         string      `json:"osName"`
	OsBuild        string      `json:"osBuild"`
	CreateTime     string      `json:"createTime"`
	Type           ImageType   `json:"type"`
	OsType         string      `json:"osType"`
	SpecialVersion string      `json:"specialVersion"`
}

type ImageStatus

type ImageStatus string
const (
	ImageStatusCreating     ImageStatus = "Creating"
	ImageStatusCreateFailed ImageStatus = "CreateFailed"
	ImageStatusAvailable    ImageStatus = "Available"
	ImageStatusNotAvailable ImageStatus = "NotAvailable"
	ImageStatusError        ImageStatus = "Error"
)

type ImageType

type ImageType string
const (
	ImageTypeIntegration ImageType = "Integration"
	ImageTypeSystem      ImageType = "System"
	ImageTypeCustom      ImageType = "Custom"
)

type InstanceModel

type InstanceModel struct {
	Id                    string           `json:"id"`
	Name                  string           `json:"name"`
	Desc                  string           `json:"desc"`
	Status                InstanceStatus   `json:"status"`
	PaymentTiming         string           `json:"paymentTiming"`
	CreateTime            string           `json:"createTime"`
	ExpireTime            string           `json:"expireTime"`
	PublicIP              string           `json:"publicIp"`
	InternalIP            string           `json:"internalIp"`
	ImageId               string           `json:"imageId"`
	FlavorId              string           `json:"flavorId"`
	Zone                  string           `json:"zone"`
	Region                string           `json:"region"`
	NetworkCapacityInMbps int              `json:"networkCapacityInMbps"`
	Tags                  []model.TagModel `json:"tags"`
}

func GetInstanceDetail

func GetInstanceDetail(cli bce.Client, instanceId string) (*InstanceModel, error)

GetInstanceDetail - get a bbc instance detail msg

PARAMS:

  • cli: the client agent which can perform sending request
  • instanceId: the id of the instance

RETURNS:

  • *InstanceModel: instance detail msg
  • error: nil if success otherwise the specific error

type InstanceStatus

type InstanceStatus string
const (
	InstanceStatusRunning         InstanceStatus = "Running"
	InstanceStatusStarting        InstanceStatus = "Starting"
	InstanceStatusStopping        InstanceStatus = "Stopping"
	InstanceStatusStopped         InstanceStatus = "Stopped"
	InstanceStatusDeleted         InstanceStatus = "Deleted"
	InstanceStatusExpired         InstanceStatus = "Expired"
	InstanceStatusError           InstanceStatus = "Error"
	InstanceStatusImageProcessing InstanceStatus = "ImageProcessing"
)

type ListDeploySetsResult

type ListDeploySetsResult struct {
	DeploySetList []DeploySetModel `json:"deploySetList"`
}

func ListDeploySets

func ListDeploySets(cli bce.Client) (*ListDeploySetsResult, error)

ListDeploySets - list all deploy sets PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • *api.ListDeploySetsResult: the result of list all deploy sets
  • error: nil if success otherwise the specific error

type ListFlavorsResult

type ListFlavorsResult struct {
	Flavors []FlavorModel `json:"flavors"`
}

func ListFlavors

func ListFlavors(cli bce.Client) (*ListFlavorsResult, error)

ListFlavors - list all available flavors

PARAMS:

  • cli: the client agent which can perform sending request

RETURNS:

  • *ListFlavorsResult: the result of list all flavors
  • error: nil if success otherwise the specific error

type ListImageArgs

type ListImageArgs struct {
	Marker    string
	MaxKeys   int
	ImageType string
}

type ListImageResult

type ListImageResult struct {
	Marker      string       `json:"marker"`
	IsTruncated bool         `json:"isTruncated"`
	NextMarker  string       `json:"nextMarker"`
	MaxKeys     int          `json:"maxKeys"`
	Images      []ImageModel `json:"images"`
}

func ListImage

func ListImage(cli bce.Client, queryArgs *ListImageArgs) (*ListImageResult, error)

ListImage - list all images

PARAMS:

  • cli: the client agent which can perform sending request
  • args: the arguments to list all images

RETURNS:

  • *api.ListImageResult: the result of list all images
  • error: nil if success otherwise the specific error

type ListInstanceArgs

type ListInstanceArgs struct {
	Marker     string
	MaxKeys    int
	InternalIp string
}

type ListInstanceResult

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

func ListInstances

func ListInstances(cli bce.Client, args *ListInstanceArgs) (*ListInstanceResult, error)

ListInstances - list all bbc instances

PARAMS:

  • cli: the client agent which can perform sending request
  • args: the arguments to list bbc instances

RETURNS:

  • *ListInstanceResult: results of list bbc instances
  • error: nil if success otherwise the specific error

type ModifyInstanceDescArgs

type ModifyInstanceDescArgs struct {
	Description string `json:"desc"`
}

type ModifyInstanceNameArgs

type ModifyInstanceNameArgs struct {
	Name string `json:"name"`
}

type ModifyInstancePasswordArgs

type ModifyInstancePasswordArgs struct {
	AdminPass string `json:"adminPass"`
}

type OperationLogModel

type OperationLogModel struct {
	OperationStatus bool   `json:"operationStatus"`
	OperationTime   string `json:"operationTime"`
	OperationDesc   string `json:"operationDesc"`
	OperationIp     string `json:"operationIp"`
}

type PaymentTimingType

type PaymentTimingType string
const (
	PaymentTimingPrePaid  PaymentTimingType = "Prepaid"
	PaymentTimingPostPaid PaymentTimingType = "Postpaid"
)

type RaidModel

type RaidModel struct {
	RaidId       string `json:"raidId"`
	Raid         string `json:"raid"`
	SysSwapSize  int    `json:"sysSwapSize"`
	SysRootSize  int    `json:"sysRootSize"`
	SysHomeSize  int    `json:"sysHomeSize"`
	SysDiskSize  int    `json:"sysDiskSize"`
	DataDiskSize int    `json:"dataDiskSize"`
}

type RebuildInstanceArgs

type RebuildInstanceArgs struct {
	ImageId        string `json:"imageId"`
	AdminPass      string `json:"adminPass"`
	IsPreserveData bool   `json:"isPreserveData,omitempty"`
	RaidId         string `json:"raidId,omitempty"`
	SysRootSize    int    `json:"sysRootSize,omitempty"`
}

type Reservation

type Reservation struct {
	ReservationLength   int    `json:"reservationLength"`
	ReservationTimeUnit string `json:"reservationTimeUnit"`
}

type StopInstanceArgs

type StopInstanceArgs struct {
	ForceStop bool `json:"forceStop,omitempty"`
}

type SubnetModel

type SubnetModel struct {
	VpcId      string `json:"vpcId"`
	Name       string `json:"name"`
	SubnetType string `json:"subnetType"`
	SubnetId   string `json:"subnetId"`
	Cidr       string `json:"cidr"`
	ZoneName   string `json:"zoneName"`
}

type UnbindTagsArgs

type UnbindTagsArgs struct {
	ChangeTags []model.TagModel `json:"changeTags"`
}

type VpcModel

type VpcModel struct {
	VpcId       string `json:"vpcId"`
	Cidr        string `json:"cidr"`
	Name        string `json:"name"`
	IsDefault   bool   `json:"isDefault"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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