mci

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Index

Constants

View Source
const (
	// AutoStatusReady is const for "Ready" status.
	AutoStatusReady string = "Ready"

	// AutoStatusChecking is const for "Checking" status.
	AutoStatusChecking string = "Checking"

	// AutoStatusDetected is const for "Detected" status.
	AutoStatusDetected string = "Detected"

	// AutoStatusOperating is const for "Operating" status.
	AutoStatusOperating string = "Operating"

	// AutoStatusStabilizing is const for "Stabilizing" status.
	AutoStatusStabilizing string = "Stabilizing"

	// AutoStatusTimeout is const for "Timeout" status.
	AutoStatusTimeout string = "Timeout"

	// AutoStatusError is const for "Failed" status.
	AutoStatusError string = "Failed"

	// AutoStatusSuspended is const for "Suspended" status.
	AutoStatusSuspended string = "Suspended"
)

Status for mci automation

View Source
const (
	// AutoActionScaleOut is const for "ScaleOut" action.
	AutoActionScaleOut string = "ScaleOut"

	// AutoActionScaleIn is const for "ScaleIn" action.
	AutoActionScaleIn string = "ScaleIn"
)

Action for mci automation

View Source
const (
	// ActionCreate is const for Create
	ActionCreate string = "Create"

	// ActionTerminate is const for Terminate
	ActionTerminate string = "Terminate"

	// ActionSuspend is const for Suspend
	ActionSuspend string = "Suspend"

	// ActionResume is const for Resume
	ActionResume string = "Resume"

	// ActionReboot is const for Reboot
	ActionReboot string = "Reboot"

	// ActionRefine is const for Refine
	ActionRefine string = "Refine"

	// ActionComplete is const for Complete
	ActionComplete string = "None"
)
View Source
const (
	// StatusRunning is const for Running
	StatusRunning string = "Running"

	// StatusSuspended is const for Suspended
	StatusSuspended string = "Suspended"

	// StatusFailed is const for Failed
	StatusFailed string = "Failed"

	// StatusTerminated is const for Terminated
	StatusTerminated string = "Terminated"

	// StatusCreating is const for Creating
	StatusCreating string = "Creating"

	// StatusSuspending is const for Suspending
	StatusSuspending string = "Suspending"

	// StatusResuming is const for Resuming
	StatusResuming string = "Resuming"

	// StatusRebooting is const for Rebooting
	StatusRebooting string = "Rebooting"

	// StatusTerminating is const for Terminating
	StatusTerminating string = "Terminating"

	// StatusUndefined is const for Undefined
	StatusUndefined string = "Undefined"

	// StatusComplete is const for Complete
	StatusComplete string = "None"
)
View Source
const DefaultSystemLabel string = "Managed by CB-Tumblebug"

DefaultSystemLabel is const for string to specify the Default System Label

Variables

This section is empty.

Functions

func AddVmToMci

func AddVmToMci(wg *sync.WaitGroup, nsId string, mciId string, vmInfoData *TbVmInfo, option string) error

AddVmToMci is func to add VM to MCI

func CallGetMonitoringAsync

func CallGetMonitoringAsync(wg *sync.WaitGroup, nsID string, mciID string, vmID string, vmIP string, method string, metric string, cmd string, returnResult *[]MonResultSimple)

func CallMilkyway

func CallMilkyway(wg *sync.WaitGroup, vmList []string, nsId string, mciId string, vmId string, vmIp string, action string, option string, results *BenchmarkInfoArray)

CallMilkyway is func to call milkyway agents

func CallMonitoringAsync

func CallMonitoringAsync(wg *sync.WaitGroup, nsID string, mciID string, mciServiceType string, vmID string, givenUserName string, method string, cmd string, returnResult *[]SshCmdResult)

CallMonitoringAsync is func to call CB-Dragonfly monitoring framework

func CheckAllowedTransition

func CheckAllowedTransition(nsId string, mciId string, vmId common.OptionalParameter, action string) error

CheckAllowedTransition is func to check status transition is acceptable

func CheckConnectivity

func CheckConnectivity(host string, port string) error

CheckConnectivity func checks if given port is open and ready

func CheckDragonflyEndpoint

func CheckDragonflyEndpoint() error

Module for checking CB-Dragonfly endpoint (call get config)

func CheckK8sCluster

func CheckK8sCluster(nsId string, k8sClusterId string) (bool, error)

CheckK8sCluster returns the existence of the TB K8sCluster object in bool form.

func CheckMci

func CheckMci(nsId string, mciId string) (bool, error)

func CheckMciPolicy

func CheckMciPolicy(nsId string, mciId string) (bool, error)

func CheckNLB

func CheckNLB(nsId string, mciId string, resourceId string) (bool, error)

CheckNLB returns the existence of the TB NLB object in bool form.

func CheckSubGroup

func CheckSubGroup(nsId string, mciId string, subGroupId string) (bool, error)

CheckSubGroup func is to check given subGroupId is duplicated with existing

func CheckVm

func CheckVm(nsId string, mciId string, vmId string) (bool, error)

func ControlMciAsync

func ControlMciAsync(nsId string, mciId string, action string, force bool) error

ControlMciAsync is func to control MCI async

func ControlVmAsync

func ControlVmAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, action string, results chan<- ControlVmResult)

ControlVmAsync is func to control VM async

func CreateVm

func CreateVm(nsId string, mciId string, vmInfoData *TbVmInfo, option string) error

CreateVm is func to create VM (option = "register" for register existing VM)

func CreateVmSnapshot

func CreateVmSnapshot(nsId string, mciId string, vmId string, snapshotName string) (mcir.TbCustomImageInfo, error)

CreateVmSnapshot is func to create VM snapshot

func DFMonAgentInstallReqStructLevelValidation

func DFMonAgentInstallReqStructLevelValidation(sl validator.StructLevel)

func DelAllMci

func DelAllMci(nsId string, option string) (string, error)

DelAllMci is func to delete all MCI objects

func DelAllMciPolicy

func DelAllMciPolicy(nsId string) (string, error)

DelAllMciPolicy deletes all MciPolicyInfo objects.

func DelAllNLB

func DelAllNLB(nsId string, mciId string, subString string, forceFlag string) (common.IdList, error)

DelAllNLB deletes all TB NLB object of given nsId

func DelMci

func DelMci(nsId string, mciId string, option string) (common.IdList, error)

DelMci is func to delete MCI object

func DelMciPolicy

func DelMciPolicy(nsId string, mciId string) error

DelMciPolicy deletes MciPolicyInfo object by mciId.

func DelMciVm

func DelMciVm(nsId string, mciId string, vmId string, option string) error

DelMciVm is func to delete VM object

func DelNLB

func DelNLB(nsId string, mciId string, resourceId string, forceFlag string) error

DelNLB deletes the TB NLB object

func DeleteAllK8sCluster

func DeleteAllK8sCluster(nsId string, subString string, forceFlag string) (common.IdList, error)

DeleteAllK8sCluster deletes all clusters

func DeleteK8sCluster

func DeleteK8sCluster(nsId string, k8sClusterId string, forceFlag string) (bool, error)

DeleteK8sCluster deletes a k8s cluster

func Difference_dataDisks

func Difference_dataDisks(a, b []resourceOnTumblebugInfo) []resourceOnTumblebugInfo

func FetchVmStatusAsync

func FetchVmStatusAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, results *MciStatusInfo) error

FetchVmStatusAsync is func to get VM status async

func GenK8sClusterKey

func GenK8sClusterKey(nsId string, k8sClusterId string) string

GenK8sClusterKey is func to generate a key from K8sCluster ID

func GenNLBKey

func GenNLBKey(nsId string, mciId string, resourceId string) string

GenNLBKey is func to generate a key from NLB id

func GetAvailableDataDisks

func GetAvailableDataDisks(nsId string, mciId string, vmId string, option string) (interface{}, error)

func GetBastionNodes

func GetBastionNodes(nsId string, mciId string, targetVmId string) ([]mcir.BastionNode, error)

GetBastionNodes func retrieves bastion nodes for a given VM

func GetLatency

func GetLatency(src string, dest string) (float64, error)

GetLatency func get latency between given two regions

func GetVmIp

func GetVmIp(nsId string, mciId string, vmId string) (string, string, string, error)

GetVmIp is func to get VM IP to return PublicIP, PrivateIP, SSHPort

func GetVmSpecId

func GetVmSpecId(nsId string, mciId string, vmId string) string

GetVmSpecId is func to get VM SpecId

func GetVmSshKey

func GetVmSshKey(nsId string, mciId string, vmId string) (string, string, string, error)

GetVmSshKey is func to get VM SShKey. Returns username, verifiedUsername, privateKey

func HandleMciAction

func HandleMciAction(nsId string, mciId string, action string, force bool) (string, error)

HandleMciAction is func to handle actions to MCI

func HandleMciVmAction

func HandleMciVmAction(nsId string, mciId string, vmId string, action string, force bool) (string, error)

HandleMciVmAction is func to Get MciVm Action

func ListK8sCluster

func ListK8sCluster(nsId string, filterKey string, filterVal string) (interface{}, error)

ListK8sCluster returns the list of TB K8sCluster objects of given nsId

func ListK8sClusterId

func ListK8sClusterId(nsId string) ([]string, error)

ListK8sClusterId returns the list of TB K8sCluster object IDs of given nsId

func ListMciId

func ListMciId(nsId string) ([]string, error)

ListMciId is func to list MCI ID

func ListMciPolicyId

func ListMciPolicyId(nsId string) []string

ListMciPolicyId returns a list of Ids for all MciPolicyInfo objects .

func ListNLB

func ListNLB(nsId string, mciId string, filterKey string, filterVal string) (interface{}, error)

ListNLB returns the list of TB NLB objects of given nsId

func ListNLBId

func ListNLBId(nsId string, mciId string) ([]string, error)

ListNLBId returns the list of TB NLB object IDs of given nsId

func ListSubGroupId

func ListSubGroupId(nsId string, mciId string) ([]string, error)

