api

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	HelloGreeter_SayHello_FullMethodName = "/hello.v1.HelloGreeter/SayHello"
)
View Source
const (
	HelloIdentity_ServerVersion_FullMethodName = "/hello.v1.HelloIdentity/ServerVersion"
)

Variables

View Source
var (
	HelloVersion_Version_name = map[int32]string{
		0: "VERSION_UNSPECIFIED",

		1: "PATCH",
	}
	HelloVersion_Version_value = map[string]int32{
		"VERSION_UNSPECIFIED": 0,
		"MAJOR":               0,
		"MINOR":               0,
		"PATCH":               1,
	}
)

Enum value maps for HelloVersion_Version.

View Source
var File_api_hello_proto protoreflect.FileDescriptor
View Source
var HelloGreeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.v1.HelloGreeter",
	HandlerType: (*HelloGreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SayHello",
			Handler:    _HelloGreeter_SayHello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/hello.proto",
}

HelloGreeter_ServiceDesc is the grpc.ServiceDesc for HelloGreeter 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 HelloIdentity_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.v1.HelloIdentity",
	HandlerType: (*HelloIdentityServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ServerVersion",
			Handler:    _HelloIdentity_ServerVersion_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/hello.proto",
}

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

Functions

func RegisterHelloGreeterHandler

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

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

func RegisterHelloGreeterHandlerClient

func RegisterHelloGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloGreeterClient) error

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

func RegisterHelloGreeterHandlerFromEndpoint

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

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

func RegisterHelloGreeterHandlerServer

func RegisterHelloGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloGreeterServer) error

RegisterHelloGreeterHandlerServer registers the http handlers for service HelloGreeter to "mux". UnaryRPC :call HelloGreeterServer 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 RegisterHelloGreeterHandlerFromEndpoint instead.

func RegisterHelloGreeterServer

func RegisterHelloGreeterServer(s grpc.ServiceRegistrar, srv HelloGreeterServer)

func RegisterHelloIdentityHandler

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

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

func RegisterHelloIdentityHandlerClient

func RegisterHelloIdentityHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloIdentityClient) error

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

func RegisterHelloIdentityHandlerFromEndpoint

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

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

func RegisterHelloIdentityHandlerServer

func RegisterHelloIdentityHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloIdentityServer) error

RegisterHelloIdentityHandlerServer registers the http handlers for service HelloIdentity to "mux". UnaryRPC :call HelloIdentityServer 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 RegisterHelloIdentityHandlerFromEndpoint instead.

func RegisterHelloIdentityServer

func RegisterHelloIdentityServer(s grpc.ServiceRegistrar, srv HelloIdentityServer)

Types

type HelloGreeterClient

type HelloGreeterClient interface {
	// Sends a greeting
	SayHello(ctx context.Context, in *HelloGreeterSayHelloRequest, opts ...grpc.CallOption) (*HelloGreeterSayHelloResponse, error)
}

HelloGreeterClient is the client API for HelloGreeter 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 HelloGreeterSayHelloRequest

