mcis

package
v0.0.0-...-8f225d0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Package mcis is to manage multi-cloud infra service

Index

Constants

View Source
const (
	AttachDataDisk    string = "attach"
	DetachDataDisk    string = "detach"
	AvailableDataDisk string = "available"
)

type DataDiskCmd string

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 mcis automation

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

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

Action for mcis 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 AddVmToMcis

func AddVmToMcis(wg *sync.WaitGroup, nsId string, mcisId string, vmInfoData *TbVmInfo, option string) error

AddVmToMcis is func to add VM to MCIS

func CallGetMonitoringAsync

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

func CallMilkyway

func CallMilkyway(wg *sync.WaitGroup, vmList []string, nsId string, mcisId 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, mcisID string, mcisServiceType 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, mcisId string, 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 CheckMcis

func CheckMcis(nsId string, mcisId string) (bool, error)

func CheckMcisPolicy

func CheckMcisPolicy(nsId string, mcisId string) (bool, error)

func CheckNLB

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

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

func CheckSubGroup

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

CheckSubGroup func is to check given subGroupId is duplicated with existing

func CheckVm

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

func ControlMcisAsync

func ControlMcisAsync(nsId string, mcisId string, action string, force bool) error

ControlMcisAsync is func to control MCIS async

func ControlVm

func ControlVm(nsId string, mcisId string, vmId string, action string) error

ControlVm is func to control VM

func ControlVmAsync

func ControlVmAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, action string, results *ControlVmResultWrapper) error

ControlVmAsync is func to control VM async

func CoreGetMcisVmAction

func CoreGetMcisVmAction(nsId string, mcisId string, vmId string, action string) (string, error)

CoreGetMcisVmAction is func to Get McisVm Action

func CreateVm

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

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

func CreateVmSnapshot

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

CreateVmSnapshot is func to create VM snapshot

func DFMonAgentInstallReqStructLevelValidation

func DFMonAgentInstallReqStructLevelValidation(sl validator.StructLevel)

func DelAllMcis

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

DelAllMcis is func to delete all MCIS objects

func DelAllMcisPolicy

func DelAllMcisPolicy(nsId string) (string, error)

DelAllMcisPolicy deletes all McisPolicyInfo objects.

func DelAllNLB

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

DelAllNLB deletes all TB NLB object of given nsId

func DelMcis

func DelMcis(nsId string, mcisId string, option string) (common.IdList, error)

DelMcis is func to delete MCIS object

func DelMcisPolicy

func DelMcisPolicy(nsId string, mcisId string) error

DelMcisPolicy deletes McisPolicyInfo object by mcisId.

func DelMcisVm

func DelMcisVm(nsId string, mcisId string, vmId string, option string) error

DelMcisVm is func to delete VM object

func DelNLB

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

DelNLB deletes the TB NLB object

func Difference_dataDisks

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

func GenNLBKey

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

GenNLBKey is func to generate a key from NLB id

func GetAvailableDataDisks

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

func GetLatency

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

GetLatency func get latency between given two regions

func GetVmIp

func GetVmIp(nsId string, mcisId string, vmId string) (string, string)

GetVmIp is func to get VM IP

func GetVmListByLabel

func GetVmListByLabel(nsId string, mcisId string, label string) ([]string, error)

GetVmListByLabel is func to list VM by label

func GetVmSpecId

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

GetVmSpecId is func to get VM SpecId

func GetVmSshKey

func GetVmSshKey(nsId string, mcisId string, vmId string) (string, string, string)

GetVmSshKey is func to get VM SShKey

func GetVmStatusAsync

func GetVmStatusAsync(wg *sync.WaitGroup, nsId string, mcisId string, vmId string, results *McisStatusInfo) error

GetVmStatusAsync is func to get VM status async

func HandleMcisAction

func HandleMcisAction(nsId string, mcisId string, action string, force bool) (string, error)

HandleMcisAction is func to handle actions to MCIS

func ListMcisGroupVms

func ListMcisGroupVms(nsId string, mcisId string, groupId string) ([]string, error)

ListMcisGroupVms is func to get VM list with a SubGroup label in a specified MCIS

func ListMcisId

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

ListMcisId is func to list MCIS ID

func ListMcisPolicyId

func ListMcisPolicyId(nsId string) []string

ListMcisPolicyId returns a list of Ids for all McisPolicyInfo objects .

func ListNLB

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

ListNLB returns the list of TB NLB objects of given nsId

func ListNLBId

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

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

func ListSubGroupId

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

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

func ListVmByFilter

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

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

func ListVmId

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

ListVmId is func to list VM IDs

func OrchestrationController