ListSubGroupId is func to return list of SubGroups in a given MCI

func ListVmByFilter

func ListVmByFilter(nsId string, mciId string, filterKey string, filterVal string) ([]string, error)

ListVmByFilter is func to get list VMs in a MCI by a filter consist of Key and Value

func ListVmByLabel

func ListVmByLabel(nsId string, mciId string, label string) ([]string, error)

ListVmByLabel is func to list VM by label

func ListVmBySubGroup

func ListVmBySubGroup(nsId string, mciId string, groupId string) ([]string, error)

ListVmBySubGroup is func to get VM list with a SubGroup label in a specified MCI

func ListVmId

func ListVmId(nsId string, mciId string) ([]string, error)

ListVmId is func to list VM IDs

func OrchestrationController

func OrchestrationController()

OrchestrationController is responsible for executing MCI automation policy. OrchestrationController will be periodically involked by a time.NewTicker in main.go.

func RecommendVm

func RecommendVm(nsId string, plan DeploymentPlan) ([]mcir.TbSpecInfo, error)

RecommendVm is func to recommend a VM

func RecommendVmCost

func RecommendVmCost(nsId string, specList *[]mcir.TbSpecInfo) ([]mcir.TbSpecInfo, error)

RecommendVmCost func prioritize specs based on given Cost

func RecommendVmLatency

func RecommendVmLatency(nsId string, specList *[]mcir.TbSpecInfo, param *[]ParameterKeyVal) ([]mcir.TbSpecInfo, error)

RecommendVmLatency func prioritize specs by latency based on given MCI (fair)

func RecommendVmLocation

func RecommendVmLocation(nsId string, specList *[]mcir.TbSpecInfo, param *[]ParameterKeyVal) ([]mcir.TbSpecInfo, error)

RecommendVmLocation func prioritize specs based on given location

func RecommendVmPerformance

func RecommendVmPerformance(nsId string, specList *[]mcir.TbSpecInfo) ([]mcir.TbSpecInfo, error)

RecommendVmPerformance func prioritize specs based on given Performance condition

func RecommendVmRandom

func RecommendVmRandom(nsId string, specList *[]mcir.TbSpecInfo) ([]mcir.TbSpecInfo, error)

RecommendVmRandom func prioritize specs randomly

func RemoveBastionNodes

func RemoveBastionNodes(nsId string, mciId string, bastionVmId string) (string, error)

RemoveBastionNodes func removes existing bastion nodes info

func RemoveK8sNodeGroup

func RemoveK8sNodeGroup(nsId string, k8sClusterId string, k8sNodeGroupName string, forceFlag string) (bool, error)

RemoveK8sNodeGroup removes a specified NodeGroup

func RemoveNLBVMs

func RemoveNLBVMs(nsId string, mciId string, resourceId string, u *TbNLBAddRemoveVMReq) error

RemoveNLBVMs accepts VM removal request, removes VMs from NLB, and returns an error if occurs.

func RunRemoteCommand

func RunRemoteCommand(nsId string, mciId string, vmId string, givenUserName string, cmds []string) (map[int]string, map[int]string, error)

RunRemoteCommand is func to execute a SSH command to a VM (sync call)

func RunRemoteCommandAsync

func RunRemoteCommandAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, givenUserName string, cmd []string, returnResult *[]SshCmdResult)

RunRemoteCommandAsync is func to execute a SSH command to a VM (async call)

func SetBastionNodes

func SetBastionNodes(nsId string, mciId string, targetVmId string, bastionVmId string) (string, error)

SetBastionNodes func sets bastion nodes

func SetMonitoringAgentStatusInstalled

func SetMonitoringAgentStatusInstalled(nsId string, mciId string, vmId string) error

SetMonitoringAgentStatusInstalled is func to Set Monitoring Agent Status Installed

func TbK8sClusterReqStructLevelValidation

func TbK8sClusterReqStructLevelValidation(sl validator.StructLevel)

TbK8sClusterReqStructLevelValidation is a function to validate 'TbK8sClusterReq' object.

func TbMciCmdReqStructLevelValidation

func TbMciCmdReqStructLevelValidation(sl validator.StructLevel)

TbMciCmdReqStructLevelValidation is func to validate fields in MciCmdReq

func TbMciReqStructLevelValidation

func TbMciReqStructLevelValidation(sl validator.StructLevel)

TbMciReqStructLevelValidation is func to validate fields in TbMciReqStruct

func TbNLBReqStructLevelValidation

func TbNLBReqStructLevelValidation(sl validator.StructLevel)

TbNLBReqStructLevelValidation is a function to validate 'TbNLBReq' object.

func TbVmReqStructLevelValidation

func TbVmReqStructLevelValidation(sl validator.StructLevel)

TbVmReqStructLevelValidation is func to validate fields in TbVmReqStruct

func TrimIP

func TrimIP(sshAccessPoint string) (string, error)

func UpdateMciInfo

func UpdateMciInfo(nsId string, mciInfoData TbMciInfo)

UpdateMciInfo is func to update MCI Info (without VM info in MCI)

func UpdateMciPolicyInfo

func UpdateMciPolicyInfo(nsId string, mciPolicyInfoData MciPolicyInfo)

UpdateMciPolicyInfo updates MciPolicyInfo object in DB.

func UpdateMonitoringAgentStatusManually

func UpdateMonitoringAgentStatusManually(nsId string, mciId string, vmId string, targetStatus string) error

UpdateMonitoringAgentStatusManually is func to Update Monitoring Agent Installation Status Manually

func UpdateVmInfo

func UpdateVmInfo(nsId string, mciId string, vmInfoData TbVmInfo)

UpdateVmInfo is func to update VM Info

func UpdateVmPublicIp

func UpdateVmPublicIp(nsId string, mciId string, vmInfoData TbVmInfo) error

UpdateVmPublicIp is func to update VM public IP

func UpdateVmSshKey

func UpdateVmSshKey(nsId string, mciId string, vmId string, verifiedUserName string) error

UpdateVmSshKey is func to update VM SShKey

func VerifySshUserName

func VerifySshUserName(nsId string, mciId string, vmId string, vmIp string, sshPort string, givenUserName string) (string, string, error)

VerifySshUserName is func to verify SSH username

Types

type AgentInstallContent

