Documentation
¶
Index ¶
- Constants
- func GetSyncerName(t resource.TYPE) string
- func NewSecretSet() *types.Set[*Secret]
- func RegistrySyncer(t resource.TYPE, s Syncer)
- type CreateSecretRequest
- func (r *CreateSecretRequest) DecryptedApiSecret() error
- func (r *CreateSecretRequest) EncryptedApiSecret() error
- func (r *CreateSecretRequest) GetEnabled() bool
- func (r *CreateSecretRequest) GetSyncLimit() int64
- func (r *CreateSecretRequest) SetEnabled(v bool) *CreateSecretRequest
- func (r *CreateSecretRequest) SetIsEncrypted(v bool) *CreateSecretRequest
- type DescribeSecretRequest
- type QuerySecretRequest
- type QuerySyncLogRequest
- type ResourceResponse
- type Secret
- type Service
- type SyncRecord
- type SyncResourceHandleFunc
- type SyncResourceRequest
- type SyncResourceTask
- type Syncer
Constants ¶
View Source
const ( APP_NAME = "secret" SECRET_KEY = "23gs6gxHrz1kNEvshRmunkXbwIiaEcYfh+EMu+e9ewA=" )
View Source
const (
SYNCER_PREFIX = "syncer"
)
View Source
const (
TASK_LABLE_SECRET_ID = "secret_id"
)
Variables ¶
This section is empty.
Functions ¶
func GetSyncerName ¶
func NewSecretSet ¶
func RegistrySyncer ¶
Types ¶
type CreateSecretRequest ¶
type CreateSecretRequest struct {
// 是否启用
Enabled *bool `json:"enabled" gorm:"column:enabled"`
// 名称
Name string `json:"name" gorm:"column:name"`
// 尝试
Vendor resource.VENDOR `json:"vendor" gorm:"column:vendor"`
// Vmware
Address string `json:"address" gorm:"column:address"`
// 需要被脱敏
// Musk
ApiKey string `json:"api_key" gorm:"column:api_key"`
// ApiKey
ApiSecret string `json:"api_secret" mask:",5,4" gorm:"column:api_secret"`
// 资源所在区域
Regions []string `json:"regions" gorm:"column:regions;serializer:json;type:json"`
// 资源列表
ResourceType []resource.TYPE `json:"resource_type" gorm:"column:resource_type;serializer:json;type:json"`
// 同步分页大小
SyncLimit int64 `json:"sync_limit" gorm:"column:sync_limit"`
// contains filtered or unexported fields
}
func NewCreateSecretRequest ¶
func NewCreateSecretRequest() *CreateSecretRequest
func (*CreateSecretRequest) DecryptedApiSecret ¶
func (r *CreateSecretRequest) DecryptedApiSecret() error
func (*CreateSecretRequest) EncryptedApiSecret ¶
func (r *CreateSecretRequest) EncryptedApiSecret() error
func (*CreateSecretRequest) GetEnabled ¶
func (r *CreateSecretRequest) GetEnabled() bool
func (*CreateSecretRequest) GetSyncLimit ¶
func (r *CreateSecretRequest) GetSyncLimit() int64
func (*CreateSecretRequest) SetEnabled ¶
func (r *CreateSecretRequest) SetEnabled(v bool) *CreateSecretRequest
func (*CreateSecretRequest) SetIsEncrypted ¶
func (r *CreateSecretRequest) SetIsEncrypted(v bool) *CreateSecretRequest
type DescribeSecretRequest ¶
type DescribeSecretRequest struct {
policy.ResourceScope
Id string `json:"id"`
}
func NewDescribeSecretRequest ¶
func NewDescribeSecretRequest(id string) *DescribeSecretRequest
type QuerySecretRequest ¶
type QuerySecretRequest struct {
policy.ResourceScope
// 分页请求
*request.PageRequest
}
func NewQuerySecretRequest ¶
func NewQuerySecretRequest() *QuerySecretRequest
type QuerySyncLogRequest ¶
type QuerySyncLogRequest struct {
TaskId int `json:"task_id"`
}
type ResourceResponse ¶
type ResourceResponse struct {
Success bool
InstanceId string `json:"instance_id"`
Resource *resource.Resource `json:"resource"`
Message string `json:"message"`
}
func (ResourceResponse) String ¶
func (t ResourceResponse) String() string
type Secret ¶
type Secret struct {
model.Meta
CreateSecretRequest `bson:"inline"`
}
func NewSecret ¶
func NewSecret(in *CreateSecretRequest) *Secret
func (*Secret) SetDefault ¶
type Service ¶
type Service interface {
// 用于Secret的管理(后台管理员配置)
// 创建secret
CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error)
// 查询secret
QuerySecret(context.Context, *QuerySecretRequest) (*types.Set[*Secret], error)
// 查询详情, 已解密, API层需要脱敏
DescribeSecret(context.Context, *DescribeSecretRequest) (*Secret, error)
// 使用task模块来执行异步任务, 通过TaskId查询异步任务状态
SyncResource(context.Context, *SyncResourceRequest) (*types.Set[*task.Task], error)
}
func GetService ¶
func GetService() Service
type SyncResourceHandleFunc ¶
type SyncResourceHandleFunc func(ResourceResponse)
type SyncResourceRequest ¶
type SyncResourceRequest struct {
Id string `json:"id"`
}
func NewSyncResourceRequest ¶
func NewSyncResourceRequest(id string) *SyncResourceRequest
Click to show internal directories.
Click to hide internal directories.