secret

package
v0.0.0-...-b68290d Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Rpc_CreateSecret_FullMethodName = "/cmdb.secret.Rpc/CreateSecret"
	Rpc_DeleteSecret_FullMethodName = "/cmdb.secret.Rpc/DeleteSecret"
	Rpc_QuerySecret_FullMethodName  = "/cmdb.secret.Rpc/QuerySecret"
	Rpc_DescSecret_FullMethodName   = "/cmdb.secret.Rpc/DescSecret"
	Rpc_SyncResource_FullMethodName = "/cmdb.secret.Rpc/SyncResource"
)
View Source
const AppName = "secret"

Variables

View Source
var (
	Vendor_name = map[int32]string{
		0: "VENDOR_UNSPECIFIED",
		1: "VENDOR_ALI",
		2: "VENDOR_TENCENT",
	}
	Vendor_value = map[string]int32{
		"VENDOR_UNSPECIFIED": 0,
		"VENDOR_ALI":         1,
		"VENDOR_TENCENT":     2,
	}
)

Enum value maps for Vendor.

View Source
var (
	QueryType_name = map[int32]string{
		0: "QUERY_TYPE_UNSPECIFIED",
		1: "QUERY_TYPE_DESC",
	}
	QueryType_value = map[string]int32{
		"QUERY_TYPE_UNSPECIFIED": 0,
		"QUERY_TYPE_DESC":        1,
	}
)

Enum value maps for QueryType.

View Source
var File_apps_secret_pb_model_proto protoreflect.FileDescriptor
View Source
var File_apps_secret_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Rpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cmdb.secret.Rpc",
	HandlerType: (*RpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateSecret",
			Handler:    _Rpc_CreateSecret_Handler,
		},
		{
			MethodName: "DeleteSecret",
			Handler:    _Rpc_DeleteSecret_Handler,
		},
		{
			MethodName: "QuerySecret",
			Handler:    _Rpc_QuerySecret_Handler,
		},
		{
			MethodName: "DescSecret",
			Handler:    _Rpc_DescSecret_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SyncResource",
			Handler:       _Rpc_SyncResource_Handler,
			ServerStreams: true,
		},
	},
	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 DeleteSecretRequest