type AgentInstallContent struct {
	MciId  string `json:"mciId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
}

AgentInstallContent ...

type AgentInstallContentWrapper

type AgentInstallContentWrapper struct {
	ResultArray []AgentInstallContent `json:"resultArray"`
}

AgentInstallContentWrapper ...

func InstallMonitorAgentToMci

func InstallMonitorAgentToMci(nsId string, mciId string, mciServiceType string, req *MciCmdReq) (AgentInstallContentWrapper, error)

type AutoAction

type AutoAction struct {
	ActionType   string         `json:"actionType" example:"ScaleOut" enums:"ScaleOut,ScaleIn"`
	VmDynamicReq TbVmDynamicReq `json:"vmDynamicReq"`

	// PostCommand is field for providing command to VMs after its creation. example:"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/setweb.sh -O ~/setweb.sh; chmod +x ~/setweb.sh; sudo ~/setweb.sh"
	PostCommand   MciCmdReq `json:"postCommand"`
	PlacementAlgo string    `json:"placementAlgo" example:"random"`
}

AutoAction is struct for MCI auto-control action.

type AutoCondition

type AutoCondition struct {
	Metric           string   `json:"metric" example:"cpu"`
	Operator         string   `json:"operator" example:">=" enums:"<,<=,>,>="`
	Operand          string   `json:"operand" example:"80"`
	EvaluationPeriod string   `json:"evaluationPeriod" example:"10"`
	EvaluationValue  []string `json:"evaluationValue"`
}

AutoCondition is struct for MCI auto-control condition.

type BastionInfo

type BastionInfo struct {
	VmId []string `json:"vmId"`
}

BastionInfo is struct for bastion info

type BenchmarkInfo

type BenchmarkInfo struct {
	Result      string          `json:"result"`
	Unit        string          `json:"unit"`
	Desc        string          `json:"desc"`
	Elapsed     string          `json:"elapsed"`
	SpecId      string          `json:"specid"`
	RegionName  string          `json:"regionName"`
	ResultArray []BenchmarkInfo `json:"resultarray"` // struct-element cycle ?
}

BenchmarkInfo is struct for BenchmarkInfo

type BenchmarkInfoArray

type BenchmarkInfoArray struct {
	ResultArray []BenchmarkInfo `json:"resultarray"`
}

BenchmarkInfoArray is struct for BenchmarkInfoArray

func BenchmarkAction

func BenchmarkAction(nsId string, mciId string, action string, option string) (BenchmarkInfoArray, error)

BenchmarkAction is func to action Benchmark

func CoreGetBenchmark

func CoreGetBenchmark(nsId string, mciId string, action string, host string) (*BenchmarkInfoArray, error)

CoreGetBenchmark is func to get Benchmark

func RunAllBenchmarks

func RunAllBenchmarks(nsId string, mciId string, host string) (*BenchmarkInfoArray, error)

RunAllBenchmarks is func to get all Benchmarks

func RunLatencyBenchmark

func RunLatencyBenchmark(nsId string, mciId string, host string) (*BenchmarkInfoArray, error)

RunLatencyBenchmark is func to get MCI benchmark for network latency

type BenchmarkReq

type BenchmarkReq struct {
	Host string `json:"host"`
	Spec string `json:"spec"`
}

BenchmarkReq is struct for BenchmarkReq

type CheckMciDynamicReqInfo

type CheckMciDynamicReqInfo struct {
	ReqCheck []CheckVmDynamicReqInfo `json:"reqCheck" validate:"required"`
}

CheckMciDynamicReqInfo is struct to check requirements to create a new MCI instance dynamically (with default resource option)

func CheckMciDynamicReq

CheckMciDynamicReq is func to check request info to create MCI obeject and deploy requested VMs in a dynamic way

type CheckVmDynamicReqInfo

type CheckVmDynamicReqInfo struct {

	// ConnectionConfigCandidates will provide ConnectionConfig options
	ConnectionConfigCandidates []string `json:"connectionConfigCandidates" default:""`

	Spec   mcir.TbSpecInfo     `json:"spec" default:""`
	Image  []mcir.TbImageInfo  `json:"image" default:""`
	Region common.RegionDetail `json:"region" default:""`

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

}

CheckVmDynamicReqInfo is struct to check requirements to create a new server instance dynamically (with default resource option)

type ControlVmResult

type ControlVmResult struct {
	VmId   string `json:"vmId"`
	Status string `json:"Status"`
	Error  error  `json:"Error"`
}

MCI Control ControlVmResult is struct for result of VM control

type ControlVmResultWrapper

type ControlVmResultWrapper struct {
	ResultArray []ControlVmResult `json:"resultarray"`
}

ControlVmResultWrapper is struct for array of results of VM control

type DeploymentPlan

type DeploymentPlan struct {
	Filter   FilterInfo   `json:"filter"`
	Priority PriorityInfo `json:"priority"`
	Limit    string       `json:"limit" example:"5" enums:"1,2,30"`
}

DeploymentPlan is struct for .

type FilterCondition

type FilterCondition struct {
	Metric    string      `json:"metric" example:"vCPU" enums:"vCPU,memoryGiB,costPerHour"`
	Condition []Operation `json:"condition"`
}

FilterCondition is struct for .

type FilterInfo

type FilterInfo struct {
	Policy []FilterCondition `json:"policy"`
}

FilterInfo is struct for .

type InspectResource

type InspectResource struct {
	ConnectionName   string                `json:"connectionName"`
	ResourceType     string                `json:"resourceType"`
	SystemMessage    string                `json:"systemMessage"`
	ResourceOverview resourceCountOverview `json:"resourceOverview"`
	Resources        resourcesByManageType `json:"resources"`
}

InspectResource is struct for InspectResource per Cloud Connection

func InspectResources

func InspectResources(connConfig string, resourceType string) (InspectResource, error)

InspectResources returns the state list of TB MCIR objects of given connConfig and resourceType

type InspectResourceAllResult

type InspectResourceAllResult struct {
	ElapsedTime          int                     `json:"elapsedTime"`
	RegisteredConnection int                     `json:"registeredConnection"`
	AvailableConnection  int                     `json:"availableConnection"`
	TumblebugOverview    inspectOverview         `json:"tumblebugOverview"`
	CspOnlyOverview      inspectOverview         `json:"cspOnlyOverview"`
	InspectResult        []InspectResourceResult `json:"inspectResult"`
}

InspectResourceAllResult is struct for Inspect Resource Result for All Clouds

func InspectResourcesOverview

func InspectResourcesOverview() (InspectResourceAllResult, error)

InspectResourcesOverview func is to check all resources in CB-TB and CSPs

type InspectResourceResult

type InspectResourceResult struct {
	ConnectionName    string          `json:"connectionName"`
	SystemMessage     string          `json:"systemMessage"`
	ElapsedTime       int             `json:"elapsedTime"`
	TumblebugOverview inspectOverview `json:"tumblebugOverview"`
	CspOnlyOverview   inspectOverview `json:"cspOnlyOverview"`
}

InspectResourceResult is struct for Inspect Resource Result

type McNlbInfo

type McNlbInfo struct {
	MciAccessInfo *MciAccessInfo  `json:"mciAccessInfo"`
	McNlbHostInfo *TbMciInfo      `json:"mcNlbHostInfo"`
	DeploymentLog MciSshCmdResult `json:"deploymentLog"`
}

McNlbInfo is a struct for response of CreateMcSwNlb

func CreateMcSwNlb

func CreateMcSwNlb(nsId string, mciId string, req *TbNLBReq, option string) (McNlbInfo, error)

CreateMcSwNlb func create a special purpose MCI for NLB and depoly and setting SW NLB

type MciAccessInfo

type MciAccessInfo struct {
	MciId                 string
	MciNlbListener        *MciAccessInfo `json:"mciNlbListener,omitempty"`
	MciSubGroupAccessInfo []MciSubGroupAccessInfo
}

MciAccessInfo is struct to retrieve overall access information of a MCI

func GetMcNlbAccess

func GetMcNlbAccess(nsId string, mciId string) (*MciAccessInfo, error)

GetMcNlbAccess returns the requested TB G-NLB access info (currenly MCI)

func GetMciAccessInfo

func GetMciAccessInfo(nsId string, mciId string, option string) (*MciAccessInfo, error)

GetMciAccessInfo is func to retrieve MCI Access information

type MciCmdReq

type MciCmdReq struct {
	UserName string   `json:"userName" example:"cb-user" default:""`
	Command  []string `` /* 128-byte string literal not displayed */
}

MciCmdReq is struct for remote command

type MciConnectionConfigCandidatesReq

type MciConnectionConfigCandidatesReq struct {
	// CommonSpec is field for id of a spec in common namespace
	CommonSpecs []string `json:"commonSpec" validate:"required" example:"aws+ap-northeast-2+t2.small,gcp+us-west1+g1-small"`
}

MciConnectionConfigCandidatesReq is struct for a request to check requirements to create a new MCI instance dynamically (with default resource option)

type MciPolicyInfo

type MciPolicyInfo struct {
	Name   string   `json:"Name"` //MCI Name (for request)
	Id     string   `json:"Id"`   //MCI Id (generated ID by the Name)
	Policy []Policy `json:"policy"`

	ActionLog   string `json:"actionLog"`
	Description string `json:"description" example:"Description"`
}

MciPolicyInfo is struct for MCI auto-control Policy object.

func CreateMciPolicy

func CreateMciPolicy(nsId string, mciId string, u *MciPolicyReq) (MciPolicyInfo, error)

CreateMciPolicy create MciPolicyInfo object in DB according to user's requirements.

func GetAllMciPolicyObject

func GetAllMciPolicyObject(nsId string) ([]MciPolicyInfo, error)

GetAllMciPolicyObject returns all MciPolicyInfo objects.

func GetMciPolicyObject

func GetMciPolicyObject(nsId string, mciId string) (MciPolicyInfo, error)

GetMciPolicyObject returns MciPolicyInfo object.

type MciPolicyReq

type MciPolicyReq struct {
	Policy      []Policy `json:"policy"`
	Description string   `json:"description" example:"Description"`
}

MciPolicyReq is struct for MCI auto-control Policy Request.

type MciRecommendReq

type MciRecommendReq struct {
	VmReq          []TbVmRecommendReq `json:"vmReq"`
	PlacementAlgo  string             `json:"placementAlgo"`
	PlacementParam []common.KeyValue  `json:"placementParam"`
	MaxResultNum   string             `json:"maxResultNum"`
}

MciRecommendReq is struct for MciRecommendReq

type MciSshCmdResult

type MciSshCmdResult struct {
	Results []SshCmdResult `json:"results"`
}

MciSshCmdResult is struct for Set of SshCmd Results in terms of MCI

type MciStatusInfo

type MciStatusInfo struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"[yes, no]"` // yes or no

	MasterVmId    string `json:"masterVmId" example:"vm-asiaeast1-cb-01"`
	MasterIp      string `json:"masterIp" example:"32.201.134.113"`
	MasterSSHPort string `json:"masterSSHPort"`

	// Label is for describing the mci in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	Vm []TbVmStatusInfo `json:"vm"`
}

MciStatusInfo is struct to define simple information of MCI with updated status of all VMs

func GetMciStatus

func GetMciStatus(nsId string, mciId string) (*MciStatusInfo, error)

GetMciStatus is func to Get Mci Status

func ListMciStatus

func ListMciStatus(nsId string) ([]MciStatusInfo, error)

ListMciStatus is func to get MCI status all

type MciSubGroupAccessInfo

type MciSubGroupAccessInfo struct {
	SubGroupId      string
	NlbListener     *TbNLBListenerInfo `json:"nlbListener,omitempty"`
	BastionVmId     string
	MciVmAccessInfo []MciVmAccessInfo
}

MciSubGroupAccessInfo is struct for MciSubGroupAccessInfo

type MciVmAccessInfo

type MciVmAccessInfo struct {
	VmId           string `json:"vmId"`
	PublicIP       string `json:"publicIP"`
	PrivateIP      string `json:"privateIP"`
	SSHPort        string `json:"sshPort"`
	PrivateKey     string `json:"privateKey,omitempty"`
	VmUserAccount  string `json:"vmUserAccount,omitempty"`
	VmUserPassword string `json:"vmUserPassword,omitempty"`
}

MciVmAccessInfo is struct for MciVmAccessInfo

type MonAgentInstallReq

type MonAgentInstallReq struct {
	NsId     string `json:"nsId,omitempty"`
	MciId    string `json:"mciId,omitempty"`
	VmId     string `json:"vmId,omitempty"`
	PublicIp string `json:"publicIp,omitempty"`
	Port     string `json:"port,omitempty"`
	UserName string `json:"userName,omitempty"`
	SshKey   string `json:"sshKey,omitempty"`
	CspType  string `json:"cspType,omitempty"`
}

MonAgentInstallReq struct

type MonResultSimple

type MonResultSimple struct {
	Metric string `json:"metric"`
	VmId   string `json:"vmId"`
	Value  string `json:"value"`
	Err    string `json:"err"`
}

MonResultSimple struct is for containing vm monitoring results

type MonResultSimpleResponse

type MonResultSimpleResponse struct {
	NsId          string            `json:"nsId"`
	MciId         string            `json:"mciId"`
	MciMonitoring []MonResultSimple `json:"mciMonitoring"`
}

MonResultSimpleResponse struct is for containing Mci monitoring results

func GetMonitoringData

func GetMonitoringData(nsId string, mciId string, metric string) (MonResultSimpleResponse, error)

GetMonitoringData func retrieves monitoring data from cb-dragonfly

type MultihostBenchmarkReq

type MultihostBenchmarkReq struct {
	Multihost []BenchmarkReq `json:"multihost"`
}

MultihostBenchmarkReq is struct for MultihostBenchmarkReq

type NLBListenerReq

