Add ttrpc generated services
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
174
api/services/containers/v1/containers_ttrpc.pb.go
Normal file
174
api/services/containers/v1/containers_ttrpc.pb.go
Normal file
@@ -0,0 +1,174 @@
|
||||
// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
|
||||
// source: github.com/containerd/containerd/api/services/containers/v1/containers.proto
|
||||
package containers
|
||||
|
||||
import (
|
||||
context "context"
|
||||
ttrpc "github.com/containerd/ttrpc"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type TTRPCContainersService interface {
|
||||
Get(context.Context, *GetContainerRequest) (*GetContainerResponse, error)
|
||||
List(context.Context, *ListContainersRequest) (*ListContainersResponse, error)
|
||||
ListStream(context.Context, *ListContainersRequest, TTRPCContainers_ListStreamServer) error
|
||||
Create(context.Context, *CreateContainerRequest) (*CreateContainerResponse, error)
|
||||
Update(context.Context, *UpdateContainerRequest) (*UpdateContainerResponse, error)
|
||||
Delete(context.Context, *DeleteContainerRequest) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
type TTRPCContainers_ListStreamServer interface {
|
||||
Send(*ListContainerMessage) error
|
||||
ttrpc.StreamServer
|
||||
}
|
||||
|
||||
type ttrpccontainersListStreamServer struct {
|
||||
ttrpc.StreamServer
|
||||
}
|
||||
|
||||
func (x *ttrpccontainersListStreamServer) Send(m *ListContainerMessage) error {
|
||||
return x.StreamServer.SendMsg(m)
|
||||
}
|
||||
|
||||
func RegisterTTRPCContainersService(srv *ttrpc.Server, svc TTRPCContainersService) {
|
||||
srv.RegisterService("containerd.services.containers.v1.Containers", &ttrpc.ServiceDesc{
|
||||
Methods: map[string]ttrpc.Method{
|
||||
"Get": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req GetContainerRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Get(ctx, &req)
|
||||
},
|
||||
"List": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req ListContainersRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.List(ctx, &req)
|
||||
},
|
||||
"Create": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req CreateContainerRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Create(ctx, &req)
|
||||
},
|
||||
"Update": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req UpdateContainerRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Update(ctx, &req)
|
||||
},
|
||||
"Delete": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req DeleteContainerRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Delete(ctx, &req)
|
||||
},
|
||||
},
|
||||
Streams: map[string]ttrpc.Stream{
|
||||
"ListStream": {
|
||||
Handler: func(ctx context.Context, stream ttrpc.StreamServer) (interface{}, error) {
|
||||
m := new(ListContainersRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, svc.ListStream(ctx, m, &ttrpccontainersListStreamServer{stream})
|
||||
},
|
||||
StreamingClient: false,
|
||||
StreamingServer: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type TTRPCContainersClient interface {
|
||||
Get(context.Context, *GetContainerRequest) (*GetContainerResponse, error)
|
||||
List(context.Context, *ListContainersRequest) (*ListContainersResponse, error)
|
||||
ListStream(context.Context, *ListContainersRequest) (TTRPCContainers_ListStreamClient, error)
|
||||
Create(context.Context, *CreateContainerRequest) (*CreateContainerResponse, error)
|
||||
Update(context.Context, *UpdateContainerRequest) (*UpdateContainerResponse, error)
|
||||
Delete(context.Context, *DeleteContainerRequest) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
type ttrpccontainersClient struct {
|
||||
client *ttrpc.Client
|
||||
}
|
||||
|
||||
func NewTTRPCContainersClient(client *ttrpc.Client) TTRPCContainersClient {
|
||||
return &ttrpccontainersClient{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) Get(ctx context.Context, req *GetContainerRequest) (*GetContainerResponse, error) {
|
||||
var resp GetContainerResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.containers.v1.Containers", "Get", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) List(ctx context.Context, req *ListContainersRequest) (*ListContainersResponse, error) {
|
||||
var resp ListContainersResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.containers.v1.Containers", "List", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) ListStream(ctx context.Context, req *ListContainersRequest) (TTRPCContainers_ListStreamClient, error) {
|
||||
stream, err := c.client.NewStream(ctx, &ttrpc.StreamDesc{
|
||||
StreamingClient: false,
|
||||
StreamingServer: true,
|
||||
}, "containerd.services.containers.v1.Containers", "ListStream", req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &ttrpccontainersListStreamClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type TTRPCContainers_ListStreamClient interface {
|
||||
Recv() (*ListContainerMessage, error)
|
||||
ttrpc.ClientStream
|
||||
}
|
||||
|
||||
type ttrpccontainersListStreamClient struct {
|
||||
ttrpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *ttrpccontainersListStreamClient) Recv() (*ListContainerMessage, error) {
|
||||
m := new(ListContainerMessage)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) Create(ctx context.Context, req *CreateContainerRequest) (*CreateContainerResponse, error) {
|
||||
var resp CreateContainerResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.containers.v1.Containers", "Create", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) Update(ctx context.Context, req *UpdateContainerRequest) (*UpdateContainerResponse, error) {
|
||||
var resp UpdateContainerResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.containers.v1.Containers", "Update", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (c *ttrpccontainersClient) Delete(ctx context.Context, req *DeleteContainerRequest) (*emptypb.Empty, error) {
|
||||
var resp emptypb.Empty
|
||||
if err := c.client.Call(ctx, "containerd.services.containers.v1.Containers", "Delete", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
Reference in New Issue
Block a user