Documentation ¶
Overview ¶
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
* Copyright (C) 2017-2019 Alibaba Group Holding Limited
Index ¶
- Constants
- func ConvertToGB(size float64) int
- type AttachDiskMethod
- type CPI
- type CalculateVMCloudPropertiesMethod
- type CallContext
- type Caller
- type CpiError
- type CpiResponse
- type CreateDiskMethod
- type CreateStemcellMethod
- func (a CreateStemcellMethod) CreateFromTarball(imagePath string, props StemcellProps) (string, error)
- func (a CreateStemcellMethod) CreateFromURL(props StemcellProps) (string, error)
- func (a CreateStemcellMethod) CreateStemcell(imagePath string, cloudProps apiv1.StemcellCloudProps) (apiv1.StemcellCID, error)
- type CreateVMMethod
- type DeleteDiskMethod
- type DeleteSnapshotMethod
- type DeleteStemcellMethod
- type DeleteVMMethod
- type DetachDiskMethod
- type DiskInfo
- type Disks
- type Factory
- type GetDisksMethod
- type HasDiskMethod
- type HasVMMethod
- type InfoMethod
- type InstanceChargeType
- type InstanceProps
- type MetaData
- type MetaInput
- type NetworkProps
- type Networks
- type PersistentDisk
- type RebootVMMethod
- type ResizeDiskMethod
- type Services
- type SetDiskMetadataMethod
- type SetVMMetadataMethod
- type SnapshotDiskMethod
- type StemcellProps
Constants ¶
const ( AlicloudImageNamePrefix = "stemcell" MinImageDiskSize = 5 //in GB OSS_BUCKET_NAME_MAX_LENGTH = 64 PART_SIZE = 5 * 1024 * 1024 // 5MB )
const ( PrePaid = InstanceChargeType("PrePaid") PostPaid = InstanceChargeType("PostPaid") )
const ( DefaultDiskCategory = alicloud.DiskCategoryCloudEfficiency DefaultSystemDiskSizeGB = 40 AmendSmallDiskSize = true )
const ( NetworkTypeManual = "manual" NetworkTypeDynamic = "dynamic" NetworkTypeVip = "vip" )
Variables ¶
This section is empty.
Functions ¶
func ConvertToGB ¶
Types ¶
type AttachDiskMethod ¶
type AttachDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewAttachDiskMethod ¶
func NewAttachDiskMethod(cc CallContext, disks alicloud.DiskManager, instances alicloud.InstanceManager, rc registry.Client) AttachDiskMethod
func (AttachDiskMethod) AttachDisk ¶
type CPI ¶
type CPI struct { InfoMethod CreateStemcellMethod DeleteStemcellMethod CreateVMMethod DeleteVMMethod HasVMMethod RebootVMMethod SetVMMetadataMethod CalculateVMCloudPropertiesMethod GetDisksMethod CreateDiskMethod DeleteDiskMethod AttachDiskMethod DetachDiskMethod HasDiskMethod ResizeDiskMethod SetDiskMetadataMethod SnapshotDiskMethod DeleteSnapshotMethod }
type CalculateVMCloudPropertiesMethod ¶
type CalculateVMCloudPropertiesMethod struct {
CallContext
}
func NewCalculateVMCloudPropertiesMethod ¶
func NewCalculateVMCloudPropertiesMethod(cc CallContext) CalculateVMCloudPropertiesMethod
func (CalculateVMCloudPropertiesMethod) CalculateVMCloudProperties ¶
func (a CalculateVMCloudPropertiesMethod) CalculateVMCloudProperties(resources apiv1.VMResources) (apiv1.VMCloudProps, error)
type CallContext ¶
type CallContext struct { Input string Logger boshlog.Logger Config alicloud.Config ConfigConcern bool }
func NewCallContext ¶
func (CallContext) Errorf ¶
func (c CallContext) Errorf(msg string, args ...interface{}) error
func (CallContext) WrapErrorf ¶
func (c CallContext) WrapErrorf(err error, msg string, args ...interface{}) error
type Caller ¶
func NewCallerWithServices ¶
func (Caller) CallGeneric ¶
func (Caller) Run ¶
func (c Caller) Run(input []byte) CpiResponse
type CpiError ¶
type CpiResponse ¶
type CpiResponse struct { Result interface{} `json:"result"` Error interface{} `json:"error"` Log string `json:"log"` }
func WrapErrorResponse ¶
func WrapErrorResponse(err error, format string, args ...interface{}) CpiResponse
func (CpiResponse) GetError ¶
func (r CpiResponse) GetError() error
func (CpiResponse) GetResult ¶
func (r CpiResponse) GetResult() interface{}
func (CpiResponse) GetResultString ¶
func (r CpiResponse) GetResultString() string
type CreateDiskMethod ¶
type CreateDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewCreateDiskMethod ¶
func NewCreateDiskMethod(cc CallContext, disks alicloud.DiskManager, instances alicloud.InstanceManager) CreateDiskMethod
func (CreateDiskMethod) CreateDisk ¶
func (a CreateDiskMethod) CreateDisk(size int, props apiv1.DiskCloudProps, vmCid *apiv1.VMCID) (apiv1.DiskCID, error)
type CreateStemcellMethod ¶
type CreateStemcellMethod struct { CallContext // contains filtered or unexported fields }
func NewCreateStemcellMethod ¶
func NewCreateStemcellMethod(cc CallContext, stemcells alicloud.StemcellManager, osses alicloud.OssManager) CreateStemcellMethod
func (CreateStemcellMethod) CreateFromTarball ¶
func (a CreateStemcellMethod) CreateFromTarball(imagePath string, props StemcellProps) (string, error)
func (CreateStemcellMethod) CreateFromURL ¶
func (a CreateStemcellMethod) CreateFromURL(props StemcellProps) (string, error)
func (CreateStemcellMethod) CreateStemcell ¶
func (a CreateStemcellMethod) CreateStemcell(imagePath string, cloudProps apiv1.StemcellCloudProps) (apiv1.StemcellCID, error)
create stemcell policy:
- stemcell metadate set in cloudProps
- we provide three ways to create stemcell 2.1 region-imageId format, return Stemcell directly 2.2 source URL, put the raw image on OSS, then create image by the oss url 2.3 local tarball, upload the tarball on OSS, the create image by the oss url
type CreateVMMethod ¶
type CreateVMMethod struct { CallContext // contains filtered or unexported fields }
func NewCreateVMMethod ¶
func NewCreateVMMethod( cc CallContext, stemcells alicloud.StemcellManager, instances alicloud.InstanceManager, disks alicloud.DiskManager, networks alicloud.NetworkManager, registry registry.Client) CreateVMMethod
func (CreateVMMethod) UpdateAgentSettings ¶
func (a CreateVMMethod) UpdateAgentSettings(instId string, agentSettings registry.AgentSettings) error
type DeleteDiskMethod ¶
type DeleteDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewDeleteDiskMethod ¶
func NewDeleteDiskMethod(cc CallContext, disks alicloud.DiskManager, instances alicloud.InstanceManager) DeleteDiskMethod
func (DeleteDiskMethod) DeleteDisk ¶
func (a DeleteDiskMethod) DeleteDisk(diskCID apiv1.DiskCID) error
type DeleteSnapshotMethod ¶
type DeleteSnapshotMethod struct { CallContext // contains filtered or unexported fields }
func NewDeleteSnapshotMethod ¶
func NewDeleteSnapshotMethod(cc CallContext, disks alicloud.DiskManager) DeleteSnapshotMethod
func (DeleteSnapshotMethod) DeleteSnapshot ¶
func (a DeleteSnapshotMethod) DeleteSnapshot(snapshotCID apiv1.SnapshotCID) error
type DeleteStemcellMethod ¶
type DeleteStemcellMethod struct { CallContext // contains filtered or unexported fields }
func NewDeleteStemcellMethod ¶
func NewDeleteStemcellMethod(cc CallContext, stemcells alicloud.StemcellManager) DeleteStemcellMethod
func (DeleteStemcellMethod) DeleteStemcell ¶
func (a DeleteStemcellMethod) DeleteStemcell(cid apiv1.StemcellCID) error
type DeleteVMMethod ¶
type DeleteVMMethod struct { CallContext // contains filtered or unexported fields }
func NewDeleteVMMethod ¶
func NewDeleteVMMethod(cc CallContext, instances alicloud.InstanceManager) DeleteVMMethod
type DetachDiskMethod ¶
type DetachDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewDetachDiskMethod ¶
func NewDetachDiskMethod(cc CallContext, disks alicloud.DiskManager, rc registry.Client) DetachDiskMethod
func (DetachDiskMethod) DetachDisk ¶
type DiskInfo ¶
type DiskInfo struct { SizeRaw interface{} `json:"size"` Category string `json:"category"` Encrypted *bool `json:"encrypted,omitempty"` DeleteWithInstance *bool `json:"delete_with_instance,omitempty"` // contains filtered or unexported fields }
func NewDiskInfo ¶
func NewDiskInfo() DiskInfo
func NewDiskInfoWithSize ¶
func NewDiskInfoWithSize(size int, props apiv1.DiskCloudProps) (DiskInfo, error)
func (DiskInfo) GetCategory ¶
func (a DiskInfo) GetCategory() alicloud.DiskCategory
type Disks ¶
type Disks struct { SystemDisk DiskInfo EphemeralDisk DiskInfo PersistentDisks []PersistentDisk }
func NewDisksWithProps ¶
func (Disks) AsRegistrySettings ¶
func (a Disks) AsRegistrySettings() registry.DisksSettings
func (Disks) AssociatePersistentDisk ¶
func (Disks) FillCreateInstanceArgs ¶
func (a Disks) FillCreateInstanceArgs(golbalEncrypt *bool, args *ecs.CreateInstanceRequest)
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(cc CallContext, services Services) Factory
type GetDisksMethod ¶
type GetDisksMethod struct { CallContext // contains filtered or unexported fields }
func NewGetDisksMethod ¶
func NewGetDisksMethod(cc CallContext, disks alicloud.DiskManager) GetDisksMethod
type HasDiskMethod ¶
type HasDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewHasDiskMethod ¶
func NewHasDiskMethod(cc CallContext, disks alicloud.DiskManager) HasDiskMethod
func (HasDiskMethod) ResizeDisk ¶
func (a HasDiskMethod) ResizeDisk(diskCID apiv1.DiskCID, size int) error
type HasVMMethod ¶
type HasVMMethod struct { CallContext // contains filtered or unexported fields }
func NewHasVMMethod ¶
func NewHasVMMethod(cc CallContext, instances alicloud.InstanceManager) HasVMMethod
type InstanceChargeType ¶
type InstanceChargeType string
type InstanceProps ¶
type InstanceProps struct { EphemeralDisk DiskInfo `json:"ephemeral_disk"` SystemDisk DiskInfo `json:"system_disk"` Region string `json:"region"` AvailabilityZone string `json:"availability_zone"` InstanceName string `json:"instance_name"` InstanceType string `json:"instance_type"` Slbs []string `json:"slbs"` SlbWeight json.Number `json:"slb_weight"` Password string `json:"password"` KeyPairName string `json:"key_pair_name"` SecurityGroupIds []string `json:"security_group_ids"` ChargeType string `json:"charge_type"` ChargePeriod json.Number `json:"charge_period"` ChargePeriodUnit string `json:"charge_period_unit"` AutoRenew string `json:"auto_renew"` AutoRenewPeriod json.Number `json:"auto_renew_period"` SpotStrategy alicloud.SpotStrategyType `json:"spot_strategy"` SpotPriceLimit float64 `json:"spot_price_limit"` RamRoleName string `json:"ram_role_name"` StemcellId string `json:"stemcell_id"` }
Instance properties: ref to docs/bosh/alicloud-cpi.md spot https://help.aliyun.com/knowledge_detail/48269.html ram profile https://help.aliyun.com/document_detail/54579.html?spm=5176.doc25481.6.797.UVS7aB
func NewInstanceProps ¶
func NewInstanceProps() InstanceProps
type NetworkProps ¶
type Networks ¶
type Networks struct {
// contains filtered or unexported fields
}
func (Networks) AsRegistrySettings ¶
func (a Networks) AsRegistrySettings() registry.NetworksSettings
func (Networks) FillCreateInstanceArgs ¶
func (a Networks) FillCreateInstanceArgs(args *ecs.CreateInstanceRequest) error
type PersistentDisk ¶
type RebootVMMethod ¶
type RebootVMMethod struct { CallContext // contains filtered or unexported fields }
func NewRebootVMMethod ¶
func NewRebootVMMethod(cc CallContext, instances alicloud.InstanceManager) RebootVMMethod
type ResizeDiskMethod ¶
type ResizeDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewResizeDiskMethod ¶
func NewResizeDiskMethod(cc CallContext, disks alicloud.DiskManager) ResizeDiskMethod
type Services ¶
type Services struct { Stemcells alicloud.StemcellManager Osses alicloud.OssManager Instances alicloud.InstanceManager Disks alicloud.DiskManager Networks alicloud.NetworkManager Registry registry.Client }
type SetDiskMetadataMethod ¶
type SetDiskMetadataMethod struct { CallContext // contains filtered or unexported fields }
func NewSetDiskMetadataMethod ¶
func NewSetDiskMetadataMethod(cc CallContext, disks alicloud.DiskManager, instances alicloud.InstanceManager) SetDiskMetadataMethod
func (SetDiskMetadataMethod) SetDiskMetadata ¶
type SetVMMetadataMethod ¶
type SetVMMetadataMethod struct { CallContext // contains filtered or unexported fields }
func NewSetVMMetadataMethod ¶
func NewSetVMMetadataMethod(cc CallContext, instances alicloud.InstanceManager) SetVMMetadataMethod
func (SetVMMetadataMethod) SetVMMetadata ¶
type SnapshotDiskMethod ¶
type SnapshotDiskMethod struct { CallContext // contains filtered or unexported fields }
func NewSnapshotDiskMethod ¶
func NewSnapshotDiskMethod(cc CallContext, disks alicloud.DiskManager) SnapshotDiskMethod
func (SnapshotDiskMethod) SnapshotDisk ¶
func (a SnapshotDiskMethod) SnapshotDisk(diskCID apiv1.DiskCID, meta apiv1.DiskMeta) (apiv1.SnapshotCID, error)
type StemcellProps ¶
type StemcellProps struct { Architecture string `json:"architecture"` ContainerFormat string `json:"container_format"` Disk interface{} `json:"disk"` DiskFormat string `json:"disk_format"` Hypervisor string `json:"hypervisor"` Name string `json:"name"` OsDistro string `json:"os_distro"` OsType string `json:"os_type"` //RootDeviceName string `json:"root_device_name"` SourceUrl string `json:"source_url"` //SourceSha1 string `json:"raw_disk_sha1,omitempty"` OSSBucket string `json:"oss_bucket"` OSSObject string `json:"oss_object"` Description string `json:"description,omitempty"` // Version string `json:"version"` TODO sometimes string, and sometimes int Images map[string]interface{} `json:"image_id"` // contains filtered or unexported fields }
func (StemcellProps) FindStemcellId ¶
func (a StemcellProps) FindStemcellId(region string) (string, error)
func (StemcellProps) GetDiskGB ¶
func (a StemcellProps) GetDiskGB() int
Image size minimum is 5GB. Refer to https://www.alibabacloud.com/help/doc-detail/25542.htm
func (StemcellProps) Validate ¶
func (a StemcellProps) Validate() (StemcellProps, error)
Source Files ¶
- attach_disk.go
- calculate_vm_properties.go
- call_context.go
- caller.go
- create_disk.go
- create_stemcell.go
- create_vm.go
- delete_disk.go
- delete_snapshot.go
- delete_stemcell.go
- delete_vm.go
- detach_disk.go
- disks.go
- factory.go
- get_disks.go
- has_disk.go
- has_vm.go
- info.go
- networks.go
- reboot_vm.go
- resize_disk.go
- set_disk_metadata.go
- set_vm_metadata.go
- snapshot_disk.go
- validators.go