discovery

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 31 Imported by: 2

Documentation

Overview

Package discovery is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const DefaultCloudServiceID = "00000000-0000-0000-0000-000000000000"

DefaultCloudServiceID is the default service ID. Currently, our discoverers have no way to differentiate between different services, but we need this feature in the future. This serves as a default to already prepare the necessary structures for this feature.

Variables

View Source
var Discovery_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clouditor.discovery.v1.Discovery",
	HandlerType: (*DiscoveryServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Start",
			Handler:    _Discovery_Start_Handler,
		},
		{
			MethodName: "Query",
			Handler:    _Discovery_Query_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/discovery/discovery.proto",
}

Discovery_ServiceDesc is the grpc.ServiceDesc for Discovery 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_api_discovery_discovery_proto protoreflect.FileDescriptor

Functions

func NewResource added in v1.6.2

func NewResource(d Discoverer, ID voc.ResourceID, name string, creationTime *time.Time, location voc.GeoLocation, labels map[string]string, typ []string) *voc.Resource

NewResource creates a new resource.

func RegisterDiscoveryHandler added in v1.3.1

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

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

func RegisterDiscoveryHandlerClient added in v1.3.1

func RegisterDiscoveryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DiscoveryClient) error

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

func RegisterDiscoveryHandlerFromEndpoint added in v1.3.1

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

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

func RegisterDiscoveryHandlerServer added in v1.3.1

func RegisterDiscoveryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DiscoveryServer) error

RegisterDiscoveryHandlerServer registers the http handlers for service Discovery to "mux". UnaryRPC :call DiscoveryServer 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 RegisterDiscoveryHandlerFromEndpoint instead.

func RegisterDiscoveryServer

func RegisterDiscoveryServer(s grpc.ServiceRegistrar, srv DiscoveryServer)

Types

type Authorizer added in v1.3.3

type Authorizer interface {
	Authorize() (err error)
}

Authorizer authorizes a Cloud service

type Discoverer added in v1.3.2

type Discoverer interface {
	Name() string
	List() ([]voc.IsCloudResource, error)
	CloudServiceID() string
}

Discoverer is a part of the discovery service that takes care of the actual discovering and translation into vocabulary objects.

type DiscoveryClient

type DiscoveryClient interface {
	// Starts discovering the cloud resources, exposed as REST.
	Start(ctx context.Context, in *StartDiscoveryRequest, opts ...grpc.CallOption) (*StartDiscoveryResponse, error)
	// Lists all evidences collected in the last run, exposed as REST.
	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
}

DiscoveryClient is the client API for Discovery service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDiscoveryClient

func NewDiscoveryClient(cc grpc.ClientConnInterface) DiscoveryClient

type DiscoveryServer

type DiscoveryServer interface {
	// Starts discovering the cloud resources, exposed as REST.
	Start(context.Context, *StartDiscoveryRequest) (*StartDiscoveryResponse, error)
	// Lists all evidences collected in the last run, exposed as REST.
	Query(context.Context, *QueryRequest) (*QueryResponse, error)
	// contains filtered or unexported methods
}

DiscoveryServer is the server API for Discovery service. All implementations must embed UnimplementedDiscoveryServer for forward compatibility

type QueryRequest added in v1.3.5

