resources

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Overview

VPC & Subnet 처리 (AlibabaCloud's Subnet --> VSwitch 임)

Index

Constants

View Source
const (
	// default Resource GROUP Name
	CBResourceGroupName = "CB-GROUP"
	// default VPC Name
	CBVirutalNetworkName = "CB-VNet"
	// default CIDR Block
	CBVnetDefaultCidr = "130.0.0.0/16"
	// default VM User Name
	CBDefaultVmUserName = "cb-user"

	// default Subnet Name
	CBSubnetName = "CB-VNet-Sub"

	// default Bandwidth is 5 Mbit/s
	CBBandwidth = "5"
	// default InstanceChargeType
	CBInstanceChargeType = "PostPaid"
	// default InternetChargeType
	CBInternetChargeType = "PayByTraffic"

	// default Tag Name
	CBMetaDefaultTagName = "cbCate"
	// default Tag Value
	CBMetaDefaultTagValue = "cbAlibaba"

	CBPageOn = true
	// page number for control pages
	CBPageNumber = 1 // 페이지 시작은 1부터 시작되기 때문에 삭제 예정

	// page size for control pages
	CBPageSize = 100 //오브젝트(예: 이미지 / 키페어 / ...) 마다 지정 개수가 달라서 삭제 예정

	CBKeyPairPath = "/meta_db/.ssh-aliyun/"
	//CBCloudInitFilePath = "/cloud-driver-libs/.cloud-init-aliyun/cloud-init"
	CBCloudInitFilePath = "/cloud-driver-libs/.cloud-init-common/cloud-init"
)
View Source
const (
	ALIBABA_DISK_STATUS_AVAILABLE = "Available"
	ALIBABA_DISK_STATUS_INUSE     = "In_use"
	ALIBABA_DISK_STATUS_ATTACHING = "Attaching"
	ALIBABA_DISK_STATUS_DETACHING = "Detaching"
	ALIBABA_DISK_STATUS_CREATING  = "Creating"
	ALIBABA_DISK_STATUS_REINITING = "ReIniting"
)
View Source
const (
	ALIBABA_IMAGE_STATE_CREATING     = "Creating"
	ALIBABA_IMAGE_STATE_WAITING      = "Waiting"
	ALIBABA_IMAGE_STATE_AVAILABLE    = "Available"
	ALIBABA_IMAGE_STATE_UNAVAILABLE  = "Unavailable"
	ALIBABA_IMAGE_STATE_CREATEFAILED = "Createfailed"
	ALIBABA_IMAGE_STATE_DEPRECATED   = "Deprecated"
	ALIBABA_IMAGE_STATE_ERROR        = "Error"

	RESOURCE_TYPE_MYIMAGE = "image"
	IMAGE_TAG_DEFAULT     = "Name"
	IMAGE_TAG_SOURCE_VM   = "CB-VMSNAPSHOT-SOURCEVM-ID"
)
View Source
const (
	ListenerProtocol_TCP string = "tcp"
	ListenerProtocol_UDP string = "udp"

	BackendServerType_ECS       string = "ecs"
	LoadBalancerSpec_SLBS1SMALL string = "slb.s1.small"

	ALI_LoadBalancerAddressType_INTERNET = "internet"
	ALI_LoadBalancerAddressType_INTRANET = "intranet"
	SPIDER_LoadBalancerType_PUBLIC       = "PUBLIC"
	SPIDER_LoadBalancerType_PRIVATE      = "PRIVATE"

	SCOPE_REGION = "REGION"
	SCOPE_GLOBAL = "GLOBAL"

	ServerHealthStatus_NORMAL      string = "normal"
	ServerHealthStatus_ABNORMAL    string = "abnormal"
	ServerHealthStatus_unavailable string = "unavailable"
)

Variables

This section is empty.

Functions

func AttachDisk added in v0.6.7

func AttachDisk(client *ecs.Client, regionInfo idrv.RegionInfo, ownerVM irs.IID, diskIID irs.IID) error

* Instance에 Disk Attach 한번에 1개씩.

func BindpricingPolicy added in v0.8.2

func BindpricingPolicy(priceResp AliPriceInfo, subscriptionType string, pricingModulePriceType string, regionName string, instanceType string) (irs.PricingPolicies, error)

func ContainString added in v0.6.7

func ContainString(s []string, str string) bool

array에 주어진 string이 있는지 체크

func ConvertJsonString

func ConvertJsonString(v interface{}) (string, error)

Cloud Object를 JSON String 타입으로 변환

func ConvertKeyValueList

func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error)

Cloud Object를 CB-KeyValue 형식으로 변환이 필요할 경우 이용

func ConvertToString

func ConvertToString(value interface{}) (string, error)

CB-KeyValue 등을 위해 String 타입으로 변환

func DescribeAvailableResource added in v0.6.7

func DescribeAvailableResource(client *ecs.Client, regionId string, zoneId string, resourceType string, destinationResource string, categoryValue string) (ecs.AvailableZonesInDescribeAvailableResource, error)

* 해당 리소스가 사용가능한지 조회

https://help.aliyun.com/document_detail/66186.html?spm=api-workbench.Troubleshoot.0.0.43651e0folUpip#doc-api-Ecs-DescribeAvailableResource
https://next.api.alibabacloud.com/api/Ecs/2014-05-26/DescribeAvailableResource?lang=GO&params={}

필수 parameter

RegionId
DestinationResource : "Zone", "IoOptimized", "InstanceType", "SystemDisk", "DataDisk", "Network", "ddh"

