resources

package
v0.6.7-patch-3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Proof of Concepts for the Cloud-Barista Multi-Cloud Project.

by CB-Spider Team, 2019.03.

Index

Constants

View Source
const (
	//
	LoadBalancerSet_Status_Creating uint64 = 0
	LoadBalancerSet_Status_Running  uint64 = 1

	Tencent_LoadBalancerType_Open     string = "OPEN" // to Spider "PUBLIC
	Tencent_LoadBalancerType_INTERNAL string = "INTERNAL"
	Spider_LoadBalancerType_PUBLIC    string = "PUBLIC" // to Tencent "OPEN"
	Spider_LoadBalancerType_INTERNAL  string = "INTERNAL"

	// Request Status : Succeeded, Failed, Progress
	Request_Status_Succeeded int64 = 0
	Request_Status_Failed    int64 = 1
	Request_Status_Progress  int64 = 2

	// Request Status : Running, Done
	Request_Status_Running string = "Running"
	Request_Status_Done    string = "Done"

	Protocol_TCP string = "TCP"
	Protocol_UDP string = "UDP"
)
View Source
const CBCloudInitFilePath string = "/cloud-driver-libs/.cloud-init-tencent/cloud-init"

2021-10-27 이슈#480에 의해 Local Key 로직 제거 const CBKeyPairPath string = "/meta_db/.ssh-tencent/"

View Source
const CBDefaultCidrBlock string = "192.168.0.0/16" // CB Default CidrBlock
View Source
const CBDefaultSubnetName string = "CB-VNet-Subnet" // CB Default Subnet Name
View Source
const CBDefaultVNetName string = "CB-VNet" // CB Default Virtual Network Name
View Source
const CBDefaultVmUserName string = "cb-user" // default VM User Name
View Source
const CUSTOM_ERR_CODE_NOTFOUND string = "404" //"XXX 정보가 존재하지 않습니다."
View Source
const CUSTOM_ERR_CODE_TOOMANY string = "600" //"n개 이상의 xxxx 정보가 존재합니다."

Variables

This section is empty.

Functions

func ConvertJsonString

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

Cloud Object를 JSON String 타입으로 변환

func ConvertJsonStringNoEscape

func ConvertJsonStringNoEscape(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 ExtractImageDescribeInfo

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

func ExtractKeyPairDescribeInfo

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

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

func ExtractVMSpecInfo

func ExtractVMSpecInfo(instanceTypeInfo *cvm.InstanceTypeConfig) irs.VMSpecInfo

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

func ExtractVpcDescribeInfo

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

VPC 정보를 추출함

func GetCBDefaultCidrBlock

func GetCBDefaultCidrBlock() string

func GetCBDefaultSubnetName

func GetCBDefaultSubnetName() string

Subnet

func GetCBDefaultVNetName

func GetCBDefaultVNetName() string

VPC

func GetResourceHandler added in v0.5.11

func GetResourceHandler(s string)

func JSONMarshal

func JSONMarshal(t interface{}) ([]byte, error)

Types

type RuleAction added in v0.5.5

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

type TencentCBNetworkInfo

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

	SubnetName string
	SubnetId   string
}

type TencentImageHandler

type TencentImageHandler struct {
	Region idrv.RegionInfo
	Client *cvm.Client
}

func (*TencentImageHandler) CreateImage

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

@TODO - 이미지 생성에 따른 구조체 정의 필요 - 현재는 IID뿐이 없어서 이미지 이름으로만 생성하도록 했음.(인스턴스Id가 없어서 에러 발생함.)

func (*TencentImageHandler) DeleteImage

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

func (*TencentImageHandler) GetImage

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

func (*TencentImageHandler) ListImage

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

type TencentKeyPairHandler

type TencentKeyPairHandler struct {
	Region idrv.RegionInfo
	Client *cvm.Client
}

func (*TencentKeyPairHandler) CreateKey

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

2021-10-27 이슈#480에 의해 Local Key 로직 제거 KeyPair 생성시 이름은 알파벳, 숫자 또는 밑줄 "_"만 지원

func (*TencentKeyPairHandler) DeleteKey

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

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

func (*TencentKeyPairHandler) GetKey

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

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

func (*TencentKeyPairHandler) ListKey

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

type TencentNLBHandler added in v0.5.10

type TencentNLBHandler struct {
	Region    idrv.RegionInfo
	Client    *clb.Client
	VpcClient *tencentvpc.Client
}

func (*TencentNLBHandler) AddVMs added in v0.5.10

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

func (*TencentNLBHandler) ChangeHealthCheckerInfo added in v0.5.10

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

func (*TencentNLBHandler) ChangeListener added in v0.5.10

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

func (*TencentNLBHandler) ChangeVMGroupInfo added in v0.5.10

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

func (*TencentNLBHandler) CreateNLB added in v0.5.10

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

NLB 생성 vpc required

func (*TencentNLBHandler) DeleteNLB added in v0.5.10

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

func (*TencentNLBHandler) ExtractHealthCheckerInfo added in v0.5.10

func (NLBHandler *TencentNLBHandler) ExtractHealthCheckerInfo(nlbIID irs.IID) (irs.HealthCheckerInfo, error)

Health Checker 정보 조회

func (*TencentNLBHandler) ExtractListenerInfo added in v0.5.10

func (NLBHandler *TencentNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.ListenerInfo, error)

NLB Name으로 Listener를 조회하여 NLBInfo.Listener 값으로 변환 NLB 를 조회하여 Listener에 사용할 IP인 VIP 추출

func (*TencentNLBHandler) ExtractNLBDescribeInfo added in v0.5.11

