cloud

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivateCloud = "PrivateCloud" // 自建机房 私有云

	AlibabaCloud = "AlibabaCloud"
	HuaweiCloud  = "HuaweiCloud"
	TencentCloud = "TencentCloud"
	BaiduCloud   = "BaiduCloud"
	AWSCloud     = "AWSCloud"
	ECloud       = "ECloud"
)
View Source
const (
	TaskId      = "TaskId"
	ClusterName = "ClusterName"
)
View Source
const (
	PrePaid  = "PrePaid"
	PostPaid = "PostPaid"
)
View Source
const (
	Unpaid
	Cancelled
)
View Source
const (
	InstanceChargeTypePrePaid  = "PrePaid"
	InstanceChargeTypePostPaid = "PostPaid"
)
View Source
const (
	EcsBuilding = "Pending"
	EcsRunning  = "Running"
	EcsStarting = "Starting"
	EcsStopping = "Stopping"
	EcsStopped  = "Stopped"
	EcsAbnormal = "Abnormal"
	EcsDeleted  = "Deleted"
)
View Source
const (
	BandwidthPayByTraffic = "PayByTraffic"
	BandwidthPayByFix     = "PayByBandwidth"
	BandwidthPrePaid      = "PrePaid"
)
View Source
const (
	InsTypeChargeTypePrePaid  = "PrePaid"
	InsTypeChargeTypePostPaid = "PostPaid"
	InsTypeChargeTypeAll      = "All"
)
View Source
const (
	InsTypeAvailable = "Available"
	InsTypeAvaSoon   = "AvailableSoon"
	InsTypeLowStock  = "LowStock"
	InsTypeSellOut   = "Sellout"
)
View Source
const (
	ImageGlobal  = "global"
	ImagePrivate = "private"
	ImageShared  = "shared"
)
View Source
const (
	SecGroupRuleIn  = "ingress"
	SecGroupRuleOut = "egress"
)
View Source
const (
	SecGroupAllow = "allow"
	SecGroupDeny  = "deny"
)
View Source
const (
	IpV4 = "IPv4"
	IpV6 = "IPv6"
)
View Source
const (
	ProtocolIcmp   = "icmp"
	ProtocolIcmpV6 = "icmpV6"
	ProtocolTcp    = "tcp"
	ProtocolUdp    = "udp"
	ProtocolGre    = "gre"
	ProtocolAll    = "all"
)
View Source
const (
	OsLinux   = "linux"
	OsWindows = "windows"
	OsOther   = "other"
)
View Source
const (
	VPCStatusPending   = "Pending"
	VPCStatusAvailable = "Available"
	VPCStatusAbnormal  = "Abnormal"
)
View Source
const (
	SubnetPending   = "Pending"
	SubnetAvailable = "Available"
	SubnetAbnormal  = "Abnormal"
)
View Source
const (
	Year  = "Year"
	Month = "Month"
)

Variables

This section is empty.

Functions

func RegisterProviderDriver

func RegisterProviderDriver(name string, f ProviderDriverFunc)

Types

type AcrInstanceListResponse added in v0.7.1

type AcrInstanceListResponse struct {
	EnterpriseContainerCommon
	Instances []RegistryInstance `json:"Instances"`
}

type AddSecurityGroupRuleRequest

type AddSecurityGroupRuleRequest struct {
	RegionId        string
	VpcId           string
	SecurityGroupId string
	IpProtocol      string
	PortFrom        int
	PortTo          int
	GroupId         string
	CidrIp          string
	PrefixListId    string
}

type AddSecurityGroupRuleResponse

type AddSecurityGroupRuleResponse struct {
}

type AllocateEipRequest added in v0.7.1

type AllocateEipRequest struct {
	RegionId                string
	Name                    string
	InternetServiceProvider string
	Bandwidth               int
	Charge                  *Charge
	Num                     int
}

type AvailableZone

type AvailableZone struct {
	ZoneId string
	Status string
}

type BucketProperties added in v0.7.1

type BucketProperties struct {
	Name string `json:"name"`
}

type Charge added in v0.1.5

type Charge struct {
	Period     int    `json:"period"`
	PeriodUnit string `json:"period_unit"`
	ChargeType string `json:"charge_type"`
}

