mcir

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelAllResources

func DelAllResources(nsId string, resourceType string, forceFlag string) error

func DelRecommendSpec

func DelRecommendSpec(nsId string, specId string, cpuSize uint16, memSize uint16, diskSize uint32) error

func DelResource

func DelResource(nsId string, resourceType string, resourceId string, forceFlag string) error

func DelResource(nsId string, resourceType string, resourceId string, forceFlag string) (int, []byte, error) {

func FetchImages

func FetchImages(nsId string) (connConfigCount uint, imageCount uint, err error)

func FetchSpecs

func FetchSpecs(nsId string) (connConfigCount uint, specCount uint, err error)

func GetNameFromStruct

func GetNameFromStruct(u interface{}) string

func GetResource

func GetResource(nsId string, resourceType string, resourceId string) (interface{}, error)

func ListResource

func ListResource(nsId string, resourceType string) (interface{}, error)

func ListResourceId

func ListResourceId(nsId string, resourceType string) []string

func LowerizeAndCheckResource

func LowerizeAndCheckResource(nsId string, resourceType string, resourceId string) (bool, string, error)

func RegisterRecommendList

func RegisterRecommendList(nsId string, connectionName string, cpuSize uint16, memSize uint16, diskSize uint32, specId string, price float32) error

Types

type FilterSpecsByRangeRequest added in v0.2.8

type FilterSpecsByRangeRequest struct {
	Num_vCPU              Range `json:"num_vCPU"`
	Num_core              Range `json:"num_core"`
	Mem_GiB               Range `json:"mem_GiB"`
	Storage_GiB           Range `json:"storage_GiB"`
	Cost_per_hour         Range `json:"cost_per_hour"`
	Num_storage           Range `json:"num_storage"`
	Max_num_storage       Range `json:"max_num_storage"`
	Max_total_storage_TiB Range `json:"max_total_storage_TiB"`
	Net_bw_Gbps           Range `json:"net_bw_Gbps"`
	Ebs_bw_Mbps           Range `json:"ebs_bw_Mbps"`
	Num_gpu               Range `json:"num_gpu"`
	Gpumem_GiB            Range `json:"gpumem_GiB"`
	EvaluationScore_01    Range `json:"evaluationScore_01"`
	EvaluationScore_02    Range `json:"evaluationScore_02"`
	EvaluationScore_03    Range `json:"evaluationScore_03"`
	EvaluationScore_04    Range `json:"evaluationScore_04"`
	EvaluationScore_05    Range `json:"evaluationScore_05"`
	EvaluationScore_06    Range `json:"evaluationScore_06"`
	EvaluationScore_07    Range `json:"evaluationScore_07"`
	EvaluationScore_08    Range `json:"evaluationScore_08"`
	EvaluationScore_09    Range `json:"evaluationScore_09"`
	EvaluationScore_10    Range `json:"evaluationScore_10"`
}

type NameOnly

type NameOnly struct {
	Name string
}

type Range added in v0.2.8

type Range struct {
	Min float32 `json:"min"`
	Max float32 `json:"max"`
}

type ReturnValue

type ReturnValue struct {
	CustomStruct interface{}
}

type SpiderGpuInfo

type SpiderGpuInfo struct {
	Count string
	Mfr   string
	Model string
	Mem   string
}

type SpiderImageInfo

type SpiderImageInfo struct {
	// Fields for request
	Name string

	// Fields for response
	IId          common.IID // {NameId, SystemId}
	GuestOS      string     // Windows7, Ubuntu etc.
	Status       string     // available, unavailable
	KeyValueList []common.KeyValue
}

func LookupImage

func LookupImage(connConfig string, imageId string) (SpiderImageInfo, error)

type SpiderImageList

type SpiderImageList struct {
	Image []SpiderImageInfo `json:"image"`
}

func LookupImageList

func LookupImageList(connConfig string) (SpiderImageList, error)

type SpiderImageReqInfoWrapper

type SpiderImageReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderImageInfo
}

type SpiderKeyPairInfo

type SpiderKeyPairInfo struct {
	// Fields for request
	Name string

	// Fields for response
	IId          common.IID // {NameId, SystemId}
	Fingerprint  string
	PublicKey    string
	PrivateKey   string
	VMUserID     string
	KeyValueList []common.KeyValue
}

type SpiderKeyPairReqInfoWrapper

type SpiderKeyPairReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderKeyPairInfo
}

type SpiderSecurityInfo

type SpiderSecurityInfo struct {
	// Fields for request
	Name    string
	VPCName string

	// Fields for both request and response
	SecurityRules *[]SpiderSecurityRuleInfo

	// Fields for response
	IId          common.IID // {NameId, SystemId}
	VpcIID       common.IID // {NameId, SystemId}
	Direction    string     // @todo userd??
	KeyValueList []common.KeyValue
}

type SpiderSecurityReqInfoWrapper

type SpiderSecurityReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderSecurityInfo
}

