Tizen_4.0 base
[platform/upstream/docker-engine.git] / vendor / github.com / docker / swarmkit / api / resource.pb.go
1 // Code generated by protoc-gen-gogo.
2 // source: resource.proto
3 // DO NOT EDIT!
4
5 package api
6
7 import proto "github.com/gogo/protobuf/proto"
8 import fmt "fmt"
9 import math "math"
10 import _ "github.com/gogo/protobuf/gogoproto"
11 import _ "github.com/docker/swarmkit/protobuf/plugin"
12
13 import github_com_docker_swarmkit_api_deepcopy "github.com/docker/swarmkit/api/deepcopy"
14
15 import (
16         context "golang.org/x/net/context"
17         grpc "google.golang.org/grpc"
18 )
19
20 import raftselector "github.com/docker/swarmkit/manager/raftselector"
21 import codes "google.golang.org/grpc/codes"
22 import metadata "google.golang.org/grpc/metadata"
23 import transport "google.golang.org/grpc/transport"
24 import rafttime "time"
25
26 import strings "strings"
27 import reflect "reflect"
28
29 import io "io"
30
31 // Reference imports to suppress errors if they are not otherwise used.
32 var _ = proto.Marshal
33 var _ = fmt.Errorf
34 var _ = math.Inf
35
36 type AttachNetworkRequest struct {
37         Config      *NetworkAttachmentConfig `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"`
38         ContainerID string                   `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
39 }
40
41 func (m *AttachNetworkRequest) Reset()                    { *m = AttachNetworkRequest{} }
42 func (*AttachNetworkRequest) ProtoMessage()               {}
43 func (*AttachNetworkRequest) Descriptor() ([]byte, []int) { return fileDescriptorResource, []int{0} }
44
45 type AttachNetworkResponse struct {
46         AttachmentID string `protobuf:"bytes,1,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"`
47 }
48
49 func (m *AttachNetworkResponse) Reset()                    { *m = AttachNetworkResponse{} }
50 func (*AttachNetworkResponse) ProtoMessage()               {}
51 func (*AttachNetworkResponse) Descriptor() ([]byte, []int) { return fileDescriptorResource, []int{1} }
52
53 type DetachNetworkRequest struct {
54         AttachmentID string `protobuf:"bytes,1,opt,name=attachment_id,json=attachmentId,proto3" json:"attachment_id,omitempty"`
55 }
56
57 func (m *DetachNetworkRequest) Reset()                    { *m = DetachNetworkRequest{} }
58 func (*DetachNetworkRequest) ProtoMessage()               {}
59 func (*DetachNetworkRequest) Descriptor() ([]byte, []int) { return fileDescriptorResource, []int{2} }
60
61 type DetachNetworkResponse struct {
62 }
63
64 func (m *DetachNetworkResponse) Reset()                    { *m = DetachNetworkResponse{} }
65 func (*DetachNetworkResponse) ProtoMessage()               {}
66 func (*DetachNetworkResponse) Descriptor() ([]byte, []int) { return fileDescriptorResource, []int{3} }
67
68 func init() {
69         proto.RegisterType((*AttachNetworkRequest)(nil), "docker.swarmkit.v1.AttachNetworkRequest")
70         proto.RegisterType((*AttachNetworkResponse)(nil), "docker.swarmkit.v1.AttachNetworkResponse")
71         proto.RegisterType((*DetachNetworkRequest)(nil), "docker.swarmkit.v1.DetachNetworkRequest")
72         proto.RegisterType((*DetachNetworkResponse)(nil), "docker.swarmkit.v1.DetachNetworkResponse")
73 }
74
75 type authenticatedWrapperResourceAllocatorServer struct {
76         local     ResourceAllocatorServer
77         authorize func(context.Context, []string) error
78 }
79
80 func NewAuthenticatedWrapperResourceAllocatorServer(local ResourceAllocatorServer, authorize func(context.Context, []string) error) ResourceAllocatorServer {
81         return &authenticatedWrapperResourceAllocatorServer{
82                 local:     local,
83                 authorize: authorize,
84         }
85 }
86
87 func (p *authenticatedWrapperResourceAllocatorServer) AttachNetwork(ctx context.Context, r *AttachNetworkRequest) (*AttachNetworkResponse, error) {
88
89         if err := p.authorize(ctx, []string{"swarm-worker", "swarm-manager"}); err != nil {
90                 return nil, err
91         }
92         return p.local.AttachNetwork(ctx, r)
93 }
94
95 func (p *authenticatedWrapperResourceAllocatorServer) DetachNetwork(ctx context.Context, r *DetachNetworkRequest) (*DetachNetworkResponse, error) {
96
97         if err := p.authorize(ctx, []string{"swarm-worker", "swarm-manager"}); err != nil {
98                 return nil, err
99         }
100         return p.local.DetachNetwork(ctx, r)
101 }
102
103 func (m *AttachNetworkRequest) Copy() *AttachNetworkRequest {
104         if m == nil {
105                 return nil
106         }
107         o := &AttachNetworkRequest{}
108         o.CopyFrom(m)
109         return o
110 }
111
112 func (m *AttachNetworkRequest) CopyFrom(src interface{}) {
113
114         o := src.(*AttachNetworkRequest)
115         *m = *o
116         if o.Config != nil {
117                 m.Config = &NetworkAttachmentConfig{}
118                 github_com_docker_swarmkit_api_deepcopy.Copy(m.Config, o.Config)
119         }
120 }
121
122 func (m *AttachNetworkResponse) Copy() *AttachNetworkResponse {
123         if m == nil {
124                 return nil
125         }
126         o := &AttachNetworkResponse{}
127         o.CopyFrom(m)
128         return o
129 }
130
131 func (m *AttachNetworkResponse) CopyFrom(src interface{}) {
132
133         o := src.(*AttachNetworkResponse)
134         *m = *o
135 }
136
137 func (m *DetachNetworkRequest) Copy() *DetachNetworkRequest {
138         if m == nil {
139                 return nil
140         }
141         o := &DetachNetworkRequest{}
142         o.CopyFrom(m)
143         return o
144 }
145
146 func (m *DetachNetworkRequest) CopyFrom(src interface{}) {
147
148         o := src.(*DetachNetworkRequest)
149         *m = *o
150 }
151
152 func (m *DetachNetworkResponse) Copy() *DetachNetworkResponse {
153         if m == nil {
154                 return nil
155         }
156         o := &DetachNetworkResponse{}
157         o.CopyFrom(m)
158         return o
159 }
160
161 func (m *DetachNetworkResponse) CopyFrom(src interface{}) {}
162
163 // Reference imports to suppress errors if they are not otherwise used.
164 var _ context.Context
165 var _ grpc.ClientConn
166
167 // This is a compile-time assertion to ensure that this generated file
168 // is compatible with the grpc package it is being compiled against.
169 const _ = grpc.SupportPackageIsVersion4
170
171 // Client API for ResourceAllocator service
172
173 type ResourceAllocatorClient interface {
174         AttachNetwork(ctx context.Context, in *AttachNetworkRequest, opts ...grpc.CallOption) (*AttachNetworkResponse, error)
175         DetachNetwork(ctx context.Context, in *DetachNetworkRequest, opts ...grpc.CallOption) (*DetachNetworkResponse, error)
176 }
177
178 type resourceAllocatorClient struct {
179         cc *grpc.ClientConn
180 }
181
182 func NewResourceAllocatorClient(cc *grpc.ClientConn) ResourceAllocatorClient {
183         return &resourceAllocatorClient{cc}
184 }
185
186 func (c *resourceAllocatorClient) AttachNetwork(ctx context.Context, in *AttachNetworkRequest, opts ...grpc.CallOption) (*AttachNetworkResponse, error) {
187         out := new(AttachNetworkResponse)
188         err := grpc.Invoke(ctx, "/docker.swarmkit.v1.ResourceAllocator/AttachNetwork", in, out, c.cc, opts...)
189         if err != nil {
190                 return nil, err
191         }
192         return out, nil
193 }
194
195 func (c *resourceAllocatorClient) DetachNetwork(ctx context.Context, in *DetachNetworkRequest, opts ...grpc.CallOption) (*DetachNetworkResponse, error) {
196         out := new(DetachNetworkResponse)
197         err := grpc.Invoke(ctx, "/docker.swarmkit.v1.ResourceAllocator/DetachNetwork", in, out, c.cc, opts...)
198         if err != nil {
199                 return nil, err
200         }
201         return out, nil
202 }
203
204 // Server API for ResourceAllocator service
205
206 type ResourceAllocatorServer interface {
207         AttachNetwork(context.Context, *AttachNetworkRequest) (*AttachNetworkResponse, error)
208         DetachNetwork(context.Context, *DetachNetworkRequest) (*DetachNetworkResponse, error)
209 }
210
211 func RegisterResourceAllocatorServer(s *grpc.Server, srv ResourceAllocatorServer) {
212         s.RegisterService(&_ResourceAllocator_serviceDesc, srv)
213 }
214
215 func _ResourceAllocator_AttachNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
216         in := new(AttachNetworkRequest)
217         if err := dec(in); err != nil {
218                 return nil, err
219         }
220         if interceptor == nil {
221                 return srv.(ResourceAllocatorServer).AttachNetwork(ctx, in)
222         }
223         info := &grpc.UnaryServerInfo{
224                 Server:     srv,
225                 FullMethod: "/docker.swarmkit.v1.ResourceAllocator/AttachNetwork",
226         }
227         handler := func(ctx context.Context, req interface{}) (interface{}, error) {
228                 return srv.(ResourceAllocatorServer).AttachNetwork(ctx, req.(*AttachNetworkRequest))
229         }
230         return interceptor(ctx, in, info, handler)
231 }
232
233 func _ResourceAllocator_DetachNetwork_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
234         in := new(DetachNetworkRequest)
235         if err := dec(in); err != nil {
236                 return nil, err
237         }
238         if interceptor == nil {
239                 return srv.(ResourceAllocatorServer).DetachNetwork(ctx, in)
240         }
241         info := &grpc.UnaryServerInfo{
242                 Server:     srv,
243                 FullMethod: "/docker.swarmkit.v1.ResourceAllocator/DetachNetwork",
244         }
245         handler := func(ctx context.Context, req interface{}) (interface{}, error) {
246                 return srv.(ResourceAllocatorServer).DetachNetwork(ctx, req.(*DetachNetworkRequest))
247         }
248         return interceptor(ctx, in, info, handler)
249 }
250
251 var _ResourceAllocator_serviceDesc = grpc.ServiceDesc{
252         ServiceName: "docker.swarmkit.v1.ResourceAllocator",
253         HandlerType: (*ResourceAllocatorServer)(nil),
254         Methods: []grpc.MethodDesc{
255                 {
256                         MethodName: "AttachNetwork",
257                         Handler:    _ResourceAllocator_AttachNetwork_Handler,
258                 },
259                 {
260                         MethodName: "DetachNetwork",
261                         Handler:    _ResourceAllocator_DetachNetwork_Handler,
262                 },
263         },
264         Streams:  []grpc.StreamDesc{},
265         Metadata: "resource.proto",
266 }
267
268 func (m *AttachNetworkRequest) Marshal() (dAtA []byte, err error) {
269         size := m.Size()
270         dAtA = make([]byte, size)
271         n, err := m.MarshalTo(dAtA)
272         if err != nil {
273                 return nil, err
274         }
275         return dAtA[:n], nil
276 }
277
278 func (m *AttachNetworkRequest) MarshalTo(dAtA []byte) (int, error) {
279         var i int
280         _ = i
281         var l int
282         _ = l
283         if m.Config != nil {
284                 dAtA[i] = 0xa
285                 i++
286                 i = encodeVarintResource(dAtA, i, uint64(m.Config.Size()))
287                 n1, err := m.Config.MarshalTo(dAtA[i:])
288                 if err != nil {
289                         return 0, err
290                 }
291                 i += n1
292         }
293         if len(m.ContainerID) > 0 {
294                 dAtA[i] = 0x12
295                 i++
296                 i = encodeVarintResource(dAtA, i, uint64(len(m.ContainerID)))
297                 i += copy(dAtA[i:], m.ContainerID)
298         }
299         return i, nil
300 }
301
302 func (m *AttachNetworkResponse) Marshal() (dAtA []byte, err error) {
303         size := m.Size()
304         dAtA = make([]byte, size)
305         n, err := m.MarshalTo(dAtA)
306         if err != nil {
307                 return nil, err
308         }
309         return dAtA[:n], nil
310 }
311
312 func (m *AttachNetworkResponse) MarshalTo(dAtA []byte) (int, error) {
313         var i int
314         _ = i
315         var l int
316         _ = l
317         if len(m.AttachmentID) > 0 {
318                 dAtA[i] = 0xa
319                 i++
320                 i = encodeVarintResource(dAtA, i, uint64(len(m.AttachmentID)))
321                 i += copy(dAtA[i:], m.AttachmentID)
322         }
323         return i, nil
324 }
325
326 func (m *DetachNetworkRequest) Marshal() (dAtA []byte, err error) {
327         size := m.Size()
328         dAtA = make([]byte, size)
329         n, err := m.MarshalTo(dAtA)
330         if err != nil {
331                 return nil, err
332         }
333         return dAtA[:n], nil
334 }
335
336 func (m *DetachNetworkRequest) MarshalTo(dAtA []byte) (int, error) {
337         var i int
338         _ = i
339         var l int
340         _ = l
341         if len(m.AttachmentID) > 0 {
342                 dAtA[i] = 0xa
343                 i++
344                 i = encodeVarintResource(dAtA, i, uint64(len(m.AttachmentID)))
345                 i += copy(dAtA[i:], m.AttachmentID)
346         }
347         return i, nil
348 }
349
350 func (m *DetachNetworkResponse) Marshal() (dAtA []byte, err error) {
351         size := m.Size()
352         dAtA = make([]byte, size)
353         n, err := m.MarshalTo(dAtA)
354         if err != nil {
355                 return nil, err
356         }
357         return dAtA[:n], nil
358 }
359
360 func (m *DetachNetworkResponse) MarshalTo(dAtA []byte) (int, error) {
361         var i int
362         _ = i
363         var l int
364         _ = l
365         return i, nil
366 }
367
368 func encodeFixed64Resource(dAtA []byte, offset int, v uint64) int {
369         dAtA[offset] = uint8(v)
370         dAtA[offset+1] = uint8(v >> 8)
371         dAtA[offset+2] = uint8(v >> 16)
372         dAtA[offset+3] = uint8(v >> 24)
373         dAtA[offset+4] = uint8(v >> 32)
374         dAtA[offset+5] = uint8(v >> 40)
375         dAtA[offset+6] = uint8(v >> 48)
376         dAtA[offset+7] = uint8(v >> 56)
377         return offset + 8
378 }
379 func encodeFixed32Resource(dAtA []byte, offset int, v uint32) int {
380         dAtA[offset] = uint8(v)
381         dAtA[offset+1] = uint8(v >> 8)
382         dAtA[offset+2] = uint8(v >> 16)
383         dAtA[offset+3] = uint8(v >> 24)
384         return offset + 4
385 }
386 func encodeVarintResource(dAtA []byte, offset int, v uint64) int {
387         for v >= 1<<7 {
388                 dAtA[offset] = uint8(v&0x7f | 0x80)
389                 v >>= 7
390                 offset++
391         }
392         dAtA[offset] = uint8(v)
393         return offset + 1
394 }
395
396 type raftProxyResourceAllocatorServer struct {
397         local                       ResourceAllocatorServer
398         connSelector                raftselector.ConnProvider
399         localCtxMods, remoteCtxMods []func(context.Context) (context.Context, error)
400 }
401
402 func NewRaftProxyResourceAllocatorServer(local ResourceAllocatorServer, connSelector raftselector.ConnProvider, localCtxMod, remoteCtxMod func(context.Context) (context.Context, error)) ResourceAllocatorServer {
403         redirectChecker := func(ctx context.Context) (context.Context, error) {
404                 s, ok := transport.StreamFromContext(ctx)
405                 if !ok {
406                         return ctx, grpc.Errorf(codes.InvalidArgument, "remote addr is not found in context")
407                 }
408                 addr := s.ServerTransport().RemoteAddr().String()
409                 md, ok := metadata.FromContext(ctx)
410                 if ok && len(md["redirect"]) != 0 {
411                         return ctx, grpc.Errorf(codes.ResourceExhausted, "more than one redirect to leader from: %s", md["redirect"])
412                 }
413                 if !ok {
414                         md = metadata.New(map[string]string{})
415                 }
416                 md["redirect"] = append(md["redirect"], addr)
417                 return metadata.NewContext(ctx, md), nil
418         }
419         remoteMods := []func(context.Context) (context.Context, error){redirectChecker}
420         remoteMods = append(remoteMods, remoteCtxMod)
421
422         var localMods []func(context.Context) (context.Context, error)
423         if localCtxMod != nil {
424                 localMods = []func(context.Context) (context.Context, error){localCtxMod}
425         }
426
427         return &raftProxyResourceAllocatorServer{
428                 local:         local,
429                 connSelector:  connSelector,
430                 localCtxMods:  localMods,
431                 remoteCtxMods: remoteMods,
432         }
433 }
434 func (p *raftProxyResourceAllocatorServer) runCtxMods(ctx context.Context, ctxMods []func(context.Context) (context.Context, error)) (context.Context, error) {
435         var err error
436         for _, mod := range ctxMods {
437                 ctx, err = mod(ctx)
438                 if err != nil {
439                         return ctx, err
440                 }
441         }
442         return ctx, nil
443 }
444 func (p *raftProxyResourceAllocatorServer) pollNewLeaderConn(ctx context.Context) (*grpc.ClientConn, error) {
445         ticker := rafttime.NewTicker(500 * rafttime.Millisecond)
446         defer ticker.Stop()
447         for {
448                 select {
449                 case <-ticker.C:
450                         conn, err := p.connSelector.LeaderConn(ctx)
451                         if err != nil {
452                                 return nil, err
453                         }
454
455                         client := NewHealthClient(conn)
456
457                         resp, err := client.Check(ctx, &HealthCheckRequest{Service: "Raft"})
458                         if err != nil || resp.Status != HealthCheckResponse_SERVING {
459                                 continue
460                         }
461                         return conn, nil
462                 case <-ctx.Done():
463                         return nil, ctx.Err()
464                 }
465         }
466 }
467
468 func (p *raftProxyResourceAllocatorServer) AttachNetwork(ctx context.Context, r *AttachNetworkRequest) (*AttachNetworkResponse, error) {
469
470         conn, err := p.connSelector.LeaderConn(ctx)
471         if err != nil {
472                 if err == raftselector.ErrIsLeader {
473                         ctx, err = p.runCtxMods(ctx, p.localCtxMods)
474                         if err != nil {
475                                 return nil, err
476                         }
477                         return p.local.AttachNetwork(ctx, r)
478                 }
479                 return nil, err
480         }
481         modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods)
482         if err != nil {
483                 return nil, err
484         }
485
486         resp, err := NewResourceAllocatorClient(conn).AttachNetwork(modCtx, r)
487         if err != nil {
488                 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") {
489                         return resp, err
490                 }
491                 conn, err := p.pollNewLeaderConn(ctx)
492                 if err != nil {
493                         if err == raftselector.ErrIsLeader {
494                                 return p.local.AttachNetwork(ctx, r)
495                         }
496                         return nil, err
497                 }
498                 return NewResourceAllocatorClient(conn).AttachNetwork(modCtx, r)
499         }
500         return resp, err
501 }
502
503 func (p *raftProxyResourceAllocatorServer) DetachNetwork(ctx context.Context, r *DetachNetworkRequest) (*DetachNetworkResponse, error) {
504
505         conn, err := p.connSelector.LeaderConn(ctx)
506         if err != nil {
507                 if err == raftselector.ErrIsLeader {
508                         ctx, err = p.runCtxMods(ctx, p.localCtxMods)
509                         if err != nil {
510                                 return nil, err
511                         }
512                         return p.local.DetachNetwork(ctx, r)
513                 }
514                 return nil, err
515         }
516         modCtx, err := p.runCtxMods(ctx, p.remoteCtxMods)
517         if err != nil {
518                 return nil, err
519         }
520
521         resp, err := NewResourceAllocatorClient(conn).DetachNetwork(modCtx, r)
522         if err != nil {
523                 if !strings.Contains(err.Error(), "is closing") && !strings.Contains(err.Error(), "the connection is unavailable") && !strings.Contains(err.Error(), "connection error") {
524                         return resp, err
525                 }
526                 conn, err := p.pollNewLeaderConn(ctx)
527                 if err != nil {
528                         if err == raftselector.ErrIsLeader {
529                                 return p.local.DetachNetwork(ctx, r)
530                         }
531                         return nil, err
532                 }
533                 return NewResourceAllocatorClient(conn).DetachNetwork(modCtx, r)
534         }
535         return resp, err
536 }
537
538 func (m *AttachNetworkRequest) Size() (n int) {
539         var l int
540         _ = l
541         if m.Config != nil {
542                 l = m.Config.Size()
543                 n += 1 + l + sovResource(uint64(l))
544         }
545         l = len(m.ContainerID)
546         if l > 0 {
547                 n += 1 + l + sovResource(uint64(l))
548         }
549         return n
550 }
551
552 func (m *AttachNetworkResponse) Size() (n int) {
553         var l int
554         _ = l
555         l = len(m.AttachmentID)
556         if l > 0 {
557                 n += 1 + l + sovResource(uint64(l))
558         }
559         return n
560 }
561
562 func (m *DetachNetworkRequest) Size() (n int) {
563         var l int
564         _ = l
565         l = len(m.AttachmentID)
566         if l > 0 {
567                 n += 1 + l + sovResource(uint64(l))
568         }
569         return n
570 }
571
572 func (m *DetachNetworkResponse) Size() (n int) {
573         var l int
574         _ = l
575         return n
576 }
577
578 func sovResource(x uint64) (n int) {
579         for {
580                 n++
581                 x >>= 7
582                 if x == 0 {
583                         break
584                 }
585         }
586         return n
587 }
588 func sozResource(x uint64) (n int) {
589         return sovResource(uint64((x << 1) ^ uint64((int64(x) >> 63))))
590 }
591 func (this *AttachNetworkRequest) String() string {
592         if this == nil {
593                 return "nil"
594         }
595         s := strings.Join([]string{`&AttachNetworkRequest{`,
596                 `Config:` + strings.Replace(fmt.Sprintf("%v", this.Config), "NetworkAttachmentConfig", "NetworkAttachmentConfig", 1) + `,`,
597                 `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`,
598                 `}`,
599         }, "")
600         return s
601 }
602 func (this *AttachNetworkResponse) String() string {
603         if this == nil {
604                 return "nil"
605         }
606         s := strings.Join([]string{`&AttachNetworkResponse{`,
607                 `AttachmentID:` + fmt.Sprintf("%v", this.AttachmentID) + `,`,
608                 `}`,
609         }, "")
610         return s
611 }
612 func (this *DetachNetworkRequest) String() string {
613         if this == nil {
614                 return "nil"
615         }
616         s := strings.Join([]string{`&DetachNetworkRequest{`,
617                 `AttachmentID:` + fmt.Sprintf("%v", this.AttachmentID) + `,`,
618                 `}`,
619         }, "")
620         return s
621 }
622 func (this *DetachNetworkResponse) String() string {
623         if this == nil {
624                 return "nil"
625         }
626         s := strings.Join([]string{`&DetachNetworkResponse{`,
627                 `}`,
628         }, "")
629         return s
630 }
631 func valueToStringResource(v interface{}) string {
632         rv := reflect.ValueOf(v)
633         if rv.IsNil() {
634                 return "nil"
635         }
636         pv := reflect.Indirect(rv).Interface()
637         return fmt.Sprintf("*%v", pv)
638 }
639 func (m *AttachNetworkRequest) Unmarshal(dAtA []byte) error {
640         l := len(dAtA)
641         iNdEx := 0
642         for iNdEx < l {
643                 preIndex := iNdEx
644                 var wire uint64
645                 for shift := uint(0); ; shift += 7 {
646                         if shift >= 64 {
647                                 return ErrIntOverflowResource
648                         }
649                         if iNdEx >= l {
650                                 return io.ErrUnexpectedEOF
651                         }
652                         b := dAtA[iNdEx]
653                         iNdEx++
654                         wire |= (uint64(b) & 0x7F) << shift
655                         if b < 0x80 {
656                                 break
657                         }
658                 }
659                 fieldNum := int32(wire >> 3)
660                 wireType := int(wire & 0x7)
661                 if wireType == 4 {
662                         return fmt.Errorf("proto: AttachNetworkRequest: wiretype end group for non-group")
663                 }
664                 if fieldNum <= 0 {
665                         return fmt.Errorf("proto: AttachNetworkRequest: illegal tag %d (wire type %d)", fieldNum, wire)
666                 }
667                 switch fieldNum {
668                 case 1:
669                         if wireType != 2 {
670                                 return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType)
671                         }
672                         var msglen int
673                         for shift := uint(0); ; shift += 7 {
674                                 if shift >= 64 {
675                                         return ErrIntOverflowResource
676                                 }
677                                 if iNdEx >= l {
678                                         return io.ErrUnexpectedEOF
679                                 }
680                                 b := dAtA[iNdEx]
681                                 iNdEx++
682                                 msglen |= (int(b) & 0x7F) << shift
683                                 if b < 0x80 {
684                                         break
685                                 }
686                         }
687                         if msglen < 0 {
688                                 return ErrInvalidLengthResource
689                         }
690                         postIndex := iNdEx + msglen
691                         if postIndex > l {
692                                 return io.ErrUnexpectedEOF
693                         }
694                         if m.Config == nil {
695                                 m.Config = &NetworkAttachmentConfig{}
696                         }
697                         if err := m.Config.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
698                                 return err
699                         }
700                         iNdEx = postIndex
701                 case 2:
702                         if wireType != 2 {
703                                 return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType)
704                         }
705                         var stringLen uint64
706                         for shift := uint(0); ; shift += 7 {
707                                 if shift >= 64 {
708                                         return ErrIntOverflowResource
709                                 }
710                                 if iNdEx >= l {
711                                         return io.ErrUnexpectedEOF
712                                 }
713                                 b := dAtA[iNdEx]
714                                 iNdEx++
715                                 stringLen |= (uint64(b) & 0x7F) << shift
716                                 if b < 0x80 {
717                                         break
718                                 }
719                         }
720                         intStringLen := int(stringLen)
721                         if intStringLen < 0 {
722                                 return ErrInvalidLengthResource
723                         }
724                         postIndex := iNdEx + intStringLen
725                         if postIndex > l {
726                                 return io.ErrUnexpectedEOF
727                         }
728                         m.ContainerID = string(dAtA[iNdEx:postIndex])
729                         iNdEx = postIndex
730                 default:
731                         iNdEx = preIndex
732                         skippy, err := skipResource(dAtA[iNdEx:])
733                         if err != nil {
734                                 return err
735                         }
736                         if skippy < 0 {
737                                 return ErrInvalidLengthResource
738                         }
739                         if (iNdEx + skippy) > l {
740                                 return io.ErrUnexpectedEOF
741                         }
742                         iNdEx += skippy
743                 }
744         }
745
746         if iNdEx > l {
747                 return io.ErrUnexpectedEOF
748         }
749         return nil
750 }
751 func (m *AttachNetworkResponse) Unmarshal(dAtA []byte) error {
752         l := len(dAtA)
753         iNdEx := 0
754         for iNdEx < l {
755                 preIndex := iNdEx
756                 var wire uint64
757                 for shift := uint(0); ; shift += 7 {
758                         if shift >= 64 {
759                                 return ErrIntOverflowResource
760                         }
761                         if iNdEx >= l {
762                                 return io.ErrUnexpectedEOF
763                         }
764                         b := dAtA[iNdEx]
765                         iNdEx++
766                         wire |= (uint64(b) & 0x7F) << shift
767                         if b < 0x80 {
768                                 break
769                         }
770                 }
771                 fieldNum := int32(wire >> 3)
772                 wireType := int(wire & 0x7)
773                 if wireType == 4 {
774                         return fmt.Errorf("proto: AttachNetworkResponse: wiretype end group for non-group")
775                 }
776                 if fieldNum <= 0 {
777                         return fmt.Errorf("proto: AttachNetworkResponse: illegal tag %d (wire type %d)", fieldNum, wire)
778                 }
779                 switch fieldNum {
780                 case 1:
781                         if wireType != 2 {
782                                 return fmt.Errorf("proto: wrong wireType = %d for field AttachmentID", wireType)
783                         }
784                         var stringLen uint64
785                         for shift := uint(0); ; shift += 7 {
786                                 if shift >= 64 {
787                                         return ErrIntOverflowResource
788                                 }
789                                 if iNdEx >= l {
790                                         return io.ErrUnexpectedEOF
791                                 }
792                                 b := dAtA[iNdEx]
793                                 iNdEx++
794                                 stringLen |= (uint64(b) & 0x7F) << shift
795                                 if b < 0x80 {
796                                         break
797                                 }
798                         }
799                         intStringLen := int(stringLen)
800                         if intStringLen < 0 {
801                                 return ErrInvalidLengthResource
802                         }
803                         postIndex := iNdEx + intStringLen
804                         if postIndex > l {
805                                 return io.ErrUnexpectedEOF
806                         }
807                         m.AttachmentID = string(dAtA[iNdEx:postIndex])
808                         iNdEx = postIndex
809                 default:
810                         iNdEx = preIndex
811                         skippy, err := skipResource(dAtA[iNdEx:])
812                         if err != nil {
813                                 return err
814                         }
815                         if skippy < 0 {
816                                 return ErrInvalidLengthResource
817                         }
818                         if (iNdEx + skippy) > l {
819                                 return io.ErrUnexpectedEOF
820                         }
821                         iNdEx += skippy
822                 }
823         }
824
825         if iNdEx > l {
826                 return io.ErrUnexpectedEOF
827         }
828         return nil
829 }
830 func (m *DetachNetworkRequest) Unmarshal(dAtA []byte) error {
831         l := len(dAtA)
832         iNdEx := 0
833         for iNdEx < l {
834                 preIndex := iNdEx
835                 var wire uint64
836                 for shift := uint(0); ; shift += 7 {
837                         if shift >= 64 {
838                                 return ErrIntOverflowResource
839                         }
840                         if iNdEx >= l {
841                                 return io.ErrUnexpectedEOF
842                         }
843                         b := dAtA[iNdEx]
844                         iNdEx++
845                         wire |= (uint64(b) & 0x7F) << shift
846                         if b < 0x80 {
847                                 break
848                         }
849                 }
850                 fieldNum := int32(wire >> 3)
851                 wireType := int(wire & 0x7)
852                 if wireType == 4 {
853                         return fmt.Errorf("proto: DetachNetworkRequest: wiretype end group for non-group")
854                 }
855                 if fieldNum <= 0 {
856                         return fmt.Errorf("proto: DetachNetworkRequest: illegal tag %d (wire type %d)", fieldNum, wire)
857                 }
858                 switch fieldNum {
859                 case 1:
860                         if wireType != 2 {
861                                 return fmt.Errorf("proto: wrong wireType = %d for field AttachmentID", wireType)
862                         }
863                         var stringLen uint64
864                         for shift := uint(0); ; shift += 7 {
865                                 if shift >= 64 {
866                                         return ErrIntOverflowResource
867                                 }
868                                 if iNdEx >= l {
869                                         return io.ErrUnexpectedEOF
870                                 }
871                                 b := dAtA[iNdEx]
872                                 iNdEx++
873                                 stringLen |= (uint64(b) & 0x7F) << shift
874                                 if b < 0x80 {
875                                         break
876                                 }
877                         }
878                         intStringLen := int(stringLen)
879                         if intStringLen < 0 {
880                                 return ErrInvalidLengthResource
881                         }
882                         postIndex := iNdEx + intStringLen
883                         if postIndex > l {
884                                 return io.ErrUnexpectedEOF
885                         }
886                         m.AttachmentID = string(dAtA[iNdEx:postIndex])
887                         iNdEx = postIndex
888                 default:
889                         iNdEx = preIndex
890                         skippy, err := skipResource(dAtA[iNdEx:])
891                         if err != nil {
892                                 return err
893                         }
894                         if skippy < 0 {
895                                 return ErrInvalidLengthResource
896                         }
897                         if (iNdEx + skippy) > l {
898                                 return io.ErrUnexpectedEOF
899                         }
900                         iNdEx += skippy
901                 }
902         }
903
904         if iNdEx > l {
905                 return io.ErrUnexpectedEOF
906         }
907         return nil
908 }
909 func (m *DetachNetworkResponse) Unmarshal(dAtA []byte) error {
910         l := len(dAtA)
911         iNdEx := 0
912         for iNdEx < l {
913                 preIndex := iNdEx
914                 var wire uint64
915                 for shift := uint(0); ; shift += 7 {
916                         if shift >= 64 {
917                                 return ErrIntOverflowResource
918                         }
919                         if iNdEx >= l {
920                                 return io.ErrUnexpectedEOF
921                         }
922                         b := dAtA[iNdEx]
923                         iNdEx++
924                         wire |= (uint64(b) & 0x7F) << shift
925                         if b < 0x80 {
926                                 break
927                         }
928                 }
929                 fieldNum := int32(wire >> 3)
930                 wireType := int(wire & 0x7)
931                 if wireType == 4 {
932                         return fmt.Errorf("proto: DetachNetworkResponse: wiretype end group for non-group")
933                 }
934                 if fieldNum <= 0 {
935                         return fmt.Errorf("proto: DetachNetworkResponse: illegal tag %d (wire type %d)", fieldNum, wire)
936                 }
937                 switch fieldNum {
938                 default:
939                         iNdEx = preIndex
940                         skippy, err := skipResource(dAtA[iNdEx:])
941                         if err != nil {
942                                 return err
943                         }
944                         if skippy < 0 {
945                                 return ErrInvalidLengthResource
946                         }
947                         if (iNdEx + skippy) > l {
948                                 return io.ErrUnexpectedEOF
949                         }
950                         iNdEx += skippy
951                 }
952         }
953
954         if iNdEx > l {
955                 return io.ErrUnexpectedEOF
956         }
957         return nil
958 }
959 func skipResource(dAtA []byte) (n int, err error) {
960         l := len(dAtA)
961         iNdEx := 0
962         for iNdEx < l {
963                 var wire uint64
964                 for shift := uint(0); ; shift += 7 {
965                         if shift >= 64 {
966                                 return 0, ErrIntOverflowResource
967                         }
968                         if iNdEx >= l {
969                                 return 0, io.ErrUnexpectedEOF
970                         }
971                         b := dAtA[iNdEx]
972                         iNdEx++
973                         wire |= (uint64(b) & 0x7F) << shift
974                         if b < 0x80 {
975                                 break
976                         }
977                 }
978                 wireType := int(wire & 0x7)
979                 switch wireType {
980                 case 0:
981                         for shift := uint(0); ; shift += 7 {
982                                 if shift >= 64 {
983                                         return 0, ErrIntOverflowResource
984                                 }
985                                 if iNdEx >= l {
986                                         return 0, io.ErrUnexpectedEOF
987                                 }
988                                 iNdEx++
989                                 if dAtA[iNdEx-1] < 0x80 {
990                                         break
991                                 }
992                         }
993                         return iNdEx, nil
994                 case 1:
995                         iNdEx += 8
996                         return iNdEx, nil
997                 case 2:
998                         var length int
999                         for shift := uint(0); ; shift += 7 {
1000                                 if shift >= 64 {
1001                                         return 0, ErrIntOverflowResource
1002                                 }
1003                                 if iNdEx >= l {
1004                                         return 0, io.ErrUnexpectedEOF
1005                                 }
1006                                 b := dAtA[iNdEx]
1007                                 iNdEx++
1008                                 length |= (int(b) & 0x7F) << shift
1009                                 if b < 0x80 {
1010                                         break
1011                                 }
1012                         }
1013                         iNdEx += length
1014                         if length < 0 {
1015                                 return 0, ErrInvalidLengthResource
1016                         }
1017                         return iNdEx, nil
1018                 case 3:
1019                         for {
1020                                 var innerWire uint64
1021                                 var start int = iNdEx
1022                                 for shift := uint(0); ; shift += 7 {
1023                                         if shift >= 64 {
1024                                                 return 0, ErrIntOverflowResource
1025                                         }
1026                                         if iNdEx >= l {
1027                                                 return 0, io.ErrUnexpectedEOF
1028                                         }
1029                                         b := dAtA[iNdEx]
1030                                         iNdEx++
1031                                         innerWire |= (uint64(b) & 0x7F) << shift
1032                                         if b < 0x80 {
1033                                                 break
1034                                         }
1035                                 }
1036                                 innerWireType := int(innerWire & 0x7)
1037                                 if innerWireType == 4 {
1038                                         break
1039                                 }
1040                                 next, err := skipResource(dAtA[start:])
1041                                 if err != nil {
1042                                         return 0, err
1043                                 }
1044                                 iNdEx = start + next
1045                         }
1046                         return iNdEx, nil
1047                 case 4:
1048                         return iNdEx, nil
1049                 case 5:
1050                         iNdEx += 4
1051                         return iNdEx, nil
1052                 default:
1053                         return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
1054                 }
1055         }
1056         panic("unreachable")
1057 }
1058
1059 var (
1060         ErrInvalidLengthResource = fmt.Errorf("proto: negative length found during unmarshaling")
1061         ErrIntOverflowResource   = fmt.Errorf("proto: integer overflow")
1062 )
1063
1064 func init() { proto.RegisterFile("resource.proto", fileDescriptorResource) }
1065
1066 var fileDescriptorResource = []byte{
1067         // 368 bytes of a gzipped FileDescriptorProto
1068         0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x4a, 0x2d, 0xce,
1069         0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x4a, 0xc9, 0x4f, 0xce,
1070         0x4e, 0x2d, 0xd2, 0x2b, 0x2e, 0x4f, 0x2c, 0xca, 0xcd, 0xce, 0x2c, 0xd1, 0x2b, 0x33, 0x94, 0xe2,
1071         0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x86, 0x28, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5,
1072         0x41, 0x2c, 0xa8, 0xa8, 0x70, 0x41, 0x4e, 0x69, 0x7a, 0x66, 0x9e, 0x3e, 0x84, 0x82, 0x08, 0x2a,
1073         0xf5, 0x33, 0x72, 0x89, 0x38, 0x96, 0x94, 0x24, 0x26, 0x67, 0xf8, 0xa5, 0x96, 0x94, 0xe7, 0x17,
1074         0x65, 0x07, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x08, 0x39, 0x73, 0xb1, 0x25, 0xe7, 0xe7, 0xa5,
1075         0x65, 0xa6, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x69, 0xeb, 0x61, 0xda, 0xaa, 0x07, 0xd5,
1076         0x03, 0x31, 0x20, 0x37, 0x35, 0xaf, 0xc4, 0x19, 0xac, 0x25, 0x08, 0xaa, 0x55, 0xc8, 0x88, 0x8b,
1077         0x27, 0x39, 0x3f, 0xaf, 0x24, 0x31, 0x33, 0x2f, 0xb5, 0x28, 0x3e, 0x33, 0x45, 0x82, 0x49, 0x81,
1078         0x51, 0x83, 0xd3, 0x89, 0xff, 0xd1, 0x3d, 0x79, 0x6e, 0x67, 0x98, 0xb8, 0xa7, 0x4b, 0x10, 0x37,
1079         0x5c, 0x91, 0x67, 0x8a, 0x92, 0x1f, 0x97, 0x28, 0x9a, 0x83, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53,
1080         0x85, 0x4c, 0xb9, 0x78, 0x13, 0xe1, 0x16, 0x81, 0x4c, 0x63, 0x04, 0x9b, 0x26, 0xf0, 0xe8, 0x9e,
1081         0x3c, 0x0f, 0xc2, 0x05, 0x9e, 0x2e, 0x41, 0x3c, 0x08, 0x65, 0x9e, 0x29, 0x4a, 0xbe, 0x5c, 0x22,
1082         0x2e, 0xa9, 0x58, 0x3c, 0x48, 0xa6, 0x71, 0xe2, 0x5c, 0xa2, 0x68, 0xc6, 0x41, 0x9c, 0x67, 0xb4,
1083         0x9a, 0x89, 0x4b, 0x30, 0x08, 0x1a, 0x51, 0x8e, 0x39, 0x39, 0xf9, 0xc9, 0x89, 0x25, 0xf9, 0x45,
1084         0x42, 0x9d, 0x8c, 0x5c, 0xbc, 0x28, 0xde, 0x11, 0xd2, 0xc0, 0x16, 0x90, 0xd8, 0xa2, 0x40, 0x4a,
1085         0x93, 0x08, 0x95, 0x10, 0xcb, 0x95, 0x94, 0x4f, 0xad, 0x7b, 0x37, 0x83, 0x49, 0x96, 0x8b, 0x07,
1086         0xac, 0x54, 0x17, 0x24, 0x97, 0x5a, 0xc4, 0xc5, 0x0b, 0xe1, 0xe5, 0x26, 0xe6, 0x25, 0xa6, 0xa7,
1087         0x42, 0xdc, 0x82, 0xe2, 0x76, 0xec, 0x6e, 0xc1, 0x16, 0x5a, 0xd8, 0xdd, 0x82, 0x35, 0x20, 0x88,
1088         0x72, 0x8b, 0x93, 0xc4, 0x89, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x34, 0x3c, 0x92, 0x63,
1089         0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x93, 0xd8, 0xc0,
1090         0x09, 0xd3, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x48, 0x12, 0x41, 0xf6, 0x02, 0x00, 0x00,
1091 }