secret

package
v0.0.0-...-2c311f4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 17 Imported by: 0

README

资源同步的凭证管理

Documentation

Index

Constants

View Source
const (
	AppName = "secrets"
)
View Source
const (
	EncryptKey = "test01"
)

Variables

View Source
var (
	PROVIDER_name = map[int32]string{
		0: "TENCENT_CLOUD",
	}
	PROVIDER_value = map[string]int32{
		"TENCENT_CLOUD": 0,
	}
)

Enum value maps for PROVIDER.

View Source
var File_apps_secret_pb_rpc_proto protoreflect.FileDescriptor
View Source
var File_apps_secret_pb_secret_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go9.devcloud.cmdb.secret.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateSecret",
			Handler:    _RPC_CreateSecret_Handler,
		},
		{
			MethodName: "QuerySecret",
			Handler:    _RPC_QuerySecret_Handler,
		},
		{
			MethodName: "DescribeSecret",
			Handler:    _RPC_DescribeSecret_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/secret/pb/rpc.proto",
}

RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterRPCServer

func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)

Types

type CreateSecretRequest

type CreateSecretRequest struct {

	// 供应商
	// @gotags: json:"provider"
	Provider PROVIDER `protobuf:"varint,1,opt,name=provider,proto3,enum=go9.devcloud.cmdb.secret.PROVIDER" json:"provider"`
	// 服务地址
	// @gotags: json:"address"
	Address string `protobuf:"bytes,6,opt,name=address,proto3" json:"address"`
	// api调用key
	// @gotags: json:"api_key" validate:"required"
	ApiKey string `protobuf:"bytes,2,opt,name=api_key,json=apiKey,proto3" json:"api_key" validate:"required"`
	// api调用secret
	// @gotags: json:"api_secret" validate:"required"
	ApiSecret string `protobuf:"bytes,3,opt,name=api_secret,json=apiSecret,proto3" json:"api_secret" validate:"required"`
	// secret描述
	// @gotags: json:"description" validate:"required"
	Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description" validate:"required"`
	// secret请求接口访问速率
	// @gotags: json:"request_rate"
	RequestRate int32 `protobuf:"varint,7,opt,name=request_rate,json=requestRate,proto3" json:"request_rate"`
	// 是否启用
	Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// 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) Desense

func (i *CreateSecretRequest) Desense()

func (*CreateSecretRequest) GetAddress

func (x *CreateSecretRequest) GetAddress() string

func (*CreateSecretRequest) GetApiKey

func (x *CreateSecretRequest) GetApiKey() string

func (*CreateSecretRequest) GetApiSecret

func (x *CreateSecretRequest) GetApiSecret() string

func (*CreateSecretRequest) GetDescription

func (x *CreateSecretRequest) GetDescription() string

func (*CreateSecretRequest) GetEnabled

func (x *CreateSecretRequest) GetEnabled() bool

func (*CreateSecretRequest) GetProvider

func (x *CreateSecretRequest) GetProvider() PROVIDER

func (*CreateSecretRequest) GetRequestRate

func (x *CreateSecretRequest) GetRequestRate() int32

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

func (*CreateSecretRequest) TableName

func (req *CreateSecretRequest) TableName() string

func (*CreateSecretRequest) Validate

func (req *CreateSecretRequest) Validate() error

type DescribeSecretRequest

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

func NewDescribeSecretRequest

func NewDescribeSecretRequest(id string) *DescribeSecretRequest

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 Meta

type Meta struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// @gotags: json:"create_at"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at"`
	// contains filtered or unexported fields
}

func NewMeta

func NewMeta() *Meta

func (*Meta) Descriptor deprecated

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

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetCreateAt

func (x *Meta) GetCreateAt() int64

func (*Meta) GetId

func (x *Meta) GetId() string

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

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

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type PROVIDER

type PROVIDER int32
const (
	// 腾讯云
	PROVIDER_TENCENT_CLOUD PROVIDER = 0
)

func (PROVIDER) Descriptor

