grpc_lookup_v1

package
v0.0.0-...-7b1f18c Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_grpc_lookup_v1_rls_config_proto protoreflect.FileDescriptor
View Source
var File_grpc_lookup_v1_rls_proto protoreflect.FileDescriptor
View Source
var RouteLookupService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.lookup.v1.RouteLookupService",
	HandlerType: (*RouteLookupServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RouteLookup",
			Handler:    _RouteLookupService_RouteLookup_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc/lookup/v1/rls.proto",
}

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

Functions

func RegisterRouteLookupServiceServer

func RegisterRouteLookupServiceServer(s grpc.ServiceRegistrar, srv RouteLookupServiceServer)

Types

type GrpcKeyBuilder

type GrpcKeyBuilder struct {
	Names []*GrpcKeyBuilder_Name `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"`
	// Extract keys from all listed headers.
	// For gRPC, it is an error to specify "required_match" on the NameMatcher
	// protos.
	Headers []*NameMatcher `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"`
	// contains filtered or unexported fields
}

A GrpcKeyBuilder applies to a given gRPC service, name, and headers.

func (*GrpcKeyBuilder) Descriptor deprecated

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

Deprecated: Use GrpcKeyBuilder.ProtoReflect.Descriptor instead.

func (*GrpcKeyBuilder) GetHeaders

func (x *GrpcKeyBuilder) GetHeaders() []*NameMatcher

func (*GrpcKeyBuilder) GetNames

func (x *GrpcKeyBuilder) GetNames() []*GrpcKeyBuilder_Name

func (*GrpcKeyBuilder) ProtoMessage

func (*GrpcKeyBuilder) ProtoMessage()

func (*GrpcKeyBuilder) ProtoReflect

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

func (*GrpcKeyBuilder) Reset

func (x *GrpcKeyBuilder) Reset()

func (*GrpcKeyBuilder) String

func (x *GrpcKeyBuilder) String() string

type GrpcKeyBuilder_Name

type GrpcKeyBuilder_Name struct {
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	Method  string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
	// contains filtered or unexported fields
}

To match, one of the given Name fields must match; the service and method fields are specified as fixed strings. The service name is required and includes the proto package name. The method name may be omitted, in which case any method on the given service is matched.

func (*GrpcKeyBuilder_Name) Descriptor deprecated

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

Deprecated: Use GrpcKeyBuilder_Name.ProtoReflect.Descriptor instead.

func (*GrpcKeyBuilder_Name) GetMethod

func (x *GrpcKeyBuilder_Name) GetMethod() string

func (*GrpcKeyBuilder_Name) GetService

func (x *GrpcKeyBuilder_Name) GetService() string

func (*GrpcKeyBuilder_Name) ProtoMessage

func (*GrpcKeyBuilder_Name) ProtoMessage()

func (*GrpcKeyBuilder_Name) ProtoReflect

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

func (*GrpcKeyBuilder_Name) Reset

func (x *GrpcKeyBuilder_Name) Reset()

func (*GrpcKeyBuilder_Name) String

func (x *GrpcKeyBuilder_Name) String() string

type HttpKeyBuilder

