resources

package
v0.8.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessInfo added in v0.6.15

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

type AddonsInfo added in v0.6.3

type AddonsInfo struct {
	KeyValueList []KeyValue
}

CNI, DNS, .... @todo

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 // Function ID

	IKeyValueList []KeyValue // Input Arguments List
	OKeyValueList []KeyValue // Output Results List
}

type CloudPrice added in v0.8.0

type CloudPrice struct {
	CloudName string  `json:"cloudName"`
	PriceList []Price `json:"priceList"`
}

type CloudPriceData added in v0.8.0

type CloudPriceData struct {
	Meta           Meta         `json:"meta"`
	CloudPriceList []CloudPrice `json:"cloudPriceList"`
}

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 // {NameId, SystemId}

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

	NodeGroupList []NodeGroupInfo
	AccessInfo    AccessInfo
	Addons        AddonsInfo

	Status ClusterStatus

	CreatedTime  time.Time
	KeyValueList []KeyValue
}

-------- Info Structure

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 // {NameId, SystemId}

	DiskType string // "", "SSD(gp2)", "Premium SSD", ...
	DiskSize string // "", "default", "50", "1000"  # (GB)

	Status  DiskStatus // DiskCreating | DiskAvailable | DiskAttached | DiskDeleting | DiskError
	OwnerVM IID        // When the Status is DiskAttached

	CreatedTime  time.Time
	KeyValueList []KeyValue
}

-------- Info Structure

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
	Mfr   string
	Model string
	Mem   string // MB
}

type HealthCheckerInfo added in v0.5.5

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

	CspID        string // Optional, May be Used by Driver.
	KeyValueList []KeyValue
}

type HealthInfo added in v0.5.6

type HealthInfo struct {
	AllVMs       *[]IID
	HealthyVMs   *[]IID
	UnHealthyVMs *[]IID
}

type IID added in v0.1.2

type IID struct {
	NameId   string // NameID by user
	SystemId string // SystemID by CloudOS
}

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    // {NameId, SystemId}
	GuestOS string // Windows7, Ubuntu etc.
	Status  string // available, unavailable

	KeyValueList []KeyValue
}

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 // {NameId, SystemId}
	Fingerprint string
	PublicKey   string
	PrivateKey  string
	VMUserID    string

	KeyValueList []KeyValue
}

type KeyPairReqInfo

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

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

type ListenerInfo added in v0.5.5

type ListenerInfo struct {
	Protocol string // TCP|UDP
	IP       string // Auto Generated and attached
	Port     string // 1-65535
	DNSName  string // Optional, Auto Generated and attached

	CspID        string // Optional, May be Used by Driver.
	KeyValueList []KeyValue
}

type Meta added in v0.8.0

type Meta struct {
	Version     string `json:"version"`
	Description string `json:"description"`
}

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 // {NameId, SystemId}

	SourceVM IID

	Status MyImageStatus // Available | Unavailable

	CreatedTime  time.Time
	KeyValueList []KeyValue
}

-------- Info Structure

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 // {NameId, SystemId}
	VpcIID IID // {NameId, SystemId}

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

	//------ Frontend
	Listener ListenerInfo

	//------ Backend
	VMGroup       VMGroupInfo
	HealthChecker HealthCheckerInfo

	CreatedTime  time.Time
	KeyValueList []KeyValue
}

-------- Info Structure

type NetworkInfo added in v0.6.3

type NetworkInfo struct {
	VpcIID            IID // {NameId, SystemId}
	SubnetIIDs        []IID
	SecurityGroupIIDs []IID

	KeyValueList []KeyValue
}

type NodeGroupInfo added in v0.6.3

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

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

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

	Status NodeGroupStatus
	Nodes  []IID

	KeyValueList []KeyValue
}

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"`
	PriceInfo   PriceInfo   `json:"priceInfo"`
}

type PriceInfo added in v0.8.0

type PriceInfo struct {
	PricingPolicies []PricingPolicies `json:"pricingPolicies"`
	CSPPriceInfo    interface{}       `json:"cspPriceInfo"`
}

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"`
	PricingPolicy     string             `json:"pricingPolicy"`
	Unit              string             `json:"unit"`
	Currency          string             `json:"currency"`
	Price             string             `json:"price"`
	Description       string             `json:"description"`
	PricingPolicyInfo *PricingPolicyInfo `json:"pricingPolicyInfo,omitempty"`
}

type PricingPolicyInfo added in v0.8.0

type PricingPolicyInfo struct {
	LeaseContractLength string `json:"LeaseContractLength"`
	OfferingClass       string `json:"OfferingClass"`
	PurchaseOption      string `json:"PurchaseOption"`
}

type ProductInfo added in v0.8.0

