evidence

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package evidence is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotValidResource       = errors.New("resource in evidence is missing")
	ErrResourceNotStruct      = errors.New("resource in evidence is not struct value")
	ErrResourceNotMap         = errors.New("resource in evidence is not a map")
	ErrResourceIdMissing      = errors.New("resource in evidence is missing the id field")
	ErrResourceIdNotString    = errors.New("resource id in evidence is not a string")
	ErrToolIdMissing          = errors.New("tool id in evidence is missing")
	ErrTimestampMissing       = errors.New("timestamp in evidence is missing")
	ErrResourceIdFieldMissing = errors.New("field id is missing")
)
View Source
var EvidenceStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clouditor.EvidenceStore",
	HandlerType: (*EvidenceStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "StoreEvidence",
			Handler:    _EvidenceStore_StoreEvidence_Handler,
		},
		{
			MethodName: "ListEvidences",
			Handler:    _EvidenceStore_ListEvidences_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StoreEvidences",
			Handler:       _EvidenceStore_StoreEvidences_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "evidence_store.proto",
}

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

View Source
var File_evidence_proto protoreflect.FileDescriptor
View Source
var File_evidence_store_proto protoreflect.FileDescriptor

Functions

func RegisterEvidenceStoreHandler added in v1.3.11

func RegisterEvidenceStoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterEvidenceStoreHandler registers the http handlers for service EvidenceStore to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterEvidenceStoreHandlerClient added in v1.3.11

func RegisterEvidenceStoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EvidenceStoreClient) error

RegisterEvidenceStoreHandlerClient registers the http handlers for service EvidenceStore to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EvidenceStoreClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EvidenceStoreClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EvidenceStoreClient" to call the correct interceptors.

func RegisterEvidenceStoreHandlerFromEndpoint added in v1.3.11

func RegisterEvidenceStoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterEvidenceStoreHandlerFromEndpoint is same as RegisterEvidenceStoreHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterEvidenceStoreHandlerServer added in v1.3.11

func RegisterEvidenceStoreHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EvidenceStoreServer) error

RegisterEvidenceStoreHandlerServer registers the http handlers for service EvidenceStore to "mux". UnaryRPC :call EvidenceStoreServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEvidenceStoreHandlerFromEndpoint instead.

func RegisterEvidenceStoreServer

func RegisterEvidenceStoreServer(s grpc.ServiceRegistrar, srv EvidenceStoreServer)

Types

type Evidence