type NLBListenerReq struct {
	Protocol string `json:"protocol" example:"TCP"` // TCP|UDP
	Port     string `json:"port" example:"80"`      // 1-65535
}

NLBListenerReq is a struct to handle NLB Listener information of the CB-Spider's & CB-Tumblebug's REST API request

type Operation

type Operation struct {
	Operator string `json:"operator" example:"<=" enums:">=,<=,=="` // >=, <=, ==
	Operand  string `json:"operand" example:"4" enums:"4,8,.."`     // 10, 70, 80, 98, ...
}

Operation is struct for .

type ParameterKeyVal

type ParameterKeyVal struct {
	Key string   `json:"key" example:"coordinateClose" enums:"coordinateClose,coordinateWithin,coordinateFair"` // coordinate
	Val []string `json:"val" example:"44.146838/-116.411403"`                                                   // ["Latitude,Longitude","12,543",..,"31,433"]
}

Operation is struct for .

type Policy

type Policy struct {
	AutoCondition AutoCondition `json:"autoCondition"`
	AutoAction    AutoAction    `json:"autoAction"`
	Status        string        `json:"status"`
}

Policy is struct for MCI auto-control Policy request that includes AutoCondition, AutoAction, Status.

type PriorityCondition

type PriorityCondition struct {
	Metric    string            `json:"metric" example:"location" enums:"location,cost,random,performance,latency"`
	Weight    string            `json:"weight" example:"0.3" enums:"0.1,0.2,..."`
	Parameter []ParameterKeyVal `json:"parameter,omitempty"`
}

FilterCondition is struct for .

type PriorityInfo

type PriorityInfo struct {
	Policy []PriorityCondition `json:"policy"`
}

PriorityInfo is struct for .

type RegionInfo

type RegionInfo struct {
	Region string
	Zone   string
}

RegionInfo is struct for region information

type RegisterResourceAllResult

type RegisterResourceAllResult struct {
	ElapsedTime           int                      `json:"elapsedTime"`
	RegisteredConnection  int                      `json:"registeredConnection"`
	AvailableConnection   int                      `json:"availableConnection"`
	RegisterationOverview registerationOverview    `json:"registerationOverview"`
	RegisterationResult   []RegisterResourceResult `json:"registerationResult"`
}

RegisterResourceAllResult is struct for Register Csp Native Resource Result for All Clouds

func RegisterCspNativeResourcesAll

func RegisterCspNativeResourcesAll(nsId string, mciId string, option string, mciFlag string) (RegisterResourceAllResult, error)

RegisterCspNativeResourcesAll func registers all CSP-native resources into CB-TB

type RegisterResourceResult

type RegisterResourceResult struct {
	ConnectionName        string                `json:"connectionName"`
	SystemMessage         string                `json:"systemMessage"`
	ElapsedTime           int                   `json:"elapsedTime"`
	RegisterationOverview registerationOverview `json:"registerationOverview"`
	RegisterationOutputs  common.IdList         `json:"registerationOutputs"`
}

RegisterResourceResult is struct for Register Csp Native Resource Result

func RegisterCspNativeResources

func RegisterCspNativeResources(nsId string, connConfig string, mciId string, option string, mciFlag string) (RegisterResourceResult, error)

RegisterCspNativeResources func registers all CSP-native resources into CB-TB

type SpecBenchmarkInfo

type SpecBenchmarkInfo struct {
	SpecId     string `json:"specid"`
	Cpus       string `json:"cpus"`
	Cpum       string `json:"cpum"`
	MemR       string `json:"memR"`
	MemW       string `json:"memW"`
	FioR       string `json:"fioR"`
	FioW       string `json:"fioW"`
	DbR        string `json:"dbR"`
	DbW        string `json:"dbW"`
	Rtt        string `json:"rtt"`
	EvaledTime string `json:"evaledTime"`
}

SpecBenchmarkInfo is struct for SpecBenchmarkInfo

type SpiderAccessInfo

type SpiderAccessInfo struct {
	Endpoint   string // ex) https://1.2.3.4:6443
	Kubeconfig string
}

SpiderAccessInfo is a struct to handle Cluster Access information from the CB-Spider's REST API response

type SpiderAddonsInfo

type SpiderAddonsInfo struct {
	KeyValueList []common.KeyValue
}

SpiderAddonsInfo is a struct to handle Cluster Addons information from the CB-Spider's REST API response

type SpiderAllList

type SpiderAllList struct {
	MappedList     []SpiderNameIdSystemId
	OnlySpiderList []SpiderNameIdSystemId
	OnlyCSPList    []SpiderNameIdSystemId
}

type SpiderAllListWrapper

type SpiderAllListWrapper struct {
	AllList SpiderAllList
}

type SpiderChangeAutoscaleSizeReq

type SpiderChangeAutoscaleSizeReq struct {
	ConnectionName string
	ReqInfo        SpiderChangeAutoscaleSizeReqInfo
}

SpiderChangeAutoscaleSizeReq is a wrapper struct to create JSON body of 'Change Autoscale Size' request.

type SpiderChangeAutoscaleSizeReqInfo

type SpiderChangeAutoscaleSizeReqInfo struct {
	DesiredNodeSize string
	MinNodeSize     string
	MaxNodeSize     string
}

SpiderChangeAutoscaleSizeReqInfo is a wrapper struct to create JSON body of 'Change Autoscale Size' request.

type SpiderChangeAutoscaleSizeRes

type SpiderChangeAutoscaleSizeRes struct {
	ConnectionName string
	NodeGroupInfo  SpiderNodeGroupInfo
}

SpiderChangeAutoscaleSizeRes is a wrapper struct to get JSON body of 'Change Autoscale Size' response

type SpiderClusterInfo

type SpiderClusterInfo struct {
	IId common.IID // {NameId, SystemId}

	Version string // Kubernetes Version, ex) 1.23.3
	Network SpiderNetworkInfo

	NodeGroupList []SpiderNodeGroupInfo
	AccessInfo    SpiderAccessInfo
	Addons        SpiderAddonsInfo

	Status SpiderClusterStatus

	CreatedTime  time.Time
	KeyValueList []common.KeyValue
}

SpiderClusterInfo is a struct to handle Cluster information from the CB-Spider's REST API response

type SpiderClusterReq

type SpiderClusterReq struct {
	NameSpace      string // should be empty string from Tumblebug
	ConnectionName string
	ReqInfo        SpiderClusterReqInfo
}

SpiderClusterReq is a wrapper struct to create JSON body of 'Create Cluster request'

type SpiderClusterReqInfo

type SpiderClusterReqInfo struct {
	// (1) Cluster Info
	Name    string
	Version string

	// (2) Network Info
	VPCName            string
	SubnetNames        []string
	SecurityGroupNames []string

	// (3) NodeGroupInfo List
	NodeGroupList []SpiderNodeGroupReqInfo
}

SpiderClusterReqInfo is a struct to create JSON body of 'Create Cluster request'

type SpiderClusterRes

type SpiderClusterRes struct {
	ConnectionName string
	ClusterInfo    SpiderClusterInfo
}

SpiderClusterRes is a wrapper struct to handle a Cluster information from the CB-Spider's REST API response

type SpiderClusterStatus

type SpiderClusterStatus string
const (
	SpiderClusterCreating SpiderClusterStatus = "Creating"
	SpiderClusterActive   SpiderClusterStatus = "Active"
	SpiderClusterInactive SpiderClusterStatus = "Inactive"
	SpiderClusterUpdating SpiderClusterStatus = "Updating"
	SpiderClusterDeleting SpiderClusterStatus = "Deleting"
)

type SpiderImageType

type SpiderImageType string
const (
	PublicImage SpiderImageType = "PublicImage"
	MyImage     SpiderImageType = "MyImage"
)

type SpiderNLBAddRemoveVMReqInfoWrapper

type SpiderNLBAddRemoveVMReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderNLBSubGroupReq
}

SpiderNLBAddRemoveVMReqInfoWrapper is a wrapper struct to create JSON body of 'Add/Remove VMs to/from NLB' request

type SpiderNLBHealthCheckerInfo

type SpiderNLBHealthCheckerInfo struct {
	Protocol  string `json:"protocol" example:"TCP"` // TCP|HTTP|HTTPS
	Port      string `json:"port" example:"22"`      // Listener Port or 1-65535
	Interval  int    `json:"interval" example:"10"`  // secs, Interval time between health checks.
	Timeout   int    `json:"timeout" example:"10"`   // secs, Waiting time to decide an unhealthy VM when no response.
	Threshold int    `json:"threshold" example:"3"`  // num, The number of continuous health checks to change the VM status.

	CspID        string            `json:"cspID"` // Optional, May be Used by Driver.
	KeyValueList []common.KeyValue `json:"keyValueList"`
}

type SpiderNLBHealthCheckerReq

type SpiderNLBHealthCheckerReq struct {
	Protocol  string `json:"protocol" example:"TCP"`      // TCP|HTTP|HTTPS
	Port      string `json:"port" example:"22"`           // Listener Port or 1-65535
	Interval  string `json:"interval" example:"default"`  // secs, Interval time between health checks.
	Timeout   string `json:"timeout" example:"default"`   // secs, Waiting time to decide an unhealthy VM when no response.
	Threshold string `json:"threshold" example:"default"` // num, The number of continuous health checks to change the VM status.
}

type SpiderNLBHealthInfo

type SpiderNLBHealthInfo struct {
	AllVMs       *[]common.IID
	HealthyVMs   *[]common.IID
	UnHealthyVMs *[]common.IID
}

type SpiderNLBHealthInfoWrapper

type SpiderNLBHealthInfoWrapper struct {
	Healthinfo SpiderNLBHealthInfo
}

type SpiderNLBInfo

type SpiderNLBInfo struct {
	IId    common.IID // {NameId, SystemId}
	VpcIID common.IID // {NameId, SystemId}

	Type  string // PUBLIC(V) | INTERNAL
	Scope string // REGION(V) | GLOBAL

	//------ Frontend
	Listener SpiderNLBListenerInfo

	//------ Backend
	VMGroup       SpiderNLBSubGroupInfo
	HealthChecker SpiderNLBHealthCheckerInfo

	CreatedTime  time.Time
	KeyValueList []common.KeyValue
}