type ConvertPublicIpToEipRequest added in v0.7.1

type ConvertPublicIpToEipRequest struct {
	RegionId   string
	InstanceId string
}

type CreateKeyPairRequest added in v0.7.0

type CreateKeyPairRequest struct {
	RegionId    string
	KeyPairName string
}

type CreateKeyPairResponse added in v0.7.0

type CreateKeyPairResponse struct {
	KeyPairId   string
	KeyPairName string
	PrivateKey  string
	PublicKey   string
}

type CreateSecurityGroupRequest

type CreateSecurityGroupRequest struct {
	RegionId          string
	SecurityGroupName string
	VpcId             string
	SecurityGroupType string
}

type CreateSecurityGroupResponse

type CreateSecurityGroupResponse struct {
	SecurityGroupId string
	RequestId       string
}

type CreateSwitchRequest

type CreateSwitchRequest struct {
	RegionId    string
	ZoneId      string
	CidrBlock   string
	VSwitchName string
	VpcId       string
	GatewayIp   string
}

type CreateSwitchResponse

type CreateSwitchResponse struct {
	SwitchId  string
	RequestId string
}

type CreateVpcRequest

type CreateVpcRequest struct {
	RegionId  string
	VpcName   string
	CidrBlock string
}

type CreateVpcResponse

type CreateVpcResponse struct {
	//RouterId       *string `json:"VRouterId,omitempty" xml:"VRouterId,omitempty"`
	//RouteTableId    *string `json:"RouteTableId,omitempty" xml:"RouteTableId,omitempty"`
	VpcId     string
	RequestId string
}

type DescribeAvailableResourceRequest

type DescribeAvailableResourceRequest struct {
	RegionId string
	ZoneId   string
}

type DescribeAvailableResourceResponse

type DescribeAvailableResourceResponse struct {
	InstanceTypes map[string][]InstanceType
}

type DescribeEipRequest added in v0.7.1

type DescribeEipRequest struct {
	RegionId    string
	InstanceId  string
	PageNum     int
	OlderMarker string
	PageSize    int
}

type DescribeEipResponse added in v0.7.1

type DescribeEipResponse struct {
	List       []Eip  `json:"list"`
	NewMarker  string `json:"new_maker"`
	TotalCount int    `json:"total_count"`
}

type DescribeGroupRulesRequest

type DescribeGroupRulesRequest struct {
	RegionId        string
	SecurityGroupId string
}

type DescribeGroupRulesResponse

type DescribeGroupRulesResponse struct {
	Rules []SecurityGroupRule
}

type DescribeImagesRequest

type DescribeImagesRequest struct {
	RegionId  string
	InsType   string
	ImageType string
}

type DescribeImagesResponse

type DescribeImagesResponse struct {
	Images []Image
}

type DescribeInstanceTypesRequest

type DescribeInstanceTypesRequest struct {
	TypeName []string
}

type DescribeInstanceTypesResponse

type DescribeInstanceTypesResponse struct {
	Infos []InstanceType
}

type DescribeKeyPairsRequest added in v0.7.0

type DescribeKeyPairsRequest struct {
	RegionId    string
	PageNumber  int
	OlderMarker string
	PageSize    int
}

type DescribeKeyPairsResponse added in v0.7.0

type DescribeKeyPairsResponse struct {
	TotalCount int
	KeyPairs   []KeyPair
	NewMarker  string
}

type DescribeSecurityGroupsRequest added in v0.1.1

type DescribeSecurityGroupsRequest struct {
	VpcId    string
	RegionId string
}

type DescribeSecurityGroupsResponse added in v0.1.1

type DescribeSecurityGroupsResponse struct {
	Groups []SecurityGroup
}

type DescribeSwitchesRequest

type DescribeSwitchesRequest struct {
	VpcId string
}

type DescribeSwitchesResponse

type DescribeSwitchesResponse struct {
	Switches []Switch
}

type DescribeVpcsRequest

type DescribeVpcsRequest struct {
	RegionId string
}

type DescribeVpcsResponse

type DescribeVpcsResponse struct {
	Vpcs []VPC
}

type DiskConf