type QueryRequest struct {
	FilteredType           *string `protobuf:"bytes,1,opt,name=filtered_type,json=filteredType,proto3,oneof" json:"filtered_type,omitempty"`
	FilteredCloudServiceId *string `` /* 137-byte string literal not displayed */
	PageSize               int32   `protobuf:"varint,10,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	PageToken              string  `protobuf:"bytes,11,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	OrderBy                string  `protobuf:"bytes,12,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	Asc                    bool    `protobuf:"varint,13,opt,name=asc,proto3" json:"asc,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRequest) Descriptor deprecated added in v1.3.5

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

Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.

func (*QueryRequest) GetAsc added in v1.4.17

func (x *QueryRequest) GetAsc() bool

func (*QueryRequest) GetFilteredCloudServiceId added in v1.6.0

func (x *QueryRequest) GetFilteredCloudServiceId() string

func (*QueryRequest) GetFilteredType added in v1.3.5

func (x *QueryRequest) GetFilteredType() string

func (*QueryRequest) GetOrderBy added in v1.4.17

func (x *QueryRequest) GetOrderBy() string

func (*QueryRequest) GetPageSize added in v1.4.6

func (x *QueryRequest) GetPageSize() int32

func (*QueryRequest) GetPageToken added in v1.4.6

func (x *QueryRequest) GetPageToken() string

func (*QueryRequest) ProtoMessage added in v1.3.5

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) ProtoReflect added in v1.3.5

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

func (*QueryRequest) Reset added in v1.3.5

func (x *QueryRequest) Reset()

func (*QueryRequest) String added in v1.3.5

func (x *QueryRequest) String() string

func (*QueryRequest) Validate added in v1.7.0

func (m *QueryRequest) Validate() error

Validate checks the field values on QueryRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*QueryRequest) ValidateAll added in v1.7.0

func (m *QueryRequest) ValidateAll() error

ValidateAll checks the field values on QueryRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in QueryRequestMultiError, or nil if none found.

type QueryRequestMultiError added in v1.7.0

type QueryRequestMultiError []error

QueryRequestMultiError is an error wrapping multiple validation errors returned by QueryRequest.ValidateAll() if the designated constraints aren't met.

func (QueryRequestMultiError) AllErrors added in v1.7.0

func (m QueryRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (QueryRequestMultiError) Error added in v1.7.0

func (m QueryRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type QueryRequestValidationError added in v1.7.0

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

QueryRequestValidationError is the validation error returned by QueryRequest.Validate if the designated constraints aren't met.

func (QueryRequestValidationError) Cause added in v1.7.0

Cause function returns cause value.

func (QueryRequestValidationError) Error added in v1.7.0

Error satisfies the builtin error interface

func (QueryRequestValidationError) ErrorName added in v1.7.0

func (e QueryRequestValidationError) ErrorName() string

ErrorName returns error name.

func (QueryRequestValidationError) Field added in v1.7.0

Field function returns field value.

func (QueryRequestValidationError) Key added in v1.7.0

Key function returns key value.

func (QueryRequestValidationError) Reason added in v1.7.0

Reason function returns reason value.

type QueryResponse added in v1.3.2

type QueryResponse struct {
	Results       []*structpb.Value `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	NextPageToken string            `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryResponse) Descriptor deprecated added in v1.3.2

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

Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.

func (*QueryResponse) GetNextPageToken added in v1.4.6

func (x *QueryResponse) GetNextPageToken() string

func (*QueryResponse) GetResults added in v1.3.7

func (x *QueryResponse) GetResults() []*structpb.Value

func (*QueryResponse) ProtoMessage added in v1.3.2

func (*QueryResponse) ProtoMessage()

func (*QueryResponse) ProtoReflect added in v1.3.2

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

func (*QueryResponse) Reset added in v1.3.2

func (x *QueryResponse) Reset()

func (*QueryResponse) String added in v1.3.2

func (x *QueryResponse) String() string

func (*QueryResponse) Validate added in v1.7.0

func (m *QueryResponse) Validate() error

Validate checks the field values on QueryResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*QueryResponse) ValidateAll added in v1.7.0

func (m *QueryResponse) ValidateAll() error

ValidateAll checks the field values on QueryResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in QueryResponseMultiError, or nil if none found.

type QueryResponseMultiError added in v1.7.0

type QueryResponseMultiError []error

QueryResponseMultiError is an error wrapping multiple validation errors returned by QueryResponse.ValidateAll() if the designated constraints aren't met.

func (QueryResponseMultiError) AllErrors added in v1.7.0

func (m QueryResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (QueryResponseMultiError) Error added in v1.7.0

func (m QueryResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type QueryResponseValidationError added in v1.7.0

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

QueryResponseValidationError is the validation error returned by QueryResponse.Validate if the designated constraints aren't met.

func (QueryResponseValidationError) Cause added in v1.7.0

Cause function returns cause value.

func (QueryResponseValidationError) Error added in v1.7.0

Error satisfies the builtin error interface

func (QueryResponseValidationError) ErrorName added in v1.7.0

func (e QueryResponseValidationError) ErrorName() string

ErrorName returns error name.

func (QueryResponseValidationError) Field added in v1.7.0

Field function returns field value.

func (QueryResponseValidationError) Key added in v1.7.0

Key function returns key value.

func (QueryResponseValidationError) Reason added in v1.7.0

Reason function returns reason value.

type StartDiscoveryRequest

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

func (*StartDiscoveryRequest) Descriptor deprecated

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

Deprecated: Use StartDiscoveryRequest.ProtoReflect.Descriptor instead.

func (*StartDiscoveryRequest) ProtoMessage

func (*StartDiscoveryRequest) ProtoMessage()

func (*StartDiscoveryRequest) ProtoReflect

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

func (*StartDiscoveryRequest) Reset

func (x *StartDiscoveryRequest) Reset()

func (*StartDiscoveryRequest) String

func (x *StartDiscoveryRequest) String() string

func (*StartDiscoveryRequest) Validate added in v1.7.0

func (m *StartDiscoveryRequest) Validate() error

Validate checks the field values on StartDiscoveryRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*StartDiscoveryRequest) ValidateAll added in v1.7.0

func (m *StartDiscoveryRequest) ValidateAll() error

ValidateAll checks the field values on StartDiscoveryRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StartDiscoveryRequestMultiError, or nil if none found.

type StartDiscoveryRequestMultiError added in v1.7.0

type StartDiscoveryRequestMultiError []error

StartDiscoveryRequestMultiError is an error wrapping multiple validation errors returned by StartDiscoveryRequest.ValidateAll() if the designated constraints aren't met.

func (StartDiscoveryRequestMultiError) AllErrors added in v1.7.0

func (m StartDiscoveryRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (StartDiscoveryRequestMultiError) Error added in v1.7.0

Error returns a concatenation of all the error messages it wraps.

type StartDiscoveryRequestValidationError added in v1.7.0

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

StartDiscoveryRequestValidationError is the validation error returned by StartDiscoveryRequest.Validate if the designated constraints aren't met.

func (StartDiscoveryRequestValidationError) Cause added in v1.7.0

Cause function returns cause value.

func (StartDiscoveryRequestValidationError) Error added in v1.7.0

Error satisfies the builtin error interface

func (StartDiscoveryRequestValidationError) ErrorName added in v1.7.0

ErrorName returns error name.

func (StartDiscoveryRequestValidationError) Field added in v1.7.0

Field function returns field value.

func (StartDiscoveryRequestValidationError) Key added in v1.7.0

Key function returns key value.

func (StartDiscoveryRequestValidationError) Reason added in v1.7.0

Reason function returns reason value.

type StartDiscoveryResponse

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

func (*StartDiscoveryResponse) Descriptor deprecated

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

Deprecated: Use StartDiscoveryResponse.ProtoReflect.Descriptor instead.

func (*StartDiscoveryResponse) GetSuccessful

func (x *StartDiscoveryResponse) GetSuccessful() bool

func (*StartDiscoveryResponse) ProtoMessage

func (*StartDiscoveryResponse) ProtoMessage()

func (*StartDiscoveryResponse) ProtoReflect

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

func (*StartDiscoveryResponse) Reset

func (x *StartDiscoveryResponse) Reset()

func (*StartDiscoveryResponse) String

func (x *StartDiscoveryResponse) String() string

func (*StartDiscoveryResponse) Validate added in v1.7.0

func (m *StartDiscoveryResponse) Validate() error

Validate checks the field values on StartDiscoveryResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*StartDiscoveryResponse) ValidateAll added in v1.7.0

func (m *StartDiscoveryResponse) ValidateAll() error

ValidateAll checks the field values on StartDiscoveryResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StartDiscoveryResponseMultiError, or nil if none found.

type StartDiscoveryResponseMultiError added in v1.7.0

type StartDiscoveryResponseMultiError []error

StartDiscoveryResponseMultiError is an error wrapping multiple validation errors returned by StartDiscoveryResponse.ValidateAll() if the designated constraints aren't met.

func (StartDiscoveryResponseMultiError) AllErrors added in v1.7.0

func (m StartDiscoveryResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (StartDiscoveryResponseMultiError) Error added in v1.7.0

Error returns a concatenation of all the error messages it wraps.

type StartDiscoveryResponseValidationError added in v1.7.0

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

StartDiscoveryResponseValidationError is the validation error returned by StartDiscoveryResponse.Validate if the designated constraints aren't met.

func (StartDiscoveryResponseValidationError) Cause added in v1.7.0

Cause function returns cause value.

func (StartDiscoveryResponseValidationError) Error added in v1.7.0

Error satisfies the builtin error interface

func (StartDiscoveryResponseValidationError) ErrorName added in v1.7.0

ErrorName returns error name.

func (StartDiscoveryResponseValidationError) Field added in v1.7.0

Field function returns field value.

func (StartDiscoveryResponseValidationError) Key added in v1.7.0

Key function returns key value.

func (StartDiscoveryResponseValidationError) Reason added in v1.7.0

Reason function returns reason value.

type UnimplementedDiscoveryServer

type UnimplementedDiscoveryServer struct {
}

UnimplementedDiscoveryServer must be embedded to have forward compatible implementations.

func (UnimplementedDiscoveryServer) Query added in v1.3.2

func (UnimplementedDiscoveryServer) Start

type UnsafeDiscoveryServer

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

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

Jump to

Keyboard shortcuts

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