type DeleteSecretRequest struct {

	// @gotags: validate:"required"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

func (*DeleteSecretRequest) Descriptor deprecated

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

Deprecated: Use DeleteSecretRequest.ProtoReflect.Descriptor instead.

func (*DeleteSecretRequest) GetId

func (x *DeleteSecretRequest) GetId() int64

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 DescSecretRequest

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

func (*DescSecretRequest) Descriptor deprecated

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

Deprecated: Use DescSecretRequest.ProtoReflect.Descriptor instead.

func (*DescSecretRequest) GetId

func (x *DescSecretRequest) GetId() int64

func (*DescSecretRequest) ProtoMessage

func (*DescSecretRequest) ProtoMessage()

func (*DescSecretRequest) ProtoReflect

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

func (*DescSecretRequest) Reset

func (x *DescSecretRequest) Reset()

func (*DescSecretRequest) String

func (x *DescSecretRequest) String() string

type Meta

type Meta struct {

	// @gotags: json:"created_at" gorm:"primaryKey"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"created_at" gorm:"primaryKey"`
	// @gotags: json:"created_at" gorm:"autoCreateTime"
	CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at" gorm:"autoCreateTime"`
	// @gotags: json:"updated_at" gorm:"autoUpdateTime"
	UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at" gorm:"autoUpdateTime"`
	// contains filtered or unexported fields
}

func (*Meta) Descriptor deprecated

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

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetCreatedAt

func (x *Meta) GetCreatedAt() int64

func (*Meta) GetId

func (x *Meta) GetId() int64

func (*Meta) GetUpdatedAt

func (x *Meta) GetUpdatedAt() int64

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 QuerySecretRequest

type QuerySecretRequest struct {
	PageNum   int64     `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty"`
	PageSize  int64     `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	QueryType QueryType `protobuf:"varint,3,opt,name=query_type,json=queryType,proto3,enum=cmdb.secret.QueryType" json:"query_type,omitempty"`
	Keyword   string    `protobuf:"bytes,4,opt,name=keyword,proto3" json:"keyword,omitempty"`
	// contains filtered or unexported fields
}

func (*QuerySecretRequest) Descriptor deprecated

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

Deprecated: Use QuerySecretRequest.ProtoReflect.Descriptor instead.

func (*QuerySecretRequest) GetKeyword

func (x *QuerySecretRequest) GetKeyword() string

func (*QuerySecretRequest) GetPageNum

func (x *QuerySecretRequest) GetPageNum() int64

func (*QuerySecretRequest) GetPageSize

func (x *QuerySecretRequest) GetPageSize() int64

func (*QuerySecretRequest) GetQueryType

func (x *QuerySecretRequest) GetQueryType() QueryType

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 QueryType

type QueryType int32
const (
	QueryType_QUERY_TYPE_UNSPECIFIED QueryType = 0
	QueryType_QUERY_TYPE_DESC        QueryType = 1
)

func (QueryType) Descriptor

func (QueryType) Descriptor() protoreflect.EnumDescriptor

func (QueryType) Enum

func (x QueryType) Enum() *QueryType

func (QueryType) EnumDescriptor deprecated

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

Deprecated: Use QueryType.Descriptor instead.

func (QueryType) Number

func (x QueryType) Number() protoreflect.EnumNumber

func (QueryType) String

func (x QueryType) String() string

func (QueryType) Type

type RpcClient

type RpcClient interface {
	CreateSecret(ctx context.Context, in *Spec, opts ...grpc.CallOption) (*Secret, error)
	DeleteSecret(ctx context.Context, in *DeleteSecretRequest, opts ...grpc.CallOption) (*Secret, error)
	QuerySecret(ctx context.Context, in *QuerySecretRequest, opts ...grpc.CallOption) (*SecretSet, error)
	DescSecret(ctx context.Context, in *DescSecretRequest, opts ...grpc.CallOption) (*Secret, error)
	SyncResource(ctx context.Context, in *SyncResourceRequest, opts ...grpc.CallOption) (Rpc_SyncResourceClient, 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, *Spec) (*Secret, error)
	DeleteSecret(context.Context, *DeleteSecretRequest) (*Secret, error)
	QuerySecret(context.Context, *QuerySecretRequest) (*SecretSet, error)
	DescSecret(context.Context, *DescSecretRequest) (*Secret, error)
	SyncResource(*SyncResourceRequest, Rpc_SyncResourceServer) error
	// contains filtered or unexported methods
}

RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility

type Rpc_SyncResourceClient

type Rpc_SyncResourceClient interface {
	Recv() (*resource.Resource, error)
	grpc.ClientStream
}

type Rpc_SyncResourceServer

type Rpc_SyncResourceServer interface {
	Send(*resource.Resource) error
	grpc.ServerStream
}

type Secret

type Secret struct {

	// @gotags: gorm:"embedded"
	Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty" gorm:"embedded"`
	// @gotags: gorm:"embedded"
	Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty" gorm:"embedded"`
	// contains filtered or unexported fields
}

func (*Secret) Descriptor deprecated

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

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) GetMeta

func (x *Secret) GetMeta() *Meta

func (*Secret) GetSpec