type DiskConf struct {
	Category         string `json:"category"`
	Size             int    `json:"size"`
	PerformanceLevel string `json:"performance_level"`
}

type Disks

type Disks struct {
	SystemDisk DiskConf   `json:"system_disk"`
	DataDisk   []DiskConf `json:"data_disk"`
}

type DockerArtifact added in v0.7.1

type DockerArtifact struct {
	Name string `json:"name"`
}

type Eip added in v0.7.1

type Eip struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	Ip         string `json:"ip"`
	InstanceId string `json:"instance_id,omitempty"`
}

type EnterpriseContainerCommon added in v0.7.1

type EnterpriseContainerCommon struct {
	TotalCount int    `json:"TotalCount"`
	PageSize   int    `json:"PageSize"`
	PageNum    int    `json:"PageNo"`
	Code       string `json:"Code"`
}

type EnterpriseImage added in v0.7.1

type EnterpriseImage struct {
	Status string `json:"Status"`
	Tag    string `json:"Tag"`
}

type EnterpriseImageListResponse added in v0.7.1

type EnterpriseImageListResponse struct {
	EnterpriseContainerCommon
	Images []EnterpriseImage `json:"Images"`
}

type EnterpriseNamespace added in v0.7.1

type EnterpriseNamespace struct {
	NamespaceName string `json:"NamespaceName"`
	NamespaceId   string `json:"NamespaceId"`
}

type EnterpriseNamespaceListResponse added in v0.7.1

type EnterpriseNamespaceListResponse struct {
	EnterpriseContainerCommon
	Namespaces []EnterpriseNamespace `json:"Namespaces"`
}

type EnterpriseRepository added in v0.7.1

type EnterpriseRepository struct {
	RepoNamespaceName string `json:"RepoNamespaceName"`
	RepoName          string `json:"RepoName"`
	RepoId            string `json:"RepoId"`
}

type EnterpriseRepositoryListResponse added in v0.7.1

type EnterpriseRepositoryListResponse struct {
	EnterpriseContainerCommon
	Repositories []EnterpriseRepository `json:"repositories"`
}

type GetOrdersRequest

type GetOrdersRequest struct {
	StartTime time.Time
	EndTime   time.Time
	PageNum   int
	PageSize  int
}

type GetOrdersResponse

type GetOrdersResponse struct {
	Orders []Order
}

type GetRegionsResponse

type GetRegionsResponse struct {
	Regions []Region
}

type GetSwitchRequest

type GetSwitchRequest struct {
	SwitchId string
}

type GetSwitchResponse

type GetSwitchResponse struct {
	Switch Switch
}

type GetVpcRequest

type GetVpcRequest struct {
	VpcId    string
	RegionId string
	VpcName  string
}

type GetVpcResponse

type GetVpcResponse struct {
	Vpc VPC
}

type GetZonesRequest

type GetZonesRequest struct {
	RegionId string
}

type GetZonesResponse

type GetZonesResponse struct {
	Zones []Zone
}

type Image

type Image struct {
	Platform  string `json:"platform"`
	OsType    string `json:"os_type"`
	OsName    string `json:"os_name"`
	Size      int    `json:"size"` //GB
	ImageId   string `json:"image_id"`
	ImageName string `json:"image_name"`
}

type ImageTag added in v0.7.1

type ImageTag struct {
	Tag    string `json:"tag"`
	Status string `json:"status"`
}

type ImportKeyPairRequest added in v0.7.0

type ImportKeyPairRequest struct {
	RegionId    string
	KeyPairName string
	PublicKey   string
}

type ImportKeyPairResponse added in v0.7.0

type ImportKeyPairResponse struct {
	KeyPairId   string
	KeyPairName string
}

type Instance

type Instance struct {
	Id       string     `json:"id"`
	CostWay  string     `json:"cost_way"`
	Provider string     `json:"provider"`
	IpInner  string     `json:"ip_inner"`
	IpOuter  string     `json:"ip_outer"`
	Network  *Network   `json:"network"`
	ImageId  string     `json:"image_id"`
	Status   string     `json:"status"`
	ExpireAt *time.Time `json:"expire_at"`
}

type InstanceType