type HttpKeyBuilder struct {

	// host_pattern is an ordered list of host template patterns for the desired
	// value.  If any host_pattern values are specified, then at least one must
	// match, and the last one wins and sets any specified variables.  A host
	// consists of labels separated by dots. Each label is matched against the
	// label in the pattern as follows:
	//   - "*": Matches any single label.
	//   - "**": Matches zero or more labels (first or last part of host only).
	//   - "{<name>=...}": One or more label capture, where "..." can be any
	//      template that does not include a capture.
	//   - "{<name>}": A single label capture. Identical to {<name>=*}.
	//
	// Examples:
	//   - "example.com": Only applies to the exact host example.com.
	//   - "*.example.com": Matches subdomains of example.com.
	//   - "**.example.com": matches example.com, and all levels of subdomains.
	//   - "{project}.example.com": Extracts the third level subdomain.
	//   - "{project=**}.example.com": Extracts the third level+ subdomains.
	//   - "{project=**}": Extracts the entire host.
	HostPatterns []string `protobuf:"bytes,1,rep,name=host_patterns,json=hostPatterns,proto3" json:"host_patterns,omitempty"`
	// path_pattern is an ordered list of path template patterns for the desired
	// value.  If any path_pattern values are specified, then at least one must
	// match, and the last one wins and sets any specified variables.  A path
	// consists of segments separated by slashes. Each segment is matched against
	// the segment in the pattern as follows:
	//   - "*": Matches any single segment.
	//   - "**": Matches zero or more segments (first or last part of path only).
	//   - "{<name>=...}": One or more segment capture, where "..." can be any
	//      template that does not include a capture.
	//   - "{<name>}": A single segment capture. Identical to {<name>=*}.
	// A custom method may also be specified by appending ":" and the custom
	// method name or "*" to indicate any custom method (including no custom
	// method).  For example, "/*/projects/{project_id}/**:*" extracts
	// `{project_id}` for any version, resource and custom method that includes
	// it.  By default, any custom method will be matched.
	//
	// Examples:
	//   - "/v1/{name=messages/*}": extracts a name like "messages/12345".
	//   - "/v1/messages/{message_id}": extracts a message_id like "12345".
	//   - "/v1/users/{user_id}/messages/{message_id}": extracts two key values.
	PathPatterns []string `protobuf:"bytes,2,rep,name=path_patterns,json=pathPatterns,proto3" json:"path_patterns,omitempty"`
	// List of query parameter names to try to match.
	// For example: ["parent", "name", "resource.name"]
	// We extract all the specified query_parameters (case-sensitively).  If any
	// are marked as "required_match" and are not present, this keybuilder fails
	// to match.  If a given parameter appears multiple times (?foo=a&foo=b) we
	// will report it as a comma-separated string (foo=a,b).
	QueryParameters []*NameMatcher `protobuf:"bytes,3,rep,name=query_parameters,json=queryParameters,proto3" json:"query_parameters,omitempty"`
	// List of headers to try to match.
	// We extract all the specified header values (case-insensitively).  If any
	// are marked as "required_match" and are not present, this keybuilder fails
	// to match.  If a given header appears multiple times in the request we will
	// report it as a comma-separated string, in standard HTTP fashion.
	Headers []*NameMatcher `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"`
	// contains filtered or unexported fields
}

An HttpKeyBuilder applies to a given HTTP URL and headers.

Path and host patterns use the matching syntax from gRPC transcoding to extract named key/value pairs from the path and host components of the URL: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto

It is invalid to specify the same key name in multiple places in a pattern.

For a service where the project id can be expressed either as a subdomain or in the path, separate HttpKeyBuilders must be used:

host_pattern: 'example.com' path_pattern: '/{id}/{object}/**'
host_pattern: '{id}.example.com' path_pattern: '/{object}/**'

If the host is exactly 'example.com', the first path segment will be used as the id and the second segment as the object. If the host has a subdomain, the subdomain will be used as the id and the first segment as the object. If neither pattern matches, no keys will be extracted.

func (*HttpKeyBuilder) Descriptor deprecated

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

Deprecated: Use HttpKeyBuilder.ProtoReflect.Descriptor instead.

func (*HttpKeyBuilder) GetHeaders

func (x *HttpKeyBuilder) GetHeaders() []*NameMatcher

func (*HttpKeyBuilder) GetHostPatterns

func (x *HttpKeyBuilder) GetHostPatterns() []string

func (*HttpKeyBuilder) GetPathPatterns

func (x *HttpKeyBuilder) GetPathPatterns() []string

func (*HttpKeyBuilder) GetQueryParameters

func (x *HttpKeyBuilder) GetQueryParameters() []*NameMatcher

func (*HttpKeyBuilder) ProtoMessage

func (*HttpKeyBuilder) ProtoMessage()

func (*HttpKeyBuilder) ProtoReflect

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

func (*HttpKeyBuilder) Reset

func (x *HttpKeyBuilder) Reset()

func (*HttpKeyBuilder) String

func (x *HttpKeyBuilder) String() string

type NameMatcher

type NameMatcher struct {

	// The name that will be used in the RLS key_map to refer to this value.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Ordered list of names (headers or query parameter names) that can supply
	// this value; the first one with a non-empty value is used.
	Names []string `protobuf:"bytes,2,rep,name=names,proto3" json:"names,omitempty"`
	// If true, make this extraction required; the key builder will not match
	// if no value is found.
	RequiredMatch bool `protobuf:"varint,3,opt,name=required_match,json=requiredMatch,proto3" json:"required_match,omitempty"`
	// contains filtered or unexported fields
}

Extract a key based on a given name (e.g. header name or query parameter name). The name must match one of the names listed in the "name" field. If the "required_match" field is true, one of the specified names must be present for the keybuilder to match.

func (*NameMatcher) Descriptor deprecated

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

Deprecated: Use NameMatcher.ProtoReflect.Descriptor instead.

func (*NameMatcher) GetKey

func (x *NameMatcher) GetKey() string

func (*NameMatcher) GetNames

func (x *NameMatcher) GetNames() []string

func (*NameMatcher) GetRequiredMatch

func (x *NameMatcher) GetRequiredMatch() bool

func (*NameMatcher) ProtoMessage

func (*NameMatcher) ProtoMessage()

func (*NameMatcher) ProtoReflect

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

func (*NameMatcher) Reset

