migration

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package migration is to handle REST API for migration

Package migration is to handle REST API for migration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyInstance

type DummyInstance struct {
	Instance
	NetworkID string `json:"NetworkId"`
}

type DummyNetwork

type DummyNetwork struct {
	Network
	Subnets []Subnet `json:"subnets"`
}

type DummyStorage

type DummyStorage struct {
	Storage
	NetworkID string `json:"NetworkId"`
}

type Handlers

type Handlers struct {
}

func (*Handlers) MigrateInfra

func (rh *Handlers) MigrateInfra(c echo.Context) error

MigrateInfra godoc @Summary Migrate an infrastructure on a cloud platform @Description It migrates an infrastructure on a cloud platform. Infrastructure includes network, storage, compute, and so on. @Tags [Migration] Infrastructure @Accept json @Produce json @Param InfrastructureInfo body MigrateInfraRequest true "Specify network, disk, compute, security group, virtual machine, etc." @Success 200 {object} MigrateInfraResponse "Successfully migrated infrastructure on a cloud platform" @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /migration/infra [post]

func (*Handlers) MigrateInstance

func (rh *Handlers) MigrateInstance(c echo.Context) error

MigrateInstance godoc @Summary (Skeleton) Migrate instance on a cloud platform @Description It migrates instance on a cloud platform. Storage includes name, spec, OS, and so on. @Tags [Migration] Infrastructure @Accept json @Produce json @Param InstanceInfo body MigrateInstanceRequest true "Specify name, spec, OS, and so on." @Success 200 {object} MigrateInstanceResponse "Successfully migrated storage on a cloud platform" @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /migration/infra/instance [post]

func (*Handlers) MigrateNetwork

func (rh *Handlers) MigrateNetwork(c echo.Context) error

MigrateNetwork godoc @Summary (Skeleton) Migrate network on a cloud platform @Description It migrates network on a cloud platform. Network includes name, ID, IPv4 CIDR block, IPv6 CIDR block, and so on. @Tags [Migration] Infrastructure @Accept json @Produce json @Param NetworkInfo body MigrateNetworkRequest true "Specify name, IPv4 CIDR block, etc." @Success 200 {object} MigrateNetworkResponse "Successfully migrated network on a cloud platform" @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /migration/infra/network [post]

func (*Handlers) MigrateStorage

func (rh *Handlers) MigrateStorage(c echo.Context) error

MigrateStorage godoc @Summary (Skeleton) Migrate storage on a cloud platform @Description It migrates storage on a cloud platform. Storage includes name, ID, type, size, and so on. @Tags [Migration] Infrastructure @Accept json @Produce json @Param StorageInfo body MigrateStorageRequest true "Specify name, type, size, affiliated Network ID, and so on." @Success 200 {object} MigrateStorageResponse "Successfully migrated storage on a cloud platform" @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /migration/infra/storage [post]

type Instance

type Instance struct {
	Name string `json:"name"`
	Id   string `json:"id"`
	Spec string `json:"type"`
	OS   string `json:"os"`
}

type MigrateInfraRequest

type MigrateInfraRequest struct {
	TbMcisDynamicReq
}

type MigrateInfraResponse

type MigrateInfraResponse struct {
	TbMcisInfo
}

type MigrateInstanceRequest

type MigrateInstanceRequest struct {
	DummyInstance
}

type MigrateInstanceResponse

type MigrateInstanceResponse struct {
	DummyInstance
}

type MigrateNetworkRequest

type MigrateNetworkRequest struct {
	DummyNetwork
}

type MigrateNetworkResponse

type MigrateNetworkResponse struct {
	DummyNetwork
}

type MigrateStorageRequest

type MigrateStorageRequest struct {
	DummyStorage
}

type MigrateStorageResponse

type MigrateStorageResponse struct {
	DummyStorage
}

type Network

type Network struct {
	Name          string `json:"name"`
	Id            string `json:"id"`
	IPv4CIDRBlock string `json:"ipv4CidrBlock"`
	IPv6CIDRBlock string `json:"ipv6CidrBlock"`
}

type RegionInfo

type RegionInfo struct {
	Region string
	Zone   string
}

RegionInfo is struct for region information

type SpiderImageType

type SpiderImageType 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 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 Storage

type Storage struct {
	Name string `json:"name"`
	Id   string `json:"id"`
	Type string `json:"type"`
	Size string `json:"size"`
}

type Subnet

type Subnet struct {
	Network
	ParentNetworkId string `json:"parentNetworkId"`
}

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

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

Jump to

Keyboard shortcuts

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