SpiderNLBInfo is a struct to handle NLB information from the CB-Spider's REST API response

type SpiderNLBListenerInfo

type SpiderNLBListenerInfo struct {
	Protocol string `json:"protocol" example:"TCP"` // TCP|UDP
	IP       string `json:"ip" example:""`          // Auto Generated and attached
	Port     string `json:"port" example:"80"`      // 1-65535
	DNSName  string `json:"dnsName" example:""`     // Optional, Auto Generated and attached

	CspID        string            `json:"cspID"` // Optional, May be Used by Driver.
	KeyValueList []common.KeyValue `json:"keyValueList"`
}

SpiderNLBListenerInfo is a struct to handle NLB Listener information from the CB-Spider's REST API response

type SpiderNLBReqInfo

type SpiderNLBReqInfo struct {
	Name    string
	VPCName string
	Type    string // PUBLIC(V) | INTERNAL
	Scope   string // REGION(V) | GLOBAL

	Listener NLBListenerReq

	VMGroup       SpiderNLBSubGroupReq
	HealthChecker SpiderNLBHealthCheckerReq
}

SpiderNLBReqInfo is a struct to create JSON body of 'Create NLB request'

type SpiderNLBReqInfoWrapper

type SpiderNLBReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderNLBReqInfo
}

SpiderNLBReqInfoWrapper is a wrapper struct to create JSON body of 'Create NLB request'

type SpiderNLBSubGroupInfo

type SpiderNLBSubGroupInfo struct {
	Protocol string // TCP|UDP|HTTP|HTTPS
	Port     string // 1-65535
	VMs      *[]common.IID

	CspID        string            `json:"cspID"` // Optional, May be Used by Driver.
	KeyValueList []common.KeyValue `json:"keyValueList"`
}

SpiderNLBSubGroupInfo is a struct from NLBSubGroupInfo from Spider

type SpiderNLBSubGroupReq

type SpiderNLBSubGroupReq struct {
	Protocol string // TCP|HTTP|HTTPS
	Port     string // Listener Port or 1-65535
	VMs      []string
}

type SpiderNameIdSystemId

type SpiderNameIdSystemId struct {
	NameId   string
	SystemId string
}

type SpiderNetworkInfo

type SpiderNetworkInfo struct {
	VpcIID            common.IID // {NameId, SystemId}
	SubnetIIDs        []common.IID
	SecurityGroupIIDs []common.IID

	KeyValueList []common.KeyValue
}

SpiderNetworkInfo is a struct to handle Cluster Network information from the CB-Spider's REST API response

type SpiderNodeGroupInfo

type SpiderNodeGroupInfo struct {
	IId common.IID // {NameId, SystemId}

	// VM config.
	ImageIID     common.IID
	VMSpecName   string
	RootDiskType string // "SSD(gp2)", "Premium SSD", ...
	RootDiskSize string // "", "default", "50", "1000" (GB)
	KeyPairIID   common.IID

	// Scaling config.
	OnAutoScaling   bool // default: true
	DesiredNodeSize int
	MinNodeSize     int
	MaxNodeSize     int

	Status SpiderNodeGroupStatus
	Nodes  []common.IID

	KeyValueList []common.KeyValue
}

SpiderNodeGroupInfo is a struct to handle Cluster Node Group information from the CB-Spider's REST API response

type SpiderNodeGroupReq

type SpiderNodeGroupReq struct {
	NameSpace      string // should be empty string from Tumblebug
	ConnectionName string
	ReqInfo        SpiderNodeGroupReqInfo
}

SpiderNodeGroupReq is a wrapper struct to create JSON body of 'Add NodeGroup' request

type SpiderNodeGroupReqInfo

type SpiderNodeGroupReqInfo struct {
	Name         string
	ImageName    string
	VMSpecName   string
	RootDiskType string
	RootDiskSize string
	KeyPairName  string

	// autoscale config.
	OnAutoScaling   string
	DesiredNodeSize string
	MinNodeSize     string
	MaxNodeSize     string
}

SpiderNodeGroupReqInfo is a wrapper struct to create JSON body of 'Add NodeGroup' request

type SpiderNodeGroupStatus

type SpiderNodeGroupStatus string
const (
	SpiderNodeGroupCreating SpiderNodeGroupStatus = "Creating"
	SpiderNodeGroupActive   SpiderNodeGroupStatus = "Active"
	SpiderNodeGroupInactive SpiderNodeGroupStatus = "Inactive"
	SpiderNodeGroupUpdating SpiderNodeGroupStatus = "Updating"
	SpiderNodeGroupDeleting SpiderNodeGroupStatus = "Deleting"
)

type SpiderSetAutoscalingReq

type SpiderSetAutoscalingReq struct {
	ConnectionName string
	ReqInfo        SpiderSetAutoscalingReqInfo
}

SpiderSetAutoscalingReq is a wrapper struct to create JSON body of 'Set Autoscaling On/Off' request.

type SpiderSetAutoscalingReqInfo

type SpiderSetAutoscalingReqInfo struct {
	OnAutoScaling string
}

SpiderSetAutoscalingReqInfo is a wrapper struct to create JSON body of 'Set Autoscaling On/Off' request.

type SpiderSetAutoscalingRes

type SpiderSetAutoscalingRes struct {
	Result string
}

SpiderSetAutoscalingRes is a wrapper struct to create JSON body of 'Set Autoscaling On/Off' response.

type SpiderUpgradeClusterReq

type SpiderUpgradeClusterReq struct {
	NameSpace      string // should be empty string from Tumblebug
	ConnectionName string
	ReqInfo        SpiderUpgradeClusterReqInfo
}

SpiderUpgradeClusterReq is a wrapper struct to create JSON body of 'Upgrade Cluster' request

type SpiderUpgradeClusterReqInfo

type SpiderUpgradeClusterReqInfo struct {
	Version string
}

SpiderUpgradeClusterReqInfo is a wrapper struct to create JSON body of 'Upgrade Cluster' request

type SpiderVMInfo

type SpiderVMInfo struct {
	// Fields for request
	Name               string
	ImageName          string
	VPCName            string
	SubnetName         string
	SecurityGroupNames []string
	KeyPairName        string
	CSPid              string // VM ID given by CSP (required for registering VM)
	DataDiskNames      []string

	// Fields for both request and response
	VMSpecName   string // instance type or flavour, etc... ex) t2.micro or f1.micro
	VMUserId     string // ex) user1
	VMUserPasswd string
	RootDiskType string // "SSD(gp2)", "Premium SSD", ...
	RootDiskSize string // "default", "50", "1000" (GB)
	ImageType    SpiderImageType

	// Fields for response
	IId               common.IID // {NameId, SystemId}
	ImageIId          common.IID
	VpcIID            common.IID
	SubnetIID         common.IID   // AWS, ex) subnet-8c4a53e4
	SecurityGroupIIds []common.IID // AWS, ex) sg-0b7452563e1121bb6
	KeyPairIId        common.IID
	DataDiskIIDs      []common.IID
	StartTime         time.Time
	Region            RegionInfo //  ex) {us-east1, us-east1-c} or {ap-northeast-2}
	NetworkInterface  string     // ex) eth0
	PublicIP          string
	PublicDNS         string
	PrivateIP         string
	PrivateDNS        string
	RootDeviceName    string // "/dev/sda1", ...
	SSHAccessPoint    string
	KeyValueList      []common.KeyValue
}

Ref: cb-spider/cloud-control-manager/cloud-driver/interfaces/resources/VMHandler.go SpiderVMInfo is struct from CB-Spider for VM information

type SpiderVMReqInfoWrapper

type SpiderVMReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderVMInfo
}

SpiderVMReqInfoWrapper is struct from CB-Spider (VMHandler.go) for wrapping SpiderVMInfo

type SshCmdResult

type SshCmdResult struct {
	MciId   string         `json:"mciId"`
	VmId    string         `json:"vmId"`
	VmIp    string         `json:"vmIp"`
	Command map[int]string `json:"command"`
	Stdout  map[int]string `json:"stdout"`
	Stderr  map[int]string `json:"stderr"`
	Err     error          `json:"err"`
}

SshCmdResult is struct for SshCmd Result

func InstallBenchmarkAgentToMci

func InstallBenchmarkAgentToMci(nsId string, mciId string, req *MciCmdReq, option string) ([]SshCmdResult, error)

InstallBenchmarkAgentToMci is func to install milkyway agents in MCI

func RemoteCommandToMci

func RemoteCommandToMci(nsId string, mciId string, subGroupId string, vmId string, req *MciCmdReq) ([]SshCmdResult, error)

RemoteCommandToMci is func to command to all VMs in MCI by SSH

type StatusCountInfo

type StatusCountInfo struct {

	// CountTotal is for Total VMs
	CountTotal int `json:"countTotal"`

	// CountCreating is for counting Creating
	CountCreating int `json:"countCreating"`

	// CountRunning is for counting Running
	CountRunning int `json:"countRunning"`

	// CountFailed is for counting Failed
	CountFailed int `json:"countFailed"`

	// CountSuspended is for counting Suspended
	CountSuspended int `json:"countSuspended"`

	// CountRebooting is for counting Rebooting
	CountRebooting int `json:"countRebooting"`

	// CountTerminated is for counting Terminated
	CountTerminated int `json:"countTerminated"`

	// CountSuspending is for counting Suspending
	CountSuspending int `json:"countSuspending"`

	// CountResuming is for counting Resuming
	CountResuming int `json:"countResuming"`

	// CountTerminating is for counting Terminating
	CountTerminating int `json:"countTerminating"`

	// CountUndefined is for counting Undefined
	CountUndefined int `json:"countUndefined"`
}

StatusCountInfo is struct to count the number of VMs in each status. ex: Running=4, Suspended=8.

type TbChangeK8sNodeGroupAutoscaleSizeReq