결과 : AvailableZone 값이 들어있음. 배열형태임.

비정상 : requestID만 반환. ex) {"RequestId":"7F2E6252-7FF6-31AF-9067-1EECF1B6B3FA"}
정상 : requestID 외에 Available
	ex) {"RequestId":"7F2E6252-7FF6-31AF-9067-1EECF1B6B3FA","AvailableZones":{"AvailableZone":[{"Status":"Available","StatusCategory":"WithStock","ZoneId":"ap-southeast-1b","AvailableResources":{"AvailableResource":[{"Type":"DataDisk","SupportedResources":{"SupportedResource":[{"Status":"Available","Min":20,"Max":32768,"Value":"cloud_efficiency","Unit":"GiB"}]}}]},"RegionId":"ap-southeast-1"}]}}

func DescribeDiskByDiskId added in v0.6.7

func DescribeDiskByDiskId(client *ecs.Client, regionInfo idrv.RegionInfo, diskIID irs.IID) (ecs.Disk, error)

* DiskID로 1개 Disk의 정보 조회

func DescribeDisks added in v0.6.7

func DescribeDisks(client *ecs.Client, regionInfo idrv.RegionInfo, instanceIID irs.IID, diskIIDs []irs.IID) ([]ecs.Disk, error)

* 디스크 목록 조회

func DescribeDisksByInstanceId added in v0.6.7

func DescribeDisksByInstanceId(client *ecs.Client, regionInfo idrv.RegionInfo, instanceIID irs.IID) ([]ecs.Disk, error)

* InstanceID로 1개 Disk의 정보 조회

func DescribeImageByImageId added in v0.6.8

func DescribeImageByImageId(client *ecs.Client, regionInfo idrv.RegionInfo, imageIID irs.IID, isMyImage bool) (ecs.Image, error)

* ImageID로 1개 Image의 정보 조회

func DescribeImageOsType added in v0.6.16

func DescribeImageOsType(client *ecs.Client, regionInfo idrv.RegionInfo, imageIID irs.IID, isMyImage bool) (string, error)

Image의 OS Type을 string으로 반환

func DescribeImageSize added in v0.6.8

func DescribeImageSize(client *ecs.Client, regionInfo idrv.RegionInfo, myImageIID irs.IID) (int64, error)

* 이미지의 크기 조회

func DescribeImageStatus added in v0.6.8

func DescribeImageStatus(client *ecs.Client, regionInfo idrv.RegionInfo, myImageIID irs.IID, aliImageStatus string) (string, error)

* 이미지의 상태 조회 조회하고 싶은 상태값을 줘야 정상적으로 조회가 됨.(default = available ) 그래서 request 객체에 status를 set하고 DescribeImage를 직접호출함.

func DescribeImages added in v0.6.8

func DescribeImages(client *ecs.Client, regionInfo idrv.RegionInfo, imageIIDs []irs.IID, isMyImage bool) ([]ecs.Image, error)

* Image 목록 조회

imageOwnerAlias 종류 : self, system, others, marketplace myimage 는 imageOwnerAlias = self 로 isMyImage로 구분 향후 system, others, marketplace 등이 추가되면 해당 구분자 변경필요.

func DescribeInstanceById added in v0.6.7

func DescribeInstanceById(client *ecs.Client, regionInfo idrv.RegionInfo, vmIID irs.IID) (ecs.Instance, error)

* 인스턴스 1개만 조회

func DescribeInstances added in v0.6.7

func DescribeInstances(client *ecs.Client, regionInfo idrv.RegionInfo, vmIIDs []irs.IID) ([]ecs.Instance, error)

* Instance 목록 조회

iid를 parameter로 주면 해당 iid들만 조회.

func DescribeRegions added in v0.7.6

func DescribeRegions(client *ecs.Client) (*ecs.DescribeRegionsResponse, error)

func DescribeZonesByRegion added in v0.7.6

func DescribeZonesByRegion(client *ecs.Client, regionId string) (*ecs.DescribeZonesResponse, error)

func ExtractDiskDescribeInfo added in v0.6.7

func ExtractDiskDescribeInfo(aliDisk *ecs.Disk) (irs.DiskInfo, error)

https://pkg.go.dev/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs?tab=doc#Image package ecs v1.61.170 Latest Published: Apr 30, 2020 Image 정보를 추출함

func ExtractImageDescribeInfo

func ExtractImageDescribeInfo(image *ecs.Image) irs.ImageInfo

https://pkg.go.dev/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs?tab=doc#Image package ecs v1.61.170 Latest Published: Apr 30, 2020 Image 정보를 추출함

func ExtractKeyPairDescribeInfo

func ExtractKeyPairDescribeInfo(keyPair *ecs.KeyPair) (irs.KeyPairInfo, error)

2021-10-27 이슈#480에 의해 Local Key 로직 제거 KeyPair 정보를 추출함

func ExtractMyImageDescribeInfo added in v0.6.8

func ExtractMyImageDescribeInfo(aliMyImage *ecs.Image) (irs.MyImageInfo, error)

func ExtractSubnetDescribeInfo

func ExtractSubnetDescribeInfo(subnetInfo vpc.VSwitch) irs.SubnetInfo

Subnet(VSwitch) 정보를 추출함

func ExtractVMSpecInfo

func ExtractVMSpecInfo(Region string, instanceTypeInfo ecs.InstanceType) irs.VMSpecInfo

