secret

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: AFL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CrendentialType_name = map[int32]string{
		0: "CRENDENTIAL_API_KEY",
		1: "CRENDENTIAL_PASSWORD",
	}
	CrendentialType_value = map[string]int32{
		"CRENDENTIAL_API_KEY":  0,
		"CRENDENTIAL_PASSWORD": 1,
	}
)

Enum value maps for Type.

View Source
var (
	Type_name = map[int32]string{
		0: "Unsuport",
		1: "HOST",
		2: "RDS",
	}
	Type_value = map[string]int32{
		"Unsuport": 0,
		"HOST":     1,
		"RDS":      2,
	}
)

Enum value maps for Type.

View Source
var (
	Vendor_name = map[int32]string{
		0: "VENDOR_ALIYUN",
		1: "VENDOR_TENCENT",
		2: "VENDOR_HUAWEI",
		3: "VENDOR_VSPHERE",
	}
	Vendor_value = map[string]int32{
		"VENDOR_ALIYUN":  0,
		"VENDOR_TENCENT": 1,
		"VENDOR_HUAWEI":  2,
		"VENDOR_VSPHERE": 3,
	}
)

Enum value maps for Type.

Functions

This section is empty.

Types

type CreateSecretRequest

type CreateSecretRequest struct {
	Description     string          `json:"description" validate:"required,lte=100"` // 描述
	Vendor          Vendor          `json:"vendor"`                                  // 厂商
	AllowRegions    []string        `json:"allow_regions"`                           // 允许同步的区域
	CrendentialType CrendentialType `json:"crendential_type"`                        // 凭证类型
	Address         string          `json:"address"`                                 // 服务地址, 云商不用填写
	APIKey          string          `json:"api_key" validate:"required,lte=100"`     // key
	APISecret       string          `json:"api_secret" validate:"required,lte=100"`  // secrete
	RequestRate     int             `json:"request_rate"`                            // 请求速率限制, 默认1秒5个
}

func NewCreateSecretRequest

func NewCreateSecretRequest() *CreateSecretRequest

func (*CreateSecretRequest) Validate

func (req *CreateSecretRequest) Validate() error

type CrendentialType

type CrendentialType int
const (
	CrendentialAPIKey CrendentialType = iota
	CrendentialPassword
)

func ParseCrendentialTypeFromString

func ParseCrendentialTypeFromString(str string) (CrendentialType, error)

ParseCrendentialTypeFromString Parse Type from string

func (CrendentialType) Equal

func (t CrendentialType) Equal(target CrendentialType) bool

Equal type compare

func (CrendentialType) IsIn

func (t CrendentialType) IsIn(targets ...CrendentialType) bool

IsIn todo

func (CrendentialType) MarshalJSON

func (t CrendentialType) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (CrendentialType) String

func (t CrendentialType) String() string

func (*CrendentialType) UnmarshalJSON

func (t *CrendentialType) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type DeleteSecretRequest

type DeleteSecretRequest struct {
	Id string
}

func NewDeleteSecretRequestWithID

func NewDeleteSecretRequestWithID(id string) *DeleteSecretRequest

type DescribeSecretRequest

type DescribeSecretRequest struct {
	Id string
}

func NewDescribeSecretRequest

func NewDescribeSecretRequest(id string) *DescribeSecretRequest

type QuerySecretRequest

type QuerySecretRequest struct {
	PageSize   uint64 `json:"page_size,omitempty"`
	PageNumber uint64 `json:"page_number,omitempty"`
	Keywords   string `json:"keywords"`
}

func NewQuerySecretRequest

func NewQuerySecretRequest() *QuerySecretRequest

func NewQuerySecretRequestFromHTTP

func NewQuerySecretRequestFromHTTP(r *http.Request) *QuerySecretRequest

func (*QuerySecretRequest) OffSet

func (req *QuerySecretRequest) OffSet() int64

type Secret

type Secret struct {
	Id       string `json:"id"`        // 全局唯一Id
	CreateAt int64  `json:"create_at"` // 创建时间

	*CreateSecretRequest
}

func NewDefaultSecret

func NewDefaultSecret() *Secret

func NewSecret

func NewSecret(req *CreateSecretRequest) (*Secret, error)

func (*Secret) AllowRegionString

func (s *Secret) AllowRegionString() string

func (*Secret) DecryptAPISecret

func (s *Secret) DecryptAPISecret(key string) error

func (*Secret) Desense

func (s *Secret) Desense()

func (*Secret) EncryptAPISecret

func (s *Secret) EncryptAPISecret(key string) error

func (*Secret) IsAllowRegion

func (s *Secret) IsAllowRegion(region string) bool

func (*Secret) LoadAllowRegionFromString

func (s *Secret) LoadAllowRegionFromString(regions string)

func (*Secret) ShortDesc

func (s *Secret) ShortDesc() string

type SecretSet

type SecretSet struct {
	Items []*Secret `json:"items"`
	Total int64     `json:"total"`
}

func NewSecretSet

func NewSecretSet() *SecretSet

func (*SecretSet) Add

func (s *SecretSet) Add(item *Secret)

type Service

type Service interface {
	CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error)
	QuerySecret(context.Context, *QuerySecretRequest) (*SecretSet, error)
	DescribeSecret(context.Context, *DescribeSecretRequest) (*Secret, error)
	DeleteSecret(context.Context, *DeleteSecretRequest) (*Secret, error)
}

type Type

type Type int

func ParseTypeFromString

func ParseTypeFromString(str string) (Type, error)

ParseTypeFromString Parse Type from string

func (Type) Equal

func (t Type) Equal(target Type) bool

Equal type compare

func (Type) IsIn

func (t Type) IsIn(targets ...Type) bool

IsIn todo

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type Vendor

type Vendor int
const (
	VendorAliYun Vendor = iota
	VendorTencent
	VendorHuaWei
	VendorVsphere
)

func ParseVendorFromString

func ParseVendorFromString(str string) (Vendor, error)

ParseVendorFromString Parse Type from string

func (Vendor) Equal

func (t Vendor) Equal(target Vendor) bool

Equal type compare

func (Vendor) IsIn

func (t Vendor) IsIn(targets ...Vendor) bool

IsIn todo

func (Vendor) MarshalJSON

func (t Vendor) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (Vendor) String

func (t Vendor) String() string

func (*Vendor) UnmarshalJSON

func (t *Vendor) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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