type HelloGreeterSayHelloRequest struct {

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

The request message containing the user's name.

func (*HelloGreeterSayHelloRequest) Descriptor deprecated

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

Deprecated: Use HelloGreeterSayHelloRequest.ProtoReflect.Descriptor instead.

func (*HelloGreeterSayHelloRequest) GetName

func (x *HelloGreeterSayHelloRequest) GetName() string

func (*HelloGreeterSayHelloRequest) ProtoMessage

func (*HelloGreeterSayHelloRequest) ProtoMessage()

func (*HelloGreeterSayHelloRequest) ProtoReflect

func (*HelloGreeterSayHelloRequest) Reset

func (x *HelloGreeterSayHelloRequest) Reset()

func (*HelloGreeterSayHelloRequest) String

func (x *HelloGreeterSayHelloRequest) String() string

type HelloGreeterSayHelloResponse

type HelloGreeterSayHelloResponse struct {

	// Message returned from server containing 'name'
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

The response message containing the greetings

func (*HelloGreeterSayHelloResponse) Descriptor deprecated

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

Deprecated: Use HelloGreeterSayHelloResponse.ProtoReflect.Descriptor instead.

func (*HelloGreeterSayHelloResponse) GetMessage

func (x *HelloGreeterSayHelloResponse) GetMessage() string

func (*HelloGreeterSayHelloResponse) ProtoMessage

func (*HelloGreeterSayHelloResponse) ProtoMessage()

func (*HelloGreeterSayHelloResponse) ProtoReflect

func (*HelloGreeterSayHelloResponse) Reset

func (x *HelloGreeterSayHelloResponse) Reset()

func (*HelloGreeterSayHelloResponse) String

type HelloGreeterServer

type HelloGreeterServer interface {
	// Sends a greeting
	SayHello(context.Context, *HelloGreeterSayHelloRequest) (*HelloGreeterSayHelloResponse, error)
	// contains filtered or unexported methods
}

HelloGreeterServer is the server API for HelloGreeter service. All implementations must embed UnimplementedHelloGreeterServer for forward compatibility

type HelloIdentityClient

type HelloIdentityClient interface {
	// Gets server version
	ServerVersion(ctx context.Context, in *HelloIdentityVersionRequest, opts ...grpc.CallOption) (*HelloIdentityVersionResponse, error)
}

HelloIdentityClient is the client API for HelloIdentity 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 HelloIdentityServer

type HelloIdentityServer interface {
	// Gets server version
	ServerVersion(context.Context, *HelloIdentityVersionRequest) (*HelloIdentityVersionResponse, error)
	// contains filtered or unexported methods
}

HelloIdentityServer is the server API for HelloIdentity service. All implementations must embed UnimplementedHelloIdentityServer for forward compatibility

type HelloIdentityVersionRequest

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

Empty request

func (*HelloIdentityVersionRequest) Descriptor deprecated

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

Deprecated: Use HelloIdentityVersionRequest.ProtoReflect.Descriptor instead.

func (*HelloIdentityVersionRequest) ProtoMessage

func (*HelloIdentityVersionRequest) ProtoMessage()

func (*HelloIdentityVersionRequest) ProtoReflect

func (*HelloIdentityVersionRequest) Reset

func (x *HelloIdentityVersionRequest) Reset()

func (*HelloIdentityVersionRequest) String

func (x *HelloIdentityVersionRequest) String() string

type HelloIdentityVersionResponse

type HelloIdentityVersionResponse struct {

	// Hello application version
	ServerVersion *HelloVersion `protobuf:"bytes,1,opt,name=server_version,json=serverVersion,proto3" json:"server_version,omitempty"`
	// contains filtered or unexported fields
}

Defines the response to version

func (*HelloIdentityVersionResponse) Descriptor deprecated

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

Deprecated: Use HelloIdentityVersionResponse.ProtoReflect.Descriptor instead.

func (*HelloIdentityVersionResponse) GetServerVersion added in v0.0.8

func (x *HelloIdentityVersionResponse) GetServerVersion() *HelloVersion

func (*HelloIdentityVersionResponse) ProtoMessage

func (*HelloIdentityVersionResponse) ProtoMessage()

func (*HelloIdentityVersionResponse) ProtoReflect

func (*HelloIdentityVersionResponse) Reset

func (x *HelloIdentityVersionResponse) Reset()

func (*HelloIdentityVersionResponse) String

type HelloVersion

type HelloVersion struct {

	// Version major number
	Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
	// Version minor number
	Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
	// Version patch number
	Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"`
	// String representation of the version. Must be
	// in `major.minor.patch` format.
	Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

Hello version in Major.Minor.Patch format. The goal of this message is to provide clients a method to determine the server and client versions.

func (*HelloVersion) Descriptor deprecated

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

Deprecated: Use HelloVersion.ProtoReflect.Descriptor instead.

func (*HelloVersion) GetMajor

func (x *HelloVersion) GetMajor() int32

func (*HelloVersion) GetMinor

func (x *HelloVersion) GetMinor() int32

func (*HelloVersion) GetPatch

func (x *HelloVersion) GetPatch() int32

func (*HelloVersion) GetVersion

func (x *HelloVersion) GetVersion() string

func (*HelloVersion) ProtoMessage

func (*HelloVersion) ProtoMessage()

func (*HelloVersion) ProtoReflect

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

func (*HelloVersion) Reset

func (x *HelloVersion) Reset()

func (*HelloVersion) String

func (x *HelloVersion) String() string

type HelloVersion_Version

type HelloVersion_Version int32

These values are constants that can be used by the client and server applications

const (
	// Must be set in the proto file; ignore.
	HelloVersion_VERSION_UNSPECIFIED HelloVersion_Version = 0
	// Version major value of this specification
	HelloVersion_MAJOR HelloVersion_Version = 0
	// Version minor value of this specification
	HelloVersion_MINOR HelloVersion_Version = 0
	// Version patch value of this specification
	HelloVersion_PATCH HelloVersion_Version = 1
)

func (HelloVersion_Version) Descriptor

func (HelloVersion_Version) Enum

func (HelloVersion_Version) EnumDescriptor deprecated

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

Deprecated: Use HelloVersion_Version.Descriptor instead.

func (HelloVersion_Version) Number

func (HelloVersion_Version) String

func (x HelloVersion_Version) String() string

func (HelloVersion_Version) Type

type UnimplementedHelloGreeterServer

type UnimplementedHelloGreeterServer struct {
}

UnimplementedHelloGreeterServer must be embedded to have forward compatible implementations.

type UnimplementedHelloIdentityServer

type UnimplementedHelloIdentityServer struct {
}

UnimplementedHelloIdentityServer must be embedded to have forward compatible implementations.

func (UnimplementedHelloIdentityServer) ServerVersion added in v0.0.8

type UnsafeHelloGreeterServer

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

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

type UnsafeHelloIdentityServer

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

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

Jump to

Keyboard shortcuts

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