func OrchestrationController()

OrchestrationController is responsible for executing MCIS 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)

// Info manage for MCIS recommendation

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 MCIS (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 RemoteCommandToMcisVm

func RemoteCommandToMcisVm(nsId string, mcisId string, vmId string, req *McisCmdReq) (string, error)

RemoteCommandToMcisVm is func to command to a VM in MCIS by SSH

func RemoveNLBVMs

func RemoveNLBVMs(nsId string, mcisId 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(vmIP string, sshPort string, userName string, privateKey string, cmd string) (*string, error)

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

func RunRemoteCommandAsync

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

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

func SetMonitoringAgentStatusInstalled

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

SetMonitoringAgentStatusInstalled is func to Set Monitoring Agent Status Installed

func TbMcisCmdReqStructLevelValidation

func TbMcisCmdReqStructLevelValidation(sl validator.StructLevel)

TbMcisCmdReqStructLevelValidation is func to validate fields in McisCmdReq

func TbMcisReqStructLevelValidation

func TbMcisReqStructLevelValidation(sl validator.StructLevel)

TbMcisReqStructLevelValidation is func to validate fields in TbMcisReqStruct

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 UpdateMcisInfo

func UpdateMcisInfo(nsId string, mcisInfoData TbMcisInfo)

UpdateMcisInfo is func to update MCIS Info (without VM info in MCIS)

func UpdateMcisPolicyInfo

func UpdateMcisPolicyInfo(nsId string, mcisPolicyInfoData McisPolicyInfo)

UpdateMcisPolicyInfo updates McisPolicyInfo object in DB.

func UpdateMonitoringAgentStatusManually

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

UpdateMonitoringAgentStatusManually is func to Update Monitoring Agent Installation Status Manually

func UpdateVmInfo

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

UpdateVmInfo is func to update VM Info

func UpdateVmPublicIp

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

UpdateVmPublicIp is func to update VM public IP

func UpdateVmSshKey

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

UpdateVmSshKey is func to update VM SShKey

func VerifySshUserName

func VerifySshUserName(nsId string, mcisId 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 {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
}

AgentInstallContent ...

type AgentInstallContentWrapper

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

AgentInstallContentWrapper ...

func ConfigureCloudAdaptiveNetwork

func ConfigureCloudAdaptiveNetwork(nsId string, mcisId string, netReq *NetworkReq) (AgentInstallContentWrapper, error)

ConfigureCloudAdaptiveNetwork configures a cloud adaptive network to VMs in an MCIS

func InjectCloudInformationForCloudAdaptiveNetwork

func InjectCloudInformationForCloudAdaptiveNetwork(nsId string, mcisId string, netReq *NetworkReq) (AgentInstallContentWrapper, error)

InjectCloudInformationForCloudAdaptiveNetwork injects cloud information for a cloud adaptive network

func InstallMonitorAgentToMcis

func InstallMonitorAgentToMcis(nsId string, mcisId string, mcisServiceType string, req *McisCmdReq) (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   McisCmdReq `json:"postCommand"`
	PlacementAlgo string     `json:"placementAlgo" example:"random"`
}

AutoAction is struct for MCIS 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 MCIS auto-control condition.

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, mcisId string, action string, option string) (BenchmarkInfoArray, error)

BenchmarkAction is func to action Benchmark

func CoreGetBenchmark

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

CoreGetBenchmark is func to get Benchmark

func RunAllBenchmarks

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

RunAllBenchmarks is func to get all Benchmarks

func RunLatencyBenchmark

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

RunLatencyBenchmark is func to get MCIS benchmark for network latency

type BenchmarkReq

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

BenchmarkReq is struct for BenchmarkReq

type CheckMcisDynamicReqInfo

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

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

func CheckMcisDynamicReq

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

type CheckVmDynamicReqInfo

type CheckVmDynamicReqInfo struct {

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

	VmSpec mcir.TbSpecInfo `json:"vmSpec" default:""`
	Region common.Region   `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"`
}

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:"cpu" enums:"cpu,memory,cost"`
	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 McisAccessInfo

type McisAccessInfo struct {
	McisId                 string
	McisNlbListener        *McisAccessInfo `json:"mcisNlbListener,omitempty"`
	McisSubGroupAccessInfo []McisSubGroupAccessInfo
}

McisAccessInfo is struct to retrieve overall access information of a MCIS

func GetMcNlbAccess

func GetMcNlbAccess(nsId string, mcisId string) (*McisAccessInfo, error)

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

func GetMcisAccessInfo

func GetMcisAccessInfo(nsId string, mcisId string, option string) (*McisAccessInfo, error)

GetMcisAccessInfo is func to retrieve MCIS Access information

type McisCmdReq

type McisCmdReq struct {
	UserName string `json:"userName" example:"cb-user" default:""`
	Command  string `json:"command" validate:"required" example:"sudo apt-get install ..."`
}

McisCmdReq is struct for remote command

type McisConnectionConfigCandidatesReq

type McisConnectionConfigCandidatesReq 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"`
}

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

type McisPolicyInfo

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

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

McisPolicyInfo is struct for MCIS auto-control Policy object.

func CreateMcisPolicy

func CreateMcisPolicy(nsId string, mcisId string, u *McisPolicyReq) (McisPolicyInfo, error)

CreateMcisPolicy create McisPolicyInfo object in DB according to user's requirements.

func GetAllMcisPolicyObject

func GetAllMcisPolicyObject(nsId string) ([]McisPolicyInfo, error)

GetAllMcisPolicyObject returns all McisPolicyInfo objects.

func GetMcisPolicyObject

func GetMcisPolicyObject(nsId string, mcisId string) (McisPolicyInfo, error)

GetMcisPolicyObject returns McisPolicyInfo object.

type McisPolicyReq

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

McisPolicyReq is struct for MCIS auto-control Policy Request.

type McisRecommendReq

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

McisRecommendReq is struct for McisRecommendReq

type McisStatusInfo

type McisStatusInfo 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 mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis 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"`
}

