proxyv1

package
v0.0.0-...-6929601 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package proxyv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ProxyAPI_RequestProxy_FullMethodName    = "/clutch.proxy.v1.ProxyAPI/RequestProxy"
	ProxyAPI_RequestProxyGet_FullMethodName = "/clutch.proxy.v1.ProxyAPI/RequestProxyGet"
)

Variables

View Source
var File_proxy_v1_proxy_proto protoreflect.FileDescriptor
View Source
var ProxyAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clutch.proxy.v1.ProxyAPI",
	HandlerType: (*ProxyAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RequestProxy",
			Handler:    _ProxyAPI_RequestProxy_Handler,
		},
		{
			MethodName: "RequestProxyGet",
			Handler:    _ProxyAPI_RequestProxyGet_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proxy/v1/proxy.proto",
}

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

Functions

func RegisterProxyAPIHandler

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

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

func RegisterProxyAPIHandlerClient

func RegisterProxyAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProxyAPIClient) error

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

func RegisterProxyAPIHandlerFromEndpoint

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

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

func RegisterProxyAPIHandlerServer

func RegisterProxyAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProxyAPIServer) error

RegisterProxyAPIHandlerServer registers the http handlers for service ProxyAPI to "mux". UnaryRPC :call ProxyAPIServer 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 RegisterProxyAPIHandlerFromEndpoint instead.

func RegisterProxyAPIServer

func RegisterProxyAPIServer(s grpc.ServiceRegistrar, srv ProxyAPIServer)

Types

type ProxyAPIClient

type ProxyAPIClient interface {
	RequestProxy(ctx context.Context, in *RequestProxyRequest, opts ...grpc.CallOption) (*RequestProxyResponse, error)
	// RequestProxyGet is a clone of the request proxy, but only permits requests with the http_method set to GET.
	// This is useful for RBAC purposes since the action type is READ.
	RequestProxyGet(ctx context.Context, in *RequestProxyGetRequest, opts ...grpc.CallOption) (*RequestProxyGetResponse, error)
}

ProxyAPIClient is the client API for ProxyAPI 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 NewProxyAPIClient

func NewProxyAPIClient(cc grpc.ClientConnInterface) ProxyAPIClient

type ProxyAPIServer

type ProxyAPIServer interface {
	RequestProxy(context.Context, *RequestProxyRequest) (*RequestProxyResponse, error)
	// RequestProxyGet is a clone of the request proxy, but only permits requests with the http_method set to GET.
	// This is useful for RBAC purposes since the action type is READ.
	RequestProxyGet(context.Context, *RequestProxyGetRequest) (*RequestProxyGetResponse, error)
}

ProxyAPIServer is the server API for ProxyAPI service. All implementations should embed UnimplementedProxyAPIServer for forward compatibility

type RequestProxyGetRequest

type RequestProxyGetRequest struct {

	// The name of a service that is configured
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	// The HTTP method that will be used for the request
	HttpMethod string `protobuf:"bytes,2,opt,name=http_method,json=httpMethod,proto3" json:"http_method,omitempty"`
	// The URI path to call
	Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	// The request body
	Request *structpb.Value `protobuf:"bytes,4,opt,name=request,proto3" json:"request,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestProxyGetRequest) Descriptor deprecated

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

Deprecated: Use RequestProxyGetRequest.ProtoReflect.Descriptor instead.

func (*RequestProxyGetRequest) GetHttpMethod

func (x *RequestProxyGetRequest) GetHttpMethod() string

func (*RequestProxyGetRequest) GetPath

func (x *RequestProxyGetRequest) GetPath() string

func (*RequestProxyGetRequest) GetRequest

func (x *RequestProxyGetRequest) GetRequest() *structpb.Value

func (*RequestProxyGetRequest) GetService

func (x *RequestProxyGetRequest) GetService() string

func (*RequestProxyGetRequest) ProtoMessage

func (*RequestProxyGetRequest) ProtoMessage()

func (*RequestProxyGetRequest) ProtoReflect

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

func (*RequestProxyGetRequest) Reset

func (x *RequestProxyGetRequest) Reset()

func (*RequestProxyGetRequest) String

func (x *RequestProxyGetRequest) String() string

func (*RequestProxyGetRequest) Validate

func (m *RequestProxyGetRequest) Validate() error

Validate checks the field values on RequestProxyGetRequest 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 (*RequestProxyGetRequest) ValidateAll

func (m *RequestProxyGetRequest) ValidateAll() error

ValidateAll checks the field values on RequestProxyGetRequest 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 RequestProxyGetRequestMultiError, or nil if none found.

type RequestProxyGetRequestMultiError

type RequestProxyGetRequestMultiError []error

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

func (RequestProxyGetRequestMultiError) AllErrors

func (m RequestProxyGetRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RequestProxyGetRequestMultiError) Error

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

type RequestProxyGetRequestValidationError

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

RequestProxyGetRequestValidationError is the validation error returned by RequestProxyGetRequest.Validate if the designated constraints aren't met.

func (RequestProxyGetRequestValidationError) Cause

Cause function returns cause value.

func (RequestProxyGetRequestValidationError) Error

Error satisfies the builtin error interface

func (RequestProxyGetRequestValidationError) ErrorName

ErrorName returns error name.

func (RequestProxyGetRequestValidationError) Field

Field function returns field value.

func (RequestProxyGetRequestValidationError) Key

Key function returns key value.

func (RequestProxyGetRequestValidationError) Reason

Reason function returns reason value.

type RequestProxyGetResponse

type RequestProxyGetResponse struct {

	// The http response code from the service response
	HttpStatus int32 `protobuf:"varint,1,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"`
	// All of the headers from the service response
	// Header values can have multiple values for the same name
	// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2
	Headers map[string]*structpb.ListValue `` /* 155-byte string literal not displayed */
	// The full response body.
	Response *structpb.Value `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestProxyGetResponse) Descriptor deprecated

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

Deprecated: Use RequestProxyGetResponse.ProtoReflect.Descriptor instead.

func (*RequestProxyGetResponse) GetHeaders

func (x *RequestProxyGetResponse) GetHeaders() map[string]*structpb.ListValue

func (*RequestProxyGetResponse) GetHttpStatus

func (x *RequestProxyGetResponse) GetHttpStatus() int32

func (*RequestProxyGetResponse) GetResponse

func (x *RequestProxyGetResponse) GetResponse() *structpb.Value

func (*RequestProxyGetResponse) ProtoMessage

func (*RequestProxyGetResponse) ProtoMessage()

func (*RequestProxyGetResponse) ProtoReflect

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

func (*RequestProxyGetResponse) Reset

func (x *RequestProxyGetResponse) Reset()

func (*RequestProxyGetResponse) String

func (x *RequestProxyGetResponse) String() string

func (*RequestProxyGetResponse) Validate

func (m *RequestProxyGetResponse) Validate() error

Validate checks the field values on RequestProxyGetResponse 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 (*RequestProxyGetResponse) ValidateAll

func (m *RequestProxyGetResponse) ValidateAll() error

ValidateAll checks the field values on RequestProxyGetResponse 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 RequestProxyGetResponseMultiError, or nil if none found.

type RequestProxyGetResponseMultiError

type RequestProxyGetResponseMultiError []error

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

func (RequestProxyGetResponseMultiError) AllErrors

func (m RequestProxyGetResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RequestProxyGetResponseMultiError) Error

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

type RequestProxyGetResponseValidationError

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

RequestProxyGetResponseValidationError is the validation error returned by RequestProxyGetResponse.Validate if the designated constraints aren't met.

func (RequestProxyGetResponseValidationError) Cause

Cause function returns cause value.

func (RequestProxyGetResponseValidationError) Error

Error satisfies the builtin error interface

func (RequestProxyGetResponseValidationError) ErrorName

ErrorName returns error name.

func (RequestProxyGetResponseValidationError) Field

Field function returns field value.

func (RequestProxyGetResponseValidationError) Key

Key function returns key value.

func (RequestProxyGetResponseValidationError) Reason

Reason function returns reason value.

type RequestProxyRequest

