secret

package
v0.0.0-...-f5108b3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 9 Imported by: 0

README

凭证管理

Documentation

Index

Constants

View Source
const (
	AppName = "secret"
)

Variables

View Source
var (
	Type_name = map[int32]string{
		0: "API_KEY",
		1: "USER_PASSWORD",
	}
	Type_value = map[string]int32{
		"API_KEY":       0,
		"USER_PASSWORD": 1,
	}
)

Enum value maps for Type.

View Source
var File_cmdb_apps_secret_pb_model_proto protoreflect.FileDescriptor
View Source
var File_cmdb_apps_secret_pb_rpc_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CreateSecretRequest

type CreateSecretRequest struct {

	// 凭证的类型
	// @gotags: json:"type"
	Type Type `protobuf:"varint,1,opt,name=type,proto3,enum=go12.cmdb.secret.Type" json:"type"`
	// @gotags: json:"key" validate:"required"
	Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key" validate:"required"`
	// @gotags: json:"value" validate:"required"
	Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value" validate:"required"`
	// 允许同步的资源的Region列表
	// @gotags: json:"regions"
	Regions []string `protobuf:"bytes,4,rep,name=regions,proto3" json:"regions"`
	// 允许同步的资源的类型
	// @gotags: json:"resource_types"
	ResourceTypes []resource.TYPE `` /* 127-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewCreateSecretRequest

func NewCreateSecretRequest() *CreateSecretRequest

func (*CreateSecretRequest) Descriptor deprecated

func (*CreateSecretRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateSecretRequest.ProtoReflect.Descriptor instead.

func (*CreateSecretRequest) GetKey

func (x *CreateSecretRequest) GetKey() string

func (*CreateSecretRequest) GetRegions

func (x *CreateSecretRequest) GetRegions() []string

func (*CreateSecretRequest) GetResourceTypes

func (x *CreateSecretRequest) GetResourceTypes() []resource.TYPE

func (*CreateSecretRequest) GetType

func (x *CreateSecretRequest) GetType() Type

func (*CreateSecretRequest) GetValue

func (x *CreateSecretRequest) GetValue() string

func (*CreateSecretRequest) ProtoMessage

func (*CreateSecretRequest) ProtoMessage()

func (*CreateSecretRequest) ProtoReflect

func (x *CreateSecretRequest) ProtoReflect() protoreflect.Message

func (*CreateSecretRequest) Reset

func (x *CreateSecretRequest) Reset()

func (*CreateSecretRequest) String

func (x *CreateSecretRequest) String() string

type DescribeSecretRequest

type DescribeSecretRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DescribeSecretRequest) Descriptor deprecated

func (*DescribeSecretRequest) Descriptor() ([]byte, []int)

Deprecated: Use DescribeSecretRequest.ProtoReflect.Descriptor instead.

func (*DescribeSecretRequest) GetId

func (x *DescribeSecretRequest) GetId() string

func (*DescribeSecretRequest) ProtoMessage

func (*DescribeSecretRequest) ProtoMessage()

func (*DescribeSecretRequest) ProtoReflect

func (x *DescribeSecretRequest) ProtoReflect() protoreflect.Message

func (*DescribeSecretRequest) Reset

func (x *DescribeSecretRequest) Reset()

func (*DescribeSecretRequest) String

func (x *DescribeSecretRequest) String() string

type Secret

type Secret struct {

	// secret id
	// @gotags: json:"id" bson:"_id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// secret id
	// @gotags: json:"domain" bson:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// secret id
	// @gotags: json:"namespace" bson:"namespace"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// 创建secret的请求
	Spec *CreateSecretRequest `protobuf:"bytes,4,opt,name=spec,proto3" json:"spec,omitempty"`
	// contains filtered or unexported fields
}

func NewSecret

func NewSecret(req *CreateSecretRequest) *Secret

func (*Secret) Decrypt

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

解密, 对称加密: key

func (*Secret) Descriptor deprecated

func (*Secret) Descriptor() ([]byte, []int)

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) Desense

func (s *Secret) Desense()

func (*Secret) Encrypt

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

加密, 对称加密: key,

func (*Secret) GetDomain

func (x *Secret) GetDomain() string

func (*Secret) GetId

func (x *Secret) GetId() string

func (*Secret) GetNamespace

func (x *Secret) GetNamespace() string

func (*Secret) GetSpec

func (x *Secret) GetSpec() *CreateSecretRequest

func (*Secret) ProtoMessage

func (*Secret) ProtoMessage()

func (*Secret) ProtoReflect

func (x *Secret) ProtoReflect() protoreflect.Message

func (*Secret) Reset

func (x *Secret) Reset()

func (*Secret) String

func (x *Secret) String() string

type Service

type Service interface {
	// 录入云商凭证
	CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error)
	// 查询云商凭证
	DescribeSecret(context.Context, *DescribeSecretRequest) (*Secret, error)
	// 使用云商凭证同步资源 Stream
	SyncResource(context.Context, *SyncResourceRequest, SyncResourceHandler) error
}

type SyncResourceHandler

type SyncResourceHandler func(*SyncResponse)

通过Hook返回 资源是否同步成功

type SyncResourceRequest

type SyncResourceRequest struct {
	// secret id
	Id string
	// 同步那些区域的资源
	Region []string
	// 同步那些类型的资源
	Resource []resource.TYPE
}

type SyncResponse

type SyncResponse struct {
	Id    string
	Name  string
	Error string
}

type Type

type Type int32
const (
	Type_API_KEY       Type = 0
	Type_USER_PASSWORD Type = 1
)

func (Type) Descriptor

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated

func (Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Type.Descriptor instead.

func (Type) Number

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

func (Type) Type

func (Type) Type() protoreflect.EnumType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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