secret

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName    = "secret"
	SECRET_KEY = "23gs6gxHrz1kNEvshRmunkXbwIiaEcYfh+EMu+e9ewA="
)

Variables

This section is empty.

Functions

func GetValue

func GetValue[T any](ptr *T) T

func NewSecretSet

func NewSecretSet() *types.Set[*Secret]

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 {
	model.Meta
	CreateSecretRequest `bson:"inline"`
}

func NewSecret

func NewSecret(in *CreateSecretRequest) *Secret

func (*Secret) SetDefault

func (s *Secret) SetDefault() *Secret

func (*Secret) String

func (s *Secret) String() string

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL