shortlinkv1

package
v0.0.0-...-f507469 Latest Latest
Warning

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

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

Documentation

Overview

Package shortlinkv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ShortlinkAPI_Create_FullMethodName = "/clutch.shortlink.v1.ShortlinkAPI/Create"
	ShortlinkAPI_Get_FullMethodName    = "/clutch.shortlink.v1.ShortlinkAPI/Get"
)

Variables

View Source
var File_shortlink_v1_shortlink_proto protoreflect.FileDescriptor
View Source
var ShortlinkAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clutch.shortlink.v1.ShortlinkAPI",
	HandlerType: (*ShortlinkAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _ShortlinkAPI_Create_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _ShortlinkAPI_Get_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "shortlink/v1/shortlink.proto",
}

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

Functions

func RegisterShortlinkAPIHandler

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

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

func RegisterShortlinkAPIHandlerClient

func RegisterShortlinkAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShortlinkAPIClient) error

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

func RegisterShortlinkAPIHandlerFromEndpoint

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

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

func RegisterShortlinkAPIHandlerServer

func RegisterShortlinkAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShortlinkAPIServer) error

RegisterShortlinkAPIHandlerServer registers the http handlers for service ShortlinkAPI to "mux". UnaryRPC :call ShortlinkAPIServer 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 RegisterShortlinkAPIHandlerFromEndpoint instead.

func RegisterShortlinkAPIServer

func RegisterShortlinkAPIServer(s grpc.ServiceRegistrar, srv ShortlinkAPIServer)

Types

type CreateRequest

type CreateRequest struct {
	Path  string            `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	State []*ShareableState `protobuf:"bytes,2,rep,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetPath

func (x *CreateRequest) GetPath() string

func (*CreateRequest) GetState

func (x *CreateRequest) GetState() []*ShareableState

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

func (*CreateRequest) Validate

func (m *CreateRequest) Validate() error

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

func (m *CreateRequest) ValidateAll() error

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

type CreateRequestMultiError

type CreateRequestMultiError []error

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

func (CreateRequestMultiError) AllErrors

func (m CreateRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateRequestMultiError) Error

func (m CreateRequestMultiError) Error() string

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

type CreateRequestValidationError

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

CreateRequestValidationError is the validation error returned by CreateRequest.Validate if the designated constraints aren't met.

func (CreateRequestValidationError) Cause

Cause function returns cause value.

func (CreateRequestValidationError) Error

Error satisfies the builtin error interface

func (CreateRequestValidationError) ErrorName

func (e CreateRequestValidationError) ErrorName() string

ErrorName returns error name.

func (CreateRequestValidationError) Field

Field function returns field value.

func (CreateRequestValidationError) Key

Key function returns key value.

func (CreateRequestValidationError) Reason

Reason function returns reason value.

type CreateResponse

type CreateResponse struct {
	Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetHash

func (x *CreateResponse) GetHash() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

func (*CreateResponse) Validate

func (m *CreateResponse) Validate() error

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

func (m *CreateResponse) ValidateAll() error

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

type CreateResponseMultiError

type CreateResponseMultiError []error

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

func (CreateResponseMultiError) AllErrors

func (m CreateResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateResponseMultiError) Error

func (m CreateResponseMultiError) Error() string

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

type CreateResponseValidationError

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

CreateResponseValidationError is the validation error returned by CreateResponse.Validate if the designated constraints aren't met.

func (CreateResponseValidationError) Cause

Cause function returns cause value.

func (CreateResponseValidationError) Error

Error satisfies the builtin error interface

func (CreateResponseValidationError) ErrorName

func (e CreateResponseValidationError) ErrorName() string

ErrorName returns error name.

func (CreateResponseValidationError) Field

Field function returns field value.

func (CreateResponseValidationError) Key

Key function returns key value.

func (CreateResponseValidationError) Reason

Reason function returns reason value.

type GetRequest

type GetRequest struct {
	Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetHash

func (x *GetRequest) GetHash() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

func (*GetRequest) Validate

func (m *GetRequest) Validate() error

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

func (m *GetRequest) ValidateAll() error

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

type GetRequestMultiError

type GetRequestMultiError []error

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

func (GetRequestMultiError) AllErrors

func (m GetRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetRequestMultiError) Error

func (m GetRequestMultiError) Error() string

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

type GetRequestValidationError

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

GetRequestValidationError is the validation error returned by GetRequest.Validate if the designated constraints aren't met.

func (GetRequestValidationError) Cause

func (e GetRequestValidationError) Cause() error

Cause function returns cause value.

func (GetRequestValidationError) Error

Error satisfies the builtin error interface

func (GetRequestValidationError) ErrorName

func (e GetRequestValidationError) ErrorName() string

ErrorName returns error name.

func (GetRequestValidationError) Field

Field function returns field value.

func (GetRequestValidationError) Key

Key function returns key value.

func (GetRequestValidationError) Reason

func (e GetRequestValidationError) Reason() string

Reason function returns reason value.

type GetResponse

type GetResponse struct {
	Path  string            `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	State []*ShareableState `protobuf:"bytes,2,rep,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetPath

func (x *GetResponse) GetPath() string

func (*GetResponse) GetState

func (x *GetResponse) GetState() []*ShareableState

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

func (*GetResponse) Validate

func (m *GetResponse) Validate() error

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

func (m *GetResponse) ValidateAll() error

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

type GetResponseMultiError

type GetResponseMultiError []error

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

func (GetResponseMultiError) AllErrors

func (m GetResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetResponseMultiError) Error

func (m GetResponseMultiError) Error() string

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

type GetResponseValidationError

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

GetResponseValidationError is the validation error returned by GetResponse.Validate if the designated constraints aren't met.

func (GetResponseValidationError) Cause

Cause function returns cause value.

func (GetResponseValidationError) Error

Error satisfies the builtin error interface

func (GetResponseValidationError) ErrorName

func (e GetResponseValidationError) ErrorName() string

ErrorName returns error name.

func (GetResponseValidationError) Field

Field function returns field value.

func (GetResponseValidationError) Key

Key function returns key value.

func (GetResponseValidationError) Reason

Reason function returns reason value.

type ShareableState

type ShareableState struct {
	Key   string          `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	State *structpb.Value `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

ShareableState stores a key identifier that maps to state. This is analogous to a map, however we are not using a map here as that will restrict our ability to further expand on this message. For example adding a "revision" identifier in the future.

func (*ShareableState) Descriptor deprecated

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

Deprecated: Use ShareableState.ProtoReflect.Descriptor instead.

func (*ShareableState) GetKey

func (x *ShareableState) GetKey() string

func (*ShareableState) GetState

func (x *ShareableState) GetState() *structpb.Value

func (*ShareableState) ProtoMessage

func (*ShareableState) ProtoMessage()

func (*ShareableState) ProtoReflect

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

func (*ShareableState) Reset

func (x *ShareableState) Reset()

func (*ShareableState) String

func (x *ShareableState) String() string

func (*ShareableState) Validate

func (m *ShareableState) Validate() error

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

func (m *ShareableState) ValidateAll() error

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

type ShareableStateMultiError

type ShareableStateMultiError []error

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

func (ShareableStateMultiError) AllErrors

func (m ShareableStateMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ShareableStateMultiError) Error

func (m ShareableStateMultiError) Error() string

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

type ShareableStateValidationError

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

ShareableStateValidationError is the validation error returned by ShareableState.Validate if the designated constraints aren't met.

func (ShareableStateValidationError) Cause

Cause function returns cause value.

func (ShareableStateValidationError) Error

Error satisfies the builtin error interface

func (ShareableStateValidationError) ErrorName

func (e ShareableStateValidationError) ErrorName() string

ErrorName returns error name.

func (ShareableStateValidationError) Field

Field function returns field value.

func (ShareableStateValidationError) Key

Key function returns key value.

func (ShareableStateValidationError) Reason

Reason function returns reason value.

type ShortlinkAPIClient

type ShortlinkAPIClient interface {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
}

ShortlinkAPIClient is the client API for ShortlinkAPI 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 ShortlinkAPIServer

type ShortlinkAPIServer interface {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	Get(context.Context, *GetRequest) (*GetResponse, error)
}

ShortlinkAPIServer is the server API for ShortlinkAPI service. All implementations should embed UnimplementedShortlinkAPIServer for forward compatibility

type UnimplementedShortlinkAPIServer

type UnimplementedShortlinkAPIServer struct {
}

UnimplementedShortlinkAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedShortlinkAPIServer) Create

func (UnimplementedShortlinkAPIServer) Get

type UnsafeShortlinkAPIServer

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

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

Jump to

Keyboard shortcuts

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