type InstanceType struct {
	ChargeType  string `json:"charge_type"`
	IsGpu       bool   `json:"is_gpu"`
	Core        int    `json:"core"`
	Memory      int    `json:"memory"`
	Family      string `json:"instance_type_family"`
	InsTypeName string `json:"instance_type"`
	Status      string `json:"status"`
}

type KeyPair added in v0.7.0

type KeyPair struct {
	KeyPairId   string
	KeyPairName string
}

type Namespace added in v0.7.1

type Namespace struct {
	Name string `json:"namespace"`
}

type Network

type Network struct {
	VpcId                   string `json:"vpc_id"`
	SubnetId                string `json:"subnet_id"`
	SecurityGroup           string `json:"security_group"`
	InternetChargeType      string `json:"internet_charge_type"`
	InternetMaxBandwidthOut int    `json:"internet_max_bandwidth_out"`
	InternetIpType          string `json:"internet_ip_type"`
}

type ObjectProperties added in v0.7.1

type ObjectProperties struct {
	Name string `json:"name"`
}

type Order

type Order struct {
	OrderId        string
	OrderTime      time.Time
	Product        string
	Quantity       int32
	UsageStartTime time.Time
	UsageEndTime   time.Time
	RegionId       string
	ChargeType     string
	PayStatus      int8
	Currency       string
	Cost           float32
	Extend         map[string]interface{}
}

type Params

type Params struct {
	Provider     string
	InstanceType string
	ImageId      string
	Network      *Network
	Zone         string
	Region       string
	Disks        *Disks
	Charge       *Charge
	Password     string
	Tags         []Tag
	DryRun       bool
	KeyPairId    string
	KeyPairName  string
}

type PersonalNamespace added in v0.7.1

type PersonalNamespace struct {
	Namespace string `json:"namespace"`
}

type PersonalNamespaceListData added in v0.7.1

type PersonalNamespaceListData struct {
	Namespaces []PersonalNamespace `json:"namespaces"`
}

type PersonalNamespaceListResponse added in v0.7.1

type PersonalNamespaceListResponse struct {
	Data PersonalNamespaceListData `json:"data"`
}

type PersonalRepo added in v0.7.1

type PersonalRepo struct {
	RepoName string `json:"repoName"`
}

type PersonalRepositoryListData added in v0.7.1

type PersonalRepositoryListData struct {
	Total    int            `json:"total"`
	Page     int            `json:"page"`
	PageSize int            `json:"pageSize"`
	Repos    []PersonalRepo `json:"repos"`
}

type PersonalRepositoryListResponse added in v0.7.1

type PersonalRepositoryListResponse struct {
	Data PersonalRepositoryListData `json:"data"`
}

type Provider

