http

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ConfigType  = "http"
	ServiceName = "ghost.keeper"
)

ConfigType is the type name for the HTTP secrets keeper.

Variables

View Source
var File_secrets_proto protoreflect.FileDescriptor
View Source
var Keeper_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "ghost.secrets.Keeper",
	HandlerType: (*KeeperServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetSecret",
			Handler:    _Keeper_GetSecret_Handler,
		},
		{
			MethodName: "SetSecret",
			Handler:    _Keeper_SetSecret_Handler,
		},
		{
			MethodName: "CopySecret",
			Handler:    _Keeper_CopySecret_Handler,
		},
		{
			MethodName: "MoveSecret",
			Handler:    _Keeper_MoveSecret_Handler,
		},
		{
			MethodName: "DeleteSecret",
			Handler:    _Keeper_DeleteSecret_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ListLocations",
			Handler:       _Keeper_ListLocations_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ListSecrets",
			Handler:       _Keeper_ListSecrets_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetSecretsByName",
			Handler:       _Keeper_GetSecretsByName_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "secrets.proto",
}

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

Functions

func Builder

func Builder(ctx context.Context, c any) (secrets.Keeper, error)

Builder is the builder function for the HTTP secrets keeper.

func MakeHttpServerSocketName added in v0.0.2

func MakeHttpServerSocketName() string

func RegisterKeeperServer

func RegisterKeeperServer(s grpc.ServiceRegistrar, srv KeeperServer)

Types

type ChangeLocationRequest

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

func (*ChangeLocationRequest) Descriptor deprecated

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

Deprecated: Use ChangeLocationRequest.ProtoReflect.Descriptor instead.

func (*ChangeLocationRequest) GetId

func (x *ChangeLocationRequest) GetId() string

func (*ChangeLocationRequest) GetLocation

func (x *ChangeLocationRequest) GetLocation() string

func (*ChangeLocationRequest) ProtoMessage

func (*ChangeLocationRequest) ProtoMessage()

func (*ChangeLocationRequest) ProtoReflect

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

func (*ChangeLocationRequest) Reset

func (x *ChangeLocationRequest) Reset()

func (*ChangeLocationRequest) String

func (x *ChangeLocationRequest) String() string

type Client

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

Client is a secret keeper that communicates with the secret keeper service provided in Server.

func NewClient

func NewClient(client KeeperClient) *Client

NewClient creates a new client for the secret keeper service.

func (*Client) CopySecret

func (c *Client) CopySecret(ctx context.Context, id, location string) (secrets.Secret, error)

CopySecret copies the secret with the given ID to the given location in the secret keeper service.

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(ctx context.Context, id string) error

DeleteSecret deletes the secret with the given ID from the secret keeper service.

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, id string) (secrets.Secret, error)

GetSecret retrieves the secret with the given ID from the secret keeper service.

func (*Client) GetSecretsByName

func (c *Client) GetSecretsByName(ctx context.Context, name string) ([]secrets.Secret, error)

GetSecretsByName retrieves the list of secrets with the given name from the secret keeper service.

func (*Client) ListLocations

func (c *Client) ListLocations(ctx context.Context) ([]string, error)

ListLocations retrieves the list of locations from the secret keeper service.

func (*Client) ListSecrets

func (c *Client) ListSecrets(ctx context.Context, location string) ([]string, error)

ListSecrets retrieves the list of secrets from the secret keeper service.

func (*Client) MoveSecret

func (c *Client) MoveSecret(ctx context.Context, id, location string) (secrets.Secret, error)

MoveSecret moves the secret with the given ID to the given location in the secret keeper service.

func (*Client) SetSecret

func (c *Client) SetSecret(ctx context.Context, secret secrets.Secret) (secrets.Secret, error)

SetSecret stores the given secret in the secret keeper service.

type Config

type Config struct{}

Config is the configuration of the HTTP secrets keeper.

type DeleteSecretRequest

type DeleteSecretRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// 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() 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 GetSecretRequest

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

func (*GetSecretRequest) Descriptor deprecated

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

Deprecated: Use GetSecretRequest.ProtoReflect.Descriptor instead.

func (*GetSecretRequest) GetId

func (x *GetSecretRequest) GetId() string

func (*GetSecretRequest) ProtoMessage

func (*GetSecretRequest) ProtoMessage()

func (*GetSecretRequest) ProtoReflect

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

func (*GetSecretRequest) Reset

func (x *GetSecretRequest) Reset()

func (*GetSecretRequest) String

func (x *GetSecretRequest) String() string

type GetSecretsByNameRequest

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

func (*GetSecretsByNameRequest) Descriptor deprecated

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

Deprecated: Use GetSecretsByNameRequest.ProtoReflect.Descriptor instead.

func (*GetSecretsByNameRequest) GetName

func (x *GetSecretsByNameRequest) GetName() string

func (*GetSecretsByNameRequest) ProtoMessage

func (*GetSecretsByNameRequest) ProtoMessage()

