v1

package
v0.1.396 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_component_switch_v1_switch_proto protoreflect.FileDescriptor
View Source
var SwitchService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "viam.component.switch.v1.SwitchService",
	HandlerType: (*SwitchServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SetPosition",
			Handler:    _SwitchService_SetPosition_Handler,
		},
		{
			MethodName: "GetPosition",
			Handler:    _SwitchService_GetPosition_Handler,
		},
		{
			MethodName: "GetNumberOfPositions",
			Handler:    _SwitchService_GetNumberOfPositions_Handler,
		},
		{
			MethodName: "DoCommand",
			Handler:    _SwitchService_DoCommand_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "component/switch/v1/switch.proto",
}

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

Functions

func RegisterSwitchServiceHandler

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

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

func RegisterSwitchServiceHandlerClient

func RegisterSwitchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SwitchServiceClient) error

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

func RegisterSwitchServiceHandlerFromEndpoint

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

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

func RegisterSwitchServiceHandlerServer

func RegisterSwitchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SwitchServiceServer) error

RegisterSwitchServiceHandlerServer registers the http handlers for service SwitchService to "mux". UnaryRPC :call SwitchServiceServer 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 RegisterSwitchServiceHandlerFromEndpoint instead.

func RegisterSwitchServiceServer

func RegisterSwitchServiceServer(s grpc.ServiceRegistrar, srv SwitchServiceServer)

Types

type GetNumberOfPositionsRequest