인스턴스 스펙 정보를 추출함

func ExtractVpcDescribeInfo

func ExtractVpcDescribeInfo(vpcInfo *vpc.Vpc) irs.VPCInfo

VPC 정보를 추출함

func GetCBResourceGroupName

func GetCBResourceGroupName() string

func GetCBSubnetName

func GetCBSubnetName() string

Subnet

func GetCBVirutalNetworkName

func GetCBVirutalNetworkName() string

VPC

func GetCBVnetDefaultCidr

func GetCBVnetDefaultCidr() string

func GetCallLogScheme added in v0.7.3

func GetCallLogScheme(region idrv.RegionInfo, resourceType call.RES_TYPE, resourceName string, apiName string) call.CLOUDLOGSCHEMA

func GetDescribeInstanceTypesForPricing added in v0.8.2

func GetDescribeInstanceTypesForPricing(bssClient *bssopenapi.Client, regionName string, instanceType string, filter map[string]*string, productFamily string) (irs.ProductInfo, error)

region의 특정 instanceType의 내용조회 func GetDescribeInstanceTypesForPricing(bssClient *bssopenapi.Client, instanceType string) (map[string]interface{}, error) {

func GetImageStatus added in v0.6.16

func GetImageStatus(ecsImage ecs.Image) string

Image에서 상태만 추출

func GetOsType added in v0.6.16

func GetOsType(ecsImage ecs.Image) string

Image에서 OSTYPE 만 추출

func GetSnapShotIdList added in v0.6.16

func GetSnapShotIdList(ecsImage ecs.Image) []string

Image에서 SnapShotID 목록 추출

func GetZoneStatus added in v0.7.6

func GetZoneStatus(status string) irs.ZoneStatus

Alibaba에서 Zone에 대한 status는 관리하고 있지 않음

func HasKey added in v0.8.2

func HasKey(key string, keyValueList []irs.KeyValue) bool

irs.KeyValue 배열에서 특정 키를 가진 KeyValue 가 있는지 검사

func InitLog added in v0.7.3

func InitLog()

func LoggingError added in v0.7.3

func LoggingError(hiscallInfo call.CLOUDLOGSCHEMA, err error)

func LoggingInfo added in v0.7.3

func LoggingInfo(hiscallInfo call.CLOUDLOGSCHEMA, start time.Time)

func QueryProductList added in v0.8.2

func QueryProductList(bssClient *bssopenapi.Client) (*bssopenapi.QueryProductListResponse, error)

Alibaba 가용한 모든 서비스 호출

func SetNameTag

func SetNameTag(Client *ecs.Client, resourceId string, resourceType string, value string) bool

func WaitForImageStatus added in v0.6.8

func WaitForImageStatus(client *ecs.Client, regionInfo idrv.RegionInfo, imageIID irs.IID, requestStatus string) (irs.MyImageStatus, error)

* 상태조회 처리 : DescribeImages에서 status값이 필수임. 없는 경우 default available이므로 다른 상태값이 조회되게 하려면 콤마(,)를 구분자로 여러개 넣을 수 있음.

요청시 상태 -> 원하는 상태 또는 실패상태를 Return

Types

type AliData added in v0.8.4

type AliData struct {
	OriginalPrice    float64
	DiscountPrice    float64
	Currency         string `json:"Currency,omitempty"`
	Quantity         int64
	ModuleDetails    AliModuleDetails    `json:"ModuleDetails"`
	PromotionDetails AliPromotionDetails `json:"PromotionDetails"`
	TradePrice       float64
}

Alibaba GetSubscriptionPrice ModuleDetails, PromotionDetails 배열 데이터 존재

type AliInstanceType added in v0.8.4

type AliInstanceType struct {
	InstanceType string  `json:"InstanceTypeId,omitempty"`
	Vcpu         int64   `json:"CpuCoreCount,omitempty"`
	Memory       float64 `json:"MemorySize,omitempty"`
	// Storage      string  `json:"LocalStorageCategory,omitempty"` 잘못된 데이터 맵핑
	Gpu       string `json:"GPUSpec,omitempty"`
	GpuMemory int64  `json:"GPUAmount,omitempty"`
}

type AliInstanceTypes added in v0.8.4

type AliInstanceTypes struct {
	InstanceType []AliInstanceType `json:"InstanceType"`
}

type AliInstanceTypesResponse added in v0.8.4

type AliInstanceTypesResponse struct {
	RequestId     string `json:"RequestId"`
	NextToken     string `json:"NextToken"`
	InstanceTypes struct {
		InstanceType []ecs.InstanceType `json:"InstanceType"`
	} `json:"InstanceTypes"`
}

type AliModuleDetail added in v0.8.4

type AliModuleDetail struct {
	UnitPrice         float64
	ModuleCode        string
	CostAfterDiscount float64
	Price             float64 `json:"OriginalCost"`
	InvoiceDiscount   float64
}

type AliModuleDetails added in v0.8.4

type AliModuleDetails struct {
	ModuleDetail []AliModuleDetail `json:"ModuleDetail"`
}

type AliPriceInfo added in v0.8.4

type AliPriceInfo struct {
	Data AliData `json:"Data"`
	Code string  `json:"Code"`
}

Alibaba GetSubscriptionPrice Response Data 최상위

type AliPromotionDetail added in v0.8.4

type AliPromotionDetail struct {
	PromotionName string `json:"PromotionName,omitempty"`
	PromotionId   int64  `json:"PromotionId,omitempty"`
}

type AliPromotionDetails added in v0.8.4

type AliPromotionDetails struct {
	PromotionDetail []AliPromotionDetail
}

Alibaba ServicePeriodUnit par 값을 Year로 넘길시 프로모션 관련 정보도 리턴을 해줌.

type AliProudctInstanceTypes added in v0.8.4

type AliProudctInstanceTypes struct {
	InstanceTypes AliInstanceTypes `json:"InstanceTypes"`
}

Alibaba DescribeInstanceTypes Response start

type AlibabaCBNetworkInfo

type AlibabaCBNetworkInfo struct {
	VpcName   string
	VpcId     string
	CidrBlock string
	IsDefault bool
	State     string

	SubnetName string
	SubnetId   string
}

type AlibabaClusterHandler added in v0.6.9

type AlibabaClusterHandler struct {
	RegionInfo     idrv.RegionInfo
	CredentialInfo idrv.CredentialInfo
	VpcClient      *vpc2016.Client
	CsClient       *cs2015.Client
	EcsClient      *ecs2014.Client
}

func (*AlibabaClusterHandler) AddNodeGroup added in v0.6.9

func (ach *AlibabaClusterHandler) AddNodeGroup(clusterIID irs.IID, nodeGroupReqInfo irs.NodeGroupInfo) (irs.NodeGroupInfo, error)

func (*AlibabaClusterHandler) ChangeNodeGroupScaling added in v0.6.9

func (ach *AlibabaClusterHandler) ChangeNodeGroupScaling(clusterIID irs.IID, nodeGroupIID irs.IID, desiredNodeSize int, minNodeSize int, maxNodeSize int) (irs.NodeGroupInfo, error)

func (*AlibabaClusterHandler) CreateCluster added in v0.6.9

func (ach *AlibabaClusterHandler) CreateCluster(clusterReqInfo irs.ClusterInfo) (irs.ClusterInfo, error)

func (*AlibabaClusterHandler) DeleteCluster added in v0.6.9

func (ach *AlibabaClusterHandler) DeleteCluster(clusterIID irs.IID) (bool, error)

func (*AlibabaClusterHandler) GetCluster added in v0.6.9

func (ach *AlibabaClusterHandler) GetCluster(clusterIID irs.IID) (irs.ClusterInfo, error)

func (*AlibabaClusterHandler) ListCluster added in v0.6.9

func (ach *AlibabaClusterHandler) ListCluster() ([]*irs.ClusterInfo, error)

func (*AlibabaClusterHandler) RemoveNodeGroup added in v0.6.9

func (ach *AlibabaClusterHandler) RemoveNodeGroup(clusterIID irs.IID, nodeGroupIID irs.IID) (bool, error)

func (*AlibabaClusterHandler) SetNodeGroupAutoScaling added in v0.6.9

func (ach *AlibabaClusterHandler) SetNodeGroupAutoScaling(clusterIID irs.IID, nodeGroupIID irs.IID, on bool) (bool, error)

func (*AlibabaClusterHandler) UpgradeCluster added in v0.6.9

func (ach *AlibabaClusterHandler) UpgradeCluster(clusterIID irs.IID, newVersion string) (irs.ClusterInfo, error)

type AlibabaDiskHandler added in v0.6.7

type AlibabaDiskHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaDiskHandler) AttachDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) AttachDisk(diskIID irs.IID, ownerVM irs.IID) (irs.DiskInfo, error)

