secret

package
v0.0.0-...-6a8978f Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "secret"
)

Variables

View Source
var (
	TYPE_name = map[int32]string{
		0: "API_KEY",
		1: "PASSWORD",
	}
	TYPE_value = map[string]int32{
		"API_KEY":  0,
		"PASSWORD": 1,
	}
)

Enum value maps for TYPE.

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: "go8.devcloud.cmdb.secret.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateSecret",
			Handler:    _RPC_CreateSecret_Handler,
		},
		{
			MethodName: "QuerySecret",
			Handler:    _RPC_QuerySecret_Handler,
		},
		{
			MethodName: "SyncResource",
			Handler:    _RPC_SyncResource_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:"description" validate:"required,lte=100"
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description" validate:"required,lte=100"`
	// 厂商
	// @gotags: json:"vendor"
	Vendor resource.VENDOR `protobuf:"varint,2,opt,name=vendor,proto3,enum=go8.devcloud.cmdb.resource.VENDOR" json:"vendor"`
	// 允许同步的区域
	// @gotags: json:"allow_regions"
	AllowRegions string `protobuf:"bytes,3,opt,name=allow_regions,json=allowRegions,proto3" json:"allow_regions"`
	// 凭证类型
	// @gotags: json:"crendential_type"
	CrendentialType TYPE `` /* 132-byte string literal not displayed */
	// 服务地址, 云商不用填写
	// @gotags: json:"address"
	Address string `protobuf:"bytes,5,opt,name=address,proto3" json:"address"`
	// key
	// @gotags: json:"api_key" validate:"required,lte=100"
	ApiKey string `protobuf:"bytes,6,opt,name=api_key,json=apiKey,proto3" json:"api_key" validate:"required,lte=100"`
	// api_secret
	// @gotags: json:"api_secret" validate:"required,lte=100"
	ApiSecret string `protobuf:"bytes,7,opt,name=api_secret,json=apiSecret,proto3" json:"api_secret" validate:"required,lte=100"`
	// 请求速率限制, 默认1秒5个
	// @gotags: json:"request_rate"
	RequestRate int32 `protobuf:"varint,8,opt,name=request_rate,json=requestRate,proto3" json:"request_rate"`
	// 所属Domain
	// @gotags: json:"domain" validate:"required"
	Domain string `protobuf:"bytes,9,opt,name=domain,proto3" json:"domain" validate:"required"`
	// 所属Namespace
	// @gotags: json:"namespace" validate:"required"
	Namespace string `protobuf:"bytes,10,opt,name=namespace,proto3" json:"namespace" validate:"required"`
	// contains filtered or unexported fields
}

func (*CreateSecretRequest) Descriptor deprecated

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

Deprecated: Use CreateSecretRequest.ProtoReflect.Descriptor instead.

func (*CreateSecretRequest) GetAddress

func (x *CreateSecretRequest) GetAddress() string

func (*CreateSecretRequest) GetAllowRegions

func (x *CreateSecretRequest) GetAllowRegions() string

func (*CreateSecretRequest) GetApiKey

func (x *CreateSecretRequest) GetApiKey() string

func (*CreateSecretRequest) GetApiSecret

func (x *CreateSecretRequest) GetApiSecret() string

func (*CreateSecretRequest) GetCrendentialType

func (x *CreateSecretRequest) GetCrendentialType() TYPE

func (*CreateSecretRequest) GetDescription

func (x *CreateSecretRequest) GetDescription() string

func (*CreateSecretRequest) GetDomain

func (x *CreateSecretRequest) GetDomain() string

func (*CreateSecretRequest) GetNamespace

func (x *CreateSecretRequest) GetNamespace() string

func (*CreateSecretRequest) GetRequestRate

func (x *CreateSecretRequest) GetRequestRate() int32

func (*CreateSecretRequest) GetVendor

func (x *CreateSecretRequest) GetVendor() resource.VENDOR

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 QuerySecretRequest

type QuerySecretRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 关键字参数
	// @gotags: json:"keywords"
	Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords"`
	// 所属Domain
	// @gotags: json:"domain"
	Domain string `protobuf:"bytes,14,opt,name=domain,proto3" json:"domain"`
	// 所属Namespace
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,15,opt,name=namespace,proto3" json:"namespace"`
	// contains filtered or unexported fields
}

func (*QuerySecretRequest) Descriptor deprecated

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

Deprecated: Use QuerySecretRequest.ProtoReflect.Descriptor instead.

func (*QuerySecretRequest) GetDomain

func (x *QuerySecretRequest) GetDomain() string

func (*QuerySecretRequest) GetKeywords

func (x *QuerySecretRequest) GetKeywords() string

func (*QuerySecretRequest) GetNamespace

func (x *QuerySecretRequest) GetNamespace() string

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)
	// 基于凭证来进行任务同步
	SyncResource(ctx context.Context, in *SyncResourceRequest, opts ...grpc.CallOption) (*SyncResourceResponse, 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)
	// 基于凭证来进行任务同步
	SyncResource(context.Context, *SyncResourceRequest) (*SyncResourceResponse, 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 {

	// 全局唯一Id
	// @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"`
	// 创建信息
	// @gotags: json:"spec"
	Spec *CreateSecretRequest `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"`
	// contains filtered or unexported fields
}

func New

func New(req *CreateSecretRequest) *Secret

func (*Secret) Descriptor deprecated

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

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) GetCreateAt

func (x *Secret) GetCreateAt() int64

func (*Secret) GetId

func (x *Secret) GetId() 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 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) Descriptor deprecated

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

Deprecated: Use SecretSet.ProtoReflect.Descriptor instead.

func (*SecretSet) Get

func (s *SecretSet) Get(secretId string) *Secret

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 {
	RPCServer
}

type SyncResourceRequest

type SyncResourceRequest struct {

	// 凭证的id列表
	// @gotags: json:"secrets"
	Secrets []string `protobuf:"bytes,1,rep,name=secrets,proto3" json:"secrets"`
	// contains filtered or unexported fields
}

func (*SyncResourceRequest) Descriptor deprecated

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

Deprecated: Use SyncResourceRequest.ProtoReflect.Descriptor instead.

func (*SyncResourceRequest) GetSecrets

func (x *SyncResourceRequest) GetSecrets() []string

func (*SyncResourceRequest) ProtoMessage

func (*SyncResourceRequest) ProtoMessage()

func (*SyncResourceRequest) ProtoReflect

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

func (*SyncResourceRequest) Reset

func (x *SyncResourceRequest) Reset()

func (*SyncResourceRequest) String

func (x *SyncResourceRequest) String() string

type SyncResourceResponse

type SyncResourceResponse struct {
	// contains filtered or unexported fields
}

func (*SyncResourceResponse) Descriptor deprecated

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

Deprecated: Use SyncResourceResponse.ProtoReflect.Descriptor instead.

func (*SyncResourceResponse) ProtoMessage

func (*SyncResourceResponse) ProtoMessage()

func (*SyncResourceResponse) ProtoReflect

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

func (*SyncResourceResponse) Reset

func (x *SyncResourceResponse) Reset()

func (*SyncResourceResponse) String

func (x *SyncResourceResponse) String() string

type TYPE

type TYPE int32

基于用户名密码的凭证 记忆API Key的凭证

const (
	TYPE_API_KEY  TYPE = 0
	TYPE_PASSWORD TYPE = 1
)

func ParseTYPEFromString

func ParseTYPEFromString(str string) (TYPE, error)

ParseTYPEFromString Parse TYPE from string

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) 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) Number

func (x TYPE) Number() protoreflect.EnumNumber

func (TYPE) String

func (x TYPE) String() string

func (TYPE) Type

func (TYPE) Type() protoreflect.EnumType

func (*TYPE) UnmarshalJSON

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

UnmarshalJSON todo

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) CreateSecret

func (UnimplementedRPCServer) QuerySecret

func (UnimplementedRPCServer) SyncResource

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