func (x *NameMatcher) Reset()

func (*NameMatcher) String

func (x *NameMatcher) String() string

type RouteLookupConfig

type RouteLookupConfig struct {

	// Ordered specifications for constructing keys for HTTP requests.  Last
	// match wins.  If no HttpKeyBuilder matches, an empty key_map will be sent to
	// the lookup service; it should likely reply with a global default route
	// and raise an alert.
	HttpKeybuilders []*HttpKeyBuilder `protobuf:"bytes,1,rep,name=http_keybuilders,json=httpKeybuilders,proto3" json:"http_keybuilders,omitempty"`
	// Unordered specifications for constructing keys for gRPC requests.  All
	// GrpcKeyBuilders on this list must have unique "name" fields so that the
	// client is free to prebuild a hash map keyed by name.  If no GrpcKeyBuilder
	// matches, an empty key_map will be sent to the lookup service; it should
	// likely reply with a global default route and raise an alert.
	GrpcKeybuilders []*GrpcKeyBuilder `protobuf:"bytes,2,rep,name=grpc_keybuilders,json=grpcKeybuilders,proto3" json:"grpc_keybuilders,omitempty"`
	// The name of the lookup service as a gRPC URI.  Typically, this will be
	// a subdomain of the target, such as "lookup.datastore.googleapis.com".
	LookupService string `protobuf:"bytes,3,opt,name=lookup_service,json=lookupService,proto3" json:"lookup_service,omitempty"`
	// Configure a timeout value for lookup service requests.
	// Defaults to 10 seconds if not specified.
	LookupServiceTimeout *durationpb.Duration `protobuf:"bytes,4,opt,name=lookup_service_timeout,json=lookupServiceTimeout,proto3" json:"lookup_service_timeout,omitempty"`
	// How long are responses valid for (like HTTP Cache-Control).
	// If omitted or zero, the longest valid cache time is used.
	// This value is clamped to 5 minutes to avoid unflushable bad responses.
	MaxAge *durationpb.Duration `protobuf:"bytes,5,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"`
	// After a response has been in the client cache for this amount of time
	// and is re-requested, start an asynchronous RPC to re-validate it.
	// This value should be less than max_age by at least the length of a
	// typical RTT to the Route Lookup Service to fully mask the RTT latency.
	// If omitted, keys are only re-requested after they have expired.
	StaleAge *durationpb.Duration `protobuf:"bytes,6,opt,name=stale_age,json=staleAge,proto3" json:"stale_age,omitempty"`
	// Rough indicator of amount of memory to use for the client cache.  Some of
	// the data structure overhead is not accounted for, so actual memory consumed
	// will be somewhat greater than this value.  If this field is omitted or set
	// to zero, a client default will be used.  The value may be capped to a lower
	// amount based on client configuration.
	CacheSizeBytes int64 `protobuf:"varint,7,opt,name=cache_size_bytes,json=cacheSizeBytes,proto3" json:"cache_size_bytes,omitempty"`
	// This is a list of all the possible targets that can be returned by the
	// lookup service.  If a target not on this list is returned, it will be
	// treated the same as an unhealthy target.
	ValidTargets []string `protobuf:"bytes,8,rep,name=valid_targets,json=validTargets,proto3" json:"valid_targets,omitempty"`
	// This value provides a default target to use if needed.  If set, it will be
	// used if RLS returns an error, times out, or returns an invalid response.
	// Note that requests can be routed only to a subdomain of the original
	// target, e.g. "us_east_1.cloudbigtable.googleapis.com".
	DefaultTarget string `protobuf:"bytes,9,opt,name=default_target,json=defaultTarget,proto3" json:"default_target,omitempty"`
	// contains filtered or unexported fields
}

func (*RouteLookupConfig) Descriptor deprecated

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

Deprecated: Use RouteLookupConfig.ProtoReflect.Descriptor instead.

func (*RouteLookupConfig) GetCacheSizeBytes

func (x *RouteLookupConfig) GetCacheSizeBytes() int64

func (*RouteLookupConfig) GetDefaultTarget

func (x *RouteLookupConfig) GetDefaultTarget() string

func (*RouteLookupConfig) GetGrpcKeybuilders

func (x *RouteLookupConfig) GetGrpcKeybuilders() []*GrpcKeyBuilder

func (*RouteLookupConfig) GetHttpKeybuilders

func (x *RouteLookupConfig) GetHttpKeybuilders() []*HttpKeyBuilder

func (*RouteLookupConfig) GetLookupService

func (x *RouteLookupConfig) GetLookupService() string

func (*RouteLookupConfig) GetLookupServiceTimeout

func (x *RouteLookupConfig) GetLookupServiceTimeout() *durationpb.Duration

func (*RouteLookupConfig) GetMaxAge