McisStatusInfo is struct to define simple information of MCIS with updated status of all VMs

func GetMcisStatus

func GetMcisStatus(nsId string, mcisId string) (*McisStatusInfo, error)

GetMcisStatus is func to Get Mcis Status

func GetMcisStatusAll

func GetMcisStatusAll(nsId string) ([]McisStatusInfo, error)

GetMcisStatusAll is func to get MCIS status all

type McisSubGroupAccessInfo

type McisSubGroupAccessInfo struct {
	SubGroupId       string
	NlbListener      *TbNLBListenerInfo `json:"nlbListener,omitempty"`
	McisVmAccessInfo []McisVmAccessInfo
}

McisSubGroupAccessInfo is struct for McisSubGroupAccessInfo

type McisVmAccessInfo

type McisVmAccessInfo 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"`
}

McisVmAccessInfo is struct for McisVmAccessInfo

type MonAgentInstallReq

type MonAgentInstallReq struct {
	NsId     string `json:"nsId,omitempty"`
	McisId   string `json:"mcisId,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"`
	McisId         string            `json:"mcisId"`
	McisMonitoring []MonResultSimple `json:"mcisMonitoring"`
}

MonResultSimpleResponse struct is for containing Mcis monitoring results

func GetMonitoringData

func GetMonitoringData(nsId string, mcisId 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 NetworkReq

type NetworkReq struct {
	ServiceEndpoint string   `json:"serviceEndpoint" example:"localhost:8053" default:""`
	EtcdEndpoints   []string `json:"etcdEndpoints" example:"PUBLIC_IP_1:2379,PUBLIC_IP_2:2379,..." default:""`
}

NetworkReq is a struct for a request to configure Cloud Adaptive Network

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 MCIS 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, mcisId string, option string, mcisFlag 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, mcisId string, option string, mcisFlag 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 SpiderAllList

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

type SpiderAllListWrapper

type SpiderAllListWrapper struct {
	AllList SpiderAllList
}

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 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 {
	McisId string `json:"mcisId"`
	VmId   string `json:"vmId"`
	VmIp   string `json:"vmIp"`
	Result string `json:"result"`
	Err    error  `json:"err"`
}

SshCmdResult is struct for SshCmd Result

func InstallBenchmarkAgentToMcis

func InstallBenchmarkAgentToMcis(nsId string, mcisId string, req *McisCmdReq, option string) ([]SshCmdResult, error)

InstallBenchmarkAgentToMcis is func to install milkyway agents in MCIS

func RemoteCommandToMcis

func RemoteCommandToMcis(nsId string, mcisId string, subGroupId string, req *McisCmdReq) ([]SshCmdResult, error)

RemoteCommandToMcis is func to command to all VMs in MCIS 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 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, mcisId 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 TbMcisDynamicReq

type TbMcisDynamicReq struct {
	Name string `json:"name" validate:"required" example:"mcis01"`

	// 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 mcis in a keyword (any string can be used)
	Label string `json:"label" example:"DynamicVM" default:""`

	// SystemLabel is for describing the mcis 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"`
}

TbMcisDynamicReq is sturct for requirements to create MCIS dynamically (with default resource option)

type TbMcisInfo

type TbMcisInfo 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 mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis 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"`
}