func (*AlibabaDiskHandler) ChangeDiskSize added in v0.6.7

func (diskHandler *AlibabaDiskHandler) ChangeDiskSize(diskIID irs.IID, size string) (bool, error)

func (*AlibabaDiskHandler) CreateDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) CreateDisk(diskReqInfo irs.DiskInfo) (irs.DiskInfo, error)

* create 시 특정 instance에 바로 attach 가능하나 CB-SPIDER에서는 사용하지 않음

func (*AlibabaDiskHandler) DeleteDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) DeleteDisk(diskIID irs.IID) (bool, error)

func (*AlibabaDiskHandler) DetachDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) DetachDisk(diskIID irs.IID, ownerVM irs.IID) (bool, error)

* The disk must be attached to an ECS instance and in the In Use (In_Use) state. The instance from which you want to detach the data disk must be in the Running (Running) or Stopped (Stopped) state. The instance from which you want to detach the system disk must be in the Stopped (Stopped) state. If OperationLocks in the response contains "LockReason" : "security" when you query information of an instance, the instance is locked for security reasons and all operations cannot take effect on the instance. DetachDisk is an asynchronous operation. It takes about 1 minute for a disk to be detached from an instance after the operation is called.

func (*AlibabaDiskHandler) GetDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) GetDisk(diskIID irs.IID) (irs.DiskInfo, error)

func (*AlibabaDiskHandler) ListDisk added in v0.6.7

func (diskHandler *AlibabaDiskHandler) ListDisk() ([]*irs.DiskInfo, error)

* Root-Disk, Data-Disk 구분 없이 모든 Disk 목록을 제공한다.

type AlibabaImageHandler

type AlibabaImageHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaImageHandler) CheckWindowsImage added in v0.6.15

func (imageHandler *AlibabaImageHandler) CheckWindowsImage(imageIID irs.IID) (bool, error)

WindowOS 여부

func (*AlibabaImageHandler) CreateImage

func (imageHandler *AlibabaImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)

func (*AlibabaImageHandler) DeleteImage

