Documentation ¶
Overview ¶
Package versionpb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func IsCompatible(rawClient, rawServer *Version) error
- func RegisterAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIClient) error
- func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server APIServer) error
- func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)
- type APIClient
- type APIServer
- type UnimplementedAPIServer
- type UnsafeAPIServer
- type Version
- func (v *Version) Canonical() string
- func (*Version) Descriptor() ([]byte, []int)deprecated
- func (x *Version) GetAdditional() string
- func (x *Version) GetBuildDate() string
- func (x *Version) GetGitCommit() string
- func (x *Version) GetGitTreeModified() string
- func (x *Version) GetGoVersion() string
- func (x *Version) GetMajor() uint32
- func (x *Version) GetMicro() uint32
- func (x *Version) GetMinor() uint32
- func (x *Version) GetPlatform() string
- func (v *Version) IsDevelopment() bool
- func (x *Version) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (*Version) ProtoMessage()
- func (x *Version) ProtoReflect() protoreflect.Message
- func (x *Version) Reset()
- func (x *Version) String() string
- func (m *Version) Validate() error
- func (m *Version) ValidateAll() error
- type VersionMultiError
- type VersionValidationError
Constants ¶
const (
API_GetVersion_FullMethodName = "/versionpb_v2.API/GetVersion"
)
Variables ¶
var ( ErrClientIsNil = errors.New("client version is missing") ErrServerIsNil = errors.New("server version is nil") ErrClientTooOld = errors.New("client is outdated") ErrServerTooOld = errors.New("server is outdated") ErrIncompatiblePreview = errors.New("client and server versions must match exactly") )
var API_ServiceDesc = grpc.ServiceDesc{ ServiceName: "versionpb_v2.API", HandlerType: (*APIServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetVersion", Handler: _API_GetVersion_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "version/versionpb/version.proto", }
API_ServiceDesc is the grpc.ServiceDesc for API service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_version_versionpb_version_proto protoreflect.FileDescriptor
Functions ¶
func IsCompatible ¶
IsCompatible determines if two versions are compatible. Versions are compatible if the versions are identical or one version is a development build, or if either the server or client are not prereleases, then the major and minor numbers are identical.
func RegisterAPIHandler ¶ added in v2.8.0
RegisterAPIHandler registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAPIHandlerClient ¶ added in v2.8.0
RegisterAPIHandlerClient registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "APIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "APIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "APIClient" to call the correct interceptors.
func RegisterAPIHandlerFromEndpoint ¶ added in v2.8.0
func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAPIHandlerFromEndpoint is same as RegisterAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAPIHandlerServer ¶ added in v2.8.0
RegisterAPIHandlerServer registers the http handlers for service API to "mux". UnaryRPC :call APIServer 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 RegisterAPIHandlerFromEndpoint instead.
func RegisterAPIServer ¶
func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)
Types ¶
type APIClient ¶
type APIClient interface {
GetVersion(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Version, error)
}
APIClient is the client API for API 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 NewAPIClient ¶
func NewAPIClient(cc grpc.ClientConnInterface) APIClient
type APIServer ¶
type APIServer interface { GetVersion(context.Context, *emptypb.Empty) (*Version, error) // contains filtered or unexported methods }
APIServer is the server API for API service. All implementations must embed UnimplementedAPIServer for forward compatibility
type UnimplementedAPIServer ¶
type UnimplementedAPIServer struct { }
UnimplementedAPIServer must be embedded to have forward compatible implementations.
func (UnimplementedAPIServer) GetVersion ¶
type UnsafeAPIServer ¶ added in v2.7.0
type UnsafeAPIServer interface {
// contains filtered or unexported methods
}
UnsafeAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to APIServer will result in compilation errors.
type Version ¶
type Version struct { Major uint32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` Minor uint32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` Micro uint32 `protobuf:"varint,3,opt,name=micro,proto3" json:"micro,omitempty"` Additional string `protobuf:"bytes,4,opt,name=additional,proto3" json:"additional,omitempty"` GitCommit string `protobuf:"bytes,5,opt,name=git_commit,json=gitCommit,proto3" json:"git_commit,omitempty"` GitTreeModified string `protobuf:"bytes,6,opt,name=git_tree_modified,json=gitTreeModified,proto3" json:"git_tree_modified,omitempty"` BuildDate string `protobuf:"bytes,7,opt,name=build_date,json=buildDate,proto3" json:"build_date,omitempty"` GoVersion string `protobuf:"bytes,8,opt,name=go_version,json=goVersion,proto3" json:"go_version,omitempty"` Platform string `protobuf:"bytes,9,opt,name=platform,proto3" json:"platform,omitempty"` // contains filtered or unexported fields }
func (*Version) Canonical ¶
Canonical returns the version in canonical semver form, according to golang.org/x/mod/semver.
func (*Version) Descriptor
deprecated
func (*Version) GetAdditional ¶
func (*Version) GetBuildDate ¶
func (*Version) GetGitCommit ¶
func (*Version) GetGitTreeModified ¶
func (*Version) GetGoVersion ¶
func (*Version) GetPlatform ¶
func (*Version) IsDevelopment ¶
IsDevelopment returns true if the version is from a local unreleased build.
func (*Version) MarshalLogObject ¶
func (x *Version) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) ProtoReflect ¶ added in v2.7.0
func (x *Version) ProtoReflect() protoreflect.Message
func (*Version) Validate ¶ added in v2.8.0
Validate checks the field values on Version 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 (*Version) ValidateAll ¶ added in v2.8.0
ValidateAll checks the field values on Version 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 VersionMultiError, or nil if none found.
type VersionMultiError ¶ added in v2.8.0
type VersionMultiError []error
VersionMultiError is an error wrapping multiple validation errors returned by Version.ValidateAll() if the designated constraints aren't met.
func (VersionMultiError) AllErrors ¶ added in v2.8.0
func (m VersionMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (VersionMultiError) Error ¶ added in v2.8.0
func (m VersionMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type VersionValidationError ¶ added in v2.8.0
type VersionValidationError struct {
// contains filtered or unexported fields
}
VersionValidationError is the validation error returned by Version.Validate if the designated constraints aren't met.
func (VersionValidationError) Cause ¶ added in v2.8.0
func (e VersionValidationError) Cause() error
Cause function returns cause value.
func (VersionValidationError) Error ¶ added in v2.8.0
func (e VersionValidationError) Error() string
Error satisfies the builtin error interface
func (VersionValidationError) ErrorName ¶ added in v2.8.0
func (e VersionValidationError) ErrorName() string
ErrorName returns error name.
func (VersionValidationError) Field ¶ added in v2.8.0
func (e VersionValidationError) Field() string
Field function returns field value.
func (VersionValidationError) Key ¶ added in v2.8.0
func (e VersionValidationError) Key() bool
Key function returns key value.
func (VersionValidationError) Reason ¶ added in v2.8.0
func (e VersionValidationError) Reason() string
Reason function returns reason value.