type Evidence struct {

	// the ID in a uuid format
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// time of evidence creation
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Reference to a service this evidence was gathered from
	ServiceId string `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	// Reference to the tool which provided the evidence
	ToolId string `protobuf:"bytes,4,opt,name=tool_id,json=toolId,proto3" json:"tool_id,omitempty"`
	// Contains the evidence in its original form without following a defined
	// schema, e.g. the raw JSON
	Raw string `protobuf:"bytes,5,opt,name=raw,proto3" json:"raw,omitempty"`
	// Semantic representation of the Cloud resource according to our defined
	// ontology
	Resource *structpb.Value `protobuf:"bytes,6,opt,name=resource,proto3" json:"resource,omitempty"`
	// contains filtered or unexported fields
}

An evidence resource

func (*Evidence) Descriptor deprecated

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

Deprecated: Use Evidence.ProtoReflect.Descriptor instead.

func (*Evidence) GetId

func (x *Evidence) GetId() string

func (*Evidence) GetRaw

func (x *Evidence) GetRaw() string

func (*Evidence) GetResource

func (x *Evidence) GetResource() *structpb.Value

func (*Evidence) GetServiceId

func (x *Evidence) GetServiceId() string

func (*Evidence) GetTimestamp

func (x *Evidence) GetTimestamp() *timestamppb.Timestamp

func (*Evidence) GetToolId added in v1.3.9

func (x *Evidence) GetToolId() string

func (*Evidence) ProtoMessage

func (*Evidence) ProtoMessage()

func (*Evidence) ProtoReflect

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

func (*Evidence) Reset

func (x *Evidence) Reset()

func (*Evidence) String

func (x *Evidence) String() string

func (*Evidence) Validate added in v1.3.9

func (evidence *Evidence) Validate() (resourceId string, err error)

Validate validates the evidence according to several required fields

type EvidenceHookFunc added in v1.3.11

type EvidenceHookFunc func(result *Evidence, err error)

type EvidenceStoreClient

type EvidenceStoreClient interface {
	// Stores an evidence to the evidence storage. Part of the public API, also exposed as REST.
	StoreEvidence(ctx context.Context, in *StoreEvidenceRequest, opts ...grpc.CallOption) (*StoreEvidenceResponse, error)
	// Stores a stream of evidences to the evidence storage. Part of the public API, not exposed as REST.
	StoreEvidences(ctx context.Context, opts ...grpc.CallOption) (EvidenceStore_StoreEvidencesClient, error)
	// Returns all stored evidences. Part of the public API, also exposed as REST.
	ListEvidences(ctx context.Context, in *ListEvidencesRequest, opts ...grpc.CallOption) (*ListEvidencesResponse, error)
}

EvidenceStoreClient is the client API for EvidenceStore 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.

type EvidenceStoreServer

type EvidenceStoreServer interface {
	// Stores an evidence to the evidence storage. Part of the public API, also exposed as REST.
	StoreEvidence(context.Context, *StoreEvidenceRequest) (*StoreEvidenceResponse, error)
	// Stores a stream of evidences to the evidence storage. Part of the public API, not exposed as REST.
	StoreEvidences(EvidenceStore_StoreEvidencesServer) error
	// Returns all stored evidences. Part of the public API, also exposed as REST.
	ListEvidences(context.Context, *ListEvidencesRequest) (*ListEvidencesResponse, error)
	// contains filtered or unexported methods
}

EvidenceStoreServer is the server API for EvidenceStore service. All implementations must embed UnimplementedEvidenceStoreServer for forward compatibility

type EvidenceStore_StoreEvidencesClient

type EvidenceStore_StoreEvidencesClient interface {
	Send(*StoreEvidenceRequest) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type EvidenceStore_StoreEvidencesServer

type EvidenceStore_StoreEvidencesServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*StoreEvidenceRequest, error)
	grpc.ServerStream
}

type ListEvidencesRequest

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

func (*ListEvidencesRequest) Descriptor deprecated

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

Deprecated: Use ListEvidencesRequest.ProtoReflect.Descriptor instead.

func (*ListEvidencesRequest) ProtoMessage

func (*ListEvidencesRequest) ProtoMessage()

func (*ListEvidencesRequest) ProtoReflect

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

func (*ListEvidencesRequest) Reset

func (x *ListEvidencesRequest) Reset()

func (*ListEvidencesRequest) String

func (x *ListEvidencesRequest) String() string

type ListEvidencesResponse

type ListEvidencesResponse struct {
	Evidences []*Evidence `protobuf:"bytes,1,rep,name=evidences,proto3" json:"evidences,omitempty"`
	// contains filtered or unexported fields
}

func (*ListEvidencesResponse) Descriptor deprecated

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

Deprecated: Use ListEvidencesResponse.ProtoReflect.Descriptor instead.

func (*ListEvidencesResponse) GetEvidences

func (x *ListEvidencesResponse) GetEvidences() []*Evidence

func (*ListEvidencesResponse) ProtoMessage

func (*ListEvidencesResponse) ProtoMessage()

func (*ListEvidencesResponse) ProtoReflect

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

func (*ListEvidencesResponse) Reset

func (x *ListEvidencesResponse) Reset()

func (*ListEvidencesResponse) String

func (x *ListEvidencesResponse) String() string

type StoreEvidenceRequest added in v1.3.11

type StoreEvidenceRequest struct {
	Evidence *Evidence `protobuf:"bytes,1,opt,name=evidence,proto3" json:"evidence,omitempty"`
	// contains filtered or unexported fields
}

func (*StoreEvidenceRequest) Descriptor deprecated added in v1.3.11

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

Deprecated: Use StoreEvidenceRequest.ProtoReflect.Descriptor instead.

func (*StoreEvidenceRequest) GetEvidence added in v1.3.11

func (x *StoreEvidenceRequest) GetEvidence() *Evidence

func (*StoreEvidenceRequest) ProtoMessage added in v1.3.11

func (*StoreEvidenceRequest) ProtoMessage()

func (*StoreEvidenceRequest) ProtoReflect added in v1.3.11

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

func (*StoreEvidenceRequest) Reset added in v1.3.11

func (x *StoreEvidenceRequest) Reset()

func (*StoreEvidenceRequest) String added in v1.3.11

func (x *StoreEvidenceRequest) String() string

type StoreEvidenceResponse

type StoreEvidenceResponse struct {
	Status bool `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*StoreEvidenceResponse) Descriptor deprecated

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

Deprecated: Use StoreEvidenceResponse.ProtoReflect.Descriptor instead.

func (*StoreEvidenceResponse) GetStatus

func (x *StoreEvidenceResponse) GetStatus() bool

func (*StoreEvidenceResponse) ProtoMessage

func (*StoreEvidenceResponse) ProtoMessage()

func (*StoreEvidenceResponse) ProtoReflect

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

func (*StoreEvidenceResponse) Reset

func (x *StoreEvidenceResponse) Reset()

func (*StoreEvidenceResponse) String

func (x *StoreEvidenceResponse) String() string

type UnimplementedEvidenceStoreServer

type UnimplementedEvidenceStoreServer struct {
}

UnimplementedEvidenceStoreServer must be embedded to have forward compatible implementations.

func (UnimplementedEvidenceStoreServer) ListEvidences

func (UnimplementedEvidenceStoreServer) StoreEvidence

func (UnimplementedEvidenceStoreServer) StoreEvidences

type UnsafeEvidenceStoreServer

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

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

Jump to

Keyboard shortcuts

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