type RequestProxyRequest struct {

	// The name of a service that is configured
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	// The HTTP method that will be used for the request
	HttpMethod string `protobuf:"bytes,2,opt,name=http_method,json=httpMethod,proto3" json:"http_method,omitempty"`
	// The URI path to call
	Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	// The request body
	Request *structpb.Value `protobuf:"bytes,4,opt,name=request,proto3" json:"request,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestProxyRequest) Descriptor deprecated

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

Deprecated: Use RequestProxyRequest.ProtoReflect.Descriptor instead.

func (*RequestProxyRequest) GetHttpMethod

func (x *RequestProxyRequest) GetHttpMethod() string

func (*RequestProxyRequest) GetPath

func (x *RequestProxyRequest) GetPath() string

func (*RequestProxyRequest) GetRequest

func (x *RequestProxyRequest) GetRequest() *structpb.Value

func (*RequestProxyRequest) GetService

func (x *RequestProxyRequest) GetService() string

func (*RequestProxyRequest) ProtoMessage

func (*RequestProxyRequest) ProtoMessage()

func (*RequestProxyRequest) ProtoReflect

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

func (*RequestProxyRequest) Reset

func (x *RequestProxyRequest) Reset()

func (*RequestProxyRequest) String

func (x *RequestProxyRequest) String() string

func (*RequestProxyRequest) Validate

func (m *RequestProxyRequest) Validate() error

Validate checks the field values on RequestProxyRequest 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 (*RequestProxyRequest) ValidateAll

func (m *RequestProxyRequest) ValidateAll() error

ValidateAll checks the field values on RequestProxyRequest 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 RequestProxyRequestMultiError, or nil if none found.

type RequestProxyRequestMultiError

type RequestProxyRequestMultiError []error

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

func (RequestProxyRequestMultiError) AllErrors

func (m RequestProxyRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RequestProxyRequestMultiError) Error

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

type RequestProxyRequestValidationError

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

RequestProxyRequestValidationError is the validation error returned by RequestProxyRequest.Validate if the designated constraints aren't met.

func (RequestProxyRequestValidationError) Cause

Cause function returns cause value.

func (RequestProxyRequestValidationError) Error

Error satisfies the builtin error interface

func (RequestProxyRequestValidationError) ErrorName

ErrorName returns error name.

func (RequestProxyRequestValidationError) Field

Field function returns field value.

func (RequestProxyRequestValidationError) Key

Key function returns key value.

func (RequestProxyRequestValidationError) Reason

Reason function returns reason value.

type RequestProxyResponse

type RequestProxyResponse struct {

	// The http response code from the service response
	HttpStatus int32 `protobuf:"varint,1,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"`
	// All of the headers from the service response
	// Header values can have multiple values for the same name
	// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2
	Headers map[string]*structpb.ListValue `` /* 155-byte string literal not displayed */
	// The full response body
	Response *structpb.Value `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestProxyResponse) Descriptor deprecated

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

Deprecated: Use RequestProxyResponse.ProtoReflect.Descriptor instead.

func (*RequestProxyResponse) GetHeaders

func (x *RequestProxyResponse) GetHeaders() map[string]*structpb.ListValue

func (*RequestProxyResponse) GetHttpStatus

func (x *RequestProxyResponse) GetHttpStatus() int32

func (*RequestProxyResponse) GetResponse

func (x *RequestProxyResponse) GetResponse() *structpb.Value

func (*RequestProxyResponse) ProtoMessage

func (*RequestProxyResponse) ProtoMessage()

func (*RequestProxyResponse) ProtoReflect

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

func (*RequestProxyResponse) Reset

func (x *RequestProxyResponse) Reset()

func (*RequestProxyResponse) String

func (x *RequestProxyResponse) String() string

func (*RequestProxyResponse) Validate

func (m *RequestProxyResponse) Validate() error

Validate checks the field values on RequestProxyResponse 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 (*RequestProxyResponse) ValidateAll

func (m *RequestProxyResponse) ValidateAll() error

ValidateAll checks the field values on RequestProxyResponse 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 RequestProxyResponseMultiError, or nil if none found.

type RequestProxyResponseMultiError

type RequestProxyResponseMultiError []error

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

func (RequestProxyResponseMultiError) AllErrors

func (m RequestProxyResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RequestProxyResponseMultiError) Error

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

type RequestProxyResponseValidationError

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

RequestProxyResponseValidationError is the validation error returned by RequestProxyResponse.Validate if the designated constraints aren't met.

func (RequestProxyResponseValidationError) Cause

Cause function returns cause value.

func (RequestProxyResponseValidationError) Error

Error satisfies the builtin error interface

func (RequestProxyResponseValidationError) ErrorName

ErrorName returns error name.

func (RequestProxyResponseValidationError) Field

Field function returns field value.

func (RequestProxyResponseValidationError) Key

Key function returns key value.

func (RequestProxyResponseValidationError) Reason

Reason function returns reason value.

type UnimplementedProxyAPIServer

type UnimplementedProxyAPIServer struct {
}

UnimplementedProxyAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedProxyAPIServer) RequestProxy

func (UnimplementedProxyAPIServer) RequestProxyGet

type UnsafeProxyAPIServer

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

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

Jump to

Keyboard shortcuts

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