func (x *Secret) GetSpec() *Spec

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 {
	Total int64     `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Items []*Secret `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

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 {
	RpcServer
	CreateTable(ctx context.Context) error
}

func GetSvc

func GetSvc() Service

type Spec

type Spec struct {

	// 秘钥的名称,同一个厂商中确保唯一
	// @gotags: gorm:"type:varchar(50);uniqueIndex:idx_vendor_name" validate:"required"
	Name string `` /* 133-byte string literal not displayed */
	// @gotags: validate:"required"
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty" validate:"required"`
	// 秘钥所属厂商,阿里云、腾讯云、华为云
	// @gotags: gorm:"uniqueIndex:idx_vendor_name" validate:"required"
	Vendor Vendor `` /* 145-byte string literal not displayed */
	// @gotags: validate:"required"
	AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty" validate:"required"`
	// @gotags: validate:"required"
	AccessSecret string `protobuf:"bytes,5,opt,name=access_secret,json=accessSecret,proto3" json:"access_secret,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

func (*Spec) Descriptor deprecated

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

Deprecated: Use Spec.ProtoReflect.Descriptor instead.

func (*Spec) GetAccessKey

func (x *Spec) GetAccessKey() string

func (*Spec) GetAccessSecret

func (x *Spec) GetAccessSecret() string

func (*Spec) GetDesc

func (x *Spec) GetDesc() string

func (*Spec) GetName

func (x *Spec) GetName() string

func (*Spec) GetVendor

func (x *Spec) GetVendor() Vendor

func (*Spec) ProtoMessage

func (*Spec) ProtoMessage()

func (*Spec) ProtoReflect

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

func (*Spec) Reset

func (x *Spec) Reset()

func (*Spec) String

func (x *Spec) String() string

type SyncResourceRequest

type SyncResourceRequest struct {

	// vendor 主要用来匹配对应的 provider
	// @gotags: validate:"required"
	Vendor Vendor `protobuf:"varint,1,opt,name=vendor,proto3,enum=cmdb.secret.Vendor" json:"vendor,omitempty" validate:"required"`
	// @gotags: validate:"required"
	SecretId int64 `protobuf:"varint,2,opt,name=secret_id,json=secretId,proto3" json:"secret_id,omitempty" validate:"required"`
	// @gotags: validate:"required"
	AccessEndpoint string `protobuf:"bytes,4,opt,name=access_endpoint,json=accessEndpoint,proto3" json:"access_endpoint,omitempty" validate:"required"`
	RegionId       string `protobuf:"bytes,5,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"`
	// contains filtered or unexported fields
}

使用哪个秘钥、去同步哪个区域的数据

func (*SyncResourceRequest) Descriptor deprecated

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

Deprecated: Use SyncResourceRequest.ProtoReflect.Descriptor instead.

func (*SyncResourceRequest) GetAccessEndpoint

func (x *SyncResourceRequest) GetAccessEndpoint() string

func (*SyncResourceRequest) GetRegionId

func (x *SyncResourceRequest) GetRegionId() string

func (*SyncResourceRequest) GetSecretId

func (x *SyncResourceRequest) GetSecretId() int64

func (*SyncResourceRequest) GetVendor

func (x *SyncResourceRequest) GetVendor() Vendor

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 {
	Status  bool   `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`  // 同步状态;成功、失败
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 同步执行的额外信息
	// contains filtered or unexported fields
}

func (*SyncResourceResponse) Descriptor deprecated

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

Deprecated: Use SyncResourceResponse.ProtoReflect.Descriptor instead.

func (*SyncResourceResponse) GetMessage

func (x *SyncResourceResponse) GetMessage() string

func (*SyncResourceResponse) GetStatus

func (x *SyncResourceResponse) GetStatus() bool

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 UnimplementedRpcServer

type UnimplementedRpcServer struct {
}

UnimplementedRpcServer must be embedded to have forward compatible implementations.

func (UnimplementedRpcServer) CreateSecret

func (UnimplementedRpcServer) CreateSecret(context.Context, *Spec) (*Secret, error)

func (UnimplementedRpcServer) DeleteSecret

func (UnimplementedRpcServer) DescSecret

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.

type Vendor

type Vendor int32
const (
	Vendor_VENDOR_UNSPECIFIED Vendor = 0
	Vendor_VENDOR_ALI         Vendor = 1
	Vendor_VENDOR_TENCENT     Vendor = 2
)

func (Vendor) Descriptor

func (Vendor) Descriptor() protoreflect.EnumDescriptor

func (Vendor) Enum

func (x Vendor) Enum() *Vendor

func (Vendor) EnumDescriptor deprecated

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

Deprecated: Use Vendor.Descriptor instead.

func (Vendor) Number

func (x Vendor) Number() protoreflect.EnumNumber

func (Vendor) String

func (x Vendor) String() string

func (Vendor) Type

func (Vendor) Type() protoreflect.EnumType

Directories

Path Synopsis
ali

Jump to

Keyboard shortcuts

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