type ProductInfo struct {
	ProductId  string `json:"productId"`
	RegionName string `json:"regionName"`
	ZoneName   string `json:"zoneName"`

	//--------- Compute Instance
	InstanceType    string `json:"instanceType,omitempty"`
	Vcpu            string `json:"vcpu,omitempty"`
	Memory          string `json:"memory,omitempty"`
	Storage         string `json:"storage,omitempty"` // Root-Disk
	Gpu             string `json:"gpu,omitempty"`
	GpuMemory       string `json:"gpuMemory,omitempty"`
	OperatingSystem string `json:"operatingSystem,omitempty"`
	PreInstalledSw  string `json:"preInstalledSw,omitempty"`

	//--------- Storage  // Data-Disk(AWS:EBS)
	VolumeType          string `json:"volumeType,omitempty"`
	StorageMedia        string `json:"storageMedia,omitempty"`
	MaxVolumeSize       string `json:"maxVolumeSize,omitempty"`
	MaxIOPSVolume       string `json:"maxIopsvolume,omitempty"`
	MaxThroughputVolume string `json:"maxThroughputvolume,omitempty"`

	Description    string      `json:"description"`
	CSPProductInfo interface{} `json:"cspProductInfo"`
}

type RegionInfo

type RegionInfo struct {
	Region string
	Zone   string
}

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
	DisplayName string
	ZoneList    []ZoneInfo

	KeyValueList []KeyValue
}

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 // {NameId, SystemId}

	VpcIID IID // {NameId, SystemId}
	//Direction     string // @todo userd??
	SecurityRules *[]SecurityRuleInfo

	KeyValueList []KeyValue
}

type SecurityReqInfo

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

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

type SecurityRuleInfo

type SecurityRuleInfo struct {
	Direction  string
	IPProtocol string
	FromPort   string
	ToPort     string
	CIDR       string
}

@definitionAlias cres.SecurityRuleInfo

type SubnetInfo added in v0.1.3

type SubnetInfo struct {
	IId       IID // {NameId, SystemId}
	IPv4_CIDR string

	KeyValueList []KeyValue
}

type VCpuInfo

type VCpuInfo struct {
	Count string
	Clock string // GHz
}

type VMGroupInfo added in v0.5.6

type VMGroupInfo struct {
	Protocol string // TCP|UDP
	Port     string // 1-65535
	VMs      *[]IID

	CspID        string // Optional, May be Used by Driver.
	KeyValueList []KeyValue
}

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       // {NameId, SystemId}
	StartTime time.Time // Timezone: based on cloud-barista server location.

	Region            RegionInfo //  ex) {us-east1, us-east1-c} or {ap-northeast-2}
	ImageType         ImageType  // PublicImage | MyImage
	ImageIId          IID
	VMSpecName        string //  instance type or flavour, etc... ex) t2.micro or f1.micro
	VpcIID            IID
	SubnetIID         IID   // AWS, ex) subnet-8c4a53e4
	SecurityGroupIIds []IID // AWS, ex) sg-0b7452563e1121bb6

	KeyPairIId IID

	RootDiskType   string // "SSD(gp2)", "Premium SSD", ...
	RootDiskSize   string // "default", "50", "1000" (GB)
	RootDeviceName string // "/dev/sda1", ...

	DataDiskIIDs []IID

	VMBootDisk  string // Deprecated soon
	VMBlockDisk string // Deprecated soon

	VMUserId     string // ex) user1
	VMUserPasswd string

	NetworkInterface string // ex) eth0
	PublicIP         string
	PublicDNS        string
	PrivateIP        string
	PrivateDNS       string

	Platform Platform // LINUX | WINDOWS

	SSHAccessPoint string // ex) 10.2.3.2:22, 123.456.789.123:4321 ==> Deprecated
	AccessPoint    string // ex) 10.2.3.2:22, 123.456.789.123:4321

	KeyValueList []KeyValue
}

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" (GB)

	DataDiskIIDs []IID

	VMUserId     string
	VMUserPasswd string
	WindowsType  bool
}

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
	Name   string
	VCpu   VCpuInfo
	Mem    string // MB
	Gpu    []GpuInfo

	KeyValueList []KeyValue
}

type VMStatus

type VMStatus string

GO do not support Enum. So, define like this.

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 // {NameId, SystemId}
	VmStatus VMStatus
}

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 // {NameId, SystemId}
	IPv4_CIDR      string
	SubnetInfoList []SubnetInfo

	KeyValueList []KeyValue
}

type VPCReqInfo added in v0.1.3

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

type ZoneInfo added in v0.7.6

type ZoneInfo struct {
	Name        string
	DisplayName string
	Status      ZoneStatus // Available | Unavailable | NotSupported

	KeyValueList []KeyValue
}

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