Documentation ¶
Overview ¶
Proof of Concepts for the Cloud-Barista Multi-Cloud Project.
- Cloud-Barista: https://github.com/cloud-barista
EC2 Hander (AWS SDK GO Version 1.16.26, Thanks AWS.)
by CB-Spider Team, 2019.03.
Index ¶
- Constants
- func Connect(region string) *ec2.EC2
- func ConvertJsonString(v interface{}) (string, error)
- func ConvertJsonStringNoEscape(v interface{}) (string, error)
- func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error)
- func ConvertToString(value interface{}) (string, error)
- func ConvertVMStatusString(vmStatus string) (irs.VMStatus, error)
- func CreateHashString(credentialInfo idrv.CredentialInfo, Region idrv.RegionInfo) (string, error)
- func ExtractGpuInfo(gpuDeviceInfo *ec2.GpuDeviceInfo) irs.GpuInfo
- func ExtractImageDescribeInfo(image *ec2.Image) irs.ImageInfo
- func ExtractIpPermissionCommon(ip *ec2.IpPermission, securityRuleInfo *irs.SecurityRuleInfo)
- func ExtractIpPermissions(ipPermissions []*ec2.IpPermission, direction string) []irs.SecurityRuleInfo
- func ExtractKeyPairDescribeInfo(keyPair *ec2.KeyPairInfo) (irs.KeyPairInfo, error)
- func ExtractSecurityInfo(securityGroupResult *ec2.SecurityGroup) irs.SecurityInfo
- func ExtractSubnetDescribeInfo(subnetInfo *ec2.Subnet) irs.SubnetInfo
- func ExtractVMSpecInfo(Region string, instanceTypeInfo *ec2.InstanceTypeInfo) irs.VMSpecInfo
- func ExtractVmName(Tags []*ec2.Tag) string
- func ExtractVpcDescribeInfo(vpcInfo *ec2.Vpc) irs.VPCInfo
- func GetCBDefaultCidrBlock() string
- func GetCBDefaultSubnetName() string
- func GetCBDefaultVNetName() string
- func JSONMarshal(t interface{}) ([]byte, error)
- func SetNameTag(Client *ec2.EC2, Id string, value string) bool
- func WaitForRun(svc *ec2.EC2, instanceID string)
- type AwsCBNetworkInfo
- type AwsImageHandler
- func (imageHandler *AwsImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)
- func (imageHandler *AwsImageHandler) DeleteImage(imageIID irs.IID) (bool, error)
- func (imageHandler *AwsImageHandler) GetImage(imageIID irs.IID) (irs.ImageInfo, error)
- func (imageHandler *AwsImageHandler) ListImage() ([]*irs.ImageInfo, error)
- type AwsKeyPairHandler
- func (keyPairHandler *AwsKeyPairHandler) CheckKeyPairFolder(keyPairPath string) error
- func (keyPairHandler *AwsKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)
- func (keyPairHandler *AwsKeyPairHandler) DeleteKey(keyIID irs.IID) (bool, error)
- func (keyPairHandler *AwsKeyPairHandler) GetKey(keyIID irs.IID) (irs.KeyPairInfo, error)
- func (keyPairHandler *AwsKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)
- type AwsNLBHandler
- func (NLBHandler *AwsNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs.VMGroupInfo, error)
- func (NLBHandler *AwsNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, healthChecker irs.HealthCheckerInfo) (irs.HealthCheckerInfo, error)
- func (NLBHandler *AwsNLBHandler) ChangeListener(nlbIID irs.IID, listener irs.ListenerInfo) (irs.ListenerInfo, error)
- func (NLBHandler *AwsNLBHandler) ChangeVMGroupInfo(nlbIID irs.IID, vmGroup irs.VMGroupInfo) (irs.VMGroupInfo, error)
- func (NLBHandler *AwsNLBHandler) CheckCreateValidation(nlbReqInfo irs.NLBInfo) error
- func (NLBHandler *AwsNLBHandler) CheckHealthCheckerValidation(reqHealthCheckerInfo irs.HealthCheckerInfo) error
- func (NLBHandler *AwsNLBHandler) CreateListener(nlbReqInfo irs.NLBInfo) (*elbv2.CreateListenerOutput, error)
- func (NLBHandler *AwsNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, error)
- func (NLBHandler *AwsNLBHandler) CreateTargetGroup(nlbReqInfo irs.NLBInfo) (*elbv2.CreateTargetGroupOutput, error)
- func (NLBHandler *AwsNLBHandler) DeleteListener(listenerArn *string) (bool, error)
- func (NLBHandler *AwsNLBHandler) DeleteNLB(nlbIID irs.IID) (bool, error)
- func (NLBHandler *AwsNLBHandler) DeleteTargetGroup(targetGroupArn *string) (bool, error)
- func (NLBHandler *AwsNLBHandler) ExtractHealthCheckerInfo(targetGroupArn string) ([]*elbv2.TargetHealthDescription, error)
- func (NLBHandler *AwsNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.ListenerInfo, error)
- func (NLBHandler *AwsNLBHandler) ExtractNLBInfo(nlbResInfo *elbv2.LoadBalancer) (irs.NLBInfo, error)
- func (NLBHandler *AwsNLBHandler) ExtractNlbSubnets(vpcId string) ([]*string, error)
- func (NLBHandler *AwsNLBHandler) ExtractVMGroupHealthInfo(targetGroupArn string) (irs.HealthInfo, error)
- func (NLBHandler *AwsNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (TargetGroupInfo, error)
- func (NLBHandler *AwsNLBHandler) ExtractVmSubnets(VMs *[]irs.IID) ([]*string, error)
- func (NLBHandler *AwsNLBHandler) GetNLB(nlbIID irs.IID) (irs.NLBInfo, error)
- func (NLBHandler *AwsNLBHandler) GetVMGroupHealthInfo(nlbIID irs.IID) (irs.HealthInfo, error)
- func (NLBHandler *AwsNLBHandler) IsExistNLB(nlbName string) (bool, error)
- func (NLBHandler *AwsNLBHandler) ListNLB() ([]*irs.NLBInfo, error)
- func (NLBHandler *AwsNLBHandler) RemoveVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (bool, error)
- type AwsSecurityHandler
- func (securityHandler *AwsSecurityHandler) AddRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) DeleteSecurity(securityIID irs.IID) (bool, error)
- func (securityHandler *AwsSecurityHandler) GetSecurity(securityIID irs.IID) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) ProcessAddRules(newGroupId *string, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) ProcessRemoveRules(newGroupId *string, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) RemoveRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (bool, error)
- type AwsVMHandler
- func (vmHandler *AwsVMHandler) AssociatePublicIP(allocationId string, instanceId string) (bool, error)
- func (vmHandler *AwsVMHandler) AttachNetworkInterface(vNicId string, instanceId string) (bool, error)
- func (vmHandler *AwsVMHandler) ExtractDescribeInstances(reservation *ec2.Reservation) irs.VMInfo
- func (vmHandler *AwsVMHandler) GetDiskInfo(ImageSystemId string) (int64, error)
- func (vmHandler *AwsVMHandler) GetVM(vmIID irs.IID) (irs.VMInfo, error)
- func (vmHandler *AwsVMHandler) GetVMStatus(vmIID irs.IID) (irs.VMStatus, error)
- func (vmHandler *AwsVMHandler) GetVolumInfo(volumeId string) (*ec2.Volume, error)
- func (vmHandler *AwsVMHandler) ListVM() ([]*irs.VMInfo, error)
- func (vmHandler *AwsVMHandler) ListVMStatus() ([]*irs.VMStatusInfo, error)
- func (vmHandler *AwsVMHandler) RebootVM(vmIID irs.IID) (irs.VMStatus, error)
- func (vmHandler *AwsVMHandler) ResumeVM(vmIID irs.IID) (irs.VMStatus, error)
- func (vmHandler *AwsVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, error)
- func (vmHandler *AwsVMHandler) SuspendVM(vmIID irs.IID) (irs.VMStatus, error)
- func (vmHandler *AwsVMHandler) TerminateVM(vmIID irs.IID) (irs.VMStatus, error)
- type AwsVPCHandler
- func (VPCHandler *AwsVPCHandler) AddSubnet(vpcIID irs.IID, subnetInfo irs.SubnetInfo) (irs.VPCInfo, error)
- func (VPCHandler *AwsVPCHandler) AssociateRouteTable(vpcId string, subnetId string) error
- func (VPCHandler *AwsVPCHandler) CreateRouteIGW(vpcId string, igwId string) error
- func (VPCHandler *AwsVPCHandler) CreateSubnet(vpcId string, reqSubnetInfo irs.SubnetInfo) (irs.SubnetInfo, error)
- func (VPCHandler *AwsVPCHandler) CreateVPC(vpcReqInfo irs.VPCReqInfo) (irs.VPCInfo, error)
- func (VPCHandler *AwsVPCHandler) DeleteAllIGW(vpcId string) error
- func (VPCHandler *AwsVPCHandler) DeleteIGW(igwId string) error
- func (VPCHandler *AwsVPCHandler) DeleteRouteIGW(vpcId string) error
- func (VPCHandler *AwsVPCHandler) DeleteSubnet(subnetIID irs.IID) (bool, error)
- func (VPCHandler *AwsVPCHandler) DeleteVPC(vpcIID irs.IID) (bool, error)
- func (VPCHandler *AwsVPCHandler) DetachInternetGateway(vpcId string, igwId string) error
- func (VPCHandler *AwsVPCHandler) GetDefaultRouteTable(vpcId string) (string, error)
- func (VPCHandler *AwsVPCHandler) GetSubnet(reqSubnetId string) (irs.SubnetInfo, error)
- func (VPCHandler *AwsVPCHandler) GetVPC(vpcIID irs.IID) (irs.VPCInfo, error)
- func (VPCHandler *AwsVPCHandler) ListSubnet(vpcId string) ([]irs.SubnetInfo, error)
- func (VPCHandler *AwsVPCHandler) ListVPC() ([]*irs.VPCInfo, error)
- func (VPCHandler *AwsVPCHandler) RemoveSubnet(vpcIID irs.IID, subnetIID irs.IID) (bool, error)
- type AwsVmSpecHandler
- func (vmSpecHandler *AwsVmSpecHandler) GetOrgVMSpec(Name string) (string, error)
- func (vmSpecHandler *AwsVmSpecHandler) GetVMSpec(Name string) (irs.VMSpecInfo, error)
- func (vmSpecHandler *AwsVmSpecHandler) ListOrgVMSpec() (string, error)
- func (vmSpecHandler *AwsVmSpecHandler) ListOrgVMSpecOld() (string, error)
- func (vmSpecHandler *AwsVmSpecHandler) ListVMSpec() ([]*irs.VMSpecInfo, error)
- func (vmSpecHandler *AwsVmSpecHandler) ListVMSpecAZ(ZoneName string) (map[string]string, error)
- type TargetGroupInfo
Constants ¶
const CBCloudInitFilePath string = "/cloud-driver-libs/.cloud-init-common/cloud-init"
const CBCloudInitFilePath string = "/cloud-driver-libs/.cloud-init-aws/cloud-init"
const CBDefaultCidrBlock string = "192.168.0.0/16" // CB Default CidrBlock
const CBDefaultSubnetName string = "CB-VNet-Subnet" // CB Default Subnet Name
const CBDefaultVNetName string = "CB-VNet" // CB Default Virtual Network Name
const CBDefaultVmUserName string = "cb-user" // default VM User Name
const CUSTOM_ERR_CODE_BAD_REQUEST string = "400" //awserr.New("400", "요청 정보가 잘 못 되었습니다.", nil)
const CUSTOM_ERR_CODE_METHOD_NOT_ALLOWED string = "405" //awserr.New("405", "지원되지 않는 기능입니다.", nil)
const CUSTOM_ERR_CODE_NOTFOUND string = "404" //awserr.New("404", "XXX 정보가 존재하지 않습니다.", nil)
const CUSTOM_ERR_CODE_NOT_IMPLEMENTED string = "501" //awserr.New("501", "기능이 구현되어 있지 않습니다.", nil)
const CUSTOM_ERR_CODE_TOOMANY string = "600" //awserr.New("600", "n개 이상의 xxxx 정보가 존재합니다.", nil)
const KEY_VALUE_CONVERT_DEBUG_INFO bool = false // JSON 및 Key Value객체 Convert시(ConvertToString, ConvertKeyValueList) Debug 로그 정보 출력 여부(Debug 모드로 개발 할 때 불필요한 정보를 줄이기 위해 추가)
Variables ¶
This section is empty.
Functions ¶
func ConvertJsonString ¶
Cloud Object를 JSON String 타입으로 변환
func ConvertJsonStringNoEscape ¶ added in v0.1.2
Cloud Object를 JSON String 타입으로 변환
func ConvertKeyValueList ¶
Cloud Object를 CB-KeyValue 형식으로 변환이 필요할 경우 이용
func ConvertToString ¶
CB-KeyValue 등을 위해 String 타입으로 변환
func CreateHashString ¶ added in v0.3.8
func CreateHashString(credentialInfo idrv.CredentialInfo, Region idrv.RegionInfo) (string, error)
@TODO - PK 이슈 처리해야 함. (A User / B User / User 하위의 IAM 계정간의 호환성에 이슈가 없어야 하는데 현재는 안 됨.)
- 따라서 AWS는 대안으로 KeyPair의 FingerPrint를 이용하도록 변경 - 필요시 리전및 키 이름과 혼용해서 만들어야할 듯.
KeyPair 해시 생성 함수 (PK 이슈로 현재는 사용하지 않음)
func ExtractGpuInfo ¶
func ExtractGpuInfo(gpuDeviceInfo *ec2.GpuDeviceInfo) irs.GpuInfo
func ExtractImageDescribeInfo ¶
Image 정보를 추출함 @TODO : GuestOS 쳌크할 것
func ExtractIpPermissionCommon ¶
func ExtractIpPermissionCommon(ip *ec2.IpPermission, securityRuleInfo *irs.SecurityRuleInfo)
IpPermission에서 공통정보 추출
func ExtractIpPermissions ¶
func ExtractIpPermissions(ipPermissions []*ec2.IpPermission, direction string) []irs.SecurityRuleInfo
func ExtractKeyPairDescribeInfo ¶
func ExtractKeyPairDescribeInfo(keyPair *ec2.KeyPairInfo) (irs.KeyPairInfo, error)
KeyPair 정보를 추출함
func ExtractSecurityInfo ¶
func ExtractSecurityInfo(securityGroupResult *ec2.SecurityGroup) irs.SecurityInfo
func ExtractSubnetDescribeInfo ¶
func ExtractSubnetDescribeInfo(subnetInfo *ec2.Subnet) irs.SubnetInfo
Subnet 정보를 추출함
func ExtractVMSpecInfo ¶
func ExtractVMSpecInfo(Region string, instanceTypeInfo *ec2.InstanceTypeInfo) irs.VMSpecInfo
인스턴스 스펙 정보를 추출함
func ExtractVmName ¶
func ExtractVpcDescribeInfo ¶
type VPCInfo struct { IId IID // {NameId, SystemId} IPv4_CIDR string SubnetInfoList []SubnetInfo KeyValueList []KeyValue }
VPC 정보를 추출함
func GetCBDefaultCidrBlock ¶
func GetCBDefaultCidrBlock() string
func JSONMarshal ¶ added in v0.1.2
Types ¶
type AwsCBNetworkInfo ¶
type AwsImageHandler ¶
type AwsImageHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsImageHandler) CreateImage ¶
func (imageHandler *AwsImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)
@TODO : 작업해야 함.
func (*AwsImageHandler) DeleteImage ¶
func (imageHandler *AwsImageHandler) DeleteImage(imageIID irs.IID) (bool, error)
@TODO : 삭제 API 찾아야 함.
type AwsKeyPairHandler ¶
type AwsKeyPairHandler struct { CredentialInfo idrv.CredentialInfo Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsKeyPairHandler) CheckKeyPairFolder ¶ added in v0.3.8
func (keyPairHandler *AwsKeyPairHandler) CheckKeyPairFolder(keyPairPath string) error
================================= 공개 키 변환 및 키 정보 로컬 보관 로직 추가 =================================
func (*AwsKeyPairHandler) CreateKey ¶
func (keyPairHandler *AwsKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)
2021-10-26 이슈#480에 의해 Local Key 로직 제거
func (*AwsKeyPairHandler) DeleteKey ¶
func (keyPairHandler *AwsKeyPairHandler) DeleteKey(keyIID irs.IID) (bool, error)
2021-10-26 이슈#480에 의해 Local Key 로직 제거
func (*AwsKeyPairHandler) GetKey ¶
func (keyPairHandler *AwsKeyPairHandler) GetKey(keyIID irs.IID) (irs.KeyPairInfo, error)
2021-10-26 이슈#480에 의해 Local Key 로직 제거 혼선을 피하기 위해 keyPairID 대신 keyName으로 변경 함.
func (*AwsKeyPairHandler) ListKey ¶
func (keyPairHandler *AwsKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)
type AwsNLBHandler ¶ added in v0.5.10
type AwsNLBHandler struct { Region idrv.RegionInfo //Client *elb.ELB Client *elbv2.ELBV2 //elbV2 VMClient *ec2.EC2 }
func (*AwsNLBHandler) AddVMs ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs.VMGroupInfo, error)
@TODO : VM 추가 시 NLB에 등록되지 않은 서브넷의 경우 추가 및 검증 로직 필요 @TODO : 이미 등록된 AZ의 다른 서브넷을 사용하는 Instance 처리 필요
func (*AwsNLBHandler) ChangeHealthCheckerInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, healthChecker irs.HealthCheckerInfo) (irs.HealthCheckerInfo, error)
func (*AwsNLBHandler) ChangeListener ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ChangeListener(nlbIID irs.IID, listener irs.ListenerInfo) (irs.ListenerInfo, error)
------ Frontend Control Protocol 하고 Port 정보만 변경 가능
func (*AwsNLBHandler) ChangeVMGroupInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ChangeVMGroupInfo(nlbIID irs.IID, vmGroup irs.VMGroupInfo) (irs.VMGroupInfo, error)
------ Backend Control
func (*AwsNLBHandler) CheckCreateValidation ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) CheckCreateValidation(nlbReqInfo irs.NLBInfo) error
&elbv2.CreateTargetGroupInput
func (*AwsNLBHandler) CheckHealthCheckerValidation ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) CheckHealthCheckerValidation(reqHealthCheckerInfo irs.HealthCheckerInfo) error
func (*AwsNLBHandler) CreateListener ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) CreateListener(nlbReqInfo irs.NLBInfo) (*elbv2.CreateListenerOutput, error)
func (*AwsNLBHandler) CreateTargetGroup ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) CreateTargetGroup(nlbReqInfo irs.NLBInfo) (*elbv2.CreateTargetGroupOutput, error)
func (*AwsNLBHandler) DeleteListener ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) DeleteListener(listenerArn *string) (bool, error)
func (*AwsNLBHandler) DeleteNLB ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) DeleteNLB(nlbIID irs.IID) (bool, error)
@TODO : 상황봐서 TargetGroup과 Listener 삭제 시 발생하는 오류는 무시하고 NLB 삭제까지 진행할 것
func (*AwsNLBHandler) DeleteTargetGroup ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) DeleteTargetGroup(targetGroupArn *string) (bool, error)
func (*AwsNLBHandler) ExtractHealthCheckerInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractHealthCheckerInfo(targetGroupArn string) ([]*elbv2.TargetHealthDescription, error)
타겟 그룹에 있는 인스턴스들의 헬스 상태 목록 조회 - 현재 바리스타에서 미사용 "인스턴스 / 포트 / 헬스 상태"의 배열
func (*AwsNLBHandler) ExtractListenerInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.ListenerInfo, error)
func (*AwsNLBHandler) ExtractNLBInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractNLBInfo(nlbResInfo *elbv2.LoadBalancer) (irs.NLBInfo, error)
func (*AwsNLBHandler) ExtractNlbSubnets ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractNlbSubnets(vpcId string) ([]*string, error)
NLB에서 사용할 서브넷 정보를 추출함.
func (*AwsNLBHandler) ExtractVMGroupHealthInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractVMGroupHealthInfo(targetGroupArn string) (irs.HealthInfo, error)
ExtractVMGroupInfo에서 GetVMGroupHealthInfo를 호출하는 형태로 사용되면 발생할 무한 루프 방지를 위해 별도의 함수로 분리 함. https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetHealth.html
func (*AwsNLBHandler) ExtractVMGroupInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (TargetGroupInfo, error)
func (*AwsNLBHandler) ExtractVmSubnets ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) ExtractVmSubnets(VMs *[]irs.IID) ([]*string, error)
NLB는 AZ별 1개의 서브넷만 선택 가능한데 NLB 생성 요청 정보에는 Subnet 정보가 없어서 성능을 위해 가급적 등록할 VM이 속한 AZ별 Subnet을 추출하려 했으나... NLB에 VM을 추가하는 AddVMS 처리시에 등록되지 않은 AZ를 추가로 처리해야 하기 때문에 현재는 이 함수의 로직을 잠시 보류하고... NLB 생성시 전달 받은 VPC에 존재하는 AZ별 서브넷 1개를 랜덤으로 선택하는 방안으로 대체함.(ExtractNlbSubnets)
성능 등을 감안할 때 ExtractVmSubnets 방식이 좋을 수 있기에 현재 로직은 보관해 놓지만... AZ 정보를 조회하는 로직은 아직 구현하지 않은 상태라서 선택된 전체 VM중 1개의 Subnet만 선택되기에 바로 사용하면 안 됨.
TODO : 서브넷의 AZ 이름을 조회해서 "az" KEY대신 실제 AZ 이름으로 처리해야 함. / 필요한 경우 VM정보 조회 시 페이징 로직도 구현해야 함.
func (*AwsNLBHandler) GetVMGroupHealthInfo ¶ added in v0.5.10
func (NLBHandler *AwsNLBHandler) GetVMGroupHealthInfo(nlbIID irs.IID) (irs.HealthInfo, error)
@TODO : 5가지의 상태(Healthy / Unhealthy / Unused / Initial / Draining)가 존재 하기 때문에 리턴 객체에 담을 Unhealthy의 범위 확정이 필요 함.
func (*AwsNLBHandler) IsExistNLB ¶ added in v0.5.11
func (NLBHandler *AwsNLBHandler) IsExistNLB(nlbName string) (bool, error)
NLB 생성전에 NLB가 이미 존재하는지 체크 함.
type AwsSecurityHandler ¶
type AwsSecurityHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsSecurityHandler) AddRules ¶ added in v0.5.4
func (securityHandler *AwsSecurityHandler) AddRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
func (*AwsSecurityHandler) CreateSecurity ¶
func (securityHandler *AwsSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)
2019-11-16부로 CB-Driver 전체 로직이 NameId 기반으로 변경됨. (보안 그룹은 그룹명으로 처리 가능하기 때문에 Name 태깅시 에러는 무시함) @TODO : 존재하는 보안 그룹에 정책 추가하는 기능 필요 VPC 생략 시 활성화된 세션의 기본 VPC를 이용 함.
func (*AwsSecurityHandler) DeleteSecurity ¶
func (securityHandler *AwsSecurityHandler) DeleteSecurity(securityIID irs.IID) (bool, error)
2019-11-16부로 CB-Driver 전체 로직이 NameId 기반으로 변경됨. func (securityHandler *AwsSecurityHandler) DeleteSecurity(securityNameId string) (bool, error) {
func (*AwsSecurityHandler) GetSecurity ¶
func (securityHandler *AwsSecurityHandler) GetSecurity(securityIID irs.IID) (irs.SecurityInfo, error)
2019-11-16부로 CB-Driver 전체 로직이 NameId 기반으로 변경됨. func (securityHandler *AwsSecurityHandler) GetSecurity(securityNameId string) (irs.SecurityInfo, error) {
func (*AwsSecurityHandler) ListSecurity ¶
func (securityHandler *AwsSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)
func (*AwsSecurityHandler) ProcessAddRules ¶ added in v0.5.5
func (securityHandler *AwsSecurityHandler) ProcessAddRules(newGroupId *string, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
func (*AwsSecurityHandler) ProcessRemoveRules ¶ added in v0.5.5
func (securityHandler *AwsSecurityHandler) ProcessRemoveRules(newGroupId *string, securityRules *[]irs.SecurityRuleInfo) (irs.SecurityInfo, error)
func (*AwsSecurityHandler) RemoveRules ¶ added in v0.5.4
func (securityHandler *AwsSecurityHandler) RemoveRules(sgIID irs.IID, securityRules *[]irs.SecurityRuleInfo) (bool, error)
type AwsVMHandler ¶
type AwsVMHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsVMHandler) AssociatePublicIP ¶
func (vmHandler *AwsVMHandler) AssociatePublicIP(allocationId string, instanceId string) (bool, error)
AssociationId 대신 PublicIP로도 가능 함.
func (*AwsVMHandler) AttachNetworkInterface ¶
func (vmHandler *AwsVMHandler) AttachNetworkInterface(vNicId string, instanceId string) (bool, error)
전달 받은 vNic을 VM에 추가함.
func (*AwsVMHandler) ExtractDescribeInstances ¶
func (vmHandler *AwsVMHandler) ExtractDescribeInstances(reservation *ec2.Reservation) irs.VMInfo
DescribeInstances결과에서 EC2 세부 정보 추출 VM 생성 시에는 Running 이전 상태의 정보가 넘어오기 때문에 최종 정보 기반으로 리턴 받고 싶으면 GetVM에 통합해야 할 듯.
func (*AwsVMHandler) GetDiskInfo ¶ added in v0.5.3
func (vmHandler *AwsVMHandler) GetDiskInfo(ImageSystemId string) (int64, error)
VM생성 시 사용할 루트 디스크의 최소 볼륨 사이즈 정보를 조회함 -1 : 정보 조회 실패
func (*AwsVMHandler) GetVM ¶
2019-11-16부로 CB-Driver 전체 로직이 NameId 기반으로 변경됨. func (vmHandler *AwsVMHandler) GetVM(vmNameId string) (irs.VMInfo, error) {
func (*AwsVMHandler) GetVMStatus ¶
SHUTTING-DOWN / TERMINATED func (vmHandler *AwsVMHandler) GetVMStatus(vmNameId string) (irs.VMStatus, error) {
func (*AwsVMHandler) GetVolumInfo ¶ added in v0.5.1
func (vmHandler *AwsVMHandler) GetVolumInfo(volumeId string) (*ec2.Volume, error)
볼륨 정보 조회
func (*AwsVMHandler) ListVMStatus ¶
func (vmHandler *AwsVMHandler) ListVMStatus() ([]*irs.VMStatusInfo, error)
func (*AwsVMHandler) RebootVM ¶
func (vmHandler *AwsVMHandler) RebootVM(vmNameId string) (irs.VMStatus, error) {
func (*AwsVMHandler) ResumeVM ¶
func (vmHandler *AwsVMHandler) ResumeVM(vmNameId string) (irs.VMStatus, error) {
func (*AwsVMHandler) StartVM ¶
1개의 VM만 생성되도록 수정 (MinCount / MaxCount 이용 안 함) 키페어 이름(예:mcloud-barista)은 아래 URL에 나오는 목록 중 "키페어 이름"의 값을 적으면 됨. https://ap-northeast-2.console.aws.amazon.com/ec2/v2/home?region=ap-northeast-2#KeyPairs:sort=keyName
func (*AwsVMHandler) SuspendVM ¶
func (vmHandler *AwsVMHandler) SuspendVM(vmNameId string) (irs.VMStatus, error) {
func (*AwsVMHandler) TerminateVM ¶
func (vmHandler *AwsVMHandler) TerminateVM(vmNameId string) (irs.VMStatus, error) {
type AwsVPCHandler ¶ added in v0.1.3
type AwsVPCHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsVPCHandler) AddSubnet ¶ added in v0.2.1
func (VPCHandler *AwsVPCHandler) AddSubnet(vpcIID irs.IID, subnetInfo irs.SubnetInfo) (irs.VPCInfo, error)
func (*AwsVPCHandler) AssociateRouteTable ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) AssociateRouteTable(vpcId string, subnetId string) error
VPC의 라우팅 테이블에 생성된 Subnet을 연결 함.
func (*AwsVPCHandler) CreateRouteIGW ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) CreateRouteIGW(vpcId string, igwId string) error
생성된 VPC의 라우팅 테이블에 IGW(Internet Gateway) 라우팅 정보를 생성함 (AWS 콘솔의 라우팅 테이블의 [라우팅] Tab 처리)
func (*AwsVPCHandler) CreateSubnet ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) CreateSubnet(vpcId string, reqSubnetInfo irs.SubnetInfo) (irs.SubnetInfo, error)
func (*AwsVPCHandler) CreateVPC ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) CreateVPC(vpcReqInfo irs.VPCReqInfo) (irs.VPCInfo, error)
func (*AwsVPCHandler) DeleteAllIGW ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DeleteAllIGW(vpcId string) error
VPC에 연결된 모든 IGW를 삭제함.
func (*AwsVPCHandler) DeleteIGW ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DeleteIGW(igwId string) error
IGW를 삭제 함.
func (*AwsVPCHandler) DeleteRouteIGW ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DeleteRouteIGW(vpcId string) error
VPC에 설정된 0.0.0.0/0 라우터를 제거 함. #255예외 처리 보완에 따른 라우팅 정보 삭제전 0.0.0.0 조회후 삭제하도록 로직 변경
func (*AwsVPCHandler) DeleteSubnet ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DeleteSubnet(subnetIID irs.IID) (bool, error)
func (*AwsVPCHandler) DeleteVPC ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DeleteVPC(vpcIID irs.IID) (bool, error)
func (*AwsVPCHandler) DetachInternetGateway ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) DetachInternetGateway(vpcId string, igwId string) error
VPC에 연결된 IGW의 연결을 해제함.
func (*AwsVPCHandler) GetDefaultRouteTable ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) GetDefaultRouteTable(vpcId string) (string, error)
https://docs.aws.amazon.com/ko_kr/vpc/latest/userguide/VPC_Route_Tables.html https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeRouteTables.html 자동 생성된 VPC의 기본 라우팅 테이블 정보를 찾음
func (*AwsVPCHandler) GetSubnet ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) GetSubnet(reqSubnetId string) (irs.SubnetInfo, error)
func (*AwsVPCHandler) ListSubnet ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) ListSubnet(vpcId string) ([]irs.SubnetInfo, error)
VPC의 하위 서브넷 목록을 조회함.
func (*AwsVPCHandler) ListVPC ¶ added in v0.1.3
func (VPCHandler *AwsVPCHandler) ListVPC() ([]*irs.VPCInfo, error)
func (*AwsVPCHandler) RemoveSubnet ¶ added in v0.2.1
type AwsVmSpecHandler ¶
type AwsVmSpecHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#EC2.DescribeInstanceTypes
func (*AwsVmSpecHandler) GetOrgVMSpec ¶
func (vmSpecHandler *AwsVmSpecHandler) GetOrgVMSpec(Name string) (string, error)
AWS의 정보 그대로를 가공 없이 JSON으로 리턴 함.
func (*AwsVmSpecHandler) GetVMSpec ¶
func (vmSpecHandler *AwsVmSpecHandler) GetVMSpec(Name string) (irs.VMSpecInfo, error)
func (*AwsVmSpecHandler) ListOrgVMSpec ¶
func (vmSpecHandler *AwsVmSpecHandler) ListOrgVMSpec() (string, error)
AWS의 정보 그대로를 가공 없이 JSON으로 리턴 함.
func (*AwsVmSpecHandler) ListOrgVMSpecOld ¶ added in v0.2.1
func (vmSpecHandler *AwsVmSpecHandler) ListOrgVMSpecOld() (string, error)
AWS의 정보 그대로를 가공 없이 JSON으로 리턴 함.
func (*AwsVmSpecHandler) ListVMSpec ¶
func (vmSpecHandler *AwsVmSpecHandler) ListVMSpec() ([]*irs.VMSpecInfo, error)
func (*AwsVmSpecHandler) ListVMSpecAZ ¶ added in v0.2.1
func (vmSpecHandler *AwsVmSpecHandler) ListVMSpecAZ(ZoneName string) (map[string]string, error)
해당 Zone의 스펙 ID 목록을 조회함.
type TargetGroupInfo ¶ added in v0.5.10
type TargetGroupInfo struct { VMGroup irs.VMGroupInfo HealthChecker irs.HealthCheckerInfo }