Documentation
¶
Index ¶
- Constants
- func AddSecurityGroupRule(ctx context.Context, r SecurityGroupRule) error
- func BatchCreate(values interface{}) error
- func BatchCreateInstance(instances []Instance) error
- func BatchUpdateByInstanceIds(instanceIds []string, instance Instance) error
- func Count(where map[string]interface{}, model interface{}) (int64, error)
- func CountActiveInstancesByClusterName(ctx context.Context, clusterNames []string) (int64, error)
- func CountByTaskStatus(taskFilter string, statuses []string) (int64, error)
- func Create(model interface{}) error
- func CreateClusterWithTagsAndInstances(ctx context.Context, cluster *Cluster, tags []*ClusterTag, ...) error
- func CreateIgnoreDuplicate(model interface{}) error
- func CreateInstanceFormFromDB(instanceForm *gf_cluster.InstanceForm) error
- func CreateInstanceGroupFromDB(instanceGroup *gf_cluster.InstanceGroup) error
- func CreateSecurityGroup(ctx context.Context, s SecurityGroup) error
- func CreateSwitch(ctx context.Context, s Switch) error
- func CreateVpc(ctx context.Context, vpc Vpc) error
- func Delete(model interface{}) error
- func DeleteInstanceGroupFromDB(instanceGroupId int64) error
- func DeleteKubernetesCluster(kubernetesId int64) error
- func DropExpiredInstanceType(ctx context.Context, tx *gorm.DB) error
- func Get(id int64, out interface{}) error
- func GetAksByOrgAk(ctx context.Context, orgId int64, ak string) ([]string, error)
- func GetAllProvider(ctx context.Context) (provider []string, err error)
- func GetInstanceGroupFromDB(instanceGroupId int64) (*gf_cluster.InstanceGroup, error)
- func GetKubernetesCluster(kubernetesId int64) (*gf_cluster.KubernetesInfo, error)
- func GetKubernetesClusterByName(clusterName string) (*gf_cluster.KubernetesInfo, error)
- func GetTaskCount(ctx context.Context, clusterNames []string) (int64, error)
- func Gets(ids []int64, out interface{}) error
- func ListAllInstanceGroupFromDB() ([]*gf_cluster.InstanceGroup, error)
- func ListClusterInstallStep(clusterId int64) (result []gf_cluster.KubernetesInstallStep, err error)
- func ListInstanceFormFromDB(id string, pageNumber int, pageSize int) ([]*gf_cluster.InstanceForm, int64, error)
- func ListInstanceGroupByUser(curUserId string) ([]*gf_cluster.InstanceGroup, error)
- func ListInstanceGroupFromDB(name string, pageNumber int, pageSize int) ([]*gf_cluster.InstanceGroup, int64, error)
- func ListInstanceGroupInKubernetes(kubernetesId int64) ([]*gf_cluster.InstanceGroup, error)
- func ListKubernetesClusters(id string, name string, pageNumber int, pageSize int) ([]*gf_cluster.KubernetesInfo, int, error)
- func ListRunningKubernetesClusters() ([]*gf_cluster.KubernetesInfo, error)
- func Query(where map[string]interface{}, page int, pageSize int, models interface{}, ...) (count int64, err error)
- func QueryAll(where map[string]interface{}, models interface{}, order string) (err error)
- func QueryFirst(where map[string]interface{}, out interface{}) error
- func QueryWhere(where *gorm.DB, page int, pageSize int, models interface{}, order string, ...) (count int64, err error)
- func RegisterKubernetesCluster(kubernetes *gf_cluster.KubernetesInfo) error
- func ReplaceRules(ctx context.Context, vpcID, groupId string, rules []SecurityGroupRule) (err error)
- func Save(model interface{}) error
- func SaveByInstanceId(instance Instance) error
- func UpdateByInstanceId(instance Instance) error
- func UpdateInstanceGroupFromDB(instanceGroup *gf_cluster.InstanceGroup) error
- func UpdateInstanceGroupInstanceCountFromDB(count int, id int64) error
- func UpdateInstanceTypeIStatus(ctx context.Context, tx *gorm.DB, provider string, status int) error
- func UpdateKubernetesCluster(kubernetes *gf_cluster.KubernetesInfo) error
- func UpdateOrCreateGroups(ctx context.Context, ak, provider string, regionIds []string, ...) error
- func UpdateOrCreateSwitches(ctx context.Context, vpcIds []string, switches []Switch) error
- func UpdateOrCreateVpcs(ctx context.Context, ak, provider string, regionIds []string, vpcs []Vpc) error
- func UpdateSwitch(ctx context.Context, availableIpAddressCount, isDefault int, ...) error
- func UpdateTaskStatus(taskIds []int64, status string) error
- func UpdateUserStatus(ctx context.Context, model interface{}, usernames []string, ...) error
- func UpdateUserType(ctx context.Context, ids []int64, updates map[string]interface{}) error
- func UpdateVpc(ctx context.Context, vpcId, cidrBlock, vStatus string) error
- func UpdateWhere(model interface{}, where map[string]interface{}, ...) error
- func Updates(model interface{}, ids []int64, updates map[string]interface{}) error
- type Account
- func GetAccountByAk(ctx context.Context, ak string) (a Account, err error)
- func GetAccounts(provider, accountName, accountKey string, pageNum, pageSize int) ([]*Account, int64, error)
- func GetAccountsByOrgId(orgId int64) (accounts []*Account, err error)
- func GetDefaultAccountByProvider(provider string) (account *Account, err error)
- type Base
- type Cacheable
- type Cluster
- func GetByClusterName(clusterName string) (*Cluster, error)
- func GetByClusterNames(clusterNames []string) ([]Cluster, error)
- func GetClusterById(id int64) (*Cluster, error)
- func GetOneRegionByAccKey(accountKey string) (*Cluster, error)
- func GetUpdatedCluster(currentTime time.Time) ([]Cluster, error)
- func ListClustersByCond(ctx context.Context, cond ClusterSearchCond) ([]Cluster, int, error)
- func (c *Cluster) GetChargeType() string
- func (c *Cluster) GetCpuType() string
- func (c *Cluster) GetInstanceTypeDesc() string
- func (Cluster) TableName() string
- func (c *Cluster) UnmarshalChargeConfig() (*types.ChargeConfig, error)
- func (c *Cluster) UnmarshalExtendConfig() (*types.ExtendConfig, error)
- type ClusterSearchCond
- type ClusterSnapshot
- type ClusterTag
- func GetBySpecifyClusterTag(clusterName string, tagKey string) (*ClusterTag, error)
- func GetClusterNamesByTags(ctx context.Context, tags map[string]string, pageSize, pageNum int) ([]ClusterTag, int64, error)
- func GetClusterTags(ctx context.Context, clusterName, tagKey string, pageNum, pageSize int) ([]ClusterTag, int64, error)
- func GetClusterTagsByClusterNames(ctx context.Context, clusterNames []string) ([]ClusterTag, error)
- func GetTagsByClusterName(clusterName string) ([]ClusterTag, error)
- type ConnectableResult
- type CustomClusterInstance
- type ExpandTaskInfo
- func (e *ExpandTaskInfo) GetAfterInstanceCount(success int) (afterCount int)
- func (e *ExpandTaskInfo) GetBeforeInstanceCount() (beforeCount int)
- func (e *ExpandTaskInfo) GetCount() int
- func (e *ExpandTaskInfo) GetCreateUsername() (username string)
- func (e *ExpandTaskInfo) GetExpectInstanceCount() (expectCount int)
- type ExpandTaskRes
- type ExtractCondition
- type FindSecurityGroupConditions
- type FindSwitchesConditions
- type FindVpcConditions
- type Instance
- func GetActiveInstancesByClusterName(clusterName string) ([]Instance, error)
- func GetActiveInstancesByClusters(ctx context.Context, clusterName []string) ([]Instance, error)
- func GetActiveInstancesWithCount(clusterName string, count int) ([]Instance, error)
- func GetDeletedInstancesByTime(ctx context.Context, clusterName []string, createBefore, deleteAfter time.Time) ([]Instance, error)
- func GetInstanceByCond(ctx context.Context, cond InstanceSearchCond) (ret []Instance, total int64, err error)
- func GetInstanceByInstanceId(instanceId string) (*Instance, error)
- func GetInstanceByIpInner(ipInner string) (Instance, error)
- func GetInstancesByIPs(ipList []string, clusterName string) ([]Instance, error)
- func GetUsageInstancesBySpecifyDay(ctx context.Context, clusterName []string, createBefore, deleteAfter time.Time, ...) ([]Instance, int64, error)
- type InstanceAttr
- type InstanceSearchCond
- type InstanceType
- type InstanceTypeCondition
- type KeyPair
- type Network
- type OperationLog
- type Order
- type Org
- type SecurityGroup
- type SecurityGroupIDStruct
- type SecurityGroupRule
- type ShrinkTaskInfo
- func (s *ShrinkTaskInfo) GetAfterInstanceCount(success int) (afterCount int)
- func (s *ShrinkTaskInfo) GetBeforeInstanceCount() (beforeCount int)
- func (e *ShrinkTaskInfo) GetCount() int
- func (s *ShrinkTaskInfo) GetCreateUsername() (username string)
- func (s *ShrinkTaskInfo) GetExpectInstanceCount() (expectCount int)
- type Switch
- type SwitchIdStruct
- type Task
- type TaskInfo
- type TaskResult
- type TaskSearchCond
- type User
- func GetUserById(ctx context.Context, uid int64) (*User, error)
- func GetUserByName(ctx context.Context, username string) *User
- func GetUserList(ctx context.Context, orgId int64, pageNum, pageSize int) ([]User, int64, error)
- func GetUserThroughBigCache(ids []int64, keyMaker func(int64) string, ...) ([]*User, []int64, error)
- func GetUsersByIDs(ctx context.Context, ids []int64) []User
- func GetUsersByUsernamesAndUserType(ctx context.Context, usernames []string, userType int8) ([]User, error)
- type Vpc
- type VpcIDStruct
Constants ¶
const ( InstanceTypeStatusNoActivate = iota InstanceTypeStatusActivated InstanceTypeStatusExpired )
const (
BATCH_SIZE = 5
)
Variables ¶
This section is empty.
Functions ¶
func AddSecurityGroupRule ¶
func AddSecurityGroupRule(ctx context.Context, r SecurityGroupRule) error
func BatchCreate ¶
func BatchCreate(values interface{}) error
func BatchCreateInstance ¶
func CountActiveInstancesByClusterName ¶
CountActiveInstancesByClusterName 获取clusters下状态不为deleted状态节点数量
func CountByTaskStatus ¶
func CreateClusterWithTagsAndInstances ¶ added in v0.4.0
func CreateIgnoreDuplicate ¶ added in v0.1.1
func CreateIgnoreDuplicate(model interface{}) error
func CreateInstanceFormFromDB ¶ added in v0.2.0
func CreateInstanceFormFromDB(instanceForm *gf_cluster.InstanceForm) error
func CreateInstanceGroupFromDB ¶ added in v0.2.0
func CreateInstanceGroupFromDB(instanceGroup *gf_cluster.InstanceGroup) error
func CreateSecurityGroup ¶
func CreateSecurityGroup(ctx context.Context, s SecurityGroup) error
func DeleteInstanceGroupFromDB ¶ added in v0.2.0
func DeleteKubernetesCluster ¶ added in v0.2.0
DeleteKubernetesCluster 删除集群记录
func GetAksByOrgAk ¶ added in v0.4.0
GetAksByOrgAk get aks by ak
func GetAllProvider ¶ added in v0.2.1
func GetInstanceGroupFromDB ¶ added in v0.2.0
func GetInstanceGroupFromDB(instanceGroupId int64) (*gf_cluster.InstanceGroup, error)
func GetKubernetesCluster ¶ added in v0.2.0
func GetKubernetesCluster(kubernetesId int64) (*gf_cluster.KubernetesInfo, error)
GetKubernetesCluster 获取集群
func GetKubernetesClusterByName ¶ added in v0.4.0
func GetKubernetesClusterByName(clusterName string) (*gf_cluster.KubernetesInfo, error)
GetKubernetesClusterByName 根据集群名称获取集群配置信息
func ListAllInstanceGroupFromDB ¶ added in v0.2.0
func ListAllInstanceGroupFromDB() ([]*gf_cluster.InstanceGroup, error)
func ListClusterInstallStep ¶ added in v0.5.0
func ListClusterInstallStep(clusterId int64) (result []gf_cluster.KubernetesInstallStep, err error)
func ListInstanceFormFromDB ¶ added in v0.2.0
func ListInstanceFormFromDB(id string, pageNumber int, pageSize int) ([]*gf_cluster.InstanceForm, int64, error)
func ListInstanceGroupByUser ¶ added in v0.2.0
func ListInstanceGroupByUser(curUserId string) ([]*gf_cluster.InstanceGroup, error)
func ListInstanceGroupFromDB ¶ added in v0.2.0
func ListInstanceGroupFromDB(name string, pageNumber int, pageSize int) ([]*gf_cluster.InstanceGroup, int64, error)
func ListInstanceGroupInKubernetes ¶ added in v0.2.0
func ListInstanceGroupInKubernetes(kubernetesId int64) ([]*gf_cluster.InstanceGroup, error)
func ListKubernetesClusters ¶ added in v0.2.0
func ListKubernetesClusters(id string, name string, pageNumber int, pageSize int) ([]*gf_cluster.KubernetesInfo, int, error)
ListKubernetesClusters 列出所有集群
func ListRunningKubernetesClusters ¶ added in v0.2.0
func ListRunningKubernetesClusters() ([]*gf_cluster.KubernetesInfo, error)
ListRunningKubernetesClusters 列出所有正在运行的集群
func Query ¶
func Query(where map[string]interface{}, page int, pageSize int, models interface{}, order string, withCount bool) (count int64, err error)
Query records
func QueryFirst ¶ added in v0.1.5
func QueryWhere ¶
func QueryWhere(where *gorm.DB, page int, pageSize int, models interface{}, order string, withCount bool) (count int64, err error)
Query records
func RegisterKubernetesCluster ¶ added in v0.2.0
func RegisterKubernetesCluster(kubernetes *gf_cluster.KubernetesInfo) error
RegisterKubernetesCluster 注册集群
func ReplaceRules ¶
func ReplaceRules(ctx context.Context, vpcID, groupId string, rules []SecurityGroupRule) (err error)
func Save ¶
func Save(model interface{}) error
Save update value in database, if the value doesn't have primary key, will insert it
func SaveByInstanceId ¶ added in v0.7.0
func UpdateByInstanceId ¶
func UpdateInstanceGroupFromDB ¶ added in v0.2.0
func UpdateInstanceGroupFromDB(instanceGroup *gf_cluster.InstanceGroup) error
func UpdateInstanceGroupInstanceCountFromDB ¶ added in v0.2.0
func UpdateKubernetesCluster ¶ added in v0.2.0
func UpdateKubernetesCluster(kubernetes *gf_cluster.KubernetesInfo) error
UpdateKubernetesCluster 更新集群信息
func UpdateOrCreateGroups ¶
func UpdateOrCreateSwitches ¶
func UpdateOrCreateVpcs ¶
func UpdateSwitch ¶
func UpdateTaskStatus ¶
func UpdateUserStatus ¶
func UpdateUserType ¶ added in v0.5.1
func UpdateWhere ¶ added in v0.7.0
Types ¶
type Account ¶
type Account struct { Base AccountName string `json:"account_name" diff:"account_name"` AccountKey string `json:"account_key" diff:"account_key"` EncryptedAccountSecret string `json:"encrypted_account_secret" diff:"encrypted_account_secret"` Salt string `json:"salt" diff:"salt"` Provider string `json:"provider" diff:"provider"` OrgId int64 `json:"org_id" diff:"org_id"` CreateBy string `json:"create_by" diff:"create_by"` UpdateBy string `json:"update_by" diff:"update_by"` DeletedAt gorm.DeletedAt // the value of this field will not be empty only after decryption function called. AccountSecret string `json:"account_secret" gorm:"-"` }
Account cloud provider account info
func GetAccountByAk ¶ added in v0.2.1
GetAccountByAk get first account by ak
func GetAccounts ¶
func GetAccounts(provider, accountName, accountKey string, pageNum, pageSize int) ([]*Account, int64, error)
GetAccounts search accounts by condition
func GetAccountsByOrgId ¶
GetAccountsByOrgId get accounts belongs to specify orgId
func GetDefaultAccountByProvider ¶
GetDefaultAccountByProvider return default accounts by provider
type Base ¶
type Cluster ¶
type Cluster struct { Base ClusterName string //uniq_key ClusterType string ClusterDesc string ExpectCount int Status string //ENABLE, DISABLE RegionId string ZoneId string InstanceType string Image string Provider string Password string KeyId string AuthType string //Advanced Config ImageConfig string NetworkConfig string StorageConfig string ChargeConfig string ExtendConfig string AccountKey string CreateBy string UpdateBy string DeleteUniqKey int64 DeletedAt gorm.DeletedAt }
func GetByClusterName ¶
GetByClusterName find first record that match given conditions
func GetByClusterNames ¶
GetByClusterNames find first record that match given conditions
func GetClusterById ¶
GetClusterById find cluster with given cluster id
func GetOneRegionByAccKey ¶ added in v0.1.1
GetOneRegionByAccKey find one region_id with given accountKey
func GetUpdatedCluster ¶
GetUpdatedCluster 获取任务更新时间大于指定时间的所有cluster实例
func ListClustersByCond ¶
func (*Cluster) GetChargeType ¶ added in v0.1.5
func (*Cluster) GetCpuType ¶ added in v0.5.0
func (*Cluster) GetInstanceTypeDesc ¶ added in v0.5.0
func (*Cluster) UnmarshalChargeConfig ¶ added in v0.1.5
func (c *Cluster) UnmarshalChargeConfig() (*types.ChargeConfig, error)
func (*Cluster) UnmarshalExtendConfig ¶ added in v0.5.0
func (c *Cluster) UnmarshalExtendConfig() (*types.ExtendConfig, error)
type ClusterSearchCond ¶ added in v0.4.0
type ClusterSnapshot ¶
func GetClusterSnapshot ¶
func GetClusterSnapshot(clusterName string) (*ClusterSnapshot, error)
GetClusterSnapshot 获取集群现状快照
type ClusterTag ¶
ClusterTag 使用Tags来描述Cluster的用途,属性等 比如使用
{ "group": "serviceName" "imageId": "xxx:1.2" }
func GetBySpecifyClusterTag ¶ added in v0.1.5
func GetBySpecifyClusterTag(clusterName string, tagKey string) (*ClusterTag, error)
func GetClusterNamesByTags ¶ added in v0.1.5
func GetClusterNamesByTags(ctx context.Context, tags map[string]string, pageSize, pageNum int) ([]ClusterTag, int64, error)
GetClusterNamesByTags list cluster names(contains deleted cluster) by tags: e.g.
{ "k1": "v1", "k2": "v2", "k3": "", }
===> should search distinct(cluster_name) from database using condition: (tag_key = 'k1' AND tag_value = 'v1') OR tag_key = 'k3' OR (tag_key = 'k2' AND tag_value = 'v2'))
group by cluster_name
func GetClusterTags ¶ added in v0.1.5
func GetClusterTagsByClusterNames ¶ added in v0.1.5
func GetClusterTagsByClusterNames(ctx context.Context, clusterNames []string) ([]ClusterTag, error)
func GetTagsByClusterName ¶
func GetTagsByClusterName(clusterName string) ([]ClusterTag, error)
func (ClusterTag) TableName ¶
func (ClusterTag) TableName() string
type ConnectableResult ¶ added in v0.4.0
type CustomClusterInstance ¶ added in v0.4.0
type ExpandTaskInfo ¶
type ExpandTaskInfo struct { ClusterName string `json:"cluster_name"` Count int `json:"count"` TaskExecHost string `json:"task_exec_host"` TaskSubmitHost string `json:"task_submit_host"` UserId int64 `json:"user_id"` BeforeCount int `json:"before_count"` }
func (*ExpandTaskInfo) GetAfterInstanceCount ¶ added in v0.2.0
func (e *ExpandTaskInfo) GetAfterInstanceCount(success int) (afterCount int)
func (*ExpandTaskInfo) GetBeforeInstanceCount ¶ added in v0.2.0
func (e *ExpandTaskInfo) GetBeforeInstanceCount() (beforeCount int)
func (*ExpandTaskInfo) GetCount ¶ added in v0.7.0
func (e *ExpandTaskInfo) GetCount() int
func (*ExpandTaskInfo) GetCreateUsername ¶ added in v0.2.0
func (e *ExpandTaskInfo) GetCreateUsername() (username string)
func (*ExpandTaskInfo) GetExpectInstanceCount ¶ added in v0.2.0
func (e *ExpandTaskInfo) GetExpectInstanceCount() (expectCount int)
type ExpandTaskRes ¶
type ExpandTaskRes struct {
InstanceIdList []string `json:"instance_id_list"`
}
type ExtractCondition ¶ added in v0.4.0
type FindSwitchesConditions ¶
type FindVpcConditions ¶
type Instance ¶
type Instance struct { Base Status constants.Status IpInner string IpOuter string InstanceId string ClusterName string TaskId int64 //扩容任务ID ShrinkTaskId int64 //缩容任务ID ChargeType string Attrs *string //扩展属性 DeleteAt *time.Time RunningAt *time.Time ExpireAt *time.Time //PrePaid instance expire time }
func GetActiveInstancesByClusterName ¶
GetActiveInstancesByClusterName 获取当前cluster下状态不为deleted状态的所有节点
func GetActiveInstancesByClusters ¶
GetActiveInstancesByClusters 获取clusters下状态不为deleted状态的count个节点
func GetActiveInstancesWithCount ¶
GetActiveInstancesWithCount 获取当前cluster下状态不为deleted状态的count个节点
func GetDeletedInstancesByTime ¶
func GetDeletedInstancesByTime(ctx context.Context, clusterName []string, createBefore, deleteAfter time.Time) ([]Instance, error)
GetDeletedInstancesByTime 获取clusters下状态为deleted状态的节点
func GetInstanceByCond ¶
func GetInstanceByInstanceId ¶
GetInstanceByInstanceId 获取Instance
func GetInstanceByIpInner ¶
func GetInstancesByIPs ¶
type InstanceAttr ¶ added in v0.4.0
type InstanceSearchCond ¶
type InstanceType ¶
type InstanceType struct { Base Provider string RegionId string ZoneId string TypeName string Family string Core int // 核心数量,单位 核 Memory int // 内存大小,单位 G IStatus int `gorm':"column:i_status"` // 0 未激活 1 已激活 2 已过期 }
func GetInstanceTypeByName ¶ added in v0.1.2
func GetInstanceTypeByName(ctx context.Context, instanceTypeName string) (*InstanceType, error)
func ScanInstanceType ¶
func ScanInstanceType(ctx context.Context) (ins []InstanceType, err error)
func (InstanceType) TableName ¶
func (InstanceType) TableName() string
type InstanceTypeCondition ¶
type KeyPair ¶ added in v0.7.0
type KeyPair struct { Base Provider string `gorm:"column:provider"` //云厂商 RegionId string `gorm:"column:region_id"` //区域ID KeyPairName string `gorm:"column:key_pair_name"` //秘钥对名称 KeyPairId string `gorm:"column:key_pair_id"` //秘钥对ID PublicKey string `gorm:"column:public_key"` //公钥 PrivateKey string `gorm:"column:private_key"` //私钥 KeyType string `gorm:"column:key_type"` //秘钥类型 0:自动创建 1:导入 }
type Network ¶
type OperationLog ¶ added in v0.4.0
type OperationLog struct { Base Operation string `gorm:"column:operation"` // edit/create/delete ObjectName string `gorm:"column:object_name"` // target model's table name Operator int64 `gorm:"column:operator"` Diff string `gorm:"column:diff"` UserName string `gorm:"-"` }
func ExtractLogs ¶ added in v0.4.0
func ExtractLogs(ctx context.Context, conds ExtractCondition) (logs []OperationLog, count int64, err error)
func (OperationLog) TableName ¶ added in v0.4.0
func (OperationLog) TableName() string
type Order ¶
type Order struct { Base AccountName string `json:"account_name"` OrderId string `json:"order_id"` OrderTime time.Time `json:"order_time"` Product string `json:"product"` Quantity int32 `json:"quantity"` UsageStartTime time.Time `json:"usage_start_time"` UsageEndTime time.Time `json:"usage_end_time"` Provider string `json:"provider"` RegionId string `json:"region_id"` ChargeType string `json:"charge_type"` PayStatus int8 `json:"pay_status"` Currency string `json:"currency"` Cost float32 `json:"cost"` Extend string `json:"extend"` }
type SecurityGroup ¶
type SecurityGroup struct { Base AK string `gorm:"column:ak"` Provider string RegionId string VpcId string SecurityGroupId string Name string SecurityGroupType string IsDel int }
func FindSecurityGroupById ¶ added in v0.7.0
func FindSecurityGroupById(ctx context.Context, securityGroupId string) (result SecurityGroup, err error)
func FindSecurityGroupWithPage ¶
func FindSecurityGroupWithPage(ctx context.Context, cond FindSecurityGroupConditions) (result []SecurityGroup, total int64, err error)
func (SecurityGroup) TableName ¶
func (SecurityGroup) TableName() string
type SecurityGroupIDStruct ¶
type SecurityGroupIDStruct struct {
SecurityGroupId string
}
func FindSecurityId ¶
func FindSecurityId(ctx context.Context, cond FindSecurityGroupConditions) (result SecurityGroupIDStruct, err error)
type SecurityGroupRule ¶
type SecurityGroupRule struct { Base VpcId string SecurityGroupId string PortRange string Protocol string Direction string GroupId string `gorm:"column:other_group_id"` CidrIp string PrefixListId string IsDel int }
func FindSecurityGroupRulesById ¶ added in v0.7.0
func FindSecurityGroupRulesById(ctx context.Context, securityGroupId string) (result []SecurityGroupRule, err error)
func (SecurityGroupRule) TableName ¶
func (SecurityGroupRule) TableName() string
type ShrinkTaskInfo ¶
type ShrinkTaskInfo struct { ClusterName string `json:"cluster_name"` Count int `json:"count"` IPs string `json:"ips"` TaskExecHost string `json:"task_exec_host"` TaskSubmitHost string `json:"task_submit_host"` UserId int64 `json:"user_id"` BeforeCount int `json:"before_count"` }
func (*ShrinkTaskInfo) GetAfterInstanceCount ¶ added in v0.2.0
func (s *ShrinkTaskInfo) GetAfterInstanceCount(success int) (afterCount int)
func (*ShrinkTaskInfo) GetBeforeInstanceCount ¶ added in v0.2.0
func (s *ShrinkTaskInfo) GetBeforeInstanceCount() (beforeCount int)
func (*ShrinkTaskInfo) GetCount ¶ added in v0.7.0
func (e *ShrinkTaskInfo) GetCount() int
func (*ShrinkTaskInfo) GetCreateUsername ¶ added in v0.2.0
func (s *ShrinkTaskInfo) GetCreateUsername() (username string)
func (*ShrinkTaskInfo) GetExpectInstanceCount ¶ added in v0.2.0
func (s *ShrinkTaskInfo) GetExpectInstanceCount() (expectCount int)
type Switch ¶
type Switch struct { Base VpcId string SwitchId string ZoneId string Name string CidrBlock string GatewayIp string IsDefault int AvailableIpAddressCount int VStatus string IsDel int }
func FindSwitchById ¶ added in v0.7.0
func FindSwitchesWithPage ¶
type SwitchIdStruct ¶
type SwitchIdStruct struct {
SwitchId string
}
func FindSwitchId ¶
func FindSwitchId(ctx context.Context, cond FindSwitchesConditions) (result SwitchIdStruct, err error)
type Task ¶
type Task struct { Base TaskName string `json:"task_name"` Status string `json:"status"` //INIT, RUNNING, SUCCESS, FAILED TaskAction string `json:"task_action"` //expand, shrink TaskFilter string `json:"task_filter"` //任务过滤,业务标识(如集群名等) TaskInfo string `json:"task_info"` //不同任务需要的不同的参数 ErrMsg string `json:"err_msg"` TaskResult string `json:"task_result"` SupportCancel bool `json:"support_cancel"` FinishTime *time.Time `json:"finish_time"` }
func GetExpireRunningTask ¶
GetExpireRunningTask 获取执行状态为Running并且最后更新时间(应该为执行时间)大于指定时间的所有的task
func GetTaskByStatus ¶
GetTaskByStatus 获取当前cluster下状态zai在列表中的所有实例
func SearchTask ¶
type TaskResult ¶ added in v0.7.0
type TaskResult struct {
SuccessNum int `json:"success_num"`
}
type TaskSearchCond ¶
type User ¶
type User struct { Base Username string `json:"username"` Password string `json:"password"` UserType int8 `json:"user_type"` UserStatus string `json:"user_status"` OrgId int64 `json:"org_id"` CreateBy string `json:"create_by"` }
func GetUserList ¶ added in v0.5.1
func GetUserThroughBigCache ¶ added in v0.2.1
func GetUsersByUsernamesAndUserType ¶ added in v0.5.1
type Vpc ¶
type Vpc struct { Base AK string `gorm:"column:ak"` RegionId string VpcId string Name string CidrBlock string Provider string VStatus string IsDel int }
func FindVpcById ¶
func FindVpcById(ctx context.Context, cond FindVpcConditions) (result Vpc, err error)
func FindVpcsWithPage ¶
type VpcIDStruct ¶
type VpcIDStruct struct {
VpcId string
}