type GetNumberOfPositionsRequest struct {
	Name  string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Extra *structpb.Struct `protobuf:"bytes,99,opt,name=extra,proto3" json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNumberOfPositionsRequest) Descriptor deprecated

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

Deprecated: Use GetNumberOfPositionsRequest.ProtoReflect.Descriptor instead.

func (*GetNumberOfPositionsRequest) GetExtra

func (*GetNumberOfPositionsRequest) GetName

func (x *GetNumberOfPositionsRequest) GetName() string

func (*GetNumberOfPositionsRequest) ProtoMessage

func (*GetNumberOfPositionsRequest) ProtoMessage()

func (*GetNumberOfPositionsRequest) ProtoReflect

func (*GetNumberOfPositionsRequest) Reset

func (x *GetNumberOfPositionsRequest) Reset()

func (*GetNumberOfPositionsRequest) String

func (x *GetNumberOfPositionsRequest) String() string

type GetNumberOfPositionsResponse

type GetNumberOfPositionsResponse struct {
	NumberOfPositions uint32 `protobuf:"varint,1,opt,name=number_of_positions,json=numberOfPositions,proto3" json:"number_of_positions,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNumberOfPositionsResponse) Descriptor deprecated

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

Deprecated: Use GetNumberOfPositionsResponse.ProtoReflect.Descriptor instead.

func (*GetNumberOfPositionsResponse) GetNumberOfPositions

func (x *GetNumberOfPositionsResponse) GetNumberOfPositions() uint32

func (*GetNumberOfPositionsResponse) ProtoMessage

func (*GetNumberOfPositionsResponse) ProtoMessage()

func (*GetNumberOfPositionsResponse) ProtoReflect

func (*GetNumberOfPositionsResponse) Reset

func (x *GetNumberOfPositionsResponse) Reset()

func (*GetNumberOfPositionsResponse) String

type GetPositionRequest

type GetPositionRequest struct {
	Name  string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Extra *structpb.Struct `protobuf:"bytes,99,opt,name=extra,proto3" json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPositionRequest) Descriptor deprecated

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

Deprecated: Use GetPositionRequest.ProtoReflect.Descriptor instead.

func (*GetPositionRequest) GetExtra

func (x *GetPositionRequest) GetExtra() *structpb.Struct

func (*GetPositionRequest) GetName

func (x *GetPositionRequest) GetName() string

func (*GetPositionRequest) ProtoMessage

func (*GetPositionRequest) ProtoMessage()

func (*GetPositionRequest) ProtoReflect

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

func (*GetPositionRequest) Reset

func (x *GetPositionRequest) Reset()

func (*GetPositionRequest) String

func (x *GetPositionRequest) String() string

type GetPositionResponse

type GetPositionResponse struct {
	Position uint32 `protobuf:"varint,1,opt,name=position,proto3" json:"position,omitempty"`
	// contains filtered or unexported fields
}

func (*GetPositionResponse) Descriptor deprecated

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

Deprecated: Use GetPositionResponse.ProtoReflect.Descriptor instead.

func (*GetPositionResponse) GetPosition

func (x *GetPositionResponse) GetPosition() uint32

func (*GetPositionResponse) ProtoMessage

func (*GetPositionResponse) ProtoMessage()

func (*GetPositionResponse) ProtoReflect

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

func (*GetPositionResponse) Reset

func (x *GetPositionResponse) Reset()

func (*GetPositionResponse) String

func (x *GetPositionResponse) String() string

type SetPositionRequest

type SetPositionRequest struct {
	Name     string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Position uint32           `protobuf:"varint,2,opt,name=position,proto3" json:"position,omitempty"`
	Extra    *structpb.Struct `protobuf:"bytes,99,opt,name=extra,proto3" json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func (*SetPositionRequest) Descriptor deprecated

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

Deprecated: Use SetPositionRequest.ProtoReflect.Descriptor instead.

func (*SetPositionRequest) GetExtra

func (x *SetPositionRequest) GetExtra() *structpb.Struct

func (*SetPositionRequest) GetName

func (x *SetPositionRequest) GetName() string

func (*SetPositionRequest) GetPosition

func (x *SetPositionRequest) GetPosition() uint32

func (*SetPositionRequest) ProtoMessage

func (*SetPositionRequest) ProtoMessage()

func (*SetPositionRequest) ProtoReflect

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

func (*SetPositionRequest) Reset

func (x *SetPositionRequest) Reset()

func (*SetPositionRequest) String

func (x *SetPositionRequest) String() string

type SetPositionResponse

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

func (*SetPositionResponse) Descriptor deprecated

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

Deprecated: Use SetPositionResponse.ProtoReflect.Descriptor instead.

func (*SetPositionResponse) ProtoMessage

func (*SetPositionResponse) ProtoMessage()

func (*SetPositionResponse) ProtoReflect

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

func (*SetPositionResponse) Reset

func (x *SetPositionResponse) Reset()

func (*SetPositionResponse) String

func (x *SetPositionResponse) String() string

type SwitchServiceClient

type SwitchServiceClient interface {
	// Set the position of the switch
	SetPosition(ctx context.Context, in *SetPositionRequest, opts ...grpc.CallOption) (*SetPositionResponse, error)
	// Get the position of the switch
	GetPosition(ctx context.Context, in *GetPositionRequest, opts ...grpc.CallOption) (*GetPositionResponse, error)
	// Get the number of positions that the switch supports
	GetNumberOfPositions(ctx context.Context, in *GetNumberOfPositionsRequest, opts ...grpc.CallOption) (*GetNumberOfPositionsResponse, error)
	// DoCommand sends/receives arbitrary commands
	DoCommand(ctx context.Context, in *v1.DoCommandRequest, opts ...grpc.CallOption) (*v1.DoCommandResponse, error)
}

SwitchServiceClient is the client API for SwitchService 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 SwitchServiceServer

type SwitchServiceServer interface {
	// Set the position of the switch
	SetPosition(context.Context, *SetPositionRequest) (*SetPositionResponse, error)
	// Get the position of the switch
	GetPosition(context.Context, *GetPositionRequest) (*GetPositionResponse, error)
	// Get the number of positions that the switch supports
	GetNumberOfPositions(context.Context, *GetNumberOfPositionsRequest) (*GetNumberOfPositionsResponse, error)
	// DoCommand sends/receives arbitrary commands
	DoCommand(context.Context, *v1.DoCommandRequest) (*v1.DoCommandResponse, error)
	// contains filtered or unexported methods
}

SwitchServiceServer is the server API for SwitchService service. All implementations must embed UnimplementedSwitchServiceServer for forward compatibility

type UnimplementedSwitchServiceServer

type UnimplementedSwitchServiceServer struct {
}

UnimplementedSwitchServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedSwitchServiceServer) DoCommand

func (UnimplementedSwitchServiceServer) GetPosition

func (UnimplementedSwitchServiceServer) SetPosition

type UnsafeSwitchServiceServer

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

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

Jump to

Keyboard shortcuts

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