Documentation
¶
Index ¶
- Constants
- func GetValue[T any](ptr *T) T
- func NewSecretSet() *types.Set[*Secret]
- func SetLimit(req *lighthouse.DescribeInstancesRequest, v int64)
- func SetOffset(req *lighthouse.DescribeInstancesRequest, v int64)
- func TransferLighthouseToResource(ins *lighthouse.Instance) *resource.Resource
- type CreateSecretRequest
- type DescribeSecretRequeset
- type QuerySecretRequest
- type ResourceResponse
- type Secret
- type Service
- type SyncResourceHandleFunc
- type SyncResourceRequest
Constants ¶
View Source
const ( AppName = "secret" SECRET_KEY = "23gs6gxHrz1kNEvshRmunkXbwIiaEcYfh+EMu+e9ewA=" )
Variables ¶
This section is empty.
Functions ¶
func NewSecretSet ¶
func SetLimit ¶
func SetLimit(req *lighthouse.DescribeInstancesRequest, v int64)
func SetOffset ¶
func SetOffset(req *lighthouse.DescribeInstancesRequest, v int64)
func TransferLighthouseToResource ¶
func TransferLighthouseToResource(ins *lighthouse.Instance) *resource.Resource
云商数据结构lighthouse.Instance --> Resource
Types ¶
type CreateSecretRequest ¶
type CreateSecretRequest struct {
// 名称
Name string `json:"name"`
//
Vendor resource.VENDOR `json:"vendor"`
// Vmware
Address string `json:"address"`
// 需要被脱敏
// Musk
ApiKey string `json:"api_key"`
//
ApiSecret string `json:"api_secret" mask:",5,4"`
// 资源所在区域
Regions []string `json:"regions"`
// 通过分页大小
SyncLimit int64 `json:"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) GetSyncLimit ¶
func (r *CreateSecretRequest) GetSyncLimit() int64
func (*CreateSecretRequest) SetIsEncrypted ¶
func (r *CreateSecretRequest) SetIsEncrypted(v bool)
type DescribeSecretRequeset ¶
type DescribeSecretRequeset struct {
Id string `json:"id"`
}
func NewDescribeSecretRequeset ¶
func NewDescribeSecretRequeset(id string) *DescribeSecretRequeset
type QuerySecretRequest ¶
type QuerySecretRequest struct {
// 分页请求
*request.PageRequest
}
func NewQuerySecretRequest ¶
func NewQuerySecretRequest() *QuerySecretRequest
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 {
Id string `json:"id" bson:"_id"`
UpdateAt int64 `json:"update_at" bson:"update_at"`
CreateSecretRequest `bson:"inline"`
}
func NewSecret ¶
func NewSecret(in *CreateSecretRequest) *Secret
func (*Secret) SetDefault ¶
func (*Secret) Sync ¶
func (s *Secret) Sync(cb SyncResourceHandleFunc) error
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, *DescribeSecretRequeset) (*Secret, error)
// Stream API, websocket --> UI 当前资源同步的进度
SyncResource(context.Context, *SyncResourceRequest, SyncResourceHandleFunc) 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.