mirror of https://github.com/docker/compose.git
Merge pull request #24 from ulyssessouza/add-compose
Little fixes on client side and containers.proto
This commit is contained in:
commit
7802e4d1df
|
@ -11,6 +11,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||
protobuf-compiler \
|
||||
libprotobuf-dev
|
||||
RUN go get github.com/golang/protobuf/protoc-gen-go && \
|
||||
go get golang.org/x/tools/cmd/goimports && \
|
||||
go get gotest.tools/gotestsum
|
||||
WORKDIR ${PWD}
|
||||
ADD go.* ${PWD}
|
||||
|
@ -34,9 +35,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
|||
make xbins
|
||||
|
||||
FROM scratch AS protos
|
||||
COPY --from=make-protos /go/src/github.com/docker/api/backend/v1/*.pb.go ./backend/v1/
|
||||
COPY --from=make-protos /go/src/github.com/docker/api/compose/v1/*.pb.go ./compose/v1/
|
||||
COPY --from=make-protos /go/src/github.com/docker/api/cli/v1/*.pb.go ./cli/v1/
|
||||
COPY --from=make-protos /go/src/github.com/docker/api .
|
||||
|
||||
FROM scratch AS bins
|
||||
COPY --from=make-bins /go/src/github.com/docker/api/bin/* .
|
||||
|
|
1
Makefile
1
Makefile
|
@ -38,6 +38,7 @@ xbins: xcli xexample
|
|||
|
||||
protos:
|
||||
@protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
|
||||
@goimports -w -local github.com/docker/api .
|
||||
|
||||
cli: protos
|
||||
GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o bin/docker ./cli
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
//
|
||||
//Copyright (c) 2020 Docker Inc.
|
||||
//
|
||||
//Permission is hereby granted, free of charge, to any person
|
||||
//obtaining a copy of this software and associated documentation
|
||||
//files (the "Software"), to deal in the Software without
|
||||
//restriction, including without limitation the rights to use, copy,
|
||||
//modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
//of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//The above copyright notice and this permission notice shall be
|
||||
//included in all copies or substantial portions of the Software.
|
||||
//
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
//EXPRESS OR IMPLIED,
|
||||
//INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
//IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
//HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
//DAMAGES OR OTHER LIABILITY,
|
||||
//WHETHER IN AN ACTION OF CONTRACT,
|
||||
//TORT OR OTHERWISE,
|
||||
//ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
//THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.21.0-devel
|
||||
|
@ -8,15 +34,15 @@ package v1
|
|||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -30,6 +56,44 @@ const (
|
|||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type BackendInformationRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *BackendInformationRequest) Reset() {
|
||||
*x = BackendInformationRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BackendInformationRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BackendInformationRequest) ProtoMessage() {}
|
||||
|
||||
func (x *BackendInformationRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use BackendInformationRequest.ProtoReflect.Descriptor instead.
|
||||
func (*BackendInformationRequest) Descriptor() ([]byte, []int) {
|
||||
return file_backend_v1_backend_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type BackendInformationResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -41,7 +105,7 @@ type BackendInformationResponse struct {
|
|||
func (x *BackendInformationResponse) Reset() {
|
||||
*x = BackendInformationResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[0]
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -54,7 +118,7 @@ func (x *BackendInformationResponse) String() string {
|
|||
func (*BackendInformationResponse) ProtoMessage() {}
|
||||
|
||||
func (x *BackendInformationResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[0]
|
||||
mi := &file_backend_v1_backend_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -67,7 +131,7 @@ func (x *BackendInformationResponse) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use BackendInformationResponse.ProtoReflect.Descriptor instead.
|
||||
func (*BackendInformationResponse) Descriptor() ([]byte, []int) {
|
||||
return file_backend_v1_backend_proto_rawDescGZIP(), []int{0}
|
||||
return file_backend_v1_backend_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *BackendInformationResponse) GetId() string {
|
||||
|
@ -83,15 +147,17 @@ var file_backend_v1_backend_proto_rawDesc = []byte{
|
|||
0x0a, 0x18, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x61, 0x63,
|
||||
0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65,
|
||||
0x6e, 0x64, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x1a, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66,
|
||||
0x6e, 0x64, 0x2e, 0x76, 0x31, 0x22, 0x1b, 0x0a, 0x19, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x22, 0x2c, 0x0a, 0x1a, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||
0x32, 0x6e, 0x0a, 0x07, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x63, 0x0a, 0x12, 0x42,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x32, 0x8d, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x81, 0x01, 0x0a,
|
||||
0x12, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72,
|
||||
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x64, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65,
|
||||
0x6e, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
|
@ -112,14 +178,14 @@ func file_backend_v1_backend_proto_rawDescGZIP() []byte {
|
|||
return file_backend_v1_backend_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_backend_v1_backend_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_backend_v1_backend_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_backend_v1_backend_proto_goTypes = []interface{}{
|
||||
(*BackendInformationResponse)(nil), // 0: com.docker.api.backend.v1.BackendInformationResponse
|
||||
(*empty.Empty)(nil), // 1: google.protobuf.Empty
|
||||
(*BackendInformationRequest)(nil), // 0: com.docker.api.backend.v1.BackendInformationRequest
|
||||
(*BackendInformationResponse)(nil), // 1: com.docker.api.backend.v1.BackendInformationResponse
|
||||
}
|
||||
var file_backend_v1_backend_proto_depIdxs = []int32{
|
||||
1, // 0: com.docker.api.backend.v1.Backend.BackendInformation:input_type -> google.protobuf.Empty
|
||||
0, // 1: com.docker.api.backend.v1.Backend.BackendInformation:output_type -> com.docker.api.backend.v1.BackendInformationResponse
|
||||
0, // 0: com.docker.api.backend.v1.Backend.BackendInformation:input_type -> com.docker.api.backend.v1.BackendInformationRequest
|
||||
1, // 1: com.docker.api.backend.v1.Backend.BackendInformation:output_type -> com.docker.api.backend.v1.BackendInformationResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
|
@ -134,6 +200,18 @@ func file_backend_v1_backend_proto_init() {
|
|||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_backend_v1_backend_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BackendInformationRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_backend_v1_backend_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BackendInformationResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -152,7 +230,7 @@ func file_backend_v1_backend_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_backend_v1_backend_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
@ -179,7 +257,7 @@ const _ = grpc.SupportPackageIsVersion6
|
|||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type BackendClient interface {
|
||||
// BackendInformation returns implementation specific information on the backend.
|
||||
BackendInformation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*BackendInformationResponse, error)
|
||||
BackendInformation(ctx context.Context, in *BackendInformationRequest, opts ...grpc.CallOption) (*BackendInformationResponse, error)
|
||||
}
|
||||
|
||||
type backendClient struct {
|
||||
|
@ -190,7 +268,7 @@ func NewBackendClient(cc grpc.ClientConnInterface) BackendClient {
|
|||
return &backendClient{cc}
|
||||
}
|
||||
|
||||
func (c *backendClient) BackendInformation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*BackendInformationResponse, error) {
|
||||
func (c *backendClient) BackendInformation(ctx context.Context, in *BackendInformationRequest, opts ...grpc.CallOption) (*BackendInformationResponse, error) {
|
||||
out := new(BackendInformationResponse)
|
||||
err := c.cc.Invoke(ctx, "/com.docker.api.backend.v1.Backend/BackendInformation", in, out, opts...)
|
||||
if err != nil {
|
||||
|
@ -202,14 +280,14 @@ func (c *backendClient) BackendInformation(ctx context.Context, in *empty.Empty,
|
|||
// BackendServer is the server API for Backend service.
|
||||
type BackendServer interface {
|
||||
// BackendInformation returns implementation specific information on the backend.
|
||||
BackendInformation(context.Context, *empty.Empty) (*BackendInformationResponse, error)
|
||||
BackendInformation(context.Context, *BackendInformationRequest) (*BackendInformationResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedBackendServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedBackendServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedBackendServer) BackendInformation(context.Context, *empty.Empty) (*BackendInformationResponse, error) {
|
||||
func (*UnimplementedBackendServer) BackendInformation(context.Context, *BackendInformationRequest) (*BackendInformationResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BackendInformation not implemented")
|
||||
}
|
||||
|
||||
|
@ -218,7 +296,7 @@ func RegisterBackendServer(s *grpc.Server, srv BackendServer) {
|
|||
}
|
||||
|
||||
func _Backend_BackendInformation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(empty.Empty)
|
||||
in := new(BackendInformationRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -230,7 +308,7 @@ func _Backend_BackendInformation_Handler(srv interface{}, ctx context.Context, d
|
|||
FullMethod: "/com.docker.api.backend.v1.Backend/BackendInformation",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BackendServer).BackendInformation(ctx, req.(*empty.Empty))
|
||||
return srv.(BackendServer).BackendInformation(ctx, req.(*BackendInformationRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
|
@ -1,14 +1,42 @@
|
|||
/*
|
||||
Copyright (c) 2020 Docker Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package com.docker.api.backend.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "github.com/docker/api/backend/v1;v1";
|
||||
|
||||
service Backend {
|
||||
// BackendInformation returns implementation specific information on the backend.
|
||||
rpc BackendInformation(google.protobuf.Empty) returns (BackendInformationResponse);
|
||||
rpc BackendInformation(BackendInformationRequest) returns (BackendInformationResponse);
|
||||
}
|
||||
|
||||
message BackendInformationRequest {
|
||||
}
|
||||
|
||||
message BackendInformationResponse {
|
||||
|
|
|
@ -33,8 +33,9 @@ import (
|
|||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/context/store"
|
||||
)
|
||||
|
||||
type CliContext struct {
|
||||
|
|
|
@ -32,10 +32,11 @@ import (
|
|||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
v1 "github.com/docker/api/backend/v1"
|
||||
"github.com/docker/api/client"
|
||||
)
|
||||
|
||||
var ExampleCommand = cobra.Command{
|
||||
|
@ -49,7 +50,7 @@ var ExampleCommand = cobra.Command{
|
|||
return errors.Wrap(err, "cannot connect to backend")
|
||||
}
|
||||
|
||||
info, err := c.BackendInformation(ctx, &empty.Empty{})
|
||||
info, err := c.BackendInformation(ctx, &v1.BackendInformationRequest{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetch backend information")
|
||||
}
|
||||
|
|
|
@ -5,9 +5,10 @@ import (
|
|||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
)
|
||||
|
||||
var PsCommand = cobra.Command{
|
||||
|
|
|
@ -4,13 +4,14 @@ import (
|
|||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
cliv1 "github.com/docker/api/cli/v1"
|
||||
containersv1 "github.com/docker/api/containers/v1"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/server"
|
||||
"github.com/docker/api/server/proxy"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
|
|
@ -40,12 +40,13 @@ import (
|
|||
_ "github.com/docker/api/azure"
|
||||
_ "github.com/docker/api/example"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/api/cli/cmd"
|
||||
apicontext "github.com/docker/api/context"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type mainOpts struct {
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
//
|
||||
//Copyright (c) 2020 Docker Inc.
|
||||
//
|
||||
//Permission is hereby granted, free of charge, to any person
|
||||
//obtaining a copy of this software and associated documentation
|
||||
//files (the "Software"), to deal in the Software without
|
||||
//restriction, including without limitation the rights to use, copy,
|
||||
//modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
//of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//The above copyright notice and this permission notice shall be
|
||||
//included in all copies or substantial portions of the Software.
|
||||
//
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
//EXPRESS OR IMPLIED,
|
||||
//INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
//IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
//HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
//DAMAGES OR OTHER LIABILITY,
|
||||
//WHETHER IN AN ACTION OF CONTRACT,
|
||||
//TORT OR OTHERWISE,
|
||||
//ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
//THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.21.0-devel
|
||||
|
@ -8,14 +34,15 @@ package v1
|
|||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
/*
|
||||
Copyright (c) 2020 Docker Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package com.docker.api.cli.v1;
|
||||
|
||||
|
||||
option go_package = "github.com/docker/api/cli/v1;v1";
|
||||
|
||||
service Cli {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright (c) 2020 Docker Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package v1
|
|
@ -32,8 +32,11 @@ import (
|
|||
"errors"
|
||||
|
||||
"github.com/docker/api/backend"
|
||||
v1 "github.com/docker/api/backend/v1"
|
||||
backendv1 "github.com/docker/api/backend/v1"
|
||||
cliv1 "github.com/docker/api/cli/v1"
|
||||
composev1 "github.com/docker/api/compose/v1"
|
||||
"github.com/docker/api/containers"
|
||||
containersv1 "github.com/docker/api/containers/v1"
|
||||
apicontext "github.com/docker/api/context"
|
||||
"github.com/docker/api/context/store"
|
||||
)
|
||||
|
@ -54,17 +57,23 @@ func New(ctx context.Context) (*Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if ba, ok := b.(containers.ContainerService); ok {
|
||||
return &Client{
|
||||
backendType: contextType,
|
||||
cc: ba,
|
||||
}, nil
|
||||
ba, ok := b.(containers.ContainerService)
|
||||
if !ok {
|
||||
return nil, errors.New("backend not found")
|
||||
}
|
||||
return nil, errors.New("backend not found")
|
||||
return &Client{
|
||||
backendType: contextType,
|
||||
cc: ba,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
v1.BackendClient
|
||||
backendv1.BackendClient
|
||||
cliv1.CliClient
|
||||
containersv1.ContainersClient
|
||||
composev1.ComposeClient
|
||||
|
||||
backendType string
|
||||
cc containers.ContainerService
|
||||
}
|
||||
|
|
|
@ -34,14 +34,15 @@ package v1
|
|||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,43 @@
|
|||
/*
|
||||
Copyright (c) 2020 Docker Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package com.docker.container.v1;
|
||||
package com.docker.api.containers.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "github.com/docker/d2/api/containers/v1;v1";
|
||||
option go_package = "github.com/docker/api/containers/v1;v1";
|
||||
|
||||
service Containers {
|
||||
rpc List(ListRequest) returns (ListResponse);
|
||||
rpc Create(CreateRequest) returns (CreateResponse);
|
||||
rpc Start(StartRequest) returns (StartResponse);
|
||||
rpc Stop(StopRequest) returns (google.protobuf.Empty);
|
||||
rpc Kill(KillRequest) returns (google.protobuf.Empty);
|
||||
rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
|
||||
rpc Stop(StopRequest) returns (StopResponse);
|
||||
rpc Kill(KillRequest) returns (KillResponse);
|
||||
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
||||
rpc Update(UpdateRequest) returns (UpdateResponse);
|
||||
rpc Exec(ExecRequest) returns (ExecResponse);
|
||||
}
|
||||
|
@ -71,6 +96,9 @@ message DeleteRequest {
|
|||
bool force = 2;
|
||||
}
|
||||
|
||||
message DeleteResponse {
|
||||
}
|
||||
|
||||
message StartRequest {
|
||||
string id = 1;
|
||||
string stream_id = 2;
|
||||
|
@ -85,6 +113,10 @@ message StopRequest {
|
|||
int64 signal = 2;
|
||||
}
|
||||
|
||||
message StopResponse {
|
||||
}
|
||||
|
||||
|
||||
message ExecRequest {
|
||||
string id = 1;
|
||||
string stream_id = 2;
|
||||
|
@ -103,6 +135,9 @@ message KillRequest {
|
|||
int64 signal = 2;
|
||||
}
|
||||
|
||||
message KillResponse {
|
||||
}
|
||||
|
||||
message ListRequest {
|
||||
repeated string filters = 1;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/docker/api/client"
|
||||
v1 "github.com/docker/api/containers/v1"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
)
|
||||
|
||||
type clientKey struct{}
|
||||
|
@ -54,15 +53,15 @@ func (p *proxyContainerApi) Start(_ context.Context, _ *v1.StartRequest) (*v1.St
|
|||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (p *proxyContainerApi) Stop(_ context.Context, _ *v1.StopRequest) (*empty.Empty, error) {
|
||||
func (p *proxyContainerApi) Stop(_ context.Context, _ *v1.StopRequest) (*v1.StopResponse, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (p *proxyContainerApi) Kill(_ context.Context, _ *v1.KillRequest) (*empty.Empty, error) {
|
||||
func (p *proxyContainerApi) Kill(_ context.Context, _ *v1.KillRequest) (*v1.KillResponse, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (p *proxyContainerApi) Delete(_ context.Context, _ *v1.DeleteRequest) (*empty.Empty, error) {
|
||||
func (p *proxyContainerApi) Delete(_ context.Context, _ *v1.DeleteRequest) (*v1.DeleteResponse, error) {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
|
|
|
@ -31,15 +31,16 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
apicontext "github.com/docker/api/context"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/server/proxy"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/health"
|
||||
"google.golang.org/grpc/health/grpc_health_v1"
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
apicontext "github.com/docker/api/context"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/server/proxy"
|
||||
)
|
||||
|
||||
// New returns a new GRPC server.
|
||||
|
|
Loading…
Reference in New Issue