func (PROVIDER) Descriptor() protoreflect.EnumDescriptor

func (PROVIDER) Enum

func (x PROVIDER) Enum() *PROVIDER

func (PROVIDER) EnumDescriptor deprecated

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

Deprecated: Use PROVIDER.Descriptor instead.

func (PROVIDER) Number

func (x PROVIDER) Number() protoreflect.EnumNumber

func (PROVIDER) String

func (x PROVIDER) String() string

func (PROVIDER) Type

type QuerySecretRequest

type QuerySecretRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// contains filtered or unexported fields
}

func NewQuerySecretRequest

func NewQuerySecretRequest() *QuerySecretRequest

func (*QuerySecretRequest) Descriptor deprecated

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

Deprecated: Use QuerySecretRequest.ProtoReflect.Descriptor instead.

func (*QuerySecretRequest) GetPage

func (x *QuerySecretRequest) GetPage() *request.PageRequest

func (*QuerySecretRequest) ProtoMessage

func (*QuerySecretRequest) ProtoMessage()

func (*QuerySecretRequest) ProtoReflect

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

func (*QuerySecretRequest) Reset

func (x *QuerySecretRequest) Reset()

func (*QuerySecretRequest) String

func (x *QuerySecretRequest) String() string

type RPCClient

type RPCClient interface {
	// 创建凭证
	CreateSecret(ctx context.Context, in *CreateSecretRequest, opts ...grpc.CallOption) (*Secret, error)
	// 查询凭证详情
	QuerySecret(ctx context.Context, in *QuerySecretRequest, opts ...grpc.CallOption) (*SecretSet, error)
	// 查询凭证详情
	DescribeSecret(ctx context.Context, in *DescribeSecretRequest, opts ...grpc.CallOption) (*Secret, error)
}

RPCClient is the client API for RPC service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewRPCClient

func NewRPCClient(cc grpc.ClientConnInterface) RPCClient

type RPCServer

type RPCServer interface {
	// 创建凭证
	CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error)
	// 查询凭证详情
	QuerySecret(context.Context, *QuerySecretRequest) (*SecretSet, error)
	// 查询凭证详情
	DescribeSecret(context.Context, *DescribeSecretRequest) (*Secret, error)
	// contains filtered or unexported methods
}

RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility

type Secret

type Secret struct {

	// meta定义
	// @gotags: json:"meta"
	Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta"`
	// secret定义
	// @gotags: json:"spec"
	Spec *CreateSecretRequest `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec"`
	// contains filtered or unexported fields
}

func New

func New(req *CreateSecretRequest) *Secret

func (*Secret) DecryptAPISecret

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

解密

func (*Secret) Descriptor deprecated

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

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) EncryptAPISecret

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

加密

func (*Secret) GetMeta

func (x *Secret) GetMeta() *Meta

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 SecretSet

type SecretSet struct {

	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// @gotags: json:"items"
	Items []*Secret `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

func NewSecretSet

func NewSecretSet() *SecretSet

func (*SecretSet) Add

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

func (*SecretSet) Descriptor deprecated

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

Deprecated: Use SecretSet.ProtoReflect.Descriptor instead.

func (*SecretSet) GetItems

func (x *SecretSet) GetItems() []*Secret

func (*SecretSet) GetTotal

func (x *SecretSet) GetTotal() int64

func (*SecretSet) ProtoMessage

func (*SecretSet) ProtoMessage()

func (*SecretSet) ProtoReflect

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

func (*SecretSet) Reset

func (x *SecretSet) Reset()

func (*SecretSet) String

func (x *SecretSet) String() string

type Service

type Service interface {
	// 通过该凭证的资源
	SyncResource(context.Context, *DescribeSecretRequest) error
	RPCServer
}

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) CreateSecret

func (UnimplementedRPCServer) DescribeSecret

func (UnimplementedRPCServer) QuerySecret

type UnsafeRPCServer

type UnsafeRPCServer interface {
	// contains filtered or unexported methods
}

UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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