Documentation ¶
Overview ¶
Package cloudrepo
- Copyright 2024-2025 Bilibili Inc. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package cloudrepo
- Copyright 2024-2025 Bilibili Inc. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package cloudrepo
- Copyright 2024-2025 Bilibili Inc. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package cloudrepo
- Copyright 2024-2025 Bilibili Inc. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package cloudrepo
- Copyright 2024-2025 Bilibili Inc. *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Index ¶
- Constants
- Variables
- func GetCloudEnum(cloudId string, enumType string, enum string) string
- func GetGpuModel(gpuModelRaw string) string
- func Register(repo CloudRepo)
- func TimeTrans(tm string) string
- type ChangeConfigCloudServerReply
- type ChangeConfigCloudServerReq
- type ChangeServerChargeTypeReply
- type ChangeServerChargeTypeReq
- type CloudProduct
- type CloudProductCommon
- type CloudProject
- type CloudProvider
- type CloudRegion
- type CloudRepo
- type CloudSecurityGroup
- type CloudServer
- type CloudServerImage
- type CloudServerSpec
- type CloudSubnet
- type CloudTag
- type CloudVpc
- type CloudZone
- type DeleteCloudServerReply
- type DeleteCloudServerReq
- type DescribeCloudServerReply
- type DescribeCloudServerReq
- type GetCloudProductReq
- type GetProviderReq
- type RebootCloudServerReply
- type RebootCloudServerReq
- type ReinstallCloudServerReply
- type ReinstallCloudServerReq
- type RenameCloudServerReply
- type RenameCloudServerReq
- type StartCloudServerReply
- type StartCloudServerReq
- type StopCloudServerReply
- type StopCloudServerReq
Constants ¶
const ( CloudAli = "alicloud" // 阿里云 CloudTencent = "tencentcloud" // 腾讯云 CloudHuawei = "huaweicloud" // 华为云 CloudAws = "awscloud" // AWS CloudBaidu = "baiducloud" // 百度云 )
const ( CloudVMStatusPending = "pending" // 创建中 CloudVMStatusRunning = "running" // 运行中 CloudVMStatusStarting = "starting" // 启动中 CloudVMStatusStopping = "stopping" // 停止中 CloudVMStatusSuspend = "suspend" // 暂停中 CloudVMStatusStopped = "stopped" // 已停止 CloudVMStatusTerminated = "terminated" // 已销毁 CloudVMStatusShuttingDown = "shutting-down" // 关机中 CloudVMStatusChangeFlavor = "change_flavor" // 变更规格中 CloudVMStatusDeploying = "deploying" // 部署中 CloudVMStatueDeleted = "deleted" // 已删除 CloudVMStatusOther = "other" // 其他状态 CloudVmChargeTypePrePaid = "prepaid" // 预付费/包年包月 CloudVmChargeTypePostPaid = "postpaid" // 后付费/按需付费 )
Variables ¶
var (
CloudEnumMap = map[string]map[string]map[string]string{
CloudAli: statusAli,
CloudAws: statusAws,
CloudTencent: statusTencent,
CloudBaidu: statusBaidu,
CloudHuawei: statusHuawei,
}
)
var (
NotFoundError = ecode.NewECode("-60001")
)
Functions ¶
func GetCloudEnum ¶
GetCloudEnum 获取云厂商
Types ¶
type ChangeConfigCloudServerReply ¶
type ChangeConfigCloudServerReply struct { // 请求ID RequestID string }
ChangeConfigCloudServerReply 变更云服务器配置响应参数
type ChangeConfigCloudServerReq ¶
type ChangeConfigCloudServerReq struct { // 云服务器ID InstanceID string // 云服务器类型 InstanceType string // 云项目ID ProjectID string }
ChangeConfigCloudServerReq 变更云服务器配置请求参数
type ChangeServerChargeTypeReply ¶
type ChangeServerChargeTypeReply struct { // 请求ID RequestID string }
ChangeServerChargeTypeReply 变更云服务器计费方式响应参数
type ChangeServerChargeTypeReq ¶
type ChangeServerChargeTypeReq struct { // 云服务器ID InstanceID string // 云项目ID ProjectID string // 计费方式 ChargeType string }
ChangeServerChargeTypeReq 变更云服务器计费方式请求参数
type CloudProduct ¶
type CloudProduct interface { GetCID() string // 获取产品CID GetName() string // 获取产品名称 GetStatus() string // 获取产品状态 }
CloudProduct 云产品通用接口
type CloudProductCommon ¶
CloudProductCommon 云产品通用
type CloudProvider ¶
type CloudProvider interface { ListRegion(req *GetCloudProductReq) ([]CloudRegion, error) //获取地域 ListProject(req *GetCloudProductReq) ([]CloudProject, error) //获取项目 ListServer(req *GetCloudProductReq) ([]CloudServer, error) //获取服务器 ListSecurityGroup(req *GetCloudProductReq) ([]CloudSecurityGroup, error) //获取安全组 ListZone(req *GetCloudProductReq) ([]CloudZone, error) //获取可用区 ListVpc(req *GetCloudProductReq) ([]CloudVpc, error) //获取专有网路 ListSubnet(req *GetCloudProductReq) ([]CloudSubnet, error) //获取子网 ListServerImage(req *GetCloudProductReq) ([]CloudServerImage, error) //获取镜像 ListServerSpec(req *GetCloudProductReq) ([]CloudServerSpec, error) //获取服务器规格 ListTag(req *GetCloudProductReq) ([]CloudTag, error) //获取标签 RebootServer(req *RebootCloudServerReq) (*RebootCloudServerReply, error) //重启 ReinstallServer(req *ReinstallCloudServerReq) (*ReinstallCloudServerReply, error) //重装 RenameServer(req *RenameCloudServerReq) (*RenameCloudServerReply, error) //改名 ChangeServerConfig(req *ChangeConfigCloudServerReq) (*ChangeConfigCloudServerReply, error) //改配 DeleteServer(req *DeleteCloudServerReq) (*DeleteCloudServerReply, error) //清退 StartServer(req *StartCloudServerReq) (*StartCloudServerReply, error) //开机 StopServer(req *StopCloudServerReq) (*StopCloudServerReply, error) //关机 DescribeServer(req *DescribeCloudServerReq) (*DescribeCloudServerReply, error) //查询 ChangeServerChargeType(req *ChangeServerChargeTypeReq) (*ChangeServerChargeTypeReply, error) //改费 }
CloudProvider 获取云厂商产品
type CloudRepo ¶
type CloudRepo interface { GetName() string // 获取云厂商名称 GetProvider(req *GetProviderReq) (CloudProvider, error) // 获取云厂商client }
CloudRepo 云厂商数据
type CloudSecurityGroup ¶
type CloudSecurityGroup interface { CloudProduct GetProject() string // 获取云项目 GetVpc() string // 获取云专有网路 }
CloudSecurityGroup 云安全组通用接口
type CloudServer ¶
type CloudServer interface { CloudProduct GetSecurityGroupCid() []string // 获取云安全组cid GetSubnetCid() string // 获取云子网cid GetVpcCid() string // 获取云专有网络cid GetImageCid() string // 获取云服务器镜像cid GetZoneCid() string // 获取云可用区cid GetProjectCid() string // 获取云项目cid GetServerSpec() string // 获取云服务器规格cid GetChangeType() string // 获取计费方式 GetRenewStatus() string // 获取续费状态 GetPrivateIP() string // 获取内网IP GetPublicIP() string // 获取外网IP GetExpireTime() string // 获取过期时间 }
CloudServer 云服务器通用接口
type CloudServerImage ¶
type CloudServerImage interface { CloudProduct GetOsName() string // 获取操作系统名称 GetType() string // 获取镜像类型 }
CloudServerImage 云服务器镜像通用接口
type CloudServerSpec ¶
type CloudServerSpec interface { CloudProduct GetBandWidth() float64 // 获取带宽 GetCategory() string // 获取规格类型 GetCPU() int // 获取CPU核数 GetGPU() int // 获取GPU数量 GetGPUModel() string // 获取GPU型号 GetFamily() string // 获取规格系列 GetMemory() int // 获取内存大小 GetPPS() float64 // 获取每秒处理量 }
CloudServerSpec 云服务器规格通用接口
type CloudSubnet ¶
type CloudSubnet interface { CloudProduct GetCidr() string // 获取cidr GetProject() string // 获取云项目 GetVpc() string // 获取云专有网络 GetZone() string // 获取云可用区 }
CloudSubnet 云子网通用接口
type CloudVpc ¶
type CloudVpc interface { CloudProduct GetCidr() string // 获取cidr GetProject() string // 获取云项目 }
CloudVpc 云专有网络通用接口
type DeleteCloudServerReply ¶
type DeleteCloudServerReply struct { // 请求ID RequestID string }
DeleteCloudServerReply 删除云服务器响应参数
type DeleteCloudServerReq ¶
type DeleteCloudServerReq struct { // 云服务器ID InstanceID string // 是否强制 IsForce bool // 云项目ID ProjectID string }
DeleteCloudServerReq 删除云服务器请求参数
type DescribeCloudServerReply ¶
type DescribeCloudServerReply struct { // 云服务器ID InstanceID string // 云服务器名称 InstanceName string // 镜像ID ImageID string // 云服务器状态 InstanceState string // 云服务器类型 InstanceType string // 计费方式 ChargeType string // 实例的最新操作状态 LatestOperationState string // 实例是否操作完成 IsOperation bool }
DescribeCloudServerReply 获取云服务器详情响应参数
type DescribeCloudServerReq ¶
DescribeCloudServerReq 获取云服务器详情请求参数
type GetCloudProductReq ¶
type GetCloudProductReq struct { GetProviderReq // 云产品名称 ResourceName string // 云产品ID ResourceID string // 云地域 Region string // 标识 Cursor string // 是否分页 DisablePage bool // 条数 PageSize int // 页码 PageNum int }
GetCloudProductReq 获取云产品列表请求
type GetProviderReq ¶
GetProviderReq 获取云厂商请求
type RebootCloudServerReply ¶
type RebootCloudServerReply struct { // 请求ID RequestID string }
RebootCloudServerReply 重启云服务器响应参数
type RebootCloudServerReq ¶
type RebootCloudServerReq struct { // 云服务器ID InstanceID string // 是否强制 IsForce bool // 云项目ID ProjectID string }
RebootCloudServerReq 重启云服务器请求参数
type ReinstallCloudServerReply ¶
type ReinstallCloudServerReply struct { // 请求ID RequestID string }
ReinstallCloudServerReply 重装云服务器响应参数
type ReinstallCloudServerReq ¶
type ReinstallCloudServerReq struct { // 云服务器ID InstanceID string // 镜像ID ImageID string // 云项目ID ProjectID string // 云账号ID AccountID string // 密钥对ID KeyPairID string // 密钥对名称 KeyPairName string }
ReinstallCloudServerReq 重装云服务器请求参数
type RenameCloudServerReply ¶
type RenameCloudServerReply struct { // 请求ID RequestID string }
RenameCloudServerReply 重命名云服务器名称响应参数
type RenameCloudServerReq ¶
type RenameCloudServerReq struct { // 云服务器ID InstanceID string // 新名称 NewName string // 云项目ID ProjectID string }
RenameCloudServerReq 重命名云服务器名称请求参数
type StartCloudServerReply ¶
type StartCloudServerReply struct { // 请求ID RequestID string }
StartCloudServerReply 启动云服务器响应参数
type StartCloudServerReq ¶
type StartCloudServerReq struct { // 云服务器ID InstanceID string // 云项目ID ProjectID string // 是否强制 IsForce bool }
StartCloudServerReq 启动云服务器请求参数
type StopCloudServerReply ¶
type StopCloudServerReply struct { // 请求ID RequestID string }
StopCloudServerReply 停止云服务器响应参数
type StopCloudServerReq ¶
type StopCloudServerReq struct { // 云服务器ID InstanceID string // 云项目ID ProjectID string // 是否强制 IsForce bool }
StopCloudServerReq 停止云服务器请求参数
Directories ¶
Path | Synopsis |
---|---|
provider
|
|
alicloud
Package alicloud
|
Package alicloud |
awscloud
Package awscloud
|
Package awscloud |
baiducloud
Package baiducloud
|
Package baiducloud |
huaweicloud
Package huaweicloud
|
Package huaweicloud |
tencentcloud
Package tencentcloud
|
Package tencentcloud |