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
- func Aes128EncryptUseSecreteKey(sk string, data string) (string, error)
- func DeleteDeploySet(cli bce.Client, deploySetId string) error
- func DeleteImage(cli bce.Client, imageId string) error
- func ModifyInstanceDesc(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func ModifyInstanceName(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func ModifyInstancePassword(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func RebootInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func RebuildInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func ReleaseInstance(cli bce.Client, instanceId string) error
- func StartInstance(cli bce.Client, instanceId string) error
- func StopInstance(cli bce.Client, instanceId string, reqBody *bce.Body) error
- func UnbindTags(cli bce.Client, instanceId string, reqBody *bce.Body) error
- type BbcNetworkModel
- type Billing
- type CreateDeploySetArgs
- type CreateDeploySetResult
- type CreateImageArgs
- type CreateImageResult
- type CreateInstanceArgs
- type CreateInstanceResult
- type DeploySetModel
- type FlavorModel
- type GetDeploySetResult
- type GetFlavorDetailResult
- type GetFlavorRaidResult
- type GetImageDetailResult
- type GetOperationLogArgs
- type GetOperationLogResult
- type GetVpcSubnetArgs
- type GetVpcSubnetResult
- type ImageModel
- type ImageStatus
- type ImageType
- type InstanceModel
- type InstanceStatus
- type ListDeploySetsResult
- type ListFlavorsResult
- type ListImageArgs
- type ListImageResult
- type ListInstanceArgs
- type ListInstanceResult
- type ModifyInstanceDescArgs
- type ModifyInstanceNameArgs
- type ModifyInstancePasswordArgs
- type OperationLogModel
- type PaymentTimingType
- type RaidModel
- type RebuildInstanceArgs
- type Reservation
- type StopInstanceArgs
- type SubnetModel
- type UnbindTagsArgs
- type VpcModel
Constants ¶
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 DeleteDeploySet ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 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 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 FlavorModel ¶
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 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 ¶
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 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 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 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 PaymentTimingType ¶
type PaymentTimingType string
const ( PaymentTimingPrePaid PaymentTimingType = "Prepaid" PaymentTimingPostPaid PaymentTimingType = "Postpaid" )
type RebuildInstanceArgs ¶
type Reservation ¶
type StopInstanceArgs ¶
type StopInstanceArgs struct {
ForceStop bool `json:"forceStop,omitempty"`
}