Documentation ¶
Index ¶
- Constants
- func AddSecurityGroupRule(ctx context.Context, req AddSecurityGroupRuleRequest) (string, error)
- func BatchCreateInstanceType(ctx context.Context, inss []model.InstanceType) error
- func CheckAccountValid(ak, sk, provider string) error
- func CheckClusterParam(clusterInfo *types.ClusterInfo) error
- func CheckInstanceConnectable(instances []model.CustomClusterInstance) response.CheckInstanceConnectableResponse
- func CleanClusterUnusedInstances(clusterInfo *types.ClusterInfo) (int, error)
- func ConvertToClusterInfo(m *model.Cluster, tags []model.ClusterTag) (*types.ClusterInfo, error)
- func CountUser(ctx context.Context, orgId int64) (int64, error)
- func CreateCloudAccount(ctx context.Context, accountName, provider, ak, sk string, orgId int64, ...) error
- func CreateCluster4Test(clusterName string) error
- func CreateClusterTags(tags []model.ClusterTag) error
- func CreateClusterWithTagsAndInstances(ctx context.Context, cluster *model.Cluster, tags []*model.ClusterTag, ...) error
- func CreateExpandTask(ctx context.Context, clusterName string, count int, taskName string, uid int64) (int64, error)
- func CreateKeyPair(ctx context.Context, ak, provider, regionId, keyPairName string) error
- func CreateKeyPairByPrivateKey(ctx context.Context, ...) (*model.KeyPair, error)
- func CreateOrg(ctx context.Context, orgName, username, password, createBy string) error
- func CreateSecurityGroup(ctx context.Context, req CreateSecurityGroupRequest) (securityGroupId string, err error)
- func CreateShrinkAllTask(ctx context.Context, clusterName, taskName string, uid int64) (int64, error)
- func CreateShrinkTask(ctx context.Context, clusterName string, count int, ips string, ...) (int64, error)
- func CreateSwitch(ctx context.Context, req CreateSwitchRequest) (switchId string, err error)
- func CreateUser(ctx context.Context, orgId int64, username, password, createBy string, ...) error
- func CreateVPC(ctx context.Context, req CreateVPCRequest) (vpcId string, err error)
- func DecryptAccount(pepper, salt, key, encrypted string) (string, error)
- func DecryptAccounts(accounts []*model.Account)
- func DeleteCloudAccount(ctx context.Context, ids []int64, orgId int64) error
- func DeleteClusterTags(tags []model.ClusterTag) error
- func DeleteClusters(ctx context.Context, ids []int64, orgId int64) error
- func DescribeSecurityGroups(provider, ak, regionId, vpcId string) ([]cloud.SecurityGroup, error)
- func DoesSecurityGroupBelongsVpc(provider string) bool
- func EditCloudAccount(ctx context.Context, id int64, accountName, provider, username string) error
- func EditCluster(cluster *model.Cluster, username string) error
- func EditClusterTags(tags []model.ClusterTag) error
- func EditOrg(ctx context.Context, orgId int64, orgName string) error
- func EncryptAccount(pepper, salt, key, text string) (string, error)
- func ExistAdmin(ctx context.Context, usernames []string) (bool, error)
- func Expand(clusterInfo *types.ClusterInfo, tags []cloud.Tag, num int) (instanceIds []string, err error)
- func ExpandCluster(c *types.ClusterInfo, num int, taskId int64) ([]string, []string, error)
- func ExpandInDeed(c *types.ClusterInfo, num int, taskId int64) ([]string, error)
- func ExtractLogs(ctx context.Context, conds model.ExtractCondition) ([]model.OperationLog, int64, error)
- func GetAccount(provider, accountKey string) (*model.Account, error)
- func GetAccountSecretByAccountKey(ctx context.Context, ak string) (string, error)
- func GetAccounts(provider, accountName, accountKey string, pageNum, pageSize int) ([]*model.Account, int64, error)
- func GetAccountsByOrgId(orgId int64) (*types.OrgKeys, error)
- func GetAksByOrgAk(ctx context.Context, orgId int64, ak string) ([]string, error)
- func GetAksByOrgId(orgId int64) ([]string, error)
- func GetAllCustomInstanceInCluster(ctx context.Context, user *authorization.CustomClaims, clusterName string) ([]model.Instance, error)
- func GetAllInstanceInCluster(ctx context.Context, user *authorization.CustomClaims, clusterName string) ([]model.Instance, error)
- func GetBridgxUnusedCluster(ctx context.Context, user *authorization.CustomClaims, pageSize, pageNum int) ([]*gf_cluster.BridgxUnusedCluster, int, error)
- func GetCloudInstancesByClusterName(clusterInfo *types.ClusterInfo) (instances []cloud.Instance, err error)
- func GetClusterAccount(cluster *types.ClusterInfo) (*model.Account, error)
- func GetClusterById(ctx context.Context, Id int64) (*model.Cluster, error)
- func GetClusterByName(ctx context.Context, name string) (*model.Cluster, error)
- func GetClusterCount(ctx context.Context, accountKeys []string) (count int64, err error)
- func GetClusterInfo(ctx context.Context, clusterName string) (*types.ClusterInfo, error)
- func GetClusterTags(ctx context.Context, clusterName, tagKey string, pageNum, pageSize int) ([]model.ClusterTag, int64, error)
- func GetClusterTagsByClusterName(ctx context.Context, name string) ([]model.ClusterTag, error)
- func GetClusterTagsByClusters(ctx context.Context, clusters []model.Cluster) (map[string]map[string]string, error)
- func GetClustersByNames(ctx context.Context, names []string) ([]model.Cluster, error)
- func GetClustersByTags(ctx context.Context, tags map[string]string, pageSize, pageNum int) ([]model.Cluster, int64, error)
- func GetDefaultAccount(provider string) (*types.OrgKeys, error)
- func GetEnabledClusterNamesByAccount(ctx context.Context, accountKey string) ([]string, error)
- func GetEnabledClusterNamesByCond(ctx context.Context, provider, clusterName string, aks []string, strict bool) ([]string, error)
- func GetImages(ctx context.Context, req GetImagesRequest) ([]cloud.Image, error)
- func GetInstance(ctx context.Context, instanceId string) (*model.Instance, error)
- func GetInstanceByTag(c *types.ClusterInfo, tags []cloud.Tag) (instances []cloud.Instance, err error)
- func GetInstanceCount(ctx context.Context, accountKeys []string, clusterName string) (int64, error)
- func GetInstanceCountByCluster(ctx context.Context, clusters []model.Cluster) map[string]int64
- func GetInstanceUsageStatistics(ctx context.Context, clusterName string, specifyDay time.Time, orgId int64, ...) ([]model.Instance, int64, error)
- func GetInstanceUsageTotal(ctx context.Context, clusterName string, specifyDay time.Time, orgId int64) (int64, error)
- func GetInstances(clusterInfo *types.ClusterInfo, instancesIds []string) (instances []cloud.Instance, err error)
- func GetInstancesByAccount(ctx context.Context, accountKey string, pageNum, pageSize int) (instances []model.Instance, total int64, err error)
- func GetInstancesByAccounts(ctx context.Context, cond GetInstancesCond) (clusterNames []string, instances []model.Instance, total int64, err error)
- func GetInstancesByCond(ctx context.Context, cond InstancesSearchCond) (ret []model.Instance, total int64, err error)
- func GetInstancesByTaskId(ctx context.Context, taskId string, taskAction string) ([]model.Instance, error)
- func GetKeyPair(ctx context.Context, keyId int64) (*model.KeyPair, error)
- func GetKeyPairByKeyIds(ctx context.Context, keyIds []int64) (map[int64]model.KeyPair, error)
- func GetOrgInfoById(ctx context.Context, id int64) (*model.Org, error)
- func GetOrgKeysByAk(ctx context.Context, ak string) (*types.OrgKeys, error)
- func GetOrgList(ctx context.Context) (ret []model.Org, err error)
- func GetRegions(ctx context.Context, req GetRegionsRequest) ([]cloud.Region, error)
- func GetStandardClusterNamesByAccounts(ctx context.Context, accountKeys []string) ([]string, error)
- func GetTask(ctx context.Context, taskId string) (*model.Task, error)
- func GetTaskCount(ctx context.Context, accountKeys []string) (int64, error)
- func GetTaskListByAk(ctx context.Context, accountKey string, pageNum, pageSize int) ([]model.Task, int64, error)
- func GetTaskListByAks(ctx context.Context, accountKeys []string, pageNum, pageSize int) ([]model.Task, int64, error)
- func GetTaskListByCond(ctx context.Context, accountKey []string, cond model.TaskSearchCond) ([]model.Task, int64, error)
- func GetUserById(ctx context.Context, uid int64) (*model.User, error)
- func GetUserList(ctx context.Context, orgId int64, pageNum, pageSize int) ([]model.User, int64, error)
- func GetVPCFromCloud(ctx context.Context, req GetVPCFromCloudRequest) (vpc cloud.VPC, err error)
- func GetZones(ctx context.Context, req GetZonesRequest) ([]cloud.Zone, error)
- func ImportKeyPair(ctx context.Context, ...) error
- func Init(workerCount int)
- func IsInstanceReady(instance cloud.Instance, needPublicIp bool) bool
- func IsNeedAkSk(clusterInfo *types.ClusterInfo) bool
- func ListClusters(ctx context.Context, cond model.ClusterSearchCond) ([]model.Cluster, int, error)
- func ListInstanceType(req ListInstanceTypeRequest) ([]cloud.InstanceType, error)
- func ListKeyPairs(ctx context.Context, ak, provider, regionId string, page types.PageReq) ([]*model.KeyPair, *types.PageRsp, error)
- func Login(ctx context.Context, username, password string) *model.User
- func ModifyAdminPassword(ctx context.Context, userId int64, userName, oldPassword, newPassword string) error
- func ModifyUsername(ctx context.Context, uid int64, newUsername string) error
- func ModifyUsertype(ctx context.Context, userIds []int64, userType int8) error
- func MustDecryptAccounts(accounts []*model.Account) error
- func QueryOrders(accName, provider, ak, regionId string, startTime, endTime time.Time) error
- func RecordOperationLog(ctx context.Context, oplog OperationLog) error
- func RefreshAccount(t *SimpleTask) error
- func RefreshCache() error
- func RepairCluster(c *types.ClusterInfo, taskId int64, availableIds []string, allIds []string) int
- func SaveOrders(accName, provider string, cloudOrder []cloud.Order) error
- func Shrink(clusterInfo *types.ClusterInfo, instanceIds []string) error
- func ShrinkCluster(c *types.ClusterInfo, num int, taskId int64) (err error)
- func ShrinkClusterBySpecificIps(c *types.ClusterInfo, deletingIPs string, count int, taskId int64) (err error)
- func SyncInstanceExpireTime(ctx context.Context, clusterName string) error
- func SyncInstanceTypes(ctx context.Context, provider string) error
- func SyncNetwork(ctx context.Context, req SyncNetworkRequest) error
- func TagBridgxClusterUsage(clusterName, systemName string) error
- func UpdateUserStatus(ctx context.Context, usernames []string, status string) error
- func UserMapByIDs(ctx context.Context, ids []int64) map[int64]string
- type AddSecurityGroupRuleRequest
- type CreateNetworkRequest
- type CreateNetworkResponse
- type CreateSecurityGroupRequest
- type CreateSwitchRequest
- type CreateVPCRequest
- type GetImagesRequest
- type GetInstancesCond
- type GetRegionsRequest
- type GetSecurityGroupRequest
- type GetSwitchRequest
- type GetVPCFromCloudRequest
- type GetVPCRequest
- type GetZonesRequest
- type Group
- type GroupRule
- type GroupRuleRsp
- type InstanceTypeByZone
- type InstancesSearchCond
- type ListInstanceTypeRequest
- type ListInstanceTypeResponse
- type Operation
- type OperationLog
- type SecurityGroupResponse
- type SecurityGroupWithRule
- type SimpleTask
- type SimpleTaskHandler
- type Switch
- type SwitchResponse
- type SyncNetworkRequest
- type VPCResponse
- type Vpc
Constants ¶
const ( TargetTypeVpc targetType = iota TargetTypeSwitch TargetTypeSecurityGroup TargetTypeNetwork TargetTypeAccount TargetTypeInstanceType DefaultRegion = "cn-qingdao" DefaultRegionHuaWei = "cn-north-4" DefaultRegionTencent = "ap-beijing" DefaultRegionBaidu = "bj" DefaultRegionAws = "cn-north-1" )
const ( DirectionIn = "ingress" DirectionOut = "egress" )
Variables ¶
This section is empty.
Functions ¶
func AddSecurityGroupRule ¶
func AddSecurityGroupRule(ctx context.Context, req AddSecurityGroupRuleRequest) (string, error)
func BatchCreateInstanceType ¶
func BatchCreateInstanceType(ctx context.Context, inss []model.InstanceType) error
func CheckAccountValid ¶
func CheckClusterParam ¶ added in v0.5.0
func CheckClusterParam(clusterInfo *types.ClusterInfo) error
func CheckInstanceConnectable ¶ added in v0.4.0
func CheckInstanceConnectable(instances []model.CustomClusterInstance) response.CheckInstanceConnectableResponse
CheckInstanceConnectable 检测机器连通性
func CleanClusterUnusedInstances ¶
func CleanClusterUnusedInstances(clusterInfo *types.ClusterInfo) (int, error)
CleanClusterUnusedInstances 清除由于系统异常导致的云厂商中残留的机器
func ConvertToClusterInfo ¶
func ConvertToClusterInfo(m *model.Cluster, tags []model.ClusterTag) (*types.ClusterInfo, error)
ConvertToClusterInfo 将cluster,和tags转换为一个Cloud clusterInfo
func CreateCloudAccount ¶
func CreateCluster4Test ¶
func CreateClusterTags ¶
func CreateClusterTags(tags []model.ClusterTag) error
func CreateClusterWithTagsAndInstances ¶ added in v0.4.0
func CreateExpandTask ¶
func CreateKeyPair ¶ added in v0.7.0
func CreateKeyPairByPrivateKey ¶ added in v0.7.0
func CreateSecurityGroup ¶
func CreateSecurityGroup(ctx context.Context, req CreateSecurityGroupRequest) (securityGroupId string, err error)
func CreateShrinkAllTask ¶ added in v0.1.5
func CreateShrinkTask ¶
func CreateSwitch ¶
func CreateSwitch(ctx context.Context, req CreateSwitchRequest) (switchId string, err error)
func CreateUser ¶
func CreateVPC ¶
func CreateVPC(ctx context.Context, req CreateVPCRequest) (vpcId string, err error)
func DecryptAccount ¶ added in v0.2.1
func DecryptAccounts ¶ added in v0.2.1
DecryptAccounts same as decryptAccounts(accounts, false).
func DeleteCloudAccount ¶
func DeleteClusterTags ¶ added in v0.1.5
func DeleteClusterTags(tags []model.ClusterTag) error
func DescribeSecurityGroups ¶ added in v0.7.0
func DescribeSecurityGroups(provider, ak, regionId, vpcId string) ([]cloud.SecurityGroup, error)
func DoesSecurityGroupBelongsVpc ¶ added in v0.7.0
func EditCloudAccount ¶
func EditClusterTags ¶ added in v0.1.5
func EditClusterTags(tags []model.ClusterTag) error
func EncryptAccount ¶ added in v0.2.1
func ExistAdmin ¶ added in v0.5.1
func ExpandCluster ¶
func ExpandInDeed ¶ added in v0.5.0
func ExtractLogs ¶ added in v0.4.0
func ExtractLogs(ctx context.Context, conds model.ExtractCondition) ([]model.OperationLog, int64, error)
func GetAccount ¶ added in v0.1.5
GetAccount query account info by provider and accountKey
func GetAccountSecretByAccountKey ¶ added in v0.2.1
GetAccountSecretByAccountKey get sk(decrypt) by ak
func GetAccounts ¶
func GetAccounts(provider, accountName, accountKey string, pageNum, pageSize int) ([]*model.Account, int64, error)
GetAccounts search accounts by condition.
func GetAksByOrgAk ¶ added in v0.4.0
func GetAksByOrgId ¶
func GetAllCustomInstanceInCluster ¶ added in v0.4.0
func GetAllCustomInstanceInCluster(ctx context.Context, user *authorization.CustomClaims, clusterName string) ([]model.Instance, error)
GetAllCustomInstanceInCluster 获取自定义集群中所有节点实例
func GetAllInstanceInCluster ¶ added in v0.2.1
func GetAllInstanceInCluster(ctx context.Context, user *authorization.CustomClaims, clusterName string) ([]model.Instance, error)
GetAllInstanceInCluster 获取集群中所有节点实例
func GetBridgxUnusedCluster ¶ added in v0.2.1
func GetBridgxUnusedCluster(ctx context.Context, user *authorization.CustomClaims, pageSize, pageNum int) ([]*gf_cluster.BridgxUnusedCluster, int, error)
GetBridgxUnusedCluster 获取所有没有被占用的集群
func GetCloudInstancesByClusterName ¶
func GetCloudInstancesByClusterName(clusterInfo *types.ClusterInfo) (instances []cloud.Instance, err error)
func GetClusterAccount ¶ added in v0.2.1
func GetClusterAccount(cluster *types.ClusterInfo) (*model.Account, error)
GetClusterAccount 根据集群获取Account信息
func GetClusterByName ¶
func GetClusterCount ¶
func GetClusterInfo ¶ added in v0.2.1
GetClusterInfo 根据集群名称获取集群名称
func GetClusterTags ¶ added in v0.1.5
func GetClusterTagsByClusters ¶ added in v0.1.5
func GetClustersByNames ¶
func GetClustersByTags ¶ added in v0.1.5
func GetInstance ¶
func GetInstanceByTag ¶
func GetInstanceCount ¶
func GetInstanceUsageTotal ¶
func GetInstances ¶
func GetInstancesByAccount ¶
func GetInstancesByAccounts ¶
func GetInstancesByCond ¶
func GetInstancesByTaskId ¶
func GetKeyPair ¶ added in v0.7.0
func GetKeyPairByKeyIds ¶ added in v0.7.0
func GetRegions ¶
func GetStandardClusterNamesByAccounts ¶ added in v0.4.0
func GetTaskListByAk ¶
func GetTaskListByAks ¶
func GetTaskListByCond ¶
func GetUserList ¶
func GetVPCFromCloud ¶
func ImportKeyPair ¶ added in v0.7.0
func IsInstanceReady ¶ added in v0.7.0
func IsNeedAkSk ¶ added in v0.4.0
func IsNeedAkSk(clusterInfo *types.ClusterInfo) bool
IsNeedAkSk 标准类型集群存在AK的自定义类型集群,需要获取AKSK信息;自定义类型集群不区分是否配置aksk
func ListClusters ¶
func ListInstanceType ¶
func ListInstanceType(req ListInstanceTypeRequest) ([]cloud.InstanceType, error)
func ListKeyPairs ¶ added in v0.7.0
func ModifyAdminPassword ¶
func ModifyUsertype ¶ added in v0.5.1
func MustDecryptAccounts ¶ added in v0.2.1
MustDecryptAccounts same as decryptAccounts(accounts, true).
func QueryOrders ¶
func RecordOperationLog ¶ added in v0.4.0
func RecordOperationLog(ctx context.Context, oplog OperationLog) error
func RefreshAccount ¶ added in v0.7.0
func RefreshAccount(t *SimpleTask) error
func RefreshCache ¶
func RefreshCache() error
func RepairCluster ¶
func ShrinkCluster ¶
func ShrinkCluster(c *types.ClusterInfo, num int, taskId int64) (err error)
func SyncInstanceExpireTime ¶ added in v0.1.5
func SyncNetwork ¶ added in v0.7.0
func SyncNetwork(ctx context.Context, req SyncNetworkRequest) error
func TagBridgxClusterUsage ¶ added in v0.2.1
TagBridgxClusterUsage 将集群设置为被系统占用
func UpdateUserStatus ¶
Types ¶
type CreateNetworkRequest ¶
type CreateNetworkResponse ¶
func CreateNetwork ¶
func CreateNetwork(ctx context.Context, req *CreateNetworkRequest) (vpcRes CreateNetworkResponse, err error)
type CreateSwitchRequest ¶
type CreateVPCRequest ¶
type GetImagesRequest ¶
type GetInstancesCond ¶ added in v0.4.0
type GetRegionsRequest ¶
type GetSecurityGroupRequest ¶
type GetSwitchRequest ¶
type GetVPCFromCloudRequest ¶
type GetVPCRequest ¶
type GetZonesRequest ¶
type GroupRuleRsp ¶ added in v0.7.0
type InstanceTypeByZone ¶
type InstanceTypeByZone struct { InstanceTypeFamily string `json:"instance_type_family"` InstanceType string `json:"instance_type"` Core int `json:"core"` Memory int `json:"memory"` }
func GetInstanceTypeByName ¶ added in v0.1.2
func GetInstanceTypeByName(instanceTypeName string) InstanceTypeByZone
func (*InstanceTypeByZone) GetDesc ¶ added in v0.1.4
func (i *InstanceTypeByZone) GetDesc() string
type InstancesSearchCond ¶
type ListInstanceTypeRequest ¶
type ListInstanceTypeResponse ¶
type ListInstanceTypeResponse struct {
InstanceTypes []InstanceTypeByZone `json:"instance_types"`
}
type OperationLog ¶ added in v0.4.0
type SecurityGroupResponse ¶
func GetSecurityGroup ¶
func GetSecurityGroup(ctx context.Context, req GetSecurityGroupRequest) (SecurityGroupResponse, error)
type SecurityGroupWithRule ¶ added in v0.7.0
type SecurityGroupWithRule struct { SgId string `json:"security_group_id"` SgName string `json:"security_group_name"` SgType string `json:"security_group_type"` Rules []GroupRuleRsp `json:"rules"` }
func GetSecurityGroupWithRules ¶ added in v0.7.0
func GetSecurityGroupWithRules(ctx context.Context, securityGroupId string) (SecurityGroupWithRule, error)
type SimpleTask ¶
type SimpleTaskHandler ¶
type SimpleTaskHandler struct { Tasks chan *SimpleTask // contains filtered or unexported fields }
var H *SimpleTaskHandler
func (*SimpleTaskHandler) SubmitTask ¶
func (s *SimpleTaskHandler) SubmitTask(t *SimpleTask)
type Switch ¶
type SwitchResponse ¶
func GetSwitch ¶
func GetSwitch(ctx context.Context, req GetSwitchRequest) (resp SwitchResponse, err error)
type SyncNetworkRequest ¶ added in v0.7.0
type VPCResponse ¶
func GetVPC ¶
func GetVPC(ctx context.Context, req GetVPCRequest) (resp VPCResponse, err error)