func (imageHandler *AlibabaImageHandler) DeleteImage(imageIID irs.IID) (bool, error)

func (*AlibabaImageHandler) GetImage

func (imageHandler *AlibabaImageHandler) GetImage(imageIID irs.IID) (irs.ImageInfo, error)

func (*AlibabaImageHandler) ListImage

func (imageHandler *AlibabaImageHandler) ListImage() ([]*irs.ImageInfo, error)

type AlibabaKeyPairHandler

type AlibabaKeyPairHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaKeyPairHandler) CheckKeyPairFolder added in v0.3.8

func (keyPairHandler *AlibabaKeyPairHandler) CheckKeyPairFolder(keyPairPath string) error

================================= 공개 키 변환 및 키 정보 로컬 보관 로직 추가 =================================

func (*AlibabaKeyPairHandler) CreateKey

func (keyPairHandler *AlibabaKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)

2021-10-27 이슈#480에 의해 Local Key 로직 제거

func (*AlibabaKeyPairHandler) DeleteKey

func (keyPairHandler *AlibabaKeyPairHandler) DeleteKey(keyIID irs.IID) (bool, error)

2021-10-27 이슈#480에 의해 Local Key 로직 제거

func (*AlibabaKeyPairHandler) GetKey

func (keyPairHandler *AlibabaKeyPairHandler) GetKey(keyIID irs.IID) (irs.KeyPairInfo, error)

2021-10-27 이슈#480에 의해 Local Key 로직 제거 혼선을 피하기 위해 keyPairID 대신 keyPairName으로 변경 함.

func (*AlibabaKeyPairHandler) ListKey

func (keyPairHandler *AlibabaKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)

type AlibabaMyImageHandler added in v0.6.8

type AlibabaMyImageHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (AlibabaMyImageHandler) CheckWindowsImage added in v0.6.15

func (myImageHandler AlibabaMyImageHandler) CheckWindowsImage(myImageIID irs.IID) (bool, error)

MyImage 의 window 여부 return

func (AlibabaMyImageHandler) DeleteMyImage added in v0.6.8

func (myImageHandler AlibabaMyImageHandler) DeleteMyImage(myImageIID irs.IID) (bool, error)

MyImage 삭제 Image 삭제 후 Snapshot 삭제 가능 : - A snapshot that has been used to create custom images cannot be deleted. The snapshot can be deleted only after the created custom images are deleted Image를 Instance가 사용중이면 삭제 불가. image로 작업중이면 삭제 불가 A custom image cannot be deleted in the following scenarios:

The image is being imported. You can go to the Task Logs page in the Elastic Compute Service (ECS) console to cancel the image import task. After the image import task is canceled, you can delete the image. For more information, see Import custom images.
The image is being exported. You can go to the Task Logs page in the ECS console to cancel the image export task. After the image export task is canceled, you can delete the image. For more information, see Export a custom image.
The image is being used by ECS instances

func (*AlibabaMyImageHandler) DeleteSnapshotBySnapshotID added in v0.6.16

func (myImageHandler *AlibabaMyImageHandler) DeleteSnapshotBySnapshotID(snapshotIID irs.IID) (bool, error)

MyImage에 대한 snap 삭제 If the specified snapshot ID does not exist, the request is ignored. A snapshot that has been used to create custom images cannot be deleted. The snapshot can be deleted only after the created custom images are deleted

func (AlibabaMyImageHandler) GetMyImage added in v0.6.8

func (myImageHandler AlibabaMyImageHandler) GetMyImage(myImageIID irs.IID) (irs.MyImageInfo, error)

func (AlibabaMyImageHandler) ListMyImage added in v0.6.8

func (myImageHandler AlibabaMyImageHandler) ListMyImage() ([]*irs.MyImageInfo, error)

* owner=self인 Image목록 조회 공통으로 DescribeImages를 사용하기 때문에 구분으로 isMyImage = true 로 전송 필요

func (AlibabaMyImageHandler) SnapshotVM added in v0.6.8

func (myImageHandler AlibabaMyImageHandler) SnapshotVM(snapshotReqInfo irs.MyImageInfo) (irs.MyImageInfo, error)

type AlibabaNLBBackendServer added in v0.6.1

type AlibabaNLBBackendServer struct {
	ServerId    string
	Port        int
	Weight      int
	Description string
	Type        string
	ServerIp    string
}

type AlibabaNLBHandler added in v0.6.1

type AlibabaNLBHandler struct {
	Region idrv.RegionInfo
	//Client *ecs.Client
	Client    *slb.Client
	VMClient  *ecs.Client
	VpcClient *vpc.Client
}

func (*AlibabaNLBHandler) AddLoadBalancerListener added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) AddLoadBalancerListener(nlbIID irs.IID, nlbReqInfo irs.NLBInfo) (irs.ListenerInfo, error)

////////

//리스너는 Client의 요청 및 입력 스트림을 수신하여 백엔드 영역의 VM그룹으로 전달한다. // 하나의 NLB는 하나의 리스너를 포함하며, 수신 프로토콜, IP 및 수신 포트로 구성된다. // 선택 가능한 수신 프로토콜은 TCP 및 UDP이며, IP는 CSP 또는 대상 Driver에서 자동 생성 및 관리된다. // 수신 포트는 1-65535 범위의 값으로 설정이 가능하다. //※ 리스너 IP에 매핑 되는 DNS-Name 지원: 추후 고려 //https://www.alibabacloud.com/help/en/server-load-balancer/latest/createloadbalancertcplistener