TbMcisInfo is struct for MCIS info

func CoreGetAllMcis

func CoreGetAllMcis(nsId string, option string) ([]TbMcisInfo, error)

CoreGetAllMcis is func to get all MCIS objects

func CreateMcSwNlb

func CreateMcSwNlb(nsId string, mcisId string, req *TbNLBReq, option string) (TbMcisInfo, error)

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

func CreateMcis

func CreateMcis(nsId string, req *TbMcisReq, option string) (*TbMcisInfo, error)

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

func CreateMcisDynamic

func CreateMcisDynamic(nsId string, req *TbMcisDynamicReq) (*TbMcisInfo, error)

CreateMcisDynamic is func to create MCIS obeject and deploy requested VMs in a dynamic way

func CreateMcisGroupVm

func CreateMcisGroupVm(nsId string, mcisId string, vmRequest *TbVmReq, newSubGroup bool) (*TbMcisInfo, error)

CreateMcisGroupVm is func to create MCIS groupVM

func CreateMcisVmDynamic

func CreateMcisVmDynamic(nsId string, mcisId string, req *TbVmDynamicReq) (*TbMcisInfo, error)

CreateMcisVmDynamic is func to create requested VM in a dynamic way and add it to MCIS

func CreateSystemMcisDynamic

func CreateSystemMcisDynamic(option string) (*TbMcisInfo, error)

CreateSystemMcisDynamic is func to create MCIS obeject and deploy requested VMs in a dynamic way

func GetMcisInfo

func GetMcisInfo(nsId string, mcisId string) (*TbMcisInfo, error)

GetMcisInfo is func to return MCIS information with the current status update

func GetMcisObject

func GetMcisObject(nsId string, mcisId string) (TbMcisInfo, error)

GetMcisObject is func to retrieve MCIS object from database (no current status update)

func ScaleOutMcisSubGroup

func ScaleOutMcisSubGroup(nsId string, mcisId string, subGroupId string, numVMsToAdd string) (*TbMcisInfo, error)

ScaleOutMcisSubGroup is func to create MCIS groupVM

type TbMcisReq

type TbMcisReq struct {
	Name string `json:"name" validate:"required" example:"mcis01"`

	// 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 mcis in a keyword (any string can be used)
	Label string `json:"label" example:"custom tag" default:""`

	// SystemLabel is for describing the mcis 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"`
}

TbMcisReq is sturct for requirements to create MCIS

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, mcisId 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.GeoLocation `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, mcisId 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, mcisId 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, mcisId 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:"ns01-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 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 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 gernetad. VMs will be created accordingly.
	SubGroupSize string `json:"subGroupSize" example:"3" default:""`

	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", "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", Integer (GB): ["50", ..., "1000"]

	VmUserPassword string `json:"vmUserPassword 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.GeoLocation `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, mcisId string, vmId string, command string, dataDiskId string) (TbVmInfo, error)

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

func CoreGetMcisVmInfo

func CoreGetMcisVmInfo(nsId string, mcisId string, vmId string) (*TbVmInfo, error)

CoreGetMcisVmInfo is func to Get McisVm Info

func CreateMcisVm

func CreateMcisVm(nsId string, mcisId string, vmInfoData *TbVmInfo) (*TbVmInfo, error)

CreateMcisVm is func to post (create) McisVm

func FindTbVmByCspId

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

func GetVmObject

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

GetVmObject is func to get VM object

func GetVmTemplate

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

GetVmTemplate is func to get VM template

type TbVmPriority

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

TbVmPriority is struct for TbVmPriority

func GetRecommendList

func GetRecommendList(nsId string, cpuSize string, memSize string, diskSize string) ([]TbVmPriority, error)

GetRecommendList is func to get recommendation list

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

func CorePostMcisRecommend

func CorePostMcisRecommend(nsId string, req *McisRecommendReq) ([]TbVmRecommendInfo, error)

CorePostMcisRecommend is func to command to all VMs in MCIS with SSH

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 gernetad. 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.GeoLocation `json:"location"`
}

TbVmStatusInfo is to define simple information of VM with updated status

func CoreGetMcisVmStatus

func CoreGetMcisVmStatus(nsId string, mcisId string, vmId string) (*TbVmStatusInfo, error)

CoreGetMcisVmStatus is func to Get McisVm Status

func GetVmCurrentPublicIp

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

GetVmCurrentPublicIp is func to get VM public IP

func GetVmStatus

func GetVmStatus(nsId string, mcisId string, vmId string) (TbVmStatusInfo, error)

GetVmStatus is func to get VM status

Jump to

Keyboard shortcuts

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