func (x *RouteLookupConfig) GetMaxAge() *durationpb.Duration

func (*RouteLookupConfig) GetStaleAge

func (x *RouteLookupConfig) GetStaleAge() *durationpb.Duration

func (*RouteLookupConfig) GetValidTargets

func (x *RouteLookupConfig) GetValidTargets() []string

func (*RouteLookupConfig) ProtoMessage

func (*RouteLookupConfig) ProtoMessage()

func (*RouteLookupConfig) ProtoReflect

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

func (*RouteLookupConfig) Reset

func (x *RouteLookupConfig) Reset()

func (*RouteLookupConfig) String

func (x *RouteLookupConfig) String() string

type RouteLookupRequest

type RouteLookupRequest struct {

	// Full host name of the target server, e.g. firestore.googleapis.com.
	// Only set for gRPC requests; HTTP requests must use key_map explicitly.
	Server string `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
	// Full path of the request, i.e. "/service/method".
	// Only set for gRPC requests; HTTP requests must use key_map explicitly.
	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	// Target type allows the client to specify what kind of target format it
	// would like from RLS to allow it to find the regional server, e.g. "grpc".
	TargetType string `protobuf:"bytes,3,opt,name=target_type,json=targetType,proto3" json:"target_type,omitempty"`
	// Map of key values extracted via key builders for the gRPC or HTTP request.
	KeyMap map[string]string `` /* 167-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*RouteLookupRequest) Descriptor deprecated

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

Deprecated: Use RouteLookupRequest.ProtoReflect.Descriptor instead.

func (*RouteLookupRequest) GetKeyMap

func (x *RouteLookupRequest) GetKeyMap() map[string]string

func (*RouteLookupRequest) GetPath

func (x *RouteLookupRequest) GetPath() string

func (*RouteLookupRequest) GetServer

func (x *RouteLookupRequest) GetServer() string

func (*RouteLookupRequest) GetTargetType

func (x *RouteLookupRequest) GetTargetType() string

func (*RouteLookupRequest) ProtoMessage

func (*RouteLookupRequest) ProtoMessage()

func (*RouteLookupRequest) ProtoReflect

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

func (*RouteLookupRequest) Reset

func (x *RouteLookupRequest) Reset()

func (*RouteLookupRequest) String

func (x *RouteLookupRequest) String() string

type RouteLookupResponse

type RouteLookupResponse struct {

	// Prioritized list (best one first) of addressable entities to use
	// for routing, using syntax requested by the request target_type.
	// The targets will be tried in order until a healthy one is found.
	Targets []string `protobuf:"bytes,3,rep,name=targets,proto3" json:"targets,omitempty"`
	// Optional header value to pass along to AFE in the X-Google-RLS-Data header.
	// Cached with "target" and sent with all requests that match the request key.
	// Allows the RLS to pass its work product to the eventual target.
	HeaderData string `protobuf:"bytes,2,opt,name=header_data,json=headerData,proto3" json:"header_data,omitempty"`
	// contains filtered or unexported fields
}

func (*RouteLookupResponse) Descriptor deprecated

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

Deprecated: Use RouteLookupResponse.ProtoReflect.Descriptor instead.

func (*RouteLookupResponse) GetHeaderData

func (x *RouteLookupResponse) GetHeaderData() string

func (*RouteLookupResponse) GetTargets

func (x *RouteLookupResponse) GetTargets() []string

func (*RouteLookupResponse) ProtoMessage

func (*RouteLookupResponse) ProtoMessage()

func (*RouteLookupResponse) ProtoReflect

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

func (*RouteLookupResponse) Reset

func (x *RouteLookupResponse) Reset()

func (*RouteLookupResponse) String

func (x *RouteLookupResponse) String() string

type RouteLookupServiceClient

type RouteLookupServiceClient interface {
	// Lookup returns a target for a single key.
	RouteLookup(ctx context.Context, in *RouteLookupRequest, opts ...grpc.CallOption) (*RouteLookupResponse, error)
}

RouteLookupServiceClient is the client API for RouteLookupService 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 RouteLookupServiceServer

type RouteLookupServiceServer interface {
	// Lookup returns a target for a single key.
	RouteLookup(context.Context, *RouteLookupRequest) (*RouteLookupResponse, error)
	// contains filtered or unexported methods
}

RouteLookupServiceServer is the server API for RouteLookupService service. All implementations must embed UnimplementedRouteLookupServiceServer for forward compatibility

type UnimplementedRouteLookupServiceServer

type UnimplementedRouteLookupServiceServer struct {
}

UnimplementedRouteLookupServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedRouteLookupServiceServer) RouteLookup

type UnsafeRouteLookupServiceServer

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

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

Jump to

Keyboard shortcuts

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