secret

package
v0.0.0-...-eccb811 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 20 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: "PASSWORD",
	}
	Type_value = map[string]int32{
		"API_KEY":  0,
		"PASSWORD": 1,
	}
)

Enum value maps for Type.

View Source
var File_apps_secret_pb_secret_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "course.cmdb.secret.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateSecret",
			Handler:    _Service_CreateSecret_Handler,
		},
		{
			MethodName: "QuerySecret",
			Handler:    _Service_QuerySecret_Handler,
		},
		{
			MethodName: "DescribeSecret",
			Handler:    _Service_DescribeSecret_Handler,
		},
		{
			MethodName: "DeleteSecret",
			Handler:    _Service_DeleteSecret_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/secret/pb/secret.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

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=course.cmdb.resource.Vendor" json:"vendor"`
	// 允许同步的区域
	// @gotags: json:"allow_regions"
	AllowRegions []string `protobuf:"bytes,3,rep,name=allow_regions,json=allowRegions,proto3" json:"allow_regions"`
	// 凭证类型
	// @gotags: json:"crendential_type"
	CrendentialType Type `` /* 126-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"`
	// secrete
	// @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"`
	// 创建者
	// @gotags: json:"create_by"
	CreateBy string `protobuf:"bytes,9,opt,name=create_by,json=createBy,proto3" json:"create_by"`
	// contains filtered or unexported fields
}

func NewCreateSecretRequest

func NewCreateSecretRequest() *CreateSecretRequest

func (*CreateSecretRequest) AllowRegionString

func (s *CreateSecretRequest) AllowRegionString() string

func (*CreateSecretRequest) DecryptAPISecret

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

func (*CreateSecretRequest) Descriptor deprecated

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

Deprecated: Use CreateSecretRequest.ProtoReflect.Descriptor instead.

func (*CreateSecretRequest) Desense

func (s *CreateSecretRequest) Desense()

敏感数据脱敏

func (*CreateSecretRequest) EncryptAPISecret

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

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

func (x *CreateSecretRequest) GetCreateBy() string

func (*CreateSecretRequest) GetCrendentialType

func (x *CreateSecretRequest) GetCrendentialType() Type

func (*CreateSecretRequest) GetDescription

func (x *CreateSecretRequest) GetDescription() string

func (*CreateSecretRequest) GetRequestRate

func (x *CreateSecretRequest) GetRequestRate() int32

func (*CreateSecretRequest) GetVendor

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

func (*CreateSecretRequest) LoadAllowRegionFromString

func (s *CreateSecretRequest) LoadAllowRegionFromString(regions 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

func (*CreateSecretRequest) Validate

func (req *CreateSecretRequest) Validate() error

type DeleteSecretRequest

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

func NewDeleteSecretRequestWithID

func NewDeleteSecretRequestWithID(id string) *DeleteSecretRequest

func (*DeleteSecretRequest) Descriptor deprecated

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

Deprecated: Use DeleteSecretRequest.ProtoReflect.Descriptor instead.

func (*DeleteSecretRequest) GetId

func (x *DeleteSecretRequest) GetId() string

func (*DeleteSecretRequest) ProtoMessage

func (*DeleteSecretRequest) ProtoMessage()

func (*DeleteSecretRequest) ProtoReflect

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

func (*DeleteSecretRequest) Reset

func (x *DeleteSecretRequest) Reset()

func (*DeleteSecretRequest) String

func (x *DeleteSecretRequest) 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 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 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 NewQuerySecretRequest

func NewQuerySecretRequest() *QuerySecretRequest

func NewQuerySecretRequestFromHTTP

func NewQuerySecretRequestFromHTTP(r *http.Request) *QuerySecretRequest

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 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:"data"
	Data *CreateSecretRequest `protobuf:"bytes,3,opt,name=data,proto3" json:"data"`
	// contains filtered or unexported fields
}

func NewDefaultSecret

func NewDefaultSecret() *Secret

func NewSecret

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

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

func (x *Secret) GetData() *CreateSecretRequest

func (*Secret) GetId

func (x *Secret) GetId() string

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 ServiceClient

type ServiceClient 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)
	DeleteSecret(ctx context.Context, in *DeleteSecretRequest, opts ...grpc.CallOption) (*Secret, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer 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)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Type

type Type int32
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 UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CreateSecret

func (UnimplementedServiceServer) DeleteSecret

func (UnimplementedServiceServer) DescribeSecret

func (UnimplementedServiceServer) QuerySecret

type UnsafeServiceServer

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

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer 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