type SpiderSecurityRuleInfo

type SpiderSecurityRuleInfo struct {
	FromPort   string `json:"fromPort"`
	ToPort     string `json:"toPort"`
	IPProtocol string `json:"ipProtocol"`
	Direction  string `json:"direction"`
}

type SpiderSpecInfo

type SpiderSpecInfo struct {
	Region string
	Name   string
	VCpu   SpiderVCpuInfo
	Mem    string
	Gpu    []SpiderGpuInfo

	KeyValueList []common.KeyValue
}

func LookupSpec

func LookupSpec(connConfig string, specName string) (SpiderSpecInfo, error)

func LookupSpec(u *TbSpecInfo) (SpiderSpecInfo, error) {

type SpiderSpecList

type SpiderSpecList struct {
	Vmspec []SpiderSpecInfo `json:"vmspec"`
}

func LookupSpecList

func LookupSpecList(connConfig string) (SpiderSpecList, error)

type SpiderSubnetInfo

type SpiderSubnetInfo struct {
	IId          common.IID // {NameId, SystemId}
	IPv4_CIDR    string
	KeyValueList []common.KeyValue
}

type SpiderSubnetReqInfo

type SpiderSubnetReqInfo struct {
	Name         string
	IPv4_CIDR    string
	KeyValueList []common.KeyValue
}

type SpiderVCpuInfo

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

type SpiderVPCInfo

type SpiderVPCInfo struct {
	IId            common.IID // {NameId, SystemId}
	IPv4_CIDR      string
	SubnetInfoList []SpiderSubnetInfo
	KeyValueList   []common.KeyValue
}

type SpiderVPCReqInfo

type SpiderVPCReqInfo struct {
	Name           string
	IPv4_CIDR      string
	SubnetInfoList []SpiderSubnetReqInfo
}

type SpiderVPCReqInfoWrapper

type SpiderVPCReqInfoWrapper struct {
	ConnectionName string
	ReqInfo        SpiderVPCReqInfo
}

type TbImageInfo

type TbImageInfo struct {
	Id             string            `json:"id"`
	Name           string            `json:"name"`
	ConnectionName string            `json:"connectionName"`
	CspImageId     string            `json:"cspImageId"`
	CspImageName   string            `json:"cspImageName"`
	Description    string            `json:"description"`
	CreationDate   string            `json:"creationDate"`
	GuestOS        string            `json:"guestOS"` // Windows7, Ubuntu etc.
	Status         string            `json:"status"`  // available, unavailable
	KeyValueList   []common.KeyValue `json:"keyValueList"`
}

func ConvertSpiderImageToTumblebugImage

func ConvertSpiderImageToTumblebugImage(spiderImage SpiderImageInfo) (TbImageInfo, error)

func RegisterImageWithId

func RegisterImageWithId(nsId string, u *TbImageReq) (TbImageInfo, error)

func RegisterImageWithInfo

func RegisterImageWithInfo(nsId string, content *TbImageInfo) (TbImageInfo, error)

func SearchImage added in v0.2.8

func SearchImage(nsId string, keywords ...string) ([]TbImageInfo, error)

type TbImageReq

type TbImageReq struct {
	Name           string `json:"name"`
	ConnectionName string `json:"connectionName"`
	CspImageId     string `json:"cspImageId"`
	Description    string `json:"description"`
}

type TbSecurityGroupInfo

type TbSecurityGroupInfo struct {
	Id                   string                    `json:"id"`
	Name                 string                    `json:"name"`
	ConnectionName       string                    `json:"connectionName"`
	VNetId               string                    `json:"vNetId"`
	Description          string                    `json:"description"`
	FirewallRules        *[]SpiderSecurityRuleInfo `json:"firewallRules"`
	CspSecurityGroupId   string                    `json:"cspSecurityGroupId"`
	CspSecurityGroupName string                    `json:"cspSecurityGroupName"`
	KeyValueList         []common.KeyValue         `json:"keyValueList"`
}

func CreateSecurityGroup

func CreateSecurityGroup(nsId string, u *TbSecurityGroupReq) (TbSecurityGroupInfo, error)

type TbSecurityGroupReq

type TbSecurityGroupReq struct {
	Name           string                    `json:"name"`
	ConnectionName string                    `json:"connectionName"`
	VNetId         string                    `json:"vNetId"`
	Description    string                    `json:"description"`
	FirewallRules  *[]SpiderSecurityRuleInfo `json:"firewallRules"`
}

type TbSpecInfo

type TbSpecInfo struct {
	Id                    string  `json:"id"`
	Name                  string  `json:"name"`
	ConnectionName        string  `json:"connectionName"`
	CspSpecName           string  `json:"cspSpecName"`
	Os_type               string  `json:"os_type"`
	Num_vCPU              uint16  `json:"num_vCPU"`
	Num_core              uint16  `json:"num_core"`
	Mem_GiB               uint16  `json:"mem_GiB"`
	Storage_GiB           uint32  `json:"storage_GiB"`
	Description           string  `json:"description"`
	Cost_per_hour         float32 `json:"cost_per_hour"`
	Num_storage           uint8   `json:"num_storage"`
	Max_num_storage       uint8   `json:"max_num_storage"`
	Max_total_storage_TiB uint16  `json:"max_total_storage_TiB"`
	Net_bw_Gbps           uint16  `json:"net_bw_Gbps"`
	Ebs_bw_Mbps           uint32  `json:"ebs_bw_Mbps"`
	Gpu_model             string  `json:"gpu_model"`
	Num_gpu               uint8   `json:"num_gpu"`
	Gpumem_GiB            uint16  `json:"gpumem_GiB"`
	Gpu_p2p               string  `json:"gpu_p2p"`
	OrderInFilteredResult uint16  `json:"orderInFilteredResult"`
	EvaluationStatus      string  `json:"evaluationStatus"`
	EvaluationScore_01    float32 `json:"evaluationScore_01"`
	EvaluationScore_02    float32 `json:"evaluationScore_02"`
	EvaluationScore_03    float32 `json:"evaluationScore_03"`
	EvaluationScore_04    float32 `json:"evaluationScore_04"`
	EvaluationScore_05    float32 `json:"evaluationScore_05"`
	EvaluationScore_06    float32 `json:"evaluationScore_06"`
	EvaluationScore_07    float32 `json:"evaluationScore_07"`
	EvaluationScore_08    float32 `json:"evaluationScore_08"`
	EvaluationScore_09    float32 `json:"evaluationScore_09"`
	EvaluationScore_10    float32 `json:"evaluationScore_10"`
}

func ConvertSpiderSpecToTumblebugSpec

func ConvertSpiderSpecToTumblebugSpec(spiderSpec SpiderSpecInfo) (TbSpecInfo, error)

func FilterSpecs added in v0.2.8

func FilterSpecs(nsId string, filter TbSpecInfo) ([]TbSpecInfo, error)

func FilterSpecsByRange added in v0.2.8

func FilterSpecsByRange(nsId string, filter FilterSpecsByRangeRequest) ([]TbSpecInfo, error)

func RegisterSpecWithCspSpecName

func RegisterSpecWithCspSpecName(nsId string, u *TbSpecReq) (TbSpecInfo, error)

func RegisterSpecWithInfo

func RegisterSpecWithInfo(nsId string, content *TbSpecInfo) (TbSpecInfo, error)

func SortSpecs added in v0.2.8

func SortSpecs(specList []TbSpecInfo, orderBy string, direction string) ([]TbSpecInfo, error)

func UpdateSpec added in v0.2.8

func UpdateSpec(nsId string, newSpec TbSpecInfo) (TbSpecInfo, error)

type TbSpecReq

type TbSpecReq struct {
	Name           string `json:"name"`
	ConnectionName string `json:"connectionName"`
	CspSpecName    string `json:"cspSpecName"`
	Description    string `json:"description"`
}

type TbSshKeyInfo

type TbSshKeyInfo struct {
	Id             string            `json:"id"`
	Name           string            `json:"name"`
	ConnectionName string            `json:"connectionName"`
	Description    string            `json:"description"`
	CspSshKeyName  string            `json:"cspSshKeyName"`
	Fingerprint    string            `json:"fingerprint"`
	Username       string            `json:"username"`
	PublicKey      string            `json:"publicKey"`
	PrivateKey     string            `json:"privateKey"`
	KeyValueList   []common.KeyValue `json:"keyValueList"`
}

func CreateSshKey

func CreateSshKey(nsId string, u *TbSshKeyReq) (TbSshKeyInfo, error)

type TbSshKeyReq

type TbSshKeyReq struct {
	Name           string `json:"name"`
	ConnectionName string `json:"connectionName"`
	Description    string `json:"description"`
}

type TbVNetInfo

type TbVNetInfo struct {
	Id             string             `json:"id"`
	Name           string             `json:"name"`
	ConnectionName string             `json:"connectionName"`
	CidrBlock      string             `json:"cidrBlock"`
	SubnetInfoList []SpiderSubnetInfo `json:"subnetInfoList"`
	Description    string             `json:"description"`
	CspVNetId      string             `json:"cspVNetId"`
	CspVNetName    string             `json:"cspVNetName"`
	Status         string             `json:"status"`
	KeyValueList   []common.KeyValue  `json:"keyValueList"`
}

func CreateVNet

func CreateVNet(nsId string, u *TbVNetReq) (TbVNetInfo, error)

type TbVNetReq

type TbVNetReq struct {
	Name           string                `json:"name"`
	ConnectionName string                `json:"connectionName"`
	CidrBlock      string                `json:"cidrBlock"`
	SubnetInfoList []SpiderSubnetReqInfo `json:"subnetInfoList"`
	Description    string                `json:"description"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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