type TbChangeK8sNodeGroupAutoscaleSizeReq struct {
	DesiredNodeSize string `json:"desiredNodeSize" example:"1"`
	MinNodeSize     string `json:"minNodeSize" example:"1"`
	MaxNodeSize     string `json:"maxNodeSize" example:"3"`
}

TbChangeK8sNodeGroupAutoscaleSizeReq is a struct to handle 'Change K8sNodeGroup's Autoscale Size' request toward CB-Tumblebug.

type TbChangeK8sNodeGroupAutoscaleSizeRes

type TbChangeK8sNodeGroupAutoscaleSizeRes struct {
	TbK8sNodeGroupInfo
}

TbChangeK8sNodeGroupAutoscaleSizeRes is a struct to handle 'Change K8sNodeGroup's Autoscale Size' response from CB-Tumblebug.

func ChangeK8sNodeGroupAutoscaleSize

func ChangeK8sNodeGroupAutoscaleSize(nsId string, k8sClusterId string, k8sNodeGroupName string, u *TbChangeK8sNodeGroupAutoscaleSizeReq) (TbChangeK8sNodeGroupAutoscaleSizeRes, error)

ChangeK8sNodeGroupAutoscaleSize change NodeGroup's Autoscaling Size

type TbIdNameInDetailInfo

type TbIdNameInDetailInfo struct {
	IdInTb    string `json:"idInTb"`
	IdInSp    string `json:"idInSp"`
	IdInCsp   string `json:"idInCsp"`
	NameInCsp string `json:"nameInCsp"`
}

TbVmIdNameInDetailInfo is struct for details related with ID and Name

func GetVmIdNameInDetail

func GetVmIdNameInDetail(nsId string, mciId string, vmId string) (*TbIdNameInDetailInfo, error)

GetVmIdNameInDetail is func to get ID and Name details

type TbInspectResourcesResponse

type TbInspectResourcesResponse struct {
	InspectResources []InspectResource `json:"inspectResources"`
}

TbInspectResourcesResponse is struct for response of InspectResources request

type TbK8sAccessInfo

type TbK8sAccessInfo struct {
	Endpoint   string `json:"endpoint" example:"http://1.2.3.4:6443"`
	Kubeconfig string `json:"kubeconfig" example:"apiVersion: v1\nclusters:\n- cluster:\n certificate-authority-data: LS0..."`
}

TbK8sAccessInfo is a struct to handle K8sCluster Access information from the CB-Tumblebug's REST API response

type TbK8sAddonsInfo

type TbK8sAddonsInfo struct {
	KeyValueList []common.KeyValue `json:"keyValueList"`
}

TbK8sAddonsInfo is a struct to handle K8sCluster Addons information from the CB-Tumblebug's REST API response

type TbK8sClusterInfo

type TbK8sClusterInfo struct {
	Id             string `json:"id" example:"k8scluster-01"`
	Name           string `json:"name" example:"k8scluster-01"`
	ConnectionName string `json:"connectionName" example:"alibaba-ap-northeast-2"`

	Version string `json:"version" example:"1.30.1-aliyun.1"` // Kubernetes Version, ex) 1.23.3
	Network TbK8sClusterNetworkInfo

	K8sNodeGroupList []TbK8sNodeGroupInfo
	AccessInfo       TbK8sAccessInfo
	Addons           TbK8sAddonsInfo

	Status TbK8sClusterStatus `json:"status" example:"Creating"` // Creating, Active, Inactive, Updating, Deleting

	CreatedTime  time.Time         `json:"createdTime" example:"1970-01-01T00:00:00.00Z"`
	KeyValueList []common.KeyValue `json:"keyValueList"`

	Description       string `json:"description" example:"My K8sCluster"`
	CspK8sClusterId   string `json:"cspK8sClusterId" example:"c123456789012345678901234567890"`
	CspK8sClusterName string `json:"cspK8sClusterName" example:"default-k8scluster-01"`

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// SystemLabel is for describing the MCIR in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`
}

TbK8sClusterInfo is a struct that represents TB K8sCluster object.

func AddK8sNodeGroup

func AddK8sNodeGroup(nsId string, k8sClusterId string, u *TbK8sNodeGroupReq) (TbK8sClusterInfo, error)

AddK8sNodeGroup adds a NodeGroup

func CreateK8sCluster

func CreateK8sCluster(nsId string, u *TbK8sClusterReq, option string) (TbK8sClusterInfo, error)

CreateK8sCluster create a k8s cluster

func GetK8sCluster

func GetK8sCluster(nsId string, k8sClusterId string) (TbK8sClusterInfo, error)

GetK8sCluster retrives a k8s cluster information

func UpgradeK8sCluster

func UpgradeK8sCluster(nsId string, k8sClusterId string, u *TbUpgradeK8sClusterReq) (TbK8sClusterInfo, error)

UpgradeK8sCluster upgrades an existing k8s cluster to the specified version

type TbK8sClusterNetworkInfo

type TbK8sClusterNetworkInfo struct {
	VNetId           string   `json:"vNetId" example:"vpc-01"`
	SubnetIds        []string `json:"subnetIds" example:"subnet-01"`
	SecurityGroupIds []string `json:"securityGroupIds" example:"sg-01"`

	KeyValueList []common.KeyValue `json:"keyValueList"`
}

TbK8sClusterNetworkInfo is a struct to handle K8sCluster Network information from the CB-Tumblebug's REST API response

type TbK8sClusterReq

type TbK8sClusterReq struct {
	//Namespace      string `json:"namespace" validate:"required" example:"default"`
	ConnectionName string `json:"connectionName" validate:"required" example:"alibaba-ap-northeast-2"`
	Description    string `json:"description" example:"My K8sCluster"`

	// (1) K8sCluster Info
	Id      string `json:"id" validate:"required" example:"k8scluster-01"`
	Version string `json:"version" example:"1.30.1-aliyun.1"`

	// (2) Network Info
	VNetId           string   `json:"vNetId" validate:"required" example:"vpc-01"`
	SubnetIds        []string `json:"subnetIds" validate:"required" example:"subnet-01"`
	SecurityGroupIds []string `json:"securityGroupIds" validate:"required" example:"sg-01"`

	// (3) NodeGroupInfo List
	K8sNodeGroupList []TbK8sNodeGroupReq `json:"k8sNodeGroupList"`

	// Fields for "Register existing K8sCluster" feature
	// @description CspK8sClusterId is required to register a k8s cluster from CSP (option=register)
	CspK8sClusterId string `json:"cspK8sClusterId" example:"required when option is register"`
}

TbK8sClusterReq is a struct to handle 'Create K8sCluster' request toward CB-Tumblebug.

type TbK8sClusterStatus

type TbK8sClusterStatus string
const (
	TbK8sClusterCreating TbK8sClusterStatus = "Creating"
	TbK8sClusterActive   TbK8sClusterStatus = "Active"
	TbK8sClusterInactive TbK8sClusterStatus = "Inactive"
	TbK8sClusterUpdating TbK8sClusterStatus = "Updating"
	TbK8sClusterDeleting TbK8sClusterStatus = "Deleting"
)

type TbK8sNodeGroupInfo

type TbK8sNodeGroupInfo struct {
	Id string `json:"id" example:"ng-01"`

	// VM config.
	ImageId      string `json:"imageId" example:"image-01"`
	SpecId       string `json:"specId" example:"spec-01"`
	RootDiskType string `json:"rootDiskType" example:"cloud_essd"`
	RootDiskSize string `json:"rootDiskSize" example:"40"`
	SshKeyId     string `json:"sshKeyId" example:"sshkey-01"`

	// Scaling config.
	OnAutoScaling   bool `json:"onAutoScaling" example:"true"`
	DesiredNodeSize int  `json:"desiredNodeSize" example:"1"`
	MinNodeSize     int  `json:"minNodeSize" example:"1"`
	MaxNodeSize     int  `json:"maxNodeSize" example:"3"`

	// ---
	Status   TbK8sNodeGroupStatus `json:"status" example:"Creating"`  // Creating, Active, Inactive, Updating, Deleting
	K8sNodes []string             `json:"k8sNodes" example:"node-01"` // id for nodes

	KeyValueList []common.KeyValue `json:"keyValueList"`
}

TbK8sNodeGroupInfo is a struct to handle K8sCluster's Node Group information from the CB-Tumblebug's REST API response

type TbK8sNodeGroupReq

type TbK8sNodeGroupReq struct {
	Name         string `json:"name" example:"ng-01"`
	ImageId      string `json:"imageId" example:"image-01"`
	SpecId       string `json:"specId" example:"Standard_B2s (temporarily, CSP's Spec Names are valid. It will be upgraded)"`
	RootDiskType string `json:"rootDiskType" example:"cloud_essd" enum:"default, TYPE1, ..."` // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]
	RootDiskSize string `json:"rootDiskSize" example:"40" enum:"default, 30, 42, ..."`        // "default", Integer (GB): ["50", ..., "1000"]
	SshKeyId     string `json:"sshKeyId" example:"sshkey-01"`

	// autoscale config.
	OnAutoScaling   string `json:"onAutoScaling" example:"true"`
	DesiredNodeSize string `json:"desiredNodeSize" example:"1"`
	MinNodeSize     string `json:"minNodeSize" example:"1"`
	MaxNodeSize     string `json:"maxNodeSize" example:"3"`
}

TbK8sNodeGroupReq is a struct to handle requests related to K8sNodeGroup toward CB-Tumblebug.

type TbK8sNodeGroupStatus

type TbK8sNodeGroupStatus string
const (
	TbK8sNodeGroupCreating TbK8sNodeGroupStatus = "Creating"
	TbK8sNodeGroupActive   TbK8sNodeGroupStatus = "Active"
	TbK8sNodeGroupInactive TbK8sNodeGroupStatus = "Inactive"
	TbK8sNodeGroupUpdating TbK8sNodeGroupStatus = "Updating"
	TbK8sNodeGroupDeleting TbK8sNodeGroupStatus = "Deleting"
)

