Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterCountriesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCountriesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CountriesClient) error
- func RegisterCountriesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCountriesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CountriesServer) error
- func RegisterCountriesServer(s grpc.ServiceRegistrar, srv CountriesServer)
- func RegisterUtilHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUtilHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UtilClient) error
- func RegisterUtilHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUtilHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UtilServer) error
- func RegisterUtilServer(s grpc.ServiceRegistrar, srv UtilServer)
- type CheckStatusResponse
- func (*CheckStatusResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CheckStatusResponse) GetOldField() int32deprecated
- func (x *CheckStatusResponse) GetStatus() Status
- func (*CheckStatusResponse) ProtoMessage()
- func (x *CheckStatusResponse) ProtoReflect() protoreflect.Message
- func (x *CheckStatusResponse) Reset()
- func (x *CheckStatusResponse) String() string
- type CountriesClient
- type CountriesServer
- type Country
- type GetCountriesRequest
- func (*GetCountriesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetCountriesRequest) GetCountries() []string
- func (*GetCountriesRequest) ProtoMessage()
- func (x *GetCountriesRequest) ProtoReflect() protoreflect.Message
- func (x *GetCountriesRequest) Reset()
- func (x *GetCountriesRequest) String() string
- type GetCountriesResponse
- func (*GetCountriesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetCountriesResponse) GetCountries() map[string]*Country
- func (*GetCountriesResponse) ProtoMessage()
- func (x *GetCountriesResponse) ProtoReflect() protoreflect.Message
- func (x *GetCountriesResponse) Reset()
- func (x *GetCountriesResponse) String() string
- type Message
- type Status
- type UnimplementedCountriesServer
- type UnimplementedUtilServer
- type UnsafeCountriesServer
- type UnsafeUtilServer
- type UtilClient
- type UtilServer
Constants ¶
This section is empty.
Variables ¶
var ( Status_name = map[int32]string{ 0: "Unknown", 1: "Error", 2: "OK", } Status_value = map[string]int32{ "Unknown": 0, "Error": 1, "OK": 2, } )
Enum value maps for Status.
var Countries_ServiceDesc = grpc.ServiceDesc{ ServiceName: "gunk.example.v1.Countries", HandlerType: (*CountriesServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetCountries", Handler: _Countries_GetCountries_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/gunk/gunk-example-server/api/v1/all.proto", }
Countries_ServiceDesc is the grpc.ServiceDesc for Countries service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_github_com_gunk_gunk_example_server_api_v1_all_proto protoreflect.FileDescriptor
var Swagger []byte
Swagger is the embedded swagger definition.
var Util_ServiceDesc = grpc.ServiceDesc{ ServiceName: "gunk.example.v1.Util", HandlerType: (*UtilServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CheckStatus", Handler: _Util_CheckStatus_Handler, }, { MethodName: "Echo", Handler: _Util_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/gunk/gunk-example-server/api/v1/all.proto", }
Util_ServiceDesc is the grpc.ServiceDesc for Util service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterCountriesHandler ¶
func RegisterCountriesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterCountriesHandler registers the http handlers for service Countries to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterCountriesHandlerClient ¶
func RegisterCountriesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CountriesClient) error
RegisterCountriesHandlerClient registers the http handlers for service Countries to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CountriesClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CountriesClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CountriesClient" to call the correct interceptors.
func RegisterCountriesHandlerFromEndpoint ¶
func RegisterCountriesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterCountriesHandlerFromEndpoint is same as RegisterCountriesHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCountriesHandlerServer ¶
func RegisterCountriesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CountriesServer) error
RegisterCountriesHandlerServer registers the http handlers for service Countries to "mux". UnaryRPC :call CountriesServer 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 RegisterCountriesHandlerFromEndpoint instead.
func RegisterCountriesServer ¶
func RegisterCountriesServer(s grpc.ServiceRegistrar, srv CountriesServer)
func RegisterUtilHandler ¶
RegisterUtilHandler registers the http handlers for service Util to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUtilHandlerClient ¶
RegisterUtilHandlerClient registers the http handlers for service Util to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UtilClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UtilClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UtilClient" to call the correct interceptors.
func RegisterUtilHandlerFromEndpoint ¶
func RegisterUtilHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUtilHandlerFromEndpoint is same as RegisterUtilHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUtilHandlerServer ¶
RegisterUtilHandlerServer registers the http handlers for service Util to "mux". UnaryRPC :call UtilServer 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 RegisterUtilHandlerFromEndpoint instead.
func RegisterUtilServer ¶
func RegisterUtilServer(s grpc.ServiceRegistrar, srv UtilServer)
Types ¶
type CheckStatusResponse ¶
type CheckStatusResponse struct { Status Status `protobuf:"varint,1,opt,name=Status,json=status,proto3,enum=gunk.example.v1.Status" json:"status,omitempty"` // Deprecated: Do not use. OldField int32 `protobuf:"varint,2,opt,name=OldField,json=old_field,proto3" json:"old_field,omitempty"` // contains filtered or unexported fields }
CheckStatusResponse is the server health status response.
func (*CheckStatusResponse) Descriptor
deprecated
func (*CheckStatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use CheckStatusResponse.ProtoReflect.Descriptor instead.
func (*CheckStatusResponse) GetOldField
deprecated
func (x *CheckStatusResponse) GetOldField() int32
Deprecated: Do not use.
func (*CheckStatusResponse) GetStatus ¶
func (x *CheckStatusResponse) GetStatus() Status
func (*CheckStatusResponse) ProtoMessage ¶
func (*CheckStatusResponse) ProtoMessage()
func (*CheckStatusResponse) ProtoReflect ¶
func (x *CheckStatusResponse) ProtoReflect() protoreflect.Message
func (*CheckStatusResponse) Reset ¶
func (x *CheckStatusResponse) Reset()
func (*CheckStatusResponse) String ¶
func (x *CheckStatusResponse) String() string
type CountriesClient ¶
type CountriesClient interface { // GetCountries returns a list of countries identified by their ISO code. // (showcases multiple http matching rules with a filter). GetCountries(ctx context.Context, in *GetCountriesRequest, opts ...grpc.CallOption) (*GetCountriesResponse, error) }
CountriesClient is the client API for Countries 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 NewCountriesClient ¶
func NewCountriesClient(cc grpc.ClientConnInterface) CountriesClient
type CountriesServer ¶
type CountriesServer interface { // GetCountries returns a list of countries identified by their ISO code. // (showcases multiple http matching rules with a filter). GetCountries(context.Context, *GetCountriesRequest) (*GetCountriesResponse, error) // contains filtered or unexported methods }
CountriesServer is the server API for Countries service. All implementations must embed UnimplementedCountriesServer for forward compatibility
type Country ¶
type Country struct { Name string `protobuf:"bytes,1,opt,name=Name,json=name,proto3" json:"name,omitempty"` Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"code,omitempty"` // contains filtered or unexported fields }
Country contains country information.
func (*Country) Descriptor
deprecated
func (*Country) ProtoMessage ¶
func (*Country) ProtoMessage()
func (*Country) ProtoReflect ¶
func (x *Country) ProtoReflect() protoreflect.Message
type GetCountriesRequest ¶
type GetCountriesRequest struct { Countries []string `protobuf:"bytes,1,rep,name=Countries,json=countries,proto3" json:"countries,omitempty"` // contains filtered or unexported fields }
GetCountriesRequest is the get countries request.
func (*GetCountriesRequest) Descriptor
deprecated
func (*GetCountriesRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetCountriesRequest.ProtoReflect.Descriptor instead.
func (*GetCountriesRequest) GetCountries ¶
func (x *GetCountriesRequest) GetCountries() []string
func (*GetCountriesRequest) ProtoMessage ¶
func (*GetCountriesRequest) ProtoMessage()
func (*GetCountriesRequest) ProtoReflect ¶
func (x *GetCountriesRequest) ProtoReflect() protoreflect.Message
func (*GetCountriesRequest) Reset ¶
func (x *GetCountriesRequest) Reset()
func (*GetCountriesRequest) String ¶
func (x *GetCountriesRequest) String() string
type GetCountriesResponse ¶
type GetCountriesResponse struct { Countries map[string]*Country `` /* 174-byte string literal not displayed */ // contains filtered or unexported fields }
GetCountriesResponse is the get countries response.
func (*GetCountriesResponse) Descriptor
deprecated
func (*GetCountriesResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetCountriesResponse.ProtoReflect.Descriptor instead.
func (*GetCountriesResponse) GetCountries ¶
func (x *GetCountriesResponse) GetCountries() map[string]*Country
func (*GetCountriesResponse) ProtoMessage ¶
func (*GetCountriesResponse) ProtoMessage()
func (*GetCountriesResponse) ProtoReflect ¶
func (x *GetCountriesResponse) ProtoReflect() protoreflect.Message
func (*GetCountriesResponse) Reset ¶
func (x *GetCountriesResponse) Reset()
func (*GetCountriesResponse) String ¶
func (x *GetCountriesResponse) String() string
type Message ¶
type Message struct { // Msg holds a message. Msg string `protobuf:"bytes,1,opt,name=Msg,json=msg,proto3" json:"msg,omitempty"` Code int32 `protobuf:"varint,2,opt,name=Code,json=code,proto3" json:"code,omitempty"` // contains filtered or unexported fields }
Message is a echo message.
func (*Message) Descriptor
deprecated
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type Status ¶
type Status int32
Status is a server health status.
func (Status) Descriptor ¶
func (Status) Descriptor() protoreflect.EnumDescriptor
func (Status) EnumDescriptor
deprecated
func (Status) Number ¶
func (x Status) Number() protoreflect.EnumNumber
func (Status) Type ¶
func (Status) Type() protoreflect.EnumType
type UnimplementedCountriesServer ¶
type UnimplementedCountriesServer struct{}
UnimplementedCountriesServer must be embedded to have forward compatible implementations.
func (UnimplementedCountriesServer) GetCountries ¶
func (UnimplementedCountriesServer) GetCountries(context.Context, *GetCountriesRequest) (*GetCountriesResponse, error)
type UnimplementedUtilServer ¶
type UnimplementedUtilServer struct{}
UnimplementedUtilServer must be embedded to have forward compatible implementations.
func (UnimplementedUtilServer) CheckStatus ¶
func (UnimplementedUtilServer) CheckStatus(context.Context, *emptypb.Empty) (*CheckStatusResponse, error)
type UnsafeCountriesServer ¶
type UnsafeCountriesServer interface {
// contains filtered or unexported methods
}
UnsafeCountriesServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CountriesServer will result in compilation errors.
type UnsafeUtilServer ¶
type UnsafeUtilServer interface {
// contains filtered or unexported methods
}
UnsafeUtilServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UtilServer will result in compilation errors.
type UtilClient ¶
type UtilClient interface { // CheckStatus returns the server health status. CheckStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CheckStatusResponse, error) // Echo echoes a message. Echo(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) }
UtilClient is the client API for Util 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 NewUtilClient ¶
func NewUtilClient(cc grpc.ClientConnInterface) UtilClient
type UtilServer ¶
type UtilServer interface { // CheckStatus returns the server health status. CheckStatus(context.Context, *emptypb.Empty) (*CheckStatusResponse, error) // Echo echoes a message. Echo(context.Context, *Message) (*Message, error) // contains filtered or unexported methods }
UtilServer is the server API for Util service. All implementations must embed UnimplementedUtilServer for forward compatibility