func (*GetSecretsByNameRequest) ProtoReflect

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

func (*GetSecretsByNameRequest) Reset

func (x *GetSecretsByNameRequest) Reset()

func (*GetSecretsByNameRequest) String

func (x *GetSecretsByNameRequest) String() string

type KeeperClient

type KeeperClient interface {
	ListLocations(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (Keeper_ListLocationsClient, error)
	ListSecrets(ctx context.Context, in *Location, opts ...grpc.CallOption) (Keeper_ListSecretsClient, error)
	GetSecretsByName(ctx context.Context, in *GetSecretsByNameRequest, opts ...grpc.CallOption) (Keeper_GetSecretsByNameClient, error)
	GetSecret(ctx context.Context, in *GetSecretRequest, opts ...grpc.CallOption) (*Secret, error)
	SetSecret(ctx context.Context, in *Secret, opts ...grpc.CallOption) (*Secret, error)
	CopySecret(ctx context.Context, in *ChangeLocationRequest, opts ...grpc.CallOption) (*Secret, error)
	MoveSecret(ctx context.Context, in *ChangeLocationRequest, opts ...grpc.CallOption) (*Secret, error)
	DeleteSecret(ctx context.Context, in *DeleteSecretRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

KeeperClient is the client API for Keeper 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 NewKeeperClient

func NewKeeperClient(cc grpc.ClientConnInterface) KeeperClient

type KeeperServer

type KeeperServer interface {
	ListLocations(*empty.Empty, Keeper_ListLocationsServer) error
	ListSecrets(*Location, Keeper_ListSecretsServer) error
	GetSecretsByName(*GetSecretsByNameRequest, Keeper_GetSecretsByNameServer) error
	GetSecret(context.Context, *GetSecretRequest) (*Secret, error)
	SetSecret(context.Context, *Secret) (*Secret, error)
	CopySecret(context.Context, *ChangeLocationRequest) (*Secret, error)
	MoveSecret(context.Context, *ChangeLocationRequest) (*Secret, error)
	DeleteSecret(context.Context, *DeleteSecretRequest) (*empty.Empty, error)
	// contains filtered or unexported methods
}

KeeperServer is the server API for Keeper service. All implementations must embed UnimplementedKeeperServer for forward compatibility

type Keeper_GetSecretsByNameClient

type Keeper_GetSecretsByNameClient interface {
	Recv() (*Secret, error)
	grpc.ClientStream
}

type Keeper_GetSecretsByNameServer

type Keeper_GetSecretsByNameServer interface {
	Send(*Secret) error
	grpc.ServerStream
}

type Keeper_ListLocationsClient

type Keeper_ListLocationsClient interface {
	Recv() (*Location, error)
	grpc.ClientStream
}

type Keeper_ListLocationsServer

type Keeper_ListLocationsServer interface {
	Send(*Location) error
	grpc.ServerStream
}

type Keeper_ListSecretsClient

type Keeper_ListSecretsClient interface {
	Recv() (*Secret, error)
	grpc.ClientStream
}

type Keeper_ListSecretsServer

type Keeper_ListSecretsServer interface {
	Send(*Secret) error
	grpc.ServerStream
}

type Location

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

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetLocation

func (x *Location) GetLocation() string

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

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

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type Secret

type Secret struct {
	Id           string               `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name         string               `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Username     string               `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
	Password     string               `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	Type         string               `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
	Fields       map[string]string    `` /* 153-byte string literal not displayed */
	LastModified *timestamp.Timestamp `protobuf:"bytes,7,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"`
	Url          string               `protobuf:"bytes,8,opt,name=url,proto3" json:"url,omitempty"`
	Location     string               `protobuf:"bytes,9,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

func FromSecret

func FromSecret(s secrets.Secret) *Secret

FromSecret creates a new protobuf Secret message from the given secret.

func (*Secret) Descriptor deprecated

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

Deprecated: Use Secret.ProtoReflect.Descriptor instead.

func (*Secret) GetFields

func (x *Secret) GetFields() map[string]string

func (*Secret) GetId

func (x *Secret) GetId() string

func (*Secret) GetLastModified

func (x *Secret) GetLastModified() *timestamp.Timestamp

func (*Secret) GetLocation

func (x *Secret) GetLocation() string

func (*Secret) GetName

func (x *Secret) GetName() string

func (*Secret) GetPassword

func (x *Secret) GetPassword() string

func (*Secret) GetType

func (x *Secret) GetType() string

func (*Secret) GetUrl

func (x *Secret) GetUrl() string

func (*Secret) GetUsername

func (x *Secret) GetUsername() 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 SecretWrapper

type SecretWrapper struct {
	*Secret
}

SecretWrapper is a helper that maps the secrets.Secret interface to the protobuf Secret message.

func NewSecretWrapper

func NewSecretWrapper(s *Secret) *SecretWrapper

NewSecretWrapper creates a new secret wrapper for the given protobuf Secret message.

func (*SecretWrapper) DeleteField

func (s *SecretWrapper) DeleteField(name string)

DeleteField deletes the field with the given name.

func (*SecretWrapper) Fields

func (s *SecretWrapper) Fields() map[string]string

Fields returns the fields of the secret.

func (*SecretWrapper) GetField

func (s *SecretWrapper) GetField(name string) string

GetField returns the value of the field with the given name.

func (*SecretWrapper) ID

func (s *SecretWrapper) ID() string

ID returns the ID of the secret.

func (*SecretWrapper) LastModified

func (s *SecretWrapper) LastModified() time.Time

LastModified returns the last modified date of the secret.

func (*SecretWrapper) Location

func (s *SecretWrapper) Location() string

Location returns the location of the secret.

func (*SecretWrapper) Name

func (s *SecretWrapper) Name() string

Name returns the name of the secret.

func (*SecretWrapper) Password

func (s *SecretWrapper) Password() string

Password returns the password of the secret.

func (*SecretWrapper) SetField

func (s *SecretWrapper) SetField(name, value string)

SetField sets the value of the field with the given name.

func (*SecretWrapper) SetFields

func (s *SecretWrapper) SetFields(flds map[string]string)

SetFields sets the fields of the secret.

func (*SecretWrapper) SetName

func (s *SecretWrapper) SetName(name string)

SetName sets the name of the secret.

func (*SecretWrapper) SetPassword

func (s *SecretWrapper) SetPassword(password string)

SetPassword sets the password of the secret.

func (*SecretWrapper) SetType

func (s *SecretWrapper) SetType(typ string)

SetType sets the type of the secret.

func (*SecretWrapper) SetUrl

func (s *SecretWrapper) SetUrl(url *url.URL)

SetUrl sets the URL of the secret.

func (*SecretWrapper) SetUsername

func (s *SecretWrapper) SetUsername(username string)

SetUsername sets the username of the secret.

func (*SecretWrapper) Type

func (s *SecretWrapper) Type() string

Type returns the type of the secret.

func (*SecretWrapper) Url

func (s *SecretWrapper) Url() *url.URL

Url returns the URL of the secret.

func (*SecretWrapper) Username

func (s *SecretWrapper) Username() string

Username returns the username of the secret.

type Server

type Server struct {
	UnimplementedKeeperServer
	secrets.Keeper
}

Server gives a secret keeper a gRPC server interface.

func NewServer

func NewServer(keeper secrets.Keeper) *Server

NewServer creates a new gRPC server for the wrapped secret keeper.

func (*Server) CopySecret

func (s *Server) CopySecret(
	ctx context.Context,
	req *ChangeLocationRequest,
) (*Secret, error)

CopySecret maps the CopySecret secret keeper call to the gRPC interface.

func (*Server) DeleteSecret

func (s *Server) DeleteSecret(
	ctx context.Context,
	req *DeleteSecretRequest,
) (*empty.Empty, error)

DeleteSecret maps the DeleteSecret secret keeper call to the gRPC interface.

func (*Server) GetSecret

func (s *Server) GetSecret(
	ctx context.Context,
	req *GetSecretRequest,
) (*Secret, error)

GetSecret maps the GetSecret secret keeper call to the gRPC interface.

func (*Server) GetSecretsByName

func (s *Server) GetSecretsByName(
	req *GetSecretsByNameRequest,
	stream Keeper_GetSecretsByNameServer,
) error

GetSecretsByName maps the GetSecretsByName secret keeper call to the gRPC interface.

func (*Server) ListLocations

func (s *Server) ListLocations(
	_ *empty.Empty,
	stream Keeper_ListLocationsServer,
) error

ListLocations maps the ListLocations secret keeper call to the gRPC interface.

func (*Server) ListSecrets

func (s *Server) ListSecrets(
	location *Location,
	stream Keeper_ListSecretsServer,
) error

ListSecrets maps the ListSecrets secret keeper call to the gRPC interface.

func (*Server) MoveSecret

func (s *Server) MoveSecret(
	ctx context.Context,
	req *ChangeLocationRequest,
) (*Secret, error)

MoveSecret maps the MoveSecret secret keeper call to the gRPC interface.

func (*Server) SetSecret

func (s *Server) SetSecret(
	ctx context.Context,
	rpcSec *Secret,
) (*Secret, error)

SetSecret maps the SetSecret secret keeper call to the gRPC interface.

type UnimplementedKeeperServer

type UnimplementedKeeperServer struct {
}

UnimplementedKeeperServer must be embedded to have forward compatible implementations.

func (UnimplementedKeeperServer) CopySecret

func (UnimplementedKeeperServer) DeleteSecret

func (UnimplementedKeeperServer) GetSecret

func (UnimplementedKeeperServer) GetSecretsByName

func (UnimplementedKeeperServer) ListLocations

func (UnimplementedKeeperServer) ListSecrets

func (UnimplementedKeeperServer) MoveSecret

func (UnimplementedKeeperServer) SetSecret

type UnsafeKeeperServer

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

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

Jump to

Keyboard shortcuts

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