type TbMciDynamicReq

type TbMciDynamicReq struct {
	Name string `json:"name" validate:"required" example:"mci01"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"no" default:"no" enums:"yes,no"` // yes or no

	// Label is for describing the mci in a keyword (any string can be used)
	Label string `json:"label" example:"DynamicVM" default:""`

	// SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"" default:""`

	Description string `json:"description" example:"Made in CB-TB"`

	Vm []TbVmDynamicReq `json:"vm" validate:"required"`
}

TbMciDynamicReq is struct for requirements to create MCI dynamically (with default resource option)

type TbMciInfo

type TbMciInfo struct {
	Id           string          `json:"id"`
	Name         string          `json:"name"`
	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	// ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
	ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"no" enums:"yes,no"` // yes or no

	// Label is for describing the mci in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	PlacementAlgo string     `json:"placementAlgo,omitempty"`
	Description   string     `json:"description"`
	Vm            []TbVmInfo `json:"vm"`

	// List of IDs for new VMs. Return IDs if the VMs are newly added. This field should be used for return body only.
	NewVmList []string `json:"newVmList"`
}

TbMciInfo is struct for MCI info

func CreateMci

func CreateMci(nsId string, req *TbMciReq, option string) (*TbMciInfo, error)

CreateMci is func to create MCI obeject and deploy requested VMs (register CSP native VM with option=register)

func CreateMciDynamic

func CreateMciDynamic(reqID string, nsId string, req *TbMciDynamicReq, deployOption string) (*TbMciInfo, error)

CreateMciDynamic is func to create MCI obeject and deploy requested VMs in a dynamic way

func CreateMciGroupVm

func CreateMciGroupVm(nsId string, mciId string, vmRequest *TbVmReq, newSubGroup bool) (*TbMciInfo, error)

CreateMciGroupVm is func to create MCI groupVM

func CreateMciVmDynamic

func CreateMciVmDynamic(nsId string, mciId string, req *TbVmDynamicReq) (*TbMciInfo, error)

CreateMciVmDynamic is func to create requested VM in a dynamic way and add it to MCI

func CreateSystemMciDynamic

func CreateSystemMciDynamic(option string) (*TbMciInfo, error)

CreateSystemMciDynamic is func to create MCI obeject and deploy requested VMs in a dynamic way

func GetMciInfo

func GetMciInfo(nsId string, mciId string) (*TbMciInfo, error)

GetMciInfo is func to return MCI information with the current status update

func GetMciObject

func GetMciObject(nsId string, mciId string) (TbMciInfo, error)

GetMciObject is func to retrieve MCI object from database (no current status update)

func ListMciInfo

func ListMciInfo(nsId string, option string) ([]TbMciInfo, error)

ListMciInfo is func to get all MCI objects

func ScaleOutMciSubGroup

func ScaleOutMciSubGroup(nsId string, mciId string, subGroupId string, numVMsToAdd string) (*TbMciInfo, error)

ScaleOutMciSubGroup is func to create MCI groupVM

type TbMciReq

type TbMciReq struct {
	Name string `json:"name" validate:"required" example:"mci01"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"no" default:"yes" enums:"yes,no"` // yes or no

	// Label is for describing the mci in a keyword (any string can be used)
	Label string `json:"label" example:"custom tag" default:""`

	// SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"" default:""`

	PlacementAlgo string `json:"placementAlgo,omitempty"`
	Description   string `json:"description" example:"Made in CB-TB"`

	Vm []TbVmReq `json:"vm" validate:"required"`
}

TbMciReq is struct for requirements to create MCI

type TbNLBAddRemoveVMReq

type TbNLBAddRemoveVMReq struct {
	TargetGroup TbNLBTargetGroupInfo `json:"targetGroup"`
}

TbNLBAddRemoveVMReq is a struct to handle 'Add/Remove VMs to/from NLB' request toward CB-Tumblebug.

type TbNLBHealthCheckerInfo

type TbNLBHealthCheckerInfo struct {
	Protocol  string `json:"protocol" example:"TCP"` // TCP|HTTP|HTTPS
	Port      string `json:"port" example:"22"`      // Listener Port or 1-65535
	Interval  int    `json:"interval" example:"10"`  // secs, Interval time between health checks.
	Timeout   int    `json:"timeout" example:"10"`   // secs, Waiting time to decide an unhealthy VM when no response.
	Threshold int    `json:"threshold" example:"3"`  // num, The number of continuous health checks to change the VM status.

	KeyValueList []common.KeyValue `json:"keyValueList"`
}

type TbNLBHealthCheckerReq

type TbNLBHealthCheckerReq struct {
	Interval  string `json:"interval" example:"default"`  // secs, Interval time between health checks.
	Timeout   string `json:"timeout" example:"default"`   // secs, Waiting time to decide an unhealthy VM when no response.
	Threshold string `json:"threshold" example:"default"` // num, The number of continuous health checks to change the VM status.
}

type TbNLBHealthInfo

type TbNLBHealthInfo struct {
	AllVMs       []string
	HealthyVMs   []string
	UnHealthyVMs []string
}

func GetNLBHealth

func GetNLBHealth(nsId string, mciId string, nlbId string) (TbNLBHealthInfo, error)

GetNLBHealth queries the health status of NLB to CB-Spider, and returns it to user

type TbNLBInfo

type TbNLBInfo struct {
	Id             string `json:"id"`
	Name           string `json:"name"`
	ConnectionName string `json:"connectionName"`

	Type  string // PUBLIC(V) | INTERNAL
	Scope string // REGION(V) | GLOBAL

	Listener TbNLBListenerInfo `json:"listener"`

	TargetGroup   TbNLBTargetGroupInfo   `json:"targetGroup"`
	HealthChecker TbNLBHealthCheckerInfo `json:"healthChecker"`

	CreatedTime time.Time

	Description          string            `json:"description"`
	CspNLBId             string            `json:"cspNLBId"`
	CspNLBName           string            `json:"cspNLBName"`
	Status               string            `json:"status"`
	KeyValueList         []common.KeyValue `json:"keyValueList"`
	AssociatedObjectList []string          `json:"associatedObjectList"`
	IsAutoGenerated      bool              `json:"isAutoGenerated"`
	Location             common.Location   `json:"location"`

	// SystemLabel is for describing the MCIR in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`
}

TbNLBInfo is a struct that represents TB nlb object.

func AddNLBVMs

func AddNLBVMs(nsId string, mciId string, resourceId string, u *TbNLBAddRemoveVMReq) (TbNLBInfo, error)

AddNLBVMs accepts VM addition request, adds VM to NLB, and returns an updated TB NLB object

func CreateNLB

func CreateNLB(nsId string, mciId string, u *TbNLBReq, option string) (TbNLBInfo, error)

CreateNLB accepts nlb creation request, creates and returns an TB nlb object

func GetNLB

func GetNLB(nsId string, mciId string, resourceId string) (TbNLBInfo, error)

GetNLB returns the requested TB NLB object

type TbNLBListenerInfo

type TbNLBListenerInfo struct {
	Protocol string `json:"protocol" example:"TCP"`                                               // TCP|UDP
	IP       string `json:"ip" example:"x.x.x.x"`                                                 // Auto Generated and attached
	Port     string `json:"port" example:"80"`                                                    // 1-65535
	DNSName  string `json:"dnsName" example:"default-group-cd3.elb.ap-northeast-2.amazonaws.com"` // Optional, Auto Generated and attached

	KeyValueList []common.KeyValue `json:"keyValueList"`
}

TbNLBListenerInfo is a struct to handle NLB Listener information from the CB-Tumblebug's REST API response

type TbNLBReq

type TbNLBReq struct {
	Description string `json:"description"`
	// Existing NLB (used only for option=register)
	CspNLBId string `json:"cspNLBId"`

	Type  string `json:"type" validate:"required" enums:"PUBLIC,INTERNAL" example:"PUBLIC"` // PUBLIC(V) | INTERNAL
	Scope string `json:"scope" validate:"required" enums:"REGION,GLOBAL" example:"REGION"`  // REGION(V) | GLOBAL

	// Frontend
	Listener NLBListenerReq `json:"listener" validate:"required"`
	// Backend
	TargetGroup TbNLBTargetGroupReq `json:"targetGroup" validate:"required"`
	// HealthChecker
	HealthChecker TbNLBHealthCheckerReq `json:"healthChecker" validate:"required"`
}

TbNLBReq is a struct to handle 'Create nlb' request toward CB-Tumblebug.

type TbNLBTargetGroupInfo

type TbNLBTargetGroupInfo struct {
	Protocol string `json:"protocol" example:"TCP"` // TCP|HTTP|HTTPS
	Port     string `json:"port" example:"80"`      // Listener Port or 1-65535

	SubGroupId string   `json:"subGroupId" example:"g1"`
	VMs        []string `json:"vms"`

	KeyValueList []common.KeyValue
}

type TbNLBTargetGroupReq

type TbNLBTargetGroupReq struct {
	Protocol   string `json:"protocol" example:"TCP"` // TCP|HTTP|HTTPS
	Port       string `json:"port" example:"80"`      // Listener Port or 1-65535
	SubGroupId string `json:"subGroupId" example:"g1"`
}

type TbScaleOutSubGroupReq

type TbScaleOutSubGroupReq struct {
	// Define addtional VMs to scaleOut
	NumVMsToAdd string `json:"numVMsToAdd" validate:"required" example:"2"`
}

TbVmReq is struct to get requirements to create a new server instance

type TbSetK8sNodeGroupAutoscalingReq

type TbSetK8sNodeGroupAutoscalingReq struct {
	OnAutoScaling string `json:"onAutoScaling" example:"true"`
}

TbSetK8sNodeGroupAutoscalingReq is a struct to handle 'Set K8sNodeGroup's Autoscaling' request toward CB-Tumblebug.

type TbSetK8sNodeGroupAutoscalingRes

type TbSetK8sNodeGroupAutoscalingRes struct {
	Result string `json:"result" example:"true"`
}