Newly created listeners are in the stopped state. After a listener is created, you must call the StartLoadBalancerListener operation to start the listener. This way, the listener can forward network traffic.

리스너를 생성하면 중단 상태임. startListener 호출하여 동작시켜야 함

func (*AlibabaNLBHandler) AddVMs added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs.VMGroupInfo, error)

loadBalancer에 VM추가 vm만 추가

func (*AlibabaNLBHandler) ChangeHealthCheckerInfo added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, healthChecker irs.HealthCheckerInfo) (irs.HealthCheckerInfo, error)

HealthChecker 의 정보가 실제로는 listener에 들어있음. 따라서 nblId, port 에 해당하는 listener를 찾고 nlbInfo에 모든정보를 set(lb ID, listener protocol,port, healthchecker info)하여 healthchecker정보를 수정

func (*AlibabaNLBHandler) ChangeListener added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) ChangeListener(nlbIID irs.IID, listener irs.ListenerInfo) (irs.ListenerInfo, error)

Spider에서 원하는 listener의 변경은 protocol, ip, port 의 변경아나 ALIBABA에서는 listener의 key 가 loadbalancerId, port 이므로 실제로 변경할 수 있는 parameter가 없음.

수정 가능한 항목은 healthcheck 부분으로 현재버전에서는 error로 return 향후 필요시 삭제 후 추가 하는 방법 고려.

func (*AlibabaNLBHandler) ChangeVMGroupInfo added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) ChangeVMGroupInfo(nlbIID irs.IID, vmGroup irs.VMGroupInfo) (irs.VMGroupInfo, error)

------ Backend Control

func (*AlibabaNLBHandler) CreateNLB added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, error)

https://www.alibabacloud.com/help/en/server-load-balancer/latest/createloadbalancer-2

같은이름의 NLB생성가능. ID가 다름.

func (*AlibabaNLBHandler) DeleteNLB added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) DeleteNLB(nlbIID irs.IID) (bool, error)

NLB 삭제 After you delete an SLB instance, the listeners and tags added to the SLB instance are deleted.

func (*AlibabaNLBHandler) GetNLB added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) GetNLB(nlbIID irs.IID) (irs.NLBInfo, error)

func (*AlibabaNLBHandler) GetVMGroupHealthInfo added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) GetVMGroupHealthInfo(nlbIID irs.IID) (irs.HealthInfo, error)

func (*AlibabaNLBHandler) ListNLB added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) ListNLB() ([]*irs.NLBInfo, error)

Load balancer 전체 목록 보기

func (*AlibabaNLBHandler) RemoveVMs added in v0.6.1

func (NLBHandler *AlibabaNLBHandler) RemoveVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (bool, error)

loadBalancer에 VM제거 vm만 제거

type AlibabaPriceInfoHandler added in v0.8.2

type AlibabaPriceInfoHandler struct {
	BssClient *bssopenapi.Client
}

func (*AlibabaPriceInfoHandler) GetPriceInfo added in v0.8.2

func (priceInfoHandler *AlibabaPriceInfoHandler) GetPriceInfo(productFamily string, regionName string, filterList []irs.KeyValue) (string, error)

func (*AlibabaPriceInfoHandler) ListProductFamily added in v0.8.2

func (priceInfoHandler *AlibabaPriceInfoHandler) ListProductFamily(regionName string) ([]string, error)

type AlibabaRegionZoneHandler added in v0.7.6

type AlibabaRegionZoneHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (AlibabaRegionZoneHandler) GetRegionZone added in v0.7.6

func (regionZoneHandler AlibabaRegionZoneHandler) GetRegionZone(reqRegionId string) (irs.RegionZoneInfo, error)

특정 Region에 대한 정보 조회.

func (AlibabaRegionZoneHandler) ListOrgRegion added in v0.7.6

func (regionZoneHandler AlibabaRegionZoneHandler) ListOrgRegion() (string, error)

모든 Region 정보 조회(json return)

func (AlibabaRegionZoneHandler) ListOrgZone added in v0.7.6

func (regionZoneHandler AlibabaRegionZoneHandler) ListOrgZone() (string, error)

모든 Zone 정보 조회(json return) Region에 따라 zone 정보가 달려있으므로 region 조회 후 -> zone 정보 조회

func (AlibabaRegionZoneHandler) ListRegionZone added in v0.7.6

func (regionZoneHandler AlibabaRegionZoneHandler) ListRegionZone() ([]*irs.RegionZoneInfo, error)

모든 Region 및 Zone 정보 조회

type AlibabaSecurityHandler

type AlibabaSecurityHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaSecurityHandler) AddRules added in v0.5.4

func (securityHandler *AlibabaSecurityHandler) AddRules(securityIID irs.IID, reqSecurityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)

SecurityGroup에 Rule 추가 공통 함수명은 AddRules 이나 실제 Alibaba는 AuthorizeSecurityRules SecurityGroup 생성시에도 호출 저장 후 rule 목록 조회하여 return

  • vpcId deprecated
  • function name 변경 : AuthorizeSecurityRules to AddRules