func (NLBHandler *TencentNLBHandler) ExtractNLBDescribeInfo(nlbInfo *clb.LoadBalancer) (irs.NLBInfo, error)

조회한 결과에서 Spider의 NLBInfo 값으로 변환

func (*TencentNLBHandler) ExtractVMGroupInfo added in v0.5.10

func (NLBHandler *TencentNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (irs.VMGroupInfo, error)

VM Group 정보 조회

func (*TencentNLBHandler) GetNLB added in v0.5.10

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

NLB 조회

func (*TencentNLBHandler) GetVMGroupHealthInfo added in v0.5.10

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

func (*TencentNLBHandler) ListNLB added in v0.5.10

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

NLB 모든 목록 조회 : TCP/UDP

func (*TencentNLBHandler) RemoveVMs added in v0.5.10

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

func (*TencentNLBHandler) WaitForDone added in v0.5.10

func (NLBHandler *TencentNLBHandler) WaitForDone(requestId string) (string, error)

Current status of a task (succeeded==Done, failed, in progress)

func (*TencentNLBHandler) WaitForRun added in v0.5.10

func (NLBHandler *TencentNLBHandler) WaitForRun(nlbIID irs.IID) (string, error)

CLB instance status (creating, running)

type TencentSecurityHandler

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

func (*TencentSecurityHandler) AddRules added in v0.5.4

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

SecurityGroupRule추가 추가 후 SecurityGroup return CreateSecurityGroupPolicies inbound, outbound 동시 호출 불가 > 각각 호출 ModifySecurityGroupPolicies Version을 0으로 set하면 초기화(모든 룰 사라짐), 설정하지 않으면 모두 삭제 후 insert(기존 값 사라짐, 넘어온 값만 사용)

func (*TencentSecurityHandler) CreateSecurity

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

https://intl.cloud.tencent.com/document/product/213/34272 https://intl.cloud.tencent.com/ko/document/api/215/36083

@TODO 포트 다양하게 처리 가능해야 함. - 현재는 콤머는 에러 처리

사용가능 포트 규칙 : 콤머(,) / 대쉬(-) / ALL(전체)

Port: A single port number, or a port range in the format of “8000-8010”. The Port field is accepted only if the value of the Protocol field is TCP or UDP. Otherwise Protocol and Port are mutually exclusive. Action : ACCEPT or DROP

Tencent의 경우 : If no rules are set, all traffic is rejected by default CB Spider의 outbound default는 All Open이므로 기본 Egress는 모두 open : CreateSecurityGroupWithPolicies 사용자의 policy를 추가로 적용 : CreateSecurityGroupPolicies 1번의 request는 한반향만 가능(두가지 동시에 불가)

func (*TencentSecurityHandler) DeleteSecurity

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

func (*TencentSecurityHandler) ExtractPolicyGroups

func (securityHandler *TencentSecurityHandler) ExtractPolicyGroups(policyGroups []*vpc.SecurityGroupPolicy, direction string) ([]irs.SecurityRuleInfo, error)

@TODO Port에 콤머가 사용된 정책 처리해야 함. direction : inbound / outbound

func (*TencentSecurityHandler) GetSecurity

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

func (*TencentSecurityHandler) GetSecurityRuleInfo

func (securityHandler *TencentSecurityHandler) GetSecurityRuleInfo(securityIID irs.IID) (*[]irs.SecurityRuleInfo, error)

func (*TencentSecurityHandler) ListSecurity

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

func (*TencentSecurityHandler) RemoveRules added in v0.5.4

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

DeleteSecurityGroupPolicies inbound, outbound 동시 호출 불가 > 각각 호출

type TencentVMHandler

type TencentVMHandler struct {
	Region idrv.RegionInfo
	Client *cvm.Client
}

func (*TencentVMHandler) ExtractDescribeInstances

func (vmHandler *TencentVMHandler) ExtractDescribeInstances(curVm *cvm.Instance) (irs.VMInfo, error)

func (*TencentVMHandler) GetVM

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

func (*TencentVMHandler) GetVMStatus

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

func (*TencentVMHandler) ListVM

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

func (*TencentVMHandler) ListVMStatus

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

func (*TencentVMHandler) RebootVM

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

func (*TencentVMHandler) ResumeVM

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

func (*TencentVMHandler) StartVM

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

VM생성 시 Zone이 필수라서 Credential의 Zone에만 생성함.

func (*TencentVMHandler) SuspendVM

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

func (*TencentVMHandler) TerminateVM

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

func (*TencentVMHandler) WaitForRun

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

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

type TencentVPCHandler

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

func (*TencentVPCHandler) AddSubnet

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

func (*TencentVPCHandler) CreateVPC

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

func (*TencentVPCHandler) DeleteVPC

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

func (*TencentVPCHandler) GetVPC

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

func (*TencentVPCHandler) ListSubnet

func (VPCHandler *TencentVPCHandler) ListSubnet(reqVpcId string) ([]irs.SubnetInfo, error)

func (*TencentVPCHandler) ListVPC

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

func (*TencentVPCHandler) RemoveSubnet

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

type TencentVmSpecHandler

type TencentVmSpecHandler struct {
	Region idrv.RegionInfo
	Client *cvm.Client
}

func (*TencentVmSpecHandler) GetOrgVMSpec

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

func (*TencentVmSpecHandler) GetVMSpec

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

func (*TencentVmSpecHandler) ListOrgVMSpec

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

func (*TencentVmSpecHandler) ListVMSpec

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

@TODO : Region : zone id(Region이 아닌 zone id로 조회해야 함.)

Jump to

Keyboard shortcuts

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