resources

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RSTypeString added in v0.8.20

func RSTypeString(rsType RSType) string

Types

type AccessInfo added in v0.6.15

type AccessInfo struct {
	Endpoint   string `json:"Endpoint,omitempty" example:"https://1.2.3.4"`
	Kubeconfig string `json:"Kubeconfig,omitempty" example:"apiVersion: v1\nclusters:\n- cluster:\n ...."`
}

AccessInfo represents the access information of a Cluster. @description Access Information for a Kubernetes Cluster. <br> Take some time to provide.

type AddonsInfo added in v0.6.3

type AddonsInfo struct {
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

AddonsInfo represents the additional configuration information of a Cluster. @description Addons Information for a Kubernetes Cluster

type AnyCallHandler added in v0.6.9

type AnyCallHandler interface {
	AnyCall(callInfo AnyCallInfo) (AnyCallInfo, error)
}

type AnyCallInfo added in v0.6.9

type AnyCallInfo struct {
	FID           string     `json:"FID" validate:"required" example:"countAll"` // Function ID, ex: countAll
	IKeyValueList []KeyValue `json:"IKeyValueList" validate:"required"`          // Input Arguments List, ex:[{"Key": "rsType", "Value": "vpc"}]
	OKeyValueList []KeyValue `json:"OKeyValueList" validate:"required"`          // Output Results List, ex:[{"Key": "Count", "Value": "10"}]"
}

AnyCallInfo represents the structure for performing AnyCall API requests and responses. @description This structure holds both the input and output parameters for the AnyCall API.

type CloudPrice added in v0.8.0

type CloudPrice struct {
	CloudName string  `json:"cloudName" validate:"required" example:"AWS"`                // Name of the cloud provider
	PriceList []Price `json:"priceList" validate:"required" description:"List of prices"` // List of prices for different services/products
}

CloudPrice represents the pricing information for a specific cloud provider.

type CloudPriceData added in v0.8.0

type CloudPriceData struct {
	Meta           Meta         `json:"meta" validate:"required" description:"Metadata information about the price data"`
	CloudPriceList []CloudPrice `json:"cloudPriceList" validate:"required" description:"List of cloud prices"`
}

CloudPriceData represents the structure of cloud pricing data.

type ClusterHandler added in v0.6.3

type ClusterHandler interface {

	//------ Cluster Management
	CreateCluster(clusterReqInfo ClusterInfo) (ClusterInfo, error)
	ListCluster() ([]*ClusterInfo, error)
	GetCluster(clusterIID IID) (ClusterInfo, error)
	DeleteCluster(clusterIID IID) (bool, error)

	//------ NodeGroup Management
	AddNodeGroup(clusterIID IID, nodeGroupReqInfo NodeGroupInfo) (NodeGroupInfo, error)
	SetNodeGroupAutoScaling(clusterIID IID, nodeGroupIID IID, on bool) (bool, error)
	ChangeNodeGroupScaling(clusterIID IID, nodeGroupIID IID,
		DesiredNodeSize int, MinNodeSize int, MaxNodeSize int) (NodeGroupInfo, error)
	RemoveNodeGroup(clusterIID IID, nodeGroupIID IID) (bool, error)

	//------ Upgrade K8S
	UpgradeCluster(clusterIID IID, newVersion string) (ClusterInfo, error)
}

-------- Cluster API

type ClusterInfo added in v0.6.3

type ClusterInfo struct {
	IId IID `json:"IId" validate:"required"`

	Version string      `json:"Version" validate:"required" example:"1.30"` // Kubernetes Version, ex) 1.30
	Network NetworkInfo `json:"Network" validate:"required"`

	// ---
	NodeGroupList []NodeGroupInfo `json:"NodeGroupList" validate:"omitempty"`
	AccessInfo    AccessInfo      `json:"AccessInfo,omitempty"`
	Addons        AddonsInfo      `json:"Addons,omitempty"`

	Status ClusterStatus `json:"Status" validate:"required" example:"Active"`

	CreatedTime  time.Time  `json:"CreatedTime,omitempty" example:"2024-08-27T10:00:00Z"`
	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

-------- Info Structure ClusterInfo represents the details of a Kubernetes Cluster. @description Kubernetes Cluster Information

type ClusterStatus added in v0.6.3

type ClusterStatus string

-------- Const

const (
	ClusterCreating ClusterStatus = "Creating"
	ClusterActive   ClusterStatus = "Active"
	ClusterInactive ClusterStatus = "Inactive"
	ClusterUpdating ClusterStatus = "Updating"
	ClusterDeleting ClusterStatus = "Deleting"
)

type DiskHandler added in v0.6.4

type DiskHandler interface {

	//------ Disk Management
	CreateDisk(DiskReqInfo DiskInfo) (DiskInfo, error)
	ListDisk() ([]*DiskInfo, error)
	GetDisk(diskIID IID) (DiskInfo, error)
	ChangeDiskSize(diskIID IID, size string) (bool, error)
	DeleteDisk(diskIID IID) (bool, error)

	//------ Disk Attachment
	AttachDisk(diskIID IID, ownerVM IID) (DiskInfo, error)
	DetachDisk(diskIID IID, ownerVM IID) (bool, error)
}

-------- Disk API

type DiskInfo added in v0.6.4

type DiskInfo struct {
	IId  IID    `json:"IId" validate:"required"`                       // {NameId, SystemId}
	Zone string `json:"Zone" validate:"required" example:"us-east-1a"` // Target Zone Name

	DiskType string `json:"DiskType" validate:"required" example:"gp2"` // "gp2", "Premium SSD", ...
	DiskSize string `json:"DiskSize" validate:"required" example:"100"` // "default", "50", "1000" (unit is GB)

	Status  DiskStatus `json:"Status" validate:"required" example:"Available"`
	OwnerVM IID        `json:"OwnerVM" validate:"omitempty"` // When the Status is DiskAttached

	CreatedTime  time.Time  `json:"CreatedTime" validate:"required"`             // The time when the disk was created
	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`      // A list of tags associated with this disk
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"` // Additional key-value pairs associated with this disk
}

-------- Info Structure DiskInfo represents the information of a Disk resource.

type DiskStatus added in v0.6.4

type DiskStatus string

-------- Const

const (
	DiskCreating  DiskStatus = "Creating"
	DiskAvailable DiskStatus = "Available"
	DiskAttached  DiskStatus = "Attached"
	DiskDeleting  DiskStatus = "Deleting"
	DiskError     DiskStatus = "Error"
)

type GpuInfo

type GpuInfo struct {
	Count string `json:"Count" validate:"required" example:"1"`                    // Number of GPUs
	Mfr   string `json:"Mfr,omitempty" validate:"omitempty" example:"NVIDIA"`      // Manufacturer of the GPU
	Model string `json:"Model,omitempty" validate:"omitempty" example:"Tesla K80"` // Model of the GPU
	Mem   string `json:"Mem,omitempty" validate:"omitempty" example:"8192"`        // Memory size of the GPU in MB
}

GpuInfo represents the GPU details of a VM specification.

type HealthCheckerInfo added in v0.5.5

type HealthCheckerInfo struct {
	Protocol  string `json:"Protocol" validate:"required" example:"TCP"` // TCP|HTTP
	Port      string `json:"Port" validate:"required" example:"80"`      // Listener Port or 1-65535
	Interval  int    `json:"Interval" validate:"required" example:"30"`  // secs, Interval time between health checks.
	Timeout   int    `json:"Timeout" validate:"required" example:"5"`    // secs, Waiting time to decide an unhealthy VM when no response.
	Threshold int    `json:"Threshold" validate:"required" example:"3"`  // num, The number of continuous health checks to change the VM status.

	CspID        string     `json:"CspID,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

HealthCheckerInfo represents the health check configuration for an NLB. @description Health Checker Information for a Network Load Balancer (NLB)

type HealthInfo added in v0.5.6

type HealthInfo struct {
	AllVMs       *[]IID `json:"AllVMs" validate:"required"`
	HealthyVMs   *[]IID `json:"HealthyVMs" validate:"required"`
	UnHealthyVMs *[]IID `json:"UnHealthyVMs" validate:"required"`
}

HealthInfo represents the health status of the VM group in an NLB. @description Health Information for a Network Load Balancer (NLB)

type IID added in v0.1.2

type IID struct {
	NameId   string `json:"NameId" validate:"required" example:"user-defined-name"`
	SystemId string `json:"SystemId" validate:"required" example:"csp-defined-id"`
}

Integrated-ID consisting of User's ID and CloudOS's ID

type ImageHandler

type ImageHandler interface {
	CreateImage(imageReqInfo ImageReqInfo) (ImageInfo, error)
	ListImage() ([]*ImageInfo, error)
	GetImage(imageIID IID) (ImageInfo, error)
	CheckWindowsImage(imageIID IID) (bool, error)
	DeleteImage(imageIID IID) (bool, error)
}

type ImageInfo

type ImageInfo struct {
	IId     IID    `json:"IId" validate:"required" description:"The ID of the image."`                                                            // {NameId, SystemId}
	GuestOS string `json:"GuestOS" validate:"required" example:"Ubuntu 18.04" description:"The operating system of the image."`                   // Windows7, Ubuntu etc.
	Status  string `json:"Status" validate:"required" example:"available" description:"The status of the image, e.g., available or unavailable."` // available, unavailable

	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"A list of key-value pairs associated with the image."`
}

ImageInfo represents the information of an Image.

type ImageReqInfo

type ImageReqInfo struct {
	IId IID // {NameId, SystemId}

}

type ImageType added in v0.6.5

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

type KeyPairHandler

type KeyPairHandler interface {
	CreateKey(keyPairReqInfo KeyPairReqInfo) (KeyPairInfo, error)
	ListKey() ([]*KeyPairInfo, error)
	GetKey(keyIID IID) (KeyPairInfo, error)
	DeleteKey(keyIID IID) (bool, error)
}

type KeyPairInfo

type KeyPairInfo struct {
	IId         IID    `json:"IId" validate:"required"`                                                                              // {NameId, SystemId}
	Fingerprint string `json:"Fingerprint,omitempty" validate:"omitempty" example:"3b:16:bf:1b:13:4b:b3:58:97:dc:72:19:45:bb:2c:8f"` // Unique identifier for the public key
	PublicKey   string `json:"PublicKey,omitempty" validate:"omitempty" example:"ssh-rsa AAAAB3..."`                                 // Public part of the KeyPair
	PrivateKey  string `json:"PrivateKey,omitempty" validate:"omitempty" example:"-----BEGIN PRIVATE KEY-----..."`                   // Private part of the KeyPair
	VMUserID    string `json:"VMUserID,omitempty" validate:"omitempty" example:"cb-user"`                                            // cb-user or Administrator

	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`      // List of tags associated with this KeyPair
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"` // Additional metadata as key-value pairs
}

KeyPairInfo represents information about a KeyPair.

type KeyPairReqInfo

type KeyPairReqInfo struct {
	IId IID // {NameId, SystemId}

	TagList []KeyValue
}

type KeyValue

type KeyValue struct {
	Key   string `json:"Key" validate:"required" example:"key1"`
	Value string `json:"Value,omitempty" validate:"omitempty"  example:"value1"`
}

type ListenerInfo added in v0.5.5

type ListenerInfo struct {
	Protocol string `json:"Protocol" validate:"required" example:"TCP"` // TCP|UDP
	IP       string `json:"IP" validate:"omitempty" example:"192.168.0.1"`
	Port     string `json:"Port" validate:"required" example:"80"` // 1-65535
	DNSName  string `json:"DNSName" validate:"omitempty" example:"nlb.example.com"`

	CspID        string     `json:"CspID,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

ListenerInfo represents the frontend listener configuration for an NLB. @description Listener Information for a Network Load Balancer (NLB)

type Meta added in v0.8.0

type Meta struct {
	Version     string `json:"version" validate:"required" example:"1.0"`        // Version of the pricing data
	Description string `json:"description,omitempty" example:"Cloud price data"` // Description of the pricing data
}

Meta contains metadata information about the price data.

type MyImageHandler added in v0.6.5

type MyImageHandler interface {

	//------ Snapshot to create a MyImage
	SnapshotVM(snapshotReqInfo MyImageInfo) (MyImageInfo, error)

	//------ MyImage Management
	ListMyImage() ([]*MyImageInfo, error)
	GetMyImage(myImageIID IID) (MyImageInfo, error)
	CheckWindowsImage(myImageIID IID) (bool, error)
	DeleteMyImage(myImageIID IID) (bool, error)
}

-------- MyImage API

type MyImageInfo added in v0.6.5

type MyImageInfo struct {
	IId      IID `json:"IId" validate:"required"` // {NameId, SystemId}
	SourceVM IID `json:"SourceVM" validate:"omitempty"`

	Status MyImageStatus `json:"Status" validate:"required" example:"Available"` // Available | Unavailable

	CreatedTime  time.Time  `json:"CreatedTime" validate:"required"`
	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

-------- Info Structure MyImageInfo represents the information of a MyImage resource.

type MyImageStatus added in v0.6.5

type MyImageStatus string

-------- Const

const (
	MyImageAvailable   MyImageStatus = "Available"
	MyImageUnavailable MyImageStatus = "Unavailable"
)

type NLBHandler added in v0.5.5

type NLBHandler interface {

	//------ NLB Management
	CreateNLB(nlbReqInfo NLBInfo) (NLBInfo, error)
	ListNLB() ([]*NLBInfo, error)
	GetNLB(nlbIID IID) (NLBInfo, error)
	DeleteNLB(nlbIID IID) (bool, error)

	GetVMGroupHealthInfo(nlbIID IID) (HealthInfo, error)
	AddVMs(nlbIID IID, vmIIDs *[]IID) (VMGroupInfo, error)
	RemoveVMs(nlbIID IID, vmIIDs *[]IID) (bool, error)

	//------ Frontend Control
	ChangeListener(nlbIID IID, listener ListenerInfo) (ListenerInfo, error)
	//------ Backend Control
	ChangeVMGroupInfo(nlbIID IID, vmGroup VMGroupInfo) (VMGroupInfo, error)
	ChangeHealthCheckerInfo(nlbIID IID, healthChecker HealthCheckerInfo) (HealthCheckerInfo, error)
}

-------- API

type NLBInfo added in v0.5.5

type NLBInfo struct {
	IId    IID `json:"IId" validate:"required"`
	VpcIID IID `json:"VpcIID" validate:"required"` // Owner VPC IID

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

	//------ Frontend
	Listener ListenerInfo `json:"Listener" validate:"required"`

	//------ Backend
	VMGroup       VMGroupInfo       `json:"VMGroup" validate:"required"`
	HealthChecker HealthCheckerInfo `json:"HealthChecker" validate:"required"`

	CreatedTime  time.Time  `json:"CreatedTime" validate:"required" example:"2024-08-27T10:00:00Z"`
	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

-------- Info Structure NLBInfo represents the details of a Network Load Balancer (NLB). @description Network Load Balancer (NLB) Information

type NetworkInfo added in v0.6.3

type NetworkInfo struct {
	VpcIID            IID   `json:"VpcIID" validate:"required"`
	SubnetIIDs        []IID `json:"SubnetIIDs" validate:"required"`
	SecurityGroupIIDs []IID `json:"SecurityGroupIIDs" validate:"required"`

	// ---
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

NetworkInfo represents the network configuration of a Cluster. @description Network Information for a Kubernetes Cluster

type NodeGroupInfo added in v0.6.3

type NodeGroupInfo struct {
	IId IID `json:"IId" validate:"required"`

	// VM config.
	ImageIID     IID    `json:"ImageIID" validate:"required"`
	VMSpecName   string `json:"VMSpecName" validate:"required" example:"t3.medium"`
	RootDiskType string `json:"RootDiskType,omitempty" validate:"omitempty"`
	RootDiskSize string `json:"RootDiskSize,omitempty" validate:"omitempty" example:"50"` // in GB
	KeyPairIID   IID    `json:"KeyPairIID" validate:"required"`

	// Scaling config.
	OnAutoScaling   bool `json:"OnAutoScaling" validate:"required" example:"true"`
	DesiredNodeSize int  `json:"DesiredNodeSize" validate:"required" example:"2"`
	MinNodeSize     int  `json:"MinNodeSize" validate:"required" example:"1"`
	MaxNodeSize     int  `json:"MaxNodeSize" validate:"required" example:"3"`

	// ---
	Status NodeGroupStatus `json:"Status" validate:"required" example:"Active"`
	Nodes  []IID           `json:"Nodes,omitempty" validate:"omitempty"`

	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

NodeGroupInfo represents the configuration of a Node Group in a Cluster. @description Node Group Information for a Kubernetes Cluster

type NodeGroupStatus added in v0.6.7

type NodeGroupStatus string
const (
	NodeGroupCreating NodeGroupStatus = "Creating"
	NodeGroupActive   NodeGroupStatus = "Active"
	NodeGroupInactive NodeGroupStatus = "Inactive"
	NodeGroupUpdating NodeGroupStatus = "Updating"
	NodeGroupDeleting NodeGroupStatus = "Deleting"
)

type Platform added in v0.7.1

type Platform string
const (
	LINUX_UNIX Platform = "LINUX/UNIX"
	WINDOWS    Platform = "WINDOWS"
)

type Price added in v0.8.1

type Price struct {
	ProductInfo ProductInfo `json:"productInfo" validate:"required" description:"Information about the product"` // Information about the product
	PriceInfo   PriceInfo   `json:"priceInfo" validate:"required" description:"Pricing details of the product"`  // Pricing details of the product
}

Price represents the price information for a specific product.

type PriceInfo added in v0.8.0

type PriceInfo struct {
	PricingPolicies []PricingPolicies `json:"pricingPolicies" validate:"required" description:"List of pricing policies"` // List of pricing policies
	CSPPriceInfo    interface{}       `json:"cspPriceInfo" validate:"required" description:"Additional price info"`       // Additional price information specific to CSP
}

PriceInfo represents the pricing details for a product.

type PriceInfoHandler added in v0.8.0

type PriceInfoHandler interface {
	ListProductFamily(regionName string) ([]string, error)
	GetPriceInfo(productFamily string, regionName string, filterList []KeyValue) (string, error) // return string: json format
}

type PricingPolicies added in v0.8.0

type PricingPolicies struct {
	PricingId         string             `json:"pricingId" validate:"required" example:"price-123"`           // ID of the pricing policy
	PricingPolicy     string             `json:"pricingPolicy" validate:"required" example:"On-Demand"`       // Name of the pricing policy
	Unit              string             `json:"unit" validate:"required" example:"hour"`                     // Unit of the pricing (e.g., per hour)
	Currency          string             `json:"currency" validate:"required" example:"USD"`                  // Currency of the pricing
	Price             string             `json:"price" validate:"required" example:"0.02"`                    // Price in the specified currency per unit
	Description       string             `json:"description,omitempty" example:"Pricing for t2.micro"`        // Description of the pricing policy
	PricingPolicyInfo *PricingPolicyInfo `json:"pricingPolicyInfo" description:"Detailed info about pricing"` // Detail information about the pricing policy
}

PricingPolicies represents a single pricing policy.

type PricingPolicyInfo added in v0.8.0

type PricingPolicyInfo struct {
	LeaseContractLength string `json:"LeaseContractLength,omitempty" example:"1 year"` // Length of the lease contract
	OfferingClass       string `json:"OfferingClass,omitempty" example:"standard"`     // Offering class (e.g., standard, convertible)
	PurchaseOption      string `json:"PurchaseOption,omitempty" example:"No Upfront"`  // Purchase option (e.g., no upfront, partial upfront)
}

PricingPolicyInfo represents additional details about a pricing policy.

type ProductInfo added in v0.8.0

type ProductInfo struct {
	ProductId  string `json:"productId" validate:"required" example:"prod-123"`   // ID of the product
	RegionName string `json:"regionName" validate:"required" example:"us-east-1"` // Name of the region
	ZoneName   string `json:"zoneName,omitempty" example:"us-east-1a"`            // Name of the zone

	//--------- Compute Instance Info
	InstanceType    string `json:"instanceType,omitempty" example:"t2.micro"` // Type of the instance
	Vcpu            string `json:"vcpu,omitempty" example:"2"`                // Number of vCPUs
	Memory          string `json:"memory,omitempty" example:"4096"`           // Amount of memory in MB
	Storage         string `json:"storage,omitempty" example:"100"`           // Root-disk storage size in GB
	Gpu             string `json:"gpu,omitempty" example:"1"`                 // Number of GPUs
	GpuMemory       string `json:"gpuMemory,omitempty" example:"8192"`        // GPU memory size in MB
	OperatingSystem string `json:"operatingSystem,omitempty" example:"Linux"` // Operating system type
	PreInstalledSw  string `json:"preInstalledSw,omitempty" example:"None"`   // Pre-installed software

	//--------- Storage Info  // Data-Disk(AWS:EBS)
	VolumeType          string `json:"volumeType,omitempty" example:"gp2"`          // Type of volume
	StorageMedia        string `json:"storageMedia,omitempty" example:"SSD"`        // Storage media type
	MaxVolumeSize       string `json:"maxVolumeSize,omitempty" example:"16384"`     // Maximum volume size in GB
	MaxIOPSVolume       string `json:"maxIopsvolume,omitempty" example:"3000"`      // Maximum IOPS for the volume
	MaxThroughputVolume string `json:"maxThroughputvolume,omitempty" example:"250"` // Maximum throughput for the volume in MB/s

	Description    string      `json:"description,omitempty" example:"General purpose instance"`                 // Description of the product
	CSPProductInfo interface{} `json:"cspProductInfo" validate:"required" description:"Additional product info"` // Additional product information specific to CSP
}

ProductInfo represents the product details.

type RSType added in v0.8.20

type RSType string
const (
	ALL       RSType = "all"
	IMAGE     RSType = "image"
	VPC       RSType = "vpc"
	SUBNET    RSType = "subnet"
	SG        RSType = "sg"
	KEY       RSType = "keypair"
	VM        RSType = "vm"
	NLB       RSType = "nlb"
	DISK      RSType = "disk"
	MYIMAGE   RSType = "myimage"
	CLUSTER   RSType = "cluster"
	NODEGROUP RSType = "nodegroup"
)

type RegionInfo

type RegionInfo struct {
	Region string `json:"Region" validate:"required" example:"us-east-1"`
	Zone   string `json:"Zone,omitempty" validate:"omitempty" example:"us-east-1a"`
}

type RegionZoneHandler added in v0.7.6

type RegionZoneHandler interface {
	ListRegionZone() ([]*RegionZoneInfo, error)
	GetRegionZone(Name string) (RegionZoneInfo, error)

	ListOrgRegion() (string, error) // return string: json format
	ListOrgZone() (string, error)   // return string: json format
}

type RegionZoneInfo added in v0.7.6

type RegionZoneInfo struct {
	Name         string     `json:"Name" validate:"required" example:"us-east"`
	DisplayName  string     `json:"DisplayName" validate:"required" example:"US East"`
	ZoneList     []ZoneInfo `json:"ZoneList,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

RegionZoneInfo represents the information of a Region Zone. @example {"Name": "us-east", "DisplayName": "US East", "ZoneList": [{"Name": "us-east-1a", "DisplayName": "US East 1A", "Status": "Available"}], "KeyValueList": [{"Key": "regionKey1", "Value": "regionValue1"}]}

type SecurityHandler

type SecurityHandler interface {
	CreateSecurity(securityReqInfo SecurityReqInfo) (SecurityInfo, error)
	ListSecurity() ([]*SecurityInfo, error)
	GetSecurity(securityIID IID) (SecurityInfo, error)
	DeleteSecurity(securityIID IID) (bool, error)

	AddRules(sgIID IID, securityRules *[]SecurityRuleInfo) (SecurityInfo, error)
	RemoveRules(sgIID IID, securityRules *[]SecurityRuleInfo) (bool, error)
}

type SecurityInfo

type SecurityInfo struct {
	IId IID `json:"IId" validate:"required"` // {NameId, SystemId}

	VpcIID IID `json:"VpcIID" validate:"required"` // {NameId, SystemId}

	SecurityRules *[]SecurityRuleInfo `json:"SecurityRules" validate:"required" description:"A list of security rules applied to this security group"`

	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this security group"`
	KeyValueList []KeyValue `` /* 127-byte string literal not displayed */
}

type SecurityReqInfo

type SecurityReqInfo struct {
	IId IID // {NameId, SystemId}

	VpcIID IID // {NameId, SystemId}
	//Direction     string // To be deprecated
	SecurityRules *[]SecurityRuleInfo

	TagList []KeyValue
}

type SecurityRuleInfo

type SecurityRuleInfo struct {
	Direction  string `json:"Direction" validate:"required" example:"inbound"`         // inbound or outbound
	IPProtocol string `json:"IPProtocol" validate:"required" example:"TCP"`            // TCP, UDP, ICMP, ALL
	FromPort   string `json:"FromPort" validate:"required" example:"22"`               // TCP, UDP: 1~65535, ICMP, ALL: -1
	ToPort     string `json:"ToPort" validate:"required" example:"22"`                 // TCP, UDP: 1~65535, ICMP, ALL: -1
	CIDR       string `json:"CIDR,omitempty" validate:"omitempty" example:"0.0.0.0/0"` // if not specified, defaults to 0.0.0.0/0
}

type SubnetInfo added in v0.1.3

type SubnetInfo struct {
	IId       IID    `json:"IId" validate:"required"` // {NameId, SystemId}
	Zone      string `json:"Zone" validate:"required" example:"us-east-1a"`
	IPv4_CIDR string `json:"IPv4_CIDR" validate:"required" example:"10.0.8.0/22" description:"The IPv4 CIDR block for the subnet"`

	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this subnet"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"Additional key-value pairs associated with this subnet"`
}

type TagHandler added in v0.8.20

type TagHandler interface {
	AddTag(resType RSType, resIID IID, tag KeyValue) (KeyValue, error)
	ListTag(resType RSType, resIID IID) ([]KeyValue, error)
	GetTag(resType RSType, resIID IID, key string) (KeyValue, error)
	RemoveTag(resType RSType, resIID IID, key string) (bool, error)

	// Find tags by tag key or value
	// resType: ALL | VPC, SUBNET, etc.,.
	// keyword: The keyword to search for in the tag key or value.
	// if you want to find all tags, set keyword to "" or "*".
	FindTag(resType RSType, keyword string) ([]*TagInfo, error)
}

type TagInfo added in v0.8.20

type TagInfo struct {
	ResType RSType // VPC, SUBNET, VM, etc.,.)
	ResIId  IID    // {NameId, SystemId}

	TagList      []KeyValue
	KeyValueList []KeyValue // reserved for optinal usage
}

type VCpuInfo

type VCpuInfo struct {
	Count string `json:"Count" validate:"required" example:"2"`              // Number of CPU cores
	Clock string `json:"Clock,omitempty" validate:"omitempty" example:"2.5"` // Clock speed in GHz
}

VCpuInfo represents the CPU details of a VM specification.

type VMGroupInfo added in v0.5.6

type VMGroupInfo struct {
	Protocol string `json:"Protocol" validate:"required" example:"TCP"` // TCP|UDP
	Port     string `json:"Port" validate:"required" example:"8080"`    // 1-65535
	VMs      *[]IID `json:"VMs" validate:"required"`

	CspID        string     `json:"CspID,omitempty" validate:"omitempty"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

VMGroupInfo represents the backend VM group configuration for an NLB. @description VM Group Information for a Network Load Balancer (NLB)

type VMHandler

type VMHandler interface {
	StartVM(vmReqInfo VMReqInfo) (VMInfo, error)

	SuspendVM(vmIID IID) (VMStatus, error)
	ResumeVM(vmIID IID) (VMStatus, error)
	RebootVM(vmIID IID) (VMStatus, error)
	TerminateVM(vmIID IID) (VMStatus, error)

	ListVMStatus() ([]*VMStatusInfo, error)
	GetVMStatus(vmIID IID) (VMStatus, error)

	ListVM() ([]*VMInfo, error)
	GetVM(vmIID IID) (VMInfo, error)
}

type VMInfo

type VMInfo struct {
	IId       IID       `json:"IId" validate:"required"`                                      // example:"{NameId: 'vm-01', SystemId: 'i-12345678'}"
	StartTime time.Time `json:"StartTime" validate:"required" example:"2024-08-27T10:00:00Z"` // Timezone: based on cloud-barista server location.

	Region            RegionInfo `json:"Region" validate:"required"`                          // example:"{Region: 'us-east-1', Zone: 'us-east-1a'}"
	ImageType         ImageType  `json:"ImageType" validate:"required" example:"PublicImage"` // PublicImage | MyImage
	ImageIId          IID        `json:"ImageIId" validate:"required"`                        // example:"{NameId: 'ami-12345678', SystemId: 'ami-12345678'}"
	VMSpecName        string     `json:"VMSpecName" validate:"required" example:"t2.micro"`   // instance type or flavour, etc... ex) t2.micro or f1.micro
	VpcIID            IID        `json:"VpcIID" validate:"required"`                          // example:"{NameId: 'vpc-01', SystemId: 'vpc-12345678'}"
	SubnetIID         IID        `json:"SubnetIID" validate:"required"`                       // example:"{NameId: 'subnet-01', SystemId: 'subnet-12345678'}"
	SecurityGroupIIds []IID      `json:"SecurityGroupIIds" validate:"required"`               // example:"[{NameId: 'sg-01', SystemId: 'sg-12345678'}]"

	KeyPairIId IID `json:"KeyPairIId" validate:"required"` // example:"{NameId: 'keypair-01', SystemId: 'keypair-12345678'}"

	RootDiskType   string `json:"RootDiskType" validate:"required" example:"gp2"`         // "gp2", "Premium SSD", ...
	RootDiskSize   string `json:"RootDiskSize" validate:"required" example:"50"`          // "default", "50", "1000" (unit is GB)
	RootDeviceName string `json:"RootDeviceName" validate:"required" example:"/dev/sda1"` // "/dev/sda1", ...

	DataDiskIIDs []IID `json:"DataDiskIIDs,omitempty" validate:"omitempty"` // example:"[{NameId: 'datadisk-01', SystemId: 'datadisk-12345678'}]"

	VMBootDisk  string `json:"VMBootDisk,omitempty" validate:"omitempty" example:"/dev/sda1"`  // Deprecated soon
	VMBlockDisk string `json:"VMBlockDisk,omitempty" validate:"omitempty" example:"/dev/sda2"` // Deprecated soon

	VMUserId     string `json:"VMUserId" validate:"required" example:"cb-user"`                     // cb-user or Administrator
	VMUserPasswd string `json:"VMUserPasswd,omitempty" validate:"omitempty" example:"password1234"` // Only for Windows

	NetworkInterface string `json:"NetworkInterface" validate:"required" example:"eni-12345678"`
	PublicIP         string `json:"PublicIP" validate:"required" example:"1.2.3.4"`
	PublicDNS        string `json:"PublicDNS,omitempty" validate:"omitempty" example:"ec2-1-2-3-4.compute-1.amazonaws.com"`
	PrivateIP        string `json:"PrivateIP" validate:"required" example:"192.168.1.1"`
	PrivateDNS       string `json:"PrivateDNS,omitempty" validate:"omitempty" example:"ip-192-168-1-1.ec2.internal"`

	Platform Platform `json:"Platform" validate:"required" example:"LINUX"` // LINUX | WINDOWS

	SSHAccessPoint string `json:"SSHAccessPoint,omitempty" validate:"omitempty" example:"10.2.3.2:22"` // Deprecated
	AccessPoint    string `json:"AccessPoint" validate:"required" example:"1.2.3.4:22"`                // 10.2.3.2:22, 123.456.789.123:432

	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty"`      // example:"[{Key: 'Name', Value: 'MyVM'}]"
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"` // example:"[{Key: 'Architecture', Value: 'x86_64'}]"
}

type VMReqInfo

type VMReqInfo struct {
	IId IID // {NameId, SystemId}

	ImageType         ImageType // PublicImage | MyImage, default: PublicImage
	ImageIID          IID
	VpcIID            IID
	SubnetIID         IID
	SecurityGroupIIDs []IID

	VMSpecName string
	KeyPairIID IID

	RootDiskType string // "", "SSD(gp2)", "Premium SSD", ...
	RootDiskSize string // "", "default", "50", "1000" (unit is GB)

	DataDiskIIDs []IID

	VMUserId     string
	VMUserPasswd string
	WindowsType  bool

	TagList []KeyValue
}

type VMSpecHandler

type VMSpecHandler interface {
	ListVMSpec() ([]*VMSpecInfo, error)
	GetVMSpec(Name string) (VMSpecInfo, error)

	ListOrgVMSpec() (string, error)           // return string: json format
	GetOrgVMSpec(Name string) (string, error) // return string: json format
}

type VMSpecInfo

type VMSpecInfo struct {
	Region string    `json:"Region" validate:"required" example:"us-east-1"` // Region where the VM spec is available
	Name   string    `json:"Name" validate:"required" example:"t2.micro"`    // Name of the VM spec
	VCpu   VCpuInfo  `json:"VCpu" validate:"required"`                       // CPU details of the VM spec
	Mem    string    `json:"Mem" validate:"required" example:"1024"`         // Memory size in MB
	Gpu    []GpuInfo `json:"Gpu,omitempty" validate:"omitempty"`             // GPU details if available

	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"` // Additional key-value pairs for the VM spec
}

VMSpecInfo represents the detailed information of a VM specification.

type VMStatus

type VMStatus string

VMStatus represents the possible statuses of a VM. @description The status of a Virtual Machine (VM). @enum string @enum values [Creating, Running, Suspending, Suspended, Resuming, Rebooting, Terminating, Terminated, NotExist, Failed]

const (
	Creating VMStatus = "Creating" // from launch to running
	Running  VMStatus = "Running"

	Suspending VMStatus = "Suspending" // from running to suspended
	Suspended  VMStatus = "Suspended"
	Resuming   VMStatus = "Resuming" // from suspended to running

	Rebooting VMStatus = "Rebooting" // from running to running

	Terminating VMStatus = "Terminating" // from running, suspended to terminated
	Terminated  VMStatus = "Terminated"
	NotExist    VMStatus = "NotExist" // VM does not exist

	Failed VMStatus = "Failed"
)

type VMStatusInfo

type VMStatusInfo struct {
	IId      IID      `json:"IId" validate:"required" example:"` // {NameId: 'vm-01', SystemId: 'i-12345678'}"
	VmStatus VMStatus `json:"VmStatus" validate:"required" example:"Running"`
}

type VPCHandler added in v0.1.3

type VPCHandler interface {
	CreateVPC(vpcReqInfo VPCReqInfo) (VPCInfo, error)
	ListVPC() ([]*VPCInfo, error)
	GetVPC(vpcIID IID) (VPCInfo, error)
	DeleteVPC(vpcIID IID) (bool, error)

	AddSubnet(vpcIID IID, subnetInfo SubnetInfo) (VPCInfo, error)
	RemoveSubnet(vpcIID IID, subnetIID IID) (bool, error)
}

type VPCInfo added in v0.1.3

type VPCInfo struct {
	IId            IID          `json:"IId" validate:"required"` // {NameId, SystemId}
	IPv4_CIDR      string       `json:"IPv4_CIDR" validate:"required" example:"10.0.0.0/16" description:"The IPv4 CIDR block for the VPC"`
	SubnetInfoList []SubnetInfo `json:"SubnetInfoList" validate:"required" description:"A list of subnet information associated with this VPC"`

	TagList      []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this VPC"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"Additional key-value pairs associated with this VPC"`
}

type VPCReqInfo added in v0.1.3

type VPCReqInfo struct {
	IId            IID // {NameId, SystemId}
	IPv4_CIDR      string
	SubnetInfoList []SubnetInfo

	TagList []KeyValue
}

type ZoneInfo added in v0.7.6

type ZoneInfo struct {
	Name         string     `json:"Name" validate:"required" example:"us-east-1a"`
	DisplayName  string     `json:"DisplayName" validate:"required" example:"US East 1A"`
	Status       ZoneStatus `json:"Status" validate:"required" example:"Available"`
	KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"`
}

ZoneInfo represents the information of a Zone. @example {"Name": "us-east-1a", "DisplayName": "US East 1A", "Status": "Available", "KeyValueList": [{"Key": "zoneKey1", "Value": "zoneValue1"}]}

type ZoneStatus added in v0.7.6

type ZoneStatus string

-------- Const

const (
	ZoneAvailable   ZoneStatus = "Available"
	ZoneUnavailable ZoneStatus = "Unavailable"
	NotSupported    ZoneStatus = "StatusNotSupported"
)

Jump to

Keyboard shortcuts

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