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 powerkim@powerkim.co.kr, 2019.03.
VPC 처리
Index ¶
- func Connect(region string) *ec2.EC2
- func ExtractDescribeInfo(vpcInfo *ec2.Vpc) irs.VNetworkInfo
- func ExtractDescribeInstances(reservation *ec2.Reservation) irs.VMInfo
- func ExtractIpPermissionCommon(ip *ec2.IpPermission, securityRuleInfo *irs.SecurityRuleInfo)
- func ExtractIpPermissions(ipPermissions []*ec2.IpPermission) []*irs.SecurityRuleInfo
- func ExtractSecurityInfo(securityGroupResult *ec2.SecurityGroup) irs.SecurityInfo
- func WaitForRun(svc *ec2.EC2, instanceID string)
- type AwsImageHandler
- func (imageHandler *AwsImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)
- func (imageHandler *AwsImageHandler) DeleteImage(imageID string) (bool, error)
- func (imageHandler *AwsImageHandler) GetImage(imageID string) (irs.ImageInfo, error)
- func (imageHandler *AwsImageHandler) ListImage() ([]*irs.ImageInfo, error)
- type AwsKeyPairHandler
- func (keyPairHandler *AwsKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)
- func (keyPairHandler *AwsKeyPairHandler) DeleteKey(keyPairName string) (bool, error)
- func (keyPairHandler *AwsKeyPairHandler) GetKey(keyPairName string) (irs.KeyPairInfo, error)
- func (keyPairHandler *AwsKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)
- type AwsPublicIPHandler
- func (publicIpHandler *AwsPublicIPHandler) CreatePublicIP(publicIPReqInfo irs.PublicIPReqInfo) (irs.PublicIPInfo, error)
- func (publicIpHandler *AwsPublicIPHandler) DeletePublicIP(allocationId string) (bool, error)
- func (publicIpHandler *AwsPublicIPHandler) DisassociatePublicIP(publicIP string) (bool, error)
- func (publicIpHandler *AwsPublicIPHandler) GetPublicIP(publicIPID string) (irs.PublicIPInfo, error)
- func (publicIpHandler *AwsPublicIPHandler) ListPublicIP() ([]*irs.PublicIPInfo, error)
- type AwsSecurityHandler
- func (securityHandler *AwsSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) DeleteSecurity(securityID string) (bool, error)
- func (securityHandler *AwsSecurityHandler) GetSecurity(securityID string) (irs.SecurityInfo, error)
- func (securityHandler *AwsSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)
- type AwsVMHandler
- func (vmHandler *AwsVMHandler) GetVM(vmID string) irs.VMInfo
- func (vmHandler *AwsVMHandler) GetVMStatus(vmID string) irs.VMStatus
- func (vmHandler *AwsVMHandler) ListVM() []*irs.VMInfo
- func (vmHandler *AwsVMHandler) ListVMStatus() []*irs.VMStatusInfo
- func (vmHandler *AwsVMHandler) RebootVM(vmID string)
- func (vmHandler *AwsVMHandler) ResumeVM(vmID string)
- func (vmHandler *AwsVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, error)
- func (vmHandler *AwsVMHandler) SuspendVM(vmID string)
- func (vmHandler *AwsVMHandler) TerminateVM(vmID string)
- type AwsVNetworkHandler
- func (vNetworkHandler *AwsVNetworkHandler) CreateVNetwork(vNetworkReqInfo irs.VNetworkReqInfo) (irs.VNetworkInfo, error)
- func (vNetworkHandler *AwsVNetworkHandler) DeleteVNetwork(vNetworkID string) (bool, error)
- func (vNetworkHandler *AwsVNetworkHandler) GetVNetwork(vNetworkID string) (irs.VNetworkInfo, error)
- func (vNetworkHandler *AwsVNetworkHandler) ListVNetwork() ([]*irs.VNetworkInfo, error)
- type AwsVNicHandler
- func (vNicHandler *AwsVNicHandler) CreateVNic(vNicReqInfo irs.VNicReqInfo) (irs.VNicInfo, error)
- func (vNicHandler *AwsVNicHandler) DeleteVNic(vNicID string) (bool, error)
- func (vNicHandler *AwsVNicHandler) GetVNic(vNicID string) (irs.VNicInfo, error)
- func (vNicHandler *AwsVNicHandler) ListVNic() ([]*irs.VNicInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDescribeInstances ¶
func ExtractDescribeInstances(reservation *ec2.Reservation) irs.VMInfo
DescribeInstances결과에서 EC2 세부 정보 추출 VM 생성 시에는 Running 이전 상태의 정보가 넘어오기 때문에 최종 정보 기반으로 리턴 받고 싶으면 GetVM에 통합해야 할 듯.
func ExtractIpPermissionCommon ¶
func ExtractIpPermissionCommon(ip *ec2.IpPermission, securityRuleInfo *irs.SecurityRuleInfo)
IpPermission에서 공통정보 추출
func ExtractIpPermissions ¶
func ExtractIpPermissions(ipPermissions []*ec2.IpPermission) []*irs.SecurityRuleInfo
func ExtractSecurityInfo ¶
func ExtractSecurityInfo(securityGroupResult *ec2.SecurityGroup) irs.SecurityInfo
Types ¶
type AwsImageHandler ¶
type AwsImageHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsImageHandler) CreateImage ¶
func (imageHandler *AwsImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error)
func (*AwsImageHandler) DeleteImage ¶
func (imageHandler *AwsImageHandler) DeleteImage(imageID string) (bool, error)
type AwsKeyPairHandler ¶
type AwsKeyPairHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsKeyPairHandler) CreateKey ¶
func (keyPairHandler *AwsKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPairReqInfo) (irs.KeyPairInfo, error)
func (*AwsKeyPairHandler) DeleteKey ¶
func (keyPairHandler *AwsKeyPairHandler) DeleteKey(keyPairName string) (bool, error)
func (*AwsKeyPairHandler) GetKey ¶
func (keyPairHandler *AwsKeyPairHandler) GetKey(keyPairName string) (irs.KeyPairInfo, error)
혼선을 피하기 위해 keyPairID 대신 keyPairName으로 변경 함.
func (*AwsKeyPairHandler) ListKey ¶
func (keyPairHandler *AwsKeyPairHandler) ListKey() ([]*irs.KeyPairInfo, error)
type AwsPublicIPHandler ¶
type AwsPublicIPHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsPublicIPHandler) CreatePublicIP ¶
func (publicIpHandler *AwsPublicIPHandler) CreatePublicIP(publicIPReqInfo irs.PublicIPReqInfo) (irs.PublicIPInfo, error)
@TODO : 공통 I/F에 함수 추가해야 함. - EC2에 Public를 할당하는 AssociatePublicIP함수를 별도로 구현이 필요 함. - 현재는 테스트를 위해 생성과 동시에 할당하도록 해 놨음.
func (*AwsPublicIPHandler) DeletePublicIP ¶
func (publicIpHandler *AwsPublicIPHandler) DeletePublicIP(allocationId string) (bool, error)
Public IP를 완전히 제거 함.(AWS Pool로 되돌려 보냄)
func (*AwsPublicIPHandler) DisassociatePublicIP ¶
func (publicIpHandler *AwsPublicIPHandler) DisassociatePublicIP(publicIP string) (bool, error)
@TODO : 공통 I/F에 함수 추가해야 함. - EC2 인스턴스와의 연결만 해제하는 DisassociatePublicIP publicIP 대신 AssociationId로도 가능 함.
func (*AwsPublicIPHandler) GetPublicIP ¶
func (publicIpHandler *AwsPublicIPHandler) GetPublicIP(publicIPID string) (irs.PublicIPInfo, error)
func (*AwsPublicIPHandler) ListPublicIP ¶
func (publicIpHandler *AwsPublicIPHandler) ListPublicIP() ([]*irs.PublicIPInfo, error)
type AwsSecurityHandler ¶
type AwsSecurityHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsSecurityHandler) CreateSecurity ¶
func (securityHandler *AwsSecurityHandler) CreateSecurity(securityReqInfo irs.SecurityReqInfo) (irs.SecurityInfo, error)
@TODO : 존재하는 보안 그룹에 정책 추가하는 기능 필요 VPC 생략 시 활성화된 세션의 기본 VPC를 이용 함.
func (*AwsSecurityHandler) DeleteSecurity ¶
func (securityHandler *AwsSecurityHandler) DeleteSecurity(securityID string) (bool, error)
func (*AwsSecurityHandler) GetSecurity ¶
func (securityHandler *AwsSecurityHandler) GetSecurity(securityID string) (irs.SecurityInfo, error)
func (*AwsSecurityHandler) ListSecurity ¶
func (securityHandler *AwsSecurityHandler) ListSecurity() ([]*irs.SecurityInfo, error)
type AwsVMHandler ¶
type AwsVMHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsVMHandler) GetVM ¶
func (vmHandler *AwsVMHandler) GetVM(vmID string) irs.VMInfo
- 보안그룹의 경우 멀티개 설정이 가능한데 현재는 1개만 입력 받음 @Todo : SecurityID에 보안그룹 Name을 할당하는게 맞는지 확인 필요
func (*AwsVMHandler) GetVMStatus ¶
func (vmHandler *AwsVMHandler) GetVMStatus(vmID string) irs.VMStatus
SHUTTING-DOWN / TERMINATED
func (*AwsVMHandler) ListVM ¶
func (vmHandler *AwsVMHandler) ListVM() []*irs.VMInfo
func (*AwsVMHandler) ListVMStatus ¶
func (vmHandler *AwsVMHandler) ListVMStatus() []*irs.VMStatusInfo
func (*AwsVMHandler) RebootVM ¶
func (vmHandler *AwsVMHandler) RebootVM(vmID string)
func (*AwsVMHandler) ResumeVM ¶
func (vmHandler *AwsVMHandler) ResumeVM(vmID string)
func (*AwsVMHandler) StartVM ¶
@Todo : SecurityGroupId 배열 처리 방안 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(vmID string)
func (*AwsVMHandler) TerminateVM ¶
func (vmHandler *AwsVMHandler) TerminateVM(vmID string)
type AwsVNetworkHandler ¶
type AwsVNetworkHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsVNetworkHandler) CreateVNetwork ¶
func (vNetworkHandler *AwsVNetworkHandler) CreateVNetwork(vNetworkReqInfo irs.VNetworkReqInfo) (irs.VNetworkInfo, error)
func (*AwsVNetworkHandler) DeleteVNetwork ¶
func (vNetworkHandler *AwsVNetworkHandler) DeleteVNetwork(vNetworkID string) (bool, error)
func (*AwsVNetworkHandler) GetVNetwork ¶
func (vNetworkHandler *AwsVNetworkHandler) GetVNetwork(vNetworkID string) (irs.VNetworkInfo, error)
func (*AwsVNetworkHandler) ListVNetwork ¶
func (vNetworkHandler *AwsVNetworkHandler) ListVNetwork() ([]*irs.VNetworkInfo, error)
type AwsVNicHandler ¶
type AwsVNicHandler struct { Region idrv.RegionInfo Client *ec2.EC2 }
func (*AwsVNicHandler) CreateVNic ¶
func (vNicHandler *AwsVNicHandler) CreateVNic(vNicReqInfo irs.VNicReqInfo) (irs.VNicInfo, error)
func (*AwsVNicHandler) DeleteVNic ¶
func (vNicHandler *AwsVNicHandler) DeleteVNic(vNicID string) (bool, error)