func (securityHandler *AlibabaSecurityHandler) AuthorizeSecurityRules(securityGroupId string, vpcId string, securityRuleInfos *[]irs.SecurityRuleInfo) (*[]irs.SecurityRuleInfo, error) { func (securityHandler *AlibabaSecurityHandler) AuthorizeSecurityRules(securityGroupId string, securityRuleInfos *[]irs.SecurityRuleInfo) (*[]irs.SecurityRuleInfo, error) {

func (*AlibabaSecurityHandler) CreateSecurity

func (securityHandler *AlibabaSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)

func (*AlibabaSecurityHandler) DeleteSecurity

func (securityHandler *AlibabaSecurityHandler) DeleteSecurity(securityIID irs.IID) (bool, error)

func (*AlibabaSecurityHandler) ExtractSecurityInfo added in v0.1.4

func (securityHandler *AlibabaSecurityHandler) ExtractSecurityInfo(securityGroupResult *ecs.SecurityGroup) (irs.SecurityInfo, error)

func (*AlibabaSecurityHandler) ExtractSecurityRuleInfo added in v0.1.4

func (securityHandler *AlibabaSecurityHandler) ExtractSecurityRuleInfo(securityGroupId string) ([]irs.SecurityRuleInfo, error)

보안 그룹의 InBound / OutBound 정보를 조회함.

func (*AlibabaSecurityHandler) GetSecurity

func (securityHandler *AlibabaSecurityHandler) GetSecurity(securityIID irs.IID) (irs.SecurityInfo, error)

func (*AlibabaSecurityHandler) ListSecurity

func (securityHandler *AlibabaSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)

func (*AlibabaSecurityHandler) RemoveRules added in v0.5.4

func (securityHandler *AlibabaSecurityHandler) RemoveRules(securityIID irs.IID, reqSecurityRules *[]irs.SecurityRuleInfo) (bool, error)

If the security group rule to be deleted does not exist, the RevokeSecurityGroup operation succeeds but no rule is deleted. func (securityHandler *AlibabaSecurityHandler) RevokeSecurityRules(securityGroupId string, securityRuleInfos *[]irs.SecurityRuleInfo) (*[]irs.SecurityRuleInfo, error) {

type AlibabaVMHandler

type AlibabaVMHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaVMHandler) ConvertVMStatusString added in v0.1.4

func (vmHandler *AlibabaVMHandler) ConvertVMStatusString(vmStatus string) (irs.VMStatus, error)

알리 클라우드 라이프 사이클 : https://www.alibabacloud.com/help/doc-detail/25380.htm

const (

Creating VMStatus = “Creating" // from launch to running
Running VMStatus = “Running"
Suspending VMStatus = “Suspending" // from running to suspended
Suspended  VMStatus = “Suspended"
Resuming VMStatus = “Resuming" // from suspended to running
Rebooting VMStatus = “Rebooting" // from running to running
Terminating VMStatus = “Terminating" // from running, suspended to terminated
Terminated  VMStatus = “Terminated“
NotExist  VMStatus = “NotExist“  // VM does not exist
Failed  VMStatus = “Failed“

) <최종 상태> Running(동작 상태): MCIS가 동작 상태 Suspended(중지 상태): MCIS가 중지된 상태 Failed(실패 상태): MCIS가 오류로 인해 중단된 상태 Terminated(종료 상태): MCIS가 종료된 상태 <전이 상태> Creating(생성 진행 상태): MCIS가 생성되는 중간 상태 Suspending(중지 진행 상태): MCIS를 일시 중지하기 위한 중간 상태 Resuming(재개 진행 상태): MCIS를 다시 실행하기 위한 중간 상태 Rebooting(재시작 진행 상태): MCIS를 재부팅하는 상태 Terminating(종료 진행 상태): MCIS의 종료를 실행하고 있는 중간 상태

func (*AlibabaVMHandler) ExtractDescribeInstances added in v0.1.4

func (vmHandler *AlibabaVMHandler) ExtractDescribeInstances(instanceInfo *ecs.Instance) (irs.VMInfo, error)

@TODO : 2020-03-26 Ali클라우드 API 구조가 바뀐 것 같아서 임시로 변경해 놓음. func (vmHandler *AlibabaVMHandler) ExtractDescribeInstances() irs.VMInfo {

func (*AlibabaVMHandler) GetImageSize added in v0.5.4

func (vmHandler *AlibabaVMHandler) GetImageSize(ImageSystemId string) (int64, error)

주어진 이미지 id에 대한 이미지 사이즈 조회 -1 : 정보 조회 실패 deprecated

func (*AlibabaVMHandler) GetVM

func (vmHandler *AlibabaVMHandler) GetVM(vmIID irs.IID) (irs.VMInfo, error)

func (*AlibabaVMHandler) GetVMStatus

func (vmHandler *AlibabaVMHandler) GetVMStatus(vmIID irs.IID) (irs.VMStatus, error)

SHUTTING-DOWN / TERMINATED

func (*AlibabaVMHandler) ListVM

func (vmHandler *AlibabaVMHandler) ListVM() ([]*irs.VMInfo, error)

func (*AlibabaVMHandler) ListVMStatus

func (vmHandler *AlibabaVMHandler) ListVMStatus() ([]*irs.VMStatusInfo, error)

func (*AlibabaVMHandler) RebootVM

func (vmHandler *AlibabaVMHandler) RebootVM(vmIID irs.IID) (irs.VMStatus, error)

func (*AlibabaVMHandler) ResumeVM

func (vmHandler *AlibabaVMHandler) ResumeVM(vmIID irs.IID) (irs.VMStatus, error)

func (*AlibabaVMHandler) StartVM

func (vmHandler *AlibabaVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, error)

참고 : VM 생성 시 인증 방식은 KeyPair 또는 ID&PWD 방식이 가능하지만 계정은 모두 root - 비번 조회 기능은 없음

비밀번호는 8-30자로서 대문자, 소문자, 숫자 및/또는 특수 문자가 포함되어야 합니다.

@TODO : root 계정의 비번만 설정 가능한 데 다른 계정이 요청되었을 경우 예외 처리할 것인지.. 아니면 비번을 설정할 것인지 확인 필요. @TODO : PublicIp 요금제 방식과 대역폭 설정 방법 논의 필요

func (*AlibabaVMHandler) SuspendVM

func (vmHandler *AlibabaVMHandler) SuspendVM(vmIID irs.IID) (irs.VMStatus, error)

@TODO - 이슈 : 인스턴스 일시정지 시에 과금 정책을 결정해야 함 - StopCharging / KeepCharging

func (*AlibabaVMHandler) TerminateVM

func (vmHandler *AlibabaVMHandler) TerminateVM(vmIID irs.IID) (irs.VMStatus, error)

func (*AlibabaVMHandler) WaitForExist added in v0.3.14

func (vmHandler *AlibabaVMHandler) WaitForExist(vmIID irs.IID) (irs.VMStatus, error)

VM 상태가 정보를 조회할 수 있는 상태가 될때까지 기다림(최대 30초간 대기)

func (*AlibabaVMHandler) WaitForRun added in v0.1.4

func (vmHandler *AlibabaVMHandler) WaitForRun(vmIID irs.IID) (irs.VMStatus, error)

VM 정보를 조회할 수 있을 때까지 최대 30초간 대기

type AlibabaVPCHandler added in v0.1.4

type AlibabaVPCHandler struct {
	Region idrv.RegionInfo
	Client *vpc.Client
}

func (*AlibabaVPCHandler) AddSubnet added in v0.2.1

func (VPCHandler *AlibabaVPCHandler) AddSubnet(vpcIID irs.IID, subnetInfo irs.SubnetInfo) (irs.VPCInfo, error)

func (*AlibabaVPCHandler) CreateSubnet added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) CreateSubnet(vpcId string, reqSubnetInfo irs.SubnetInfo) (irs.SubnetInfo, error)

func (*AlibabaVPCHandler) CreateVPC added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) CreateVPC(vpcReqInfo irs.VPCReqInfo) (irs.VPCInfo, error)

func (*AlibabaVPCHandler) DeleteSubnet added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) DeleteSubnet(subnetIID irs.IID) (bool, error)