TbSetK8sNodeGroupAutoscalingRes is a struct to handle 'Set K8sNodeGroup's Autoscaling' response from CB-Tumblebug.

func SetK8sNodeGroupAutoscaling

func SetK8sNodeGroupAutoscaling(nsId string, k8sClusterId string, k8sNodeGroupName string, u *TbSetK8sNodeGroupAutoscalingReq) (TbSetK8sNodeGroupAutoscalingRes, error)

SetK8sNodeGroupAutoscaling set NodeGroup's Autoscaling On/Off

type TbSubGroupInfo

type TbSubGroupInfo struct {
	Id           string   `json:"id"`
	Name         string   `json:"name"`
	VmId         []string `json:"vmId"`
	SubGroupSize string   `json:"subGroupSize"`
}

TbSubGroupInfo is struct to define an object that includes homogeneous VMs

type TbUpgradeK8sClusterReq

type TbUpgradeK8sClusterReq struct {
	Version string `json:"version" example:"1.30.1-alyun.1"`
}

TbUpgradeK8sClusterReq is a struct to handle 'Upgrade K8sCluster' request toward CB-Tumblebug.

type TbVmDynamicReq

type TbVmDynamicReq struct {
	// VM name or subGroup name if is (not empty) && (> 0). If it is a group, actual VM name will be generated with -N postfix.
	Name string `json:"name" example:"g1-1"`

	// if subGroupSize is (not empty) && (> 0), subGroup will be generated. VMs will be created accordingly.
	SubGroupSize string `json:"subGroupSize" example:"3" default:"1"`

	Label string `json:"label" example:"DynamicVM"`

	Description string `json:"description" example:"Description"`

	// CommonSpec is field for id of a spec in common namespace
	CommonSpec string `json:"commonSpec" validate:"required" example:"aws+ap-northeast-2+t2.small"`
	// CommonImage is field for id of a image in common namespace
	CommonImage string `json:"commonImage" validate:"required" example:"ubuntu18.04"`

	RootDiskType string `json:"rootDiskType,omitempty" example:"default, TYPE1, ..." default:"default"`  // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_essd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]
	RootDiskSize string `json:"rootDiskSize,omitempty" example:"default, 30, 42, ..." default:"default"` // "default", Integer (GB): ["50", ..., "1000"]

	VmUserPassword string `json:"vmUserPassword,omitempty" default:""`
	// if ConnectionName is given, the VM tries to use associtated credential.
	// if not, it will use predefined ConnectionName in Spec objects
	ConnectionName string `json:"connectionName,omitempty" default:""`
}

TbVmDynamicReq is struct to get requirements to create a new server instance dynamically (with default resource option)

type TbVmInfo

type TbVmInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	IdByCSP string `json:"idByCSP"` // CSP managed ID or Name

	// defined if the VM is in a group
	SubGroupId string `json:"subGroupId"`

	Location common.Location `json:"location"`

	// Required by CB-Tumblebug
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// NetworkAgent status
	NetworkAgentStatus string `json:"networkAgentStatus" example:"[notInstalled, installing, installed, failed]"` // notInstalled, installing, installed, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	Label       string `json:"label"`
	Description string `json:"description"`

	Region         RegionInfo `json:"region"` // AWS, ex) {us-east1, us-east1-c} or {ap-northeast-2}
	PublicIP       string     `json:"publicIP"`
	SSHPort        string     `json:"sshPort"`
	PublicDNS      string     `json:"publicDNS"`
	PrivateIP      string     `json:"privateIP"`
	PrivateDNS     string     `json:"privateDNS"`
	RootDiskType   string     `json:"rootDiskType"`
	RootDiskSize   string     `json:"rootDiskSize"`
	RootDeviceName string     `json:"rootDeviceName"`

	ConnectionName   string            `json:"connectionName"`
	ConnectionConfig common.ConnConfig `json:"connectionConfig"`
	SpecId           string            `json:"specId"`
	ImageId          string            `json:"imageId"`
	VNetId           string            `json:"vNetId"`
	SubnetId         string            `json:"subnetId"`
	SecurityGroupIds []string          `json:"securityGroupIds"`
	DataDiskIds      []string          `json:"dataDiskIds"`
	SshKeyId         string            `json:"sshKeyId"`
	VmUserAccount    string            `json:"vmUserAccount,omitempty"`
	VmUserPassword   string            `json:"vmUserPassword,omitempty"`

	CspViewVmDetail SpiderVMInfo `json:"cspViewVmDetail,omitempty"`
}

TbVmInfo is struct to define a server instance object

func AttachDetachDataDisk

func AttachDetachDataDisk(nsId string, mciId string, vmId string, command string, dataDiskId string, force bool) (TbVmInfo, error)

AttachDetachDataDisk is func to attach/detach DataDisk to/from VM

func CreateMciVm

func CreateMciVm(nsId string, mciId string, vmInfoData *TbVmInfo) (*TbVmInfo, error)

CreateMciVm is func to post (create) MciVm

func FindTbVmByCspId

func FindTbVmByCspId(nsId string, mciId string, vmIdByCsp string) (TbVmInfo, error)

func GetVmObject

func GetVmObject(nsId string, mciId string, vmId string) (TbVmInfo, error)

GetVmObject is func to get VM object

func GetVmTemplate

func GetVmTemplate(nsId string, mciId string, algo string) (TbVmInfo, error)

GetVmTemplate is func to get VM template

func ListVmInfo

func ListVmInfo(nsId string, mciId string, vmId string) (*TbVmInfo, error)

ListVmInfo is func to Get MciVm Info

func ProvisionDataDisk

func ProvisionDataDisk(nsId string, mciId string, vmId string, u *mcir.TbDataDiskVmReq) (TbVmInfo, error)

ProvisionDataDisk is func to provision DataDisk to VM (create and attach to VM)

type TbVmPriority

type TbVmPriority struct {
	Priority string          `json:"priority"`
	VmSpec   mcir.TbSpecInfo `json:"vmSpec"`
}

TbVmPriority is struct for TbVmPriority

type TbVmRecommendInfo

type TbVmRecommendInfo struct {
	VmReq          TbVmRecommendReq  `json:"vmReq"`
	VmPriority     []TbVmPriority    `json:"vmPriority"`
	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

TbVmRecommendInfo is struct for TbVmRecommendInfo

type TbVmRecommendReq

type TbVmRecommendReq struct {
	RequestName  string `json:"requestName"`
	MaxResultNum string `json:"maxResultNum"`

	VcpuSize   string `json:"vcpuSize"`
	MemorySize string `json:"memorySize"`
	DiskSize   string `json:"diskSize"`

	PlacementAlgo  string            `json:"placementAlgo"`
	PlacementParam []common.KeyValue `json:"placementParam"`
}

TbVmRecommendReq is struct for TbVmRecommendReq

type TbVmReq

type TbVmReq struct {
	// VM name or subGroup name if is (not empty) && (> 0). If it is a group, actual VM name will be generated with -N postfix.
	Name string `json:"name" validate:"required" example:"g1-1"`

	// CSP managed ID or Name (required for option=register)
	IdByCSP string `json:"idByCsp,omitempty" example:"i-014fa6ede6ada0b2c"`

	// if subGroupSize is (not empty) && (> 0), subGroup will be generated. VMs will be created accordingly.
	SubGroupSize string `json:"subGroupSize" example:"3" default:""`

	Label string `json:"label"`

	Description string `json:"description" example:"Description"`

	ConnectionName string `json:"connectionName" validate:"required" example:"testcloud01-seoul"`
	SpecId         string `json:"specId" validate:"required"`
	// ImageType        string   `json:"imageType"`
	ImageId          string   `json:"imageId" validate:"required"`
	VNetId           string   `json:"vNetId" validate:"required"`
	SubnetId         string   `json:"subnetId" validate:"required"`
	SecurityGroupIds []string `json:"securityGroupIds" validate:"required"`
	SshKeyId         string   `json:"sshKeyId" validate:"required"`
	VmUserAccount    string   `json:"vmUserAccount,omitempty"`
	VmUserPassword   string   `json:"vmUserPassword,omitempty"`
	RootDiskType     string   `json:"rootDiskType,omitempty" example:"default, TYPE1, ..."`  // "", "default", "TYPE1", AWS: ["standard", "gp2", "gp3"], Azure: ["PremiumSSD", "StandardSSD", "StandardHDD"], GCP: ["pd-standard", "pd-balanced", "pd-ssd", "pd-extreme"], ALIBABA: ["cloud_efficiency", "cloud", "cloud_ssd"], TENCENT: ["CLOUD_PREMIUM", "CLOUD_SSD"]
	RootDiskSize     string   `json:"rootDiskSize,omitempty" example:"default, 30, 42, ..."` // "default", Integer (GB): ["50", ..., "1000"]
	DataDiskIds      []string `json:"dataDiskIds"`
}

TbVmReq is struct to get requirements to create a new server instance

type TbVmSnapshotReq

type TbVmSnapshotReq struct {
	Name string `json:"name" example:"aws-ap-southeast-1-snapshot"`
}

type TbVmStatusInfo

type TbVmStatusInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	CspVmId string `json:"cspVmId"`

	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`
	NativeStatus string `json:"nativeStatus"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	PublicIp  string `json:"publicIp"`
	PrivateIp string `json:"privateIp"`
	SSHPort   string `json:"sshPort"`

	Location common.Location `json:"location"`
}

TbVmStatusInfo is to define simple information of VM with updated status

func FetchVmStatus

func FetchVmStatus(nsId string, mciId string, vmId string) (TbVmStatusInfo, error)

FetchVmStatus is func to fetch VM status (call to CSPs)

func GetMciVmStatus

func GetMciVmStatus(nsId string, mciId string, vmId string) (*TbVmStatusInfo, error)

GetMciVmStatus is func to Get MciVm Status

func GetVmCurrentPublicIp

func GetVmCurrentPublicIp(nsId string, mciId string, vmId string) (TbVmStatusInfo, error)

GetVmCurrentPublicIp is func to get VM public IP

Jump to

Keyboard shortcuts

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