type Provider interface {
	BatchCreate(m Params, num int) (instanceIds []string, err error)
	ProviderType() string
	GetInstances(ids []string) (instances []Instance, err error)
	GetInstancesByTags(region string, tags []Tag) (instances []Instance, err error)
	GetInstancesByCluster(regionId, clusterName string) (instances []Instance, err error)
	BatchDelete(ids []string, regionId string) error
	StartInstances(ids []string) error
	StopInstances(ids []string) error
	CreateVPC(req CreateVpcRequest) (CreateVpcResponse, error)
	GetVPC(req GetVpcRequest) (GetVpcResponse, error)
	CreateSwitch(req CreateSwitchRequest) (CreateSwitchResponse, error)
	GetSwitch(req GetSwitchRequest) (GetSwitchResponse, error)
	CreateSecurityGroup(req CreateSecurityGroupRequest) (CreateSecurityGroupResponse, error)
	AddIngressSecurityGroupRule(req AddSecurityGroupRuleRequest) error
	AddEgressSecurityGroupRule(req AddSecurityGroupRuleRequest) error
	DescribeSecurityGroups(req DescribeSecurityGroupsRequest) (DescribeSecurityGroupsResponse, error)
	GetRegions() (GetRegionsResponse, error)
	GetZones(req GetZonesRequest) (GetZonesResponse, error)
	DescribeAvailableResource(req DescribeAvailableResourceRequest) (DescribeAvailableResourceResponse, error)
	DescribeInstanceTypes(req DescribeInstanceTypesRequest) (DescribeInstanceTypesResponse, error)
	DescribeImages(req DescribeImagesRequest) (DescribeImagesResponse, error)
	DescribeVpcs(req DescribeVpcsRequest) (DescribeVpcsResponse, error)
	DescribeSwitches(req DescribeSwitchesRequest) (DescribeSwitchesResponse, error)
	DescribeGroupRules(req DescribeGroupRulesRequest) (DescribeGroupRulesResponse, error)
	// order
	GetOrders(req GetOrdersRequest) (GetOrdersResponse, error)
	// key pairs
	CreateKeyPair(req CreateKeyPairRequest) (CreateKeyPairResponse, error)
	ImportKeyPair(req ImportKeyPairRequest) (ImportKeyPairResponse, error)
	DescribeKeyPairs(req DescribeKeyPairsRequest) (DescribeKeyPairsResponse, error)
	// eip
	AllocateEip(req AllocateEipRequest) (ids []string, err error)
	GetEips(ids []string, regionId string) (map[string]Eip, error)
	ReleaseEip(ids []string) (err error)
	AssociateEip(id, instanceId, vpcId string) error
	DisassociateEip(id string) error
	DescribeEip(req DescribeEipRequest) (DescribeEipResponse, error)
	ConvertPublicIpToEip(req ConvertPublicIpToEipRequest) error
	// s3
	ListObjects(endpoint, bucketName, prefix string) ([]ObjectProperties, error)
	ListBucket(endpoint string) ([]BucketProperties, error)
	GetOssDownloadUrl(string, string, string) string
	GetObjectDownloadUrl(bucketName, objectKey string) (string, error)

	// container registry
	ContainerInstanceList(region string, pageNumber, pageSize int) ([]RegistryInstance, int, error)
	EnterpriseNamespaceList(region, instanceId string, pageNumber, pageSize int) ([]Namespace, int, error)
	PersonalNamespaceList(region string) ([]Namespace, error)
	EnterpriseRepositoryList(region, instanceId, namespace string, pageNumber, pageSize int) ([]Repository, int, error)
	PersonalRepositoryList(region, namespace string, pageNumber, pageSize int) ([]Repository, int, error)
	EnterpriseImageList(region, instanceId, repoId, namespace, repoName string, pageNumber, pageSize int) ([]DockerArtifact, int, error)
	PersonalImageList(region, repoNamespace, repoName string, pageNum, pageSize int) ([]DockerArtifact, int, error)
}

type ProviderDriverFunc

type ProviderDriverFunc func(keyId ...string) (Provider, error)

type Region

type Region struct {
	RegionId  string
	LocalName string
}

type RegistryInstance added in v0.7.1

type RegistryInstance struct {
	InstanceName string `json:"InstanceName"`
	InstanceId   string `json:"InstanceId"`
}

type Repository added in v0.7.1

type Repository struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

type SecurityGroup

type SecurityGroup struct {
	SecurityGroupId   string
	SecurityGroupType string
	SecurityGroupName string
	CreateAt          string
	VpcId             string
	RegionId          string
}

type SecurityGroupRule

type SecurityGroupRule struct {
	VpcId           string
	SecurityGroupId string
	PortFrom        int
	PortTo          int
	Protocol        string
	Direction       string
	GroupId         string
	CidrIp          string
	PrefixListId    string
	CreateAt        string
}

type Switch

type Switch struct {
	VpcId                   string
	SwitchId                string
	Name                    string
	IsDefault               int
	AvailableIpAddressCount int
	VStatus                 string
	CreateAt                string
	ZoneId                  string
	CidrBlock               string
	GatewayIp               string
}

type Tag

type Tag struct {
	Key   string
	Value string
}

type TagData added in v0.7.1

type TagData struct {
	Total    int        `json:"total"`
	Page     int        `json:"page"`
	PageSize int        `json:"page_size"`
	Tags     []ImageTag `json:"tags"`
}

type TagsResponse added in v0.7.1

type TagsResponse struct {
	Data TagData `json:"data"`
}

type VPC

type VPC struct {
	VpcId     string
	VpcName   string
	CidrBlock string
	RegionId  string
	Status    string
	CreateAt  string
}

type Zone

type Zone struct {
	ZoneId    string
	LocalName string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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