func (*AlibabaVPCHandler) DeleteVPC added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) DeleteVPC(vpcIID irs.IID) (bool, error)

@TODO : 라우트 삭제 로직이 없어서 VPC가 삭제 안되는 현상이 있어서 라우트 정보를 조회해서 삭제하려다 서브넷 삭제 후 특정 시간 이후에 Route가 자동으로 삭제되기 때문에 임시로 4초 대기 후 VPC를 삭제하도록 로직을 변경함. @TODO : VPCHandler로 생성하지 않은 VPC의 경우 다른 서비스가 있을 수 있기 때문에 관련 서비스들을 조회후 삭제하는 로직이 필요할 수 있음.

  • 삭제 오류 자동 할당된 Route가 남아있어서 삭제가 안되는 듯. ErrorCode: Forbbiden Recommend: RequestId: 8871BF19-330B-4F00-93ED-D886F2CE066F Message: Active custom route in vpc.)

func (*AlibabaVPCHandler) GetSubnet added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) GetSubnet(reqSubnetId string) (irs.SubnetInfo, error)

func (*AlibabaVPCHandler) GetVPC added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) GetVPC(vpcIID irs.IID) (irs.VPCInfo, error)

func (*AlibabaVPCHandler) ListVPC added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) ListVPC() ([]*irs.VPCInfo, error)

func (*AlibabaVPCHandler) RemoveSubnet added in v0.2.1

func (VPCHandler *AlibabaVPCHandler) RemoveSubnet(vpcIID irs.IID, subnetIID irs.IID) (bool, error)

func (*AlibabaVPCHandler) WaitForRun added in v0.1.4

func (VPCHandler *AlibabaVPCHandler) WaitForRun(vpcId string) error

Pending , Available

type AlibabaVmSpecHandler

type AlibabaVmSpecHandler struct {
	Region idrv.RegionInfo
	Client *ecs.Client
}

func (*AlibabaVmSpecHandler) GetOrgVMSpec

func (vmSpecHandler *AlibabaVmSpecHandler) GetOrgVMSpec(Name string) (string, error)

func (*AlibabaVmSpecHandler) GetVMSpec

func (vmSpecHandler *AlibabaVmSpecHandler) GetVMSpec(Name string) (irs.VMSpecInfo, error)

func (*AlibabaVmSpecHandler) ListOrgVMSpec

func (vmSpecHandler *AlibabaVmSpecHandler) ListOrgVMSpec() (string, error)

Alibaba Cloud의 정보 그대로를 가공 없이 JSON으로 리턴 함.

func (*AlibabaVmSpecHandler) ListVMSpec

func (vmSpecHandler *AlibabaVmSpecHandler) ListVMSpec() ([]*irs.VMSpecInfo, error)

type DiskSize added in v0.6.7

type DiskSize struct {
	// contains filtered or unexported fields
}

type RuleAction added in v0.5.5

type RuleAction string
const (
	Add    RuleAction = "Add"
	Remove RuleAction = "Remove"
)

Jump to

Keyboard shortcuts

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