routesapi

package module
v0.0.0-...-ff62bea Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

README

Signadot Routes API Go Client

Overview

This directory contains a Go client of the Signadot Routes API.

Contents

  • A generated Go client.
  • Libraries for destination workload routing.
  • A command for querying the route server.
  • Docs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WatchOp_name = map[int32]string{
		0: "ADD",
		1: "REMOVE",
		2: "REPLACE",
		3: "SYNCED",
	}
	WatchOp_value = map[string]int32{
		"ADD":     0,
		"REMOVE":  1,
		"REPLACE": 2,
		"SYNCED":  3,
	}
)

Enum value maps for WatchOp.

View Source
var File_routes_proto protoreflect.FileDescriptor
View Source
var Routes_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "routes.Routes",
	HandlerType: (*RoutesServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetWorkloadRoutingRules",
			Handler:    _Routes_GetWorkloadRoutingRules_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "WatchWorkloadRoutingRules",
			Handler:       _Routes_WatchWorkloadRoutingRules_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "routes.proto",
}

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

Functions

func RegisterRoutesServer

func RegisterRoutesServer(s grpc.ServiceRegistrar, srv RoutesServer)

Types

type BaselineWorkload

type BaselineWorkload struct {
	Kind      string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
	Name      string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

A BaselineWorkload identifies a given baseline workload. In the context of a WorkloadRoutingRuleRequest, all the fields are optional. In the context of a response from the server, all the fields are filled in.

func (*BaselineWorkload) Descriptor deprecated

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

Deprecated: Use BaselineWorkload.ProtoReflect.Descriptor instead.

func (*BaselineWorkload) GetKind

func (x *BaselineWorkload) GetKind() string

func (*BaselineWorkload) GetName

func (x *BaselineWorkload) GetName() string

func (*BaselineWorkload) GetNamespace

func (x *BaselineWorkload) GetNamespace() string

func (*BaselineWorkload) ProtoMessage

func (*BaselineWorkload) ProtoMessage()

func (*BaselineWorkload) ProtoReflect

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

func (*BaselineWorkload) Reset

func (x *BaselineWorkload) Reset()

func (*BaselineWorkload) String

func (x *BaselineWorkload) String() string

type DestinationSandbox

type DestinationSandbox struct {

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

A DestinationSandbox represents a sandbox that will receive traffic intended for a baseline workload in the presence of a routing key.

func (*DestinationSandbox) Descriptor deprecated

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

Deprecated: Use DestinationSandbox.ProtoReflect.Descriptor instead.

func (*DestinationSandbox) GetName

func (x *DestinationSandbox) GetName() string

func (*DestinationSandbox) ProtoMessage

func (*DestinationSandbox) ProtoMessage()

func (*DestinationSandbox) ProtoReflect

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

func (*DestinationSandbox) Reset

func (x *DestinationSandbox) Reset()

func (*DestinationSandbox) String

func (x *DestinationSandbox) String() string

type GetWorkloadRoutingRulesResponse

type GetWorkloadRoutingRulesResponse struct {
	RoutingRules []*WorkloadRoutingRule `protobuf:"bytes,1,rep,name=routingRules,proto3" json:"routingRules,omitempty"`
	// contains filtered or unexported fields
}

a GetWorkloadRoutingRulesResponse gives the set of WorkloadRoutingRules which match a given WorkloadRoutingRulesRequest.

func (*GetWorkloadRoutingRulesResponse) Descriptor deprecated

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

Deprecated: Use GetWorkloadRoutingRulesResponse.ProtoReflect.Descriptor instead.

func (*GetWorkloadRoutingRulesResponse) GetRoutingRules

func (x *GetWorkloadRoutingRulesResponse) GetRoutingRules() []*WorkloadRoutingRule

func (*GetWorkloadRoutingRulesResponse) ProtoMessage

func (*GetWorkloadRoutingRulesResponse) ProtoMessage()

func (*GetWorkloadRoutingRulesResponse) ProtoReflect

func (*GetWorkloadRoutingRulesResponse) Reset

func (*GetWorkloadRoutingRulesResponse) String

type Location

type Location struct {
	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	// contains filtered or unexported fields
}

Location gives a TCP address as a host, port pair.

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetHost

func (x *Location) GetHost() string

func (*Location) GetPort

func (x *Location) GetPort() uint32

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 RoutesClient

type RoutesClient interface {
	// GetWorkloadRoutingRules returns a set of WorkloadRoutingRules, keyed by
	// baseline workload and routing key, each of which contains a
	// destinationSandbox and mappings for each port.  Each request query
	// parameter represents a different filter on the set of returned routing
	// rules.
	//
	// In the response, for each returned `WorkloadRoutingRule`, the
	// `destinationSandbox` represents the override destination to which traffic
	// will be routed in the presence of the associated routing key
	// (https://www.signadot.com/docs/context-propagation). Message queue
	// consumers may use this field to discover if a message is intended for
	// their consumption.
	//
	// `mappings` provide the association between baseline workload ports and
	// corresponding TCP addresses belonging to the `destinationSandbox`. The
	// `mappings` are used by the DevMesh sidecar
	// (https://www.signadot.com/docs/request-routing/devmesh) to implement
	// "Destination Routing", and may not be relevant to clients unless they are
	// implementing request routing in the application layer.
	GetWorkloadRoutingRules(ctx context.Context, in *WorkloadRoutingRulesRequest, opts ...grpc.CallOption) (*GetWorkloadRoutingRulesResponse, error)
	// WatchWorkloadRoutingRules is a reactive version of GetWorkloadRoutingRules
	// that provides a stream of modifications to the set of WorkloadRoutingRules
	// (keyed by the pair baseline, routingKey), in near real-time.
	WatchWorkloadRoutingRules(ctx context.Context, in *WorkloadRoutingRulesRequest, opts ...grpc.CallOption) (Routes_WatchWorkloadRoutingRulesClient, error)
}

RoutesClient is the client API for Routes 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 NewRoutesClient

func NewRoutesClient(cc grpc.ClientConnInterface) RoutesClient

type RoutesServer

type RoutesServer interface {
	// GetWorkloadRoutingRules returns a set of WorkloadRoutingRules, keyed by
	// baseline workload and routing key, each of which contains a
	// destinationSandbox and mappings for each port.  Each request query
	// parameter represents a different filter on the set of returned routing
	// rules.
	//
	// In the response, for each returned `WorkloadRoutingRule`, the
	// `destinationSandbox` represents the override destination to which traffic
	// will be routed in the presence of the associated routing key
	// (https://www.signadot.com/docs/context-propagation). Message queue
	// consumers may use this field to discover if a message is intended for
	// their consumption.
	//
	// `mappings` provide the association between baseline workload ports and
	// corresponding TCP addresses belonging to the `destinationSandbox`. The
	// `mappings` are used by the DevMesh sidecar
	// (https://www.signadot.com/docs/request-routing/devmesh) to implement
	// "Destination Routing", and may not be relevant to clients unless they are
	// implementing request routing in the application layer.
	GetWorkloadRoutingRules(context.Context, *WorkloadRoutingRulesRequest) (*GetWorkloadRoutingRulesResponse, error)
	// WatchWorkloadRoutingRules is a reactive version of GetWorkloadRoutingRules
	// that provides a stream of modifications to the set of WorkloadRoutingRules
	// (keyed by the pair baseline, routingKey), in near real-time.
	WatchWorkloadRoutingRules(*WorkloadRoutingRulesRequest, Routes_WatchWorkloadRoutingRulesServer) error
	// contains filtered or unexported methods
}

RoutesServer is the server API for Routes service. All implementations must embed UnimplementedRoutesServer for forward compatibility

type Routes_WatchWorkloadRoutingRulesClient

type Routes_WatchWorkloadRoutingRulesClient interface {
	Recv() (*WorkloadRoutingRuleOp, error)
	grpc.ClientStream
}

type Routes_WatchWorkloadRoutingRulesServer

type Routes_WatchWorkloadRoutingRulesServer interface {
	Send(*WorkloadRoutingRuleOp) error
	grpc.ServerStream
}

type UnimplementedRoutesServer

type UnimplementedRoutesServer struct {
}

UnimplementedRoutesServer must be embedded to have forward compatible implementations.

type UnsafeRoutesServer

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

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

type WatchOp

type WatchOp int32

A WatchOp indicates what operation is to be performed on the set of WorkloadRoutingRules specified in a WorkloadRoutingRulesRequest.

const (
	WatchOp_ADD     WatchOp = 0
	WatchOp_REMOVE  WatchOp = 1
	WatchOp_REPLACE WatchOp = 2
	// In any WatchWorkloadRoutingRules rpc call, the returned stream will send at most
	// 1 SYNCED WatchOp, indicating the client has all the information about
	// Sandboxes and RouteGroups available in the cluster. Prior to sending a
	// SYNCED WatchOp, all WatchOps are ADDs.
	WatchOp_SYNCED WatchOp = 3
)

func (WatchOp) Descriptor

func (WatchOp) Descriptor() protoreflect.EnumDescriptor

func (WatchOp) Enum

func (x WatchOp) Enum() *WatchOp

func (WatchOp) EnumDescriptor deprecated

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

Deprecated: Use WatchOp.Descriptor instead.

func (WatchOp) Number

func (x WatchOp) Number() protoreflect.EnumNumber

func (WatchOp) String

func (x WatchOp) String() string

func (WatchOp) Type

func (WatchOp) Type() protoreflect.EnumType

type WorkloadPortMapping

type WorkloadPortMapping struct {
	WorkloadPort uint32      `protobuf:"varint,1,opt,name=workload_port,json=workloadPort,proto3" json:"workload_port,omitempty"`
	Destinations []*Location `protobuf:"bytes,2,rep,name=destinations,proto3" json:"destinations,omitempty"`
	// contains filtered or unexported fields
}

A WorkloadPortMapping provides a mapping from a port on the workload to a set of destinations. Each destination in the response corresponds to a sandbox service matching the sandboxed workload. As a result, any of the destinations can be used.

func (*WorkloadPortMapping) Descriptor deprecated

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

Deprecated: Use WorkloadPortMapping.ProtoReflect.Descriptor instead.

func (*WorkloadPortMapping) GetDestinations

func (x *WorkloadPortMapping) GetDestinations() []*Location

func (*WorkloadPortMapping) GetWorkloadPort

func (x *WorkloadPortMapping) GetWorkloadPort() uint32

func (*WorkloadPortMapping) ProtoMessage

func (*WorkloadPortMapping) ProtoMessage()

func (*WorkloadPortMapping) ProtoReflect

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

func (*WorkloadPortMapping) Reset

func (x *WorkloadPortMapping) Reset()

func (*WorkloadPortMapping) String

func (x *WorkloadPortMapping) String() string

type WorkloadRoutingRule

type WorkloadRoutingRule struct {
	RoutingKey string `protobuf:"bytes,1,opt,name=routing_key,json=routingKey,proto3" json:"routing_key,omitempty"`
	// baseline indicates the corresponding baseline workload.
	Baseline *BaselineWorkload `protobuf:"bytes,2,opt,name=baseline,proto3" json:"baseline,omitempty"`
	// destination_sandbox indicates the sandbox associated with the destination
	// sandboxed workloads.
	DestinationSandbox *DestinationSandbox `protobuf:"bytes,3,opt,name=destination_sandbox,json=destinationSandbox,proto3" json:"destination_sandbox,omitempty"`
	// mappings represents a mapping from a port on the workload to a set of
	// destinations.
	Mappings []*WorkloadPortMapping `protobuf:"bytes,4,rep,name=mappings,proto3" json:"mappings,omitempty"`
	// contains filtered or unexported fields
}

A WorkloadRoutingRule defines for a given baseline and a routing key, a single `destinationSandbox` and `mappings`. The mappings map each port of the baseline workload with corresponding TCP addresses belonging to the `destinationSandbox` where traffic is routed instead.

func (*WorkloadRoutingRule) Descriptor deprecated

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

Deprecated: Use WorkloadRoutingRule.ProtoReflect.Descriptor instead.

func (*WorkloadRoutingRule) GetBaseline

func (x *WorkloadRoutingRule) GetBaseline() *BaselineWorkload

func (*WorkloadRoutingRule) GetDestinationSandbox

func (x *WorkloadRoutingRule) GetDestinationSandbox() *DestinationSandbox

func (*WorkloadRoutingRule) GetMappings

func (x *WorkloadRoutingRule) GetMappings() []*WorkloadPortMapping

func (*WorkloadRoutingRule) GetRoutingKey

func (x *WorkloadRoutingRule) GetRoutingKey() string

func (*WorkloadRoutingRule) ProtoMessage

func (*WorkloadRoutingRule) ProtoMessage()

func (*WorkloadRoutingRule) ProtoReflect

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

func (*WorkloadRoutingRule) Reset

func (x *WorkloadRoutingRule) Reset()

func (*WorkloadRoutingRule) String

func (x *WorkloadRoutingRule) String() string

type WorkloadRoutingRuleOp

type WorkloadRoutingRuleOp struct {
	Op    WatchOp              `protobuf:"varint,1,opt,name=op,proto3,enum=routes.WatchOp" json:"op,omitempty"`
	Route *WorkloadRoutingRule `protobuf:"bytes,2,opt,name=route,proto3" json:"route,omitempty"`
	// contains filtered or unexported fields
}

WorkloadRouteOp describes a diff operation against a set of workload routes: adding, removing, and replacing WorkloadRoutes are possible. Additionally, there is a SYNCED operation to indicate when the client has received all relevant WorkloadRoutes.

func (*WorkloadRoutingRuleOp) Descriptor deprecated

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

Deprecated: Use WorkloadRoutingRuleOp.ProtoReflect.Descriptor instead.

func (*WorkloadRoutingRuleOp) GetOp

func (x *WorkloadRoutingRuleOp) GetOp() WatchOp

func (*WorkloadRoutingRuleOp) GetRoute

func (*WorkloadRoutingRuleOp) ProtoMessage

func (*WorkloadRoutingRuleOp) ProtoMessage()

func (*WorkloadRoutingRuleOp) ProtoReflect

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

func (*WorkloadRoutingRuleOp) Reset

func (x *WorkloadRoutingRuleOp) Reset()

func (*WorkloadRoutingRuleOp) String

func (x *WorkloadRoutingRuleOp) String() string

type WorkloadRoutingRulesRequest

type WorkloadRoutingRulesRequest struct {

	// baseline_workload specifies the kind, namespace, and name of the baseline
	// workload to which requests are directed. Each field is optional.
	BaselineWorkload *BaselineWorkload `protobuf:"bytes,1,opt,name=baseline_workload,json=baselineWorkload,proto3" json:"baseline_workload,omitempty"`
	// routing_key specifies the routing key associated with the request.
	RoutingKey string `protobuf:"bytes,2,opt,name=routing_key,json=routingKey,proto3" json:"routing_key,omitempty"`
	// destination_sandbox specifies the sandbox associated with the destination
	// sandboxed workloads.
	DestinationSandbox *DestinationSandbox `protobuf:"bytes,3,opt,name=destination_sandbox,json=destinationSandbox,proto3" json:"destination_sandbox,omitempty"`
	// contains filtered or unexported fields
}

WorkloadRoutingRulesRequest is a request for a set of WorkloadRoutingRules, which give information about how to route requests when they are intercepted at a given workload. Each field is optional and constrains the the set of WorkloadRoutingRules returned accordingly.

func (*WorkloadRoutingRulesRequest) Descriptor deprecated

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

Deprecated: Use WorkloadRoutingRulesRequest.ProtoReflect.Descriptor instead.

func (*WorkloadRoutingRulesRequest) GetBaselineWorkload

func (x *WorkloadRoutingRulesRequest) GetBaselineWorkload() *BaselineWorkload

func (*WorkloadRoutingRulesRequest) GetDestinationSandbox

func (x *WorkloadRoutingRulesRequest) GetDestinationSandbox() *DestinationSandbox

func (*WorkloadRoutingRulesRequest) GetRoutingKey

func (x *WorkloadRoutingRulesRequest) GetRoutingKey() string

func (*WorkloadRoutingRulesRequest) ProtoMessage

func (*WorkloadRoutingRulesRequest) ProtoMessage()

func (*WorkloadRoutingRulesRequest) ProtoReflect

func (*WorkloadRoutingRulesRequest) Reset

func (x *WorkloadRoutingRulesRequest) Reset()

func (*WorkloadRoutingRulesRequest) String

func (x *WorkloadRoutingRulesRequest) String() string

Directories

Path Synopsis
cmd
internal
package watched provides read access to workload routes backed by a retrying client
package watched provides read access to workload routes backed by a retrying client

Jump to

Keyboard shortcuts

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