github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/api/objects.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: github.com/docker/swarmkit/api/objects.proto 3 4 package api 5 6 import ( 7 fmt "fmt" 8 github_com_docker_go_events "github.com/docker/go-events" 9 github_com_docker_swarmkit_api_deepcopy "github.com/docker/swarmkit/api/deepcopy" 10 _ "github.com/docker/swarmkit/protobuf/plugin" 11 _ "github.com/gogo/protobuf/gogoproto" 12 proto "github.com/gogo/protobuf/proto" 13 github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" 14 types "github.com/gogo/protobuf/types" 15 io "io" 16 math "math" 17 reflect "reflect" 18 strings "strings" 19 ) 20 21 // Reference imports to suppress errors if they are not otherwise used. 22 var _ = proto.Marshal 23 var _ = fmt.Errorf 24 var _ = math.Inf 25 26 // This is a compile-time assertion to ensure that this generated file 27 // is compatible with the proto package it is being compiled against. 28 // A compilation error at this line likely means your copy of the 29 // proto package needs to be updated. 30 const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package 31 32 // Meta contains metadata about objects. Every object contains a meta field. 33 type Meta struct { 34 // Version tracks the current version of the object. 35 Version Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` 36 // Object timestamps. 37 // Note: can't use stdtime because these fields are nullable. 38 CreatedAt *types.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` 39 UpdatedAt *types.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` 40 } 41 42 func (m *Meta) Reset() { *m = Meta{} } 43 func (*Meta) ProtoMessage() {} 44 func (*Meta) Descriptor() ([]byte, []int) { 45 return fileDescriptor_6218a23329ef342d, []int{0} 46 } 47 func (m *Meta) XXX_Unmarshal(b []byte) error { 48 return m.Unmarshal(b) 49 } 50 func (m *Meta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 51 if deterministic { 52 return xxx_messageInfo_Meta.Marshal(b, m, deterministic) 53 } else { 54 b = b[:cap(b)] 55 n, err := m.MarshalTo(b) 56 if err != nil { 57 return nil, err 58 } 59 return b[:n], nil 60 } 61 } 62 func (m *Meta) XXX_Merge(src proto.Message) { 63 xxx_messageInfo_Meta.Merge(m, src) 64 } 65 func (m *Meta) XXX_Size() int { 66 return m.Size() 67 } 68 func (m *Meta) XXX_DiscardUnknown() { 69 xxx_messageInfo_Meta.DiscardUnknown(m) 70 } 71 72 var xxx_messageInfo_Meta proto.InternalMessageInfo 73 74 // Node provides the internal node state as seen by the cluster. 75 type Node struct { 76 // ID specifies the identity of the node. 77 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 78 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 79 // Spec defines the desired state of the node as specified by the user. 80 // The system will honor this and will *never* modify it. 81 Spec NodeSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 82 // Description encapsulated the properties of the Node as reported by the 83 // agent. 84 Description *NodeDescription `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` 85 // Status provides the current status of the node, as seen by the manager. 86 Status NodeStatus `protobuf:"bytes,5,opt,name=status,proto3" json:"status"` 87 // ManagerStatus provides the current status of the node's manager 88 // component, if the node is a manager. 89 ManagerStatus *ManagerStatus `protobuf:"bytes,6,opt,name=manager_status,json=managerStatus,proto3" json:"manager_status,omitempty"` 90 // DEPRECATED: Use Attachments to find the ingress network 91 // The node attachment to the ingress network. 92 Attachment *NetworkAttachment `protobuf:"bytes,7,opt,name=attachment,proto3" json:"attachment,omitempty"` // Deprecated: Do not use. 93 // Certificate is the TLS certificate issued for the node, if any. 94 Certificate Certificate `protobuf:"bytes,8,opt,name=certificate,proto3" json:"certificate"` 95 // Role is the *observed* role for this node. It differs from the 96 // desired role set in Node.Spec.Role because the role here is only 97 // updated after the Raft member list has been reconciled with the 98 // desired role from the spec. 99 // 100 // This field represents the current reconciled state. If an action is 101 // to be performed, first verify the role in the cert. This field only 102 // shows the privilege level that the CA would currently grant when 103 // issuing or renewing the node's certificate. 104 Role NodeRole `protobuf:"varint,9,opt,name=role,proto3,enum=docker.swarmkit.v1.NodeRole" json:"role,omitempty"` 105 // Attachments enumerates the network attachments for the node to set up an 106 // endpoint on the node to be used for load balancing. Each overlay 107 // network, including ingress network, will have an NetworkAttachment. 108 Attachments []*NetworkAttachment `protobuf:"bytes,10,rep,name=attachments,proto3" json:"attachments,omitempty"` 109 // VXLANUDPPort specifies the UDP port for VXLAN traffic. 110 // This information is passed from cluster object to individual nodes. 111 VXLANUDPPort uint32 `protobuf:"varint,11,opt,name=VXLANUDPPort,proto3" json:"VXLANUDPPort,omitempty"` 112 } 113 114 func (m *Node) Reset() { *m = Node{} } 115 func (*Node) ProtoMessage() {} 116 func (*Node) Descriptor() ([]byte, []int) { 117 return fileDescriptor_6218a23329ef342d, []int{1} 118 } 119 func (m *Node) XXX_Unmarshal(b []byte) error { 120 return m.Unmarshal(b) 121 } 122 func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 123 if deterministic { 124 return xxx_messageInfo_Node.Marshal(b, m, deterministic) 125 } else { 126 b = b[:cap(b)] 127 n, err := m.MarshalTo(b) 128 if err != nil { 129 return nil, err 130 } 131 return b[:n], nil 132 } 133 } 134 func (m *Node) XXX_Merge(src proto.Message) { 135 xxx_messageInfo_Node.Merge(m, src) 136 } 137 func (m *Node) XXX_Size() int { 138 return m.Size() 139 } 140 func (m *Node) XXX_DiscardUnknown() { 141 xxx_messageInfo_Node.DiscardUnknown(m) 142 } 143 144 var xxx_messageInfo_Node proto.InternalMessageInfo 145 146 type Service struct { 147 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 148 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 149 Spec ServiceSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 150 // SpecVersion versions Spec, to identify changes in the spec. Note that 151 // this is not directly comparable to the service's Version. 152 SpecVersion *Version `protobuf:"bytes,10,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"` 153 // PreviousSpec is the previous service spec that was in place before 154 // "Spec". 155 PreviousSpec *ServiceSpec `protobuf:"bytes,6,opt,name=previous_spec,json=previousSpec,proto3" json:"previous_spec,omitempty"` 156 // PreviousSpecVersion versions PreviousSpec. Note that this is not 157 // directly comparable to the service's Version. 158 PreviousSpecVersion *Version `protobuf:"bytes,11,opt,name=previous_spec_version,json=previousSpecVersion,proto3" json:"previous_spec_version,omitempty"` 159 // Runtime state of service endpoint. This may be different 160 // from the spec version because the user may not have entered 161 // the optional fields like node_port or virtual_ip and it 162 // could be auto allocated by the system. 163 Endpoint *Endpoint `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` 164 // UpdateStatus contains the status of an update, if one is in 165 // progress. 166 UpdateStatus *UpdateStatus `protobuf:"bytes,5,opt,name=update_status,json=updateStatus,proto3" json:"update_status,omitempty"` 167 // JobStatus contains the status of a Service that is in one of the Job 168 // modes. It is absent on Replicated and Global services. 169 JobStatus *JobStatus `protobuf:"bytes,12,opt,name=job_status,json=jobStatus,proto3" json:"job_status,omitempty"` 170 // PendingDelete indicates that this service's deletion has been requested. 171 // Services, as well as all service-level resources, can only be deleted 172 // after all of the service's containers have properly shut down. 173 // When a user requests a deletion, we just flip this flag 174 // the deallocator will take it from there - it will start monitoring 175 // this service's tasks, and proceed to delete the service itself (and 176 // potentially its associated resources also marked for deletion) when 177 // all of its tasks are gone 178 PendingDelete bool `protobuf:"varint,7,opt,name=pending_delete,json=pendingDelete,proto3" json:"pending_delete,omitempty"` 179 } 180 181 func (m *Service) Reset() { *m = Service{} } 182 func (*Service) ProtoMessage() {} 183 func (*Service) Descriptor() ([]byte, []int) { 184 return fileDescriptor_6218a23329ef342d, []int{2} 185 } 186 func (m *Service) XXX_Unmarshal(b []byte) error { 187 return m.Unmarshal(b) 188 } 189 func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 190 if deterministic { 191 return xxx_messageInfo_Service.Marshal(b, m, deterministic) 192 } else { 193 b = b[:cap(b)] 194 n, err := m.MarshalTo(b) 195 if err != nil { 196 return nil, err 197 } 198 return b[:n], nil 199 } 200 } 201 func (m *Service) XXX_Merge(src proto.Message) { 202 xxx_messageInfo_Service.Merge(m, src) 203 } 204 func (m *Service) XXX_Size() int { 205 return m.Size() 206 } 207 func (m *Service) XXX_DiscardUnknown() { 208 xxx_messageInfo_Service.DiscardUnknown(m) 209 } 210 211 var xxx_messageInfo_Service proto.InternalMessageInfo 212 213 // Endpoint specified all the network parameters required to 214 // correctly discover and load balance a service 215 type Endpoint struct { 216 Spec *EndpointSpec `protobuf:"bytes,1,opt,name=spec,proto3" json:"spec,omitempty"` 217 // Runtime state of the exposed ports which may carry 218 // auto-allocated swarm ports in addition to the user 219 // configured information. 220 Ports []*PortConfig `protobuf:"bytes,2,rep,name=ports,proto3" json:"ports,omitempty"` 221 // VirtualIPs specifies the IP addresses under which this endpoint will be 222 // made available. 223 VirtualIPs []*Endpoint_VirtualIP `protobuf:"bytes,3,rep,name=virtual_ips,json=virtualIps,proto3" json:"virtual_ips,omitempty"` 224 } 225 226 func (m *Endpoint) Reset() { *m = Endpoint{} } 227 func (*Endpoint) ProtoMessage() {} 228 func (*Endpoint) Descriptor() ([]byte, []int) { 229 return fileDescriptor_6218a23329ef342d, []int{3} 230 } 231 func (m *Endpoint) XXX_Unmarshal(b []byte) error { 232 return m.Unmarshal(b) 233 } 234 func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 235 if deterministic { 236 return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) 237 } else { 238 b = b[:cap(b)] 239 n, err := m.MarshalTo(b) 240 if err != nil { 241 return nil, err 242 } 243 return b[:n], nil 244 } 245 } 246 func (m *Endpoint) XXX_Merge(src proto.Message) { 247 xxx_messageInfo_Endpoint.Merge(m, src) 248 } 249 func (m *Endpoint) XXX_Size() int { 250 return m.Size() 251 } 252 func (m *Endpoint) XXX_DiscardUnknown() { 253 xxx_messageInfo_Endpoint.DiscardUnknown(m) 254 } 255 256 var xxx_messageInfo_Endpoint proto.InternalMessageInfo 257 258 // VirtualIP specifies a set of networks this endpoint will be attached to 259 // and the IP addresses the target service will be made available under. 260 type Endpoint_VirtualIP struct { 261 // NetworkID for which this endpoint attachment was created. 262 NetworkID string `protobuf:"bytes,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` 263 // A virtual IP is used to address this service in IP 264 // layer that the client can use to send requests to 265 // this service. A DNS A/AAAA query on the service 266 // name might return this IP to the client. This is 267 // strictly a logical IP and there may not be any 268 // interfaces assigned this IP address or any route 269 // created for this address. More than one to 270 // accommodate for both IPv4 and IPv6 271 Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` 272 } 273 274 func (m *Endpoint_VirtualIP) Reset() { *m = Endpoint_VirtualIP{} } 275 func (*Endpoint_VirtualIP) ProtoMessage() {} 276 func (*Endpoint_VirtualIP) Descriptor() ([]byte, []int) { 277 return fileDescriptor_6218a23329ef342d, []int{3, 0} 278 } 279 func (m *Endpoint_VirtualIP) XXX_Unmarshal(b []byte) error { 280 return m.Unmarshal(b) 281 } 282 func (m *Endpoint_VirtualIP) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 283 if deterministic { 284 return xxx_messageInfo_Endpoint_VirtualIP.Marshal(b, m, deterministic) 285 } else { 286 b = b[:cap(b)] 287 n, err := m.MarshalTo(b) 288 if err != nil { 289 return nil, err 290 } 291 return b[:n], nil 292 } 293 } 294 func (m *Endpoint_VirtualIP) XXX_Merge(src proto.Message) { 295 xxx_messageInfo_Endpoint_VirtualIP.Merge(m, src) 296 } 297 func (m *Endpoint_VirtualIP) XXX_Size() int { 298 return m.Size() 299 } 300 func (m *Endpoint_VirtualIP) XXX_DiscardUnknown() { 301 xxx_messageInfo_Endpoint_VirtualIP.DiscardUnknown(m) 302 } 303 304 var xxx_messageInfo_Endpoint_VirtualIP proto.InternalMessageInfo 305 306 // Task specifies the parameters for implementing a Spec. A task is effectively 307 // immutable and idempotent. Once it is dispatched to a node, it will not be 308 // dispatched to another node. 309 type Task struct { 310 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 311 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 312 // Spec defines the desired state of the task as specified by the user. 313 // The system will honor this and will *never* modify it. 314 Spec TaskSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 315 // SpecVersion is copied from Service, to identify which version of the 316 // spec this task has. Note that this is not directly comparable to the 317 // service's Version. 318 SpecVersion *Version `protobuf:"bytes,14,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"` 319 // ServiceID indicates the service under which this task is orchestrated. This 320 // should almost always be set. 321 ServiceID string `protobuf:"bytes,4,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` 322 // Slot is the service slot number for a task. 323 // For example, if a replicated service has replicas = 2, there will be a 324 // task with slot = 1, and another with slot = 2. 325 Slot uint64 `protobuf:"varint,5,opt,name=slot,proto3" json:"slot,omitempty"` 326 // NodeID indicates the node to which the task is assigned. If this field 327 // is empty or not set, the task is unassigned. 328 NodeID string `protobuf:"bytes,6,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` 329 // Annotations defines the names and labels for the runtime, as set by 330 // the cluster manager. 331 // 332 // As backup, if this field has an empty name, the runtime will 333 // allocate a unique name for the actual container. 334 // 335 // NOTE(stevvooe): The preserves the ability for us to making naming 336 // decisions for tasks in orchestrator, albeit, this is left empty for now. 337 Annotations Annotations `protobuf:"bytes,7,opt,name=annotations,proto3" json:"annotations"` 338 // ServiceAnnotations is a direct copy of the service name and labels when 339 // this task is created. 340 // 341 // Labels set here will *not* be propagated to the runtime target, such as a 342 // container. Use labels on the runtime target for that purpose. 343 ServiceAnnotations Annotations `protobuf:"bytes,8,opt,name=service_annotations,json=serviceAnnotations,proto3" json:"service_annotations"` 344 Status TaskStatus `protobuf:"bytes,9,opt,name=status,proto3" json:"status"` 345 // DesiredState is the target state for the task. It is set to 346 // TaskStateRunning when a task is first created, and changed to 347 // TaskStateShutdown if the manager wants to terminate the task. This field 348 // is only written by the manager. 349 DesiredState TaskState `protobuf:"varint,10,opt,name=desired_state,json=desiredState,proto3,enum=docker.swarmkit.v1.TaskState" json:"desired_state,omitempty"` 350 // List of network attachments by the task. 351 Networks []*NetworkAttachment `protobuf:"bytes,11,rep,name=networks,proto3" json:"networks,omitempty"` 352 // A copy of runtime state of service endpoint from Service 353 // object to be distributed to agents as part of the task. 354 Endpoint *Endpoint `protobuf:"bytes,12,opt,name=endpoint,proto3" json:"endpoint,omitempty"` 355 // LogDriver specifies the selected log driver to use for the task. Agent 356 // processes should always favor the value in this field. 357 // 358 // If present in the TaskSpec, this will be a copy of that value. The 359 // orchestrator may choose to insert a value here, which should be honored, 360 // such a cluster default or policy-based value. 361 // 362 // If not present, the daemon's default will be used. 363 LogDriver *Driver `protobuf:"bytes,13,opt,name=log_driver,json=logDriver,proto3" json:"log_driver,omitempty"` 364 AssignedGenericResources []*GenericResource `protobuf:"bytes,15,rep,name=assigned_generic_resources,json=assignedGenericResources,proto3" json:"assigned_generic_resources,omitempty"` 365 // JobIteration is the iteration number of the Job-mode Service that this 366 // task belongs to. 367 JobIteration *Version `protobuf:"bytes,16,opt,name=job_iteration,json=jobIteration,proto3" json:"job_iteration,omitempty"` 368 } 369 370 func (m *Task) Reset() { *m = Task{} } 371 func (*Task) ProtoMessage() {} 372 func (*Task) Descriptor() ([]byte, []int) { 373 return fileDescriptor_6218a23329ef342d, []int{4} 374 } 375 func (m *Task) XXX_Unmarshal(b []byte) error { 376 return m.Unmarshal(b) 377 } 378 func (m *Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 379 if deterministic { 380 return xxx_messageInfo_Task.Marshal(b, m, deterministic) 381 } else { 382 b = b[:cap(b)] 383 n, err := m.MarshalTo(b) 384 if err != nil { 385 return nil, err 386 } 387 return b[:n], nil 388 } 389 } 390 func (m *Task) XXX_Merge(src proto.Message) { 391 xxx_messageInfo_Task.Merge(m, src) 392 } 393 func (m *Task) XXX_Size() int { 394 return m.Size() 395 } 396 func (m *Task) XXX_DiscardUnknown() { 397 xxx_messageInfo_Task.DiscardUnknown(m) 398 } 399 400 var xxx_messageInfo_Task proto.InternalMessageInfo 401 402 // NetworkAttachment specifies the network parameters of attachment to 403 // a single network by an object such as task or node. 404 type NetworkAttachment struct { 405 // Network state as a whole becomes part of the object so that 406 // it always is available for use in agents so that agents 407 // don't have any other dependency during execution. 408 Network *Network `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` 409 // List of IPv4/IPv6 addresses that are assigned to the object 410 // as part of getting attached to this network. 411 Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` 412 // List of aliases by which a task is resolved in a network 413 Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"` 414 // Map of all the driver attachment options for this network 415 DriverAttachmentOpts map[string]string `protobuf:"bytes,4,rep,name=driver_attachment_opts,json=driverAttachmentOpts,proto3" json:"driver_attachment_opts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` 416 } 417 418 func (m *NetworkAttachment) Reset() { *m = NetworkAttachment{} } 419 func (*NetworkAttachment) ProtoMessage() {} 420 func (*NetworkAttachment) Descriptor() ([]byte, []int) { 421 return fileDescriptor_6218a23329ef342d, []int{5} 422 } 423 func (m *NetworkAttachment) XXX_Unmarshal(b []byte) error { 424 return m.Unmarshal(b) 425 } 426 func (m *NetworkAttachment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 427 if deterministic { 428 return xxx_messageInfo_NetworkAttachment.Marshal(b, m, deterministic) 429 } else { 430 b = b[:cap(b)] 431 n, err := m.MarshalTo(b) 432 if err != nil { 433 return nil, err 434 } 435 return b[:n], nil 436 } 437 } 438 func (m *NetworkAttachment) XXX_Merge(src proto.Message) { 439 xxx_messageInfo_NetworkAttachment.Merge(m, src) 440 } 441 func (m *NetworkAttachment) XXX_Size() int { 442 return m.Size() 443 } 444 func (m *NetworkAttachment) XXX_DiscardUnknown() { 445 xxx_messageInfo_NetworkAttachment.DiscardUnknown(m) 446 } 447 448 var xxx_messageInfo_NetworkAttachment proto.InternalMessageInfo 449 450 type Network struct { 451 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 452 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 453 Spec NetworkSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 454 // Driver specific operational state provided by the network driver. 455 DriverState *Driver `protobuf:"bytes,4,opt,name=driver_state,json=driverState,proto3" json:"driver_state,omitempty"` 456 // Runtime state of IPAM options. This may not reflect the 457 // ipam options from NetworkSpec. 458 IPAM *IPAMOptions `protobuf:"bytes,5,opt,name=ipam,proto3" json:"ipam,omitempty"` 459 // PendingDelete indicates that this network's deletion has been requested. 460 // Services, as well as all service-level resources, can only be deleted 461 // after all the service's containers have properly shut down 462 // when a user requests a deletion, we just flip this flag 463 // the deallocator will take it from there 464 // PendingDelete indicates that this network's deletion has been requested. 465 // Services, as well as all service-level resources, can only be deleted 466 // after all of the service's containers have properly shut down. 467 // When a user requests a deletion of this network, we just flip this flag 468 // the deallocator will take it from there - it will start monitoring 469 // the services that still use this service, and proceed to delete 470 // this network when all of these services are gone 471 PendingDelete bool `protobuf:"varint,6,opt,name=pending_delete,json=pendingDelete,proto3" json:"pending_delete,omitempty"` 472 } 473 474 func (m *Network) Reset() { *m = Network{} } 475 func (*Network) ProtoMessage() {} 476 func (*Network) Descriptor() ([]byte, []int) { 477 return fileDescriptor_6218a23329ef342d, []int{6} 478 } 479 func (m *Network) XXX_Unmarshal(b []byte) error { 480 return m.Unmarshal(b) 481 } 482 func (m *Network) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 483 if deterministic { 484 return xxx_messageInfo_Network.Marshal(b, m, deterministic) 485 } else { 486 b = b[:cap(b)] 487 n, err := m.MarshalTo(b) 488 if err != nil { 489 return nil, err 490 } 491 return b[:n], nil 492 } 493 } 494 func (m *Network) XXX_Merge(src proto.Message) { 495 xxx_messageInfo_Network.Merge(m, src) 496 } 497 func (m *Network) XXX_Size() int { 498 return m.Size() 499 } 500 func (m *Network) XXX_DiscardUnknown() { 501 xxx_messageInfo_Network.DiscardUnknown(m) 502 } 503 504 var xxx_messageInfo_Network proto.InternalMessageInfo 505 506 // Cluster provides global cluster settings. 507 type Cluster struct { 508 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 509 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 510 Spec ClusterSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 511 // RootCA contains key material for the root CA. 512 RootCA RootCA `protobuf:"bytes,4,opt,name=root_ca,json=rootCa,proto3" json:"root_ca"` 513 // Symmetric encryption key distributed by the lead manager. Used by agents 514 // for securing network bootstrapping and communication. 515 NetworkBootstrapKeys []*EncryptionKey `protobuf:"bytes,5,rep,name=network_bootstrap_keys,json=networkBootstrapKeys,proto3" json:"network_bootstrap_keys,omitempty"` 516 // Logical clock used to timestamp every key. It allows other managers 517 // and agents to unambiguously identify the older key to be deleted when 518 // a new key is allocated on key rotation. 519 EncryptionKeyLamportClock uint64 `protobuf:"varint,6,opt,name=encryption_key_lamport_clock,json=encryptionKeyLamportClock,proto3" json:"encryption_key_lamport_clock,omitempty"` 520 // BlacklistedCertificates tracks certificates that should no longer 521 // be honored. It's a mapping from CN -> BlacklistedCertificate. 522 // swarm. Their certificates should effectively be blacklisted. 523 BlacklistedCertificates map[string]*BlacklistedCertificate `protobuf:"bytes,8,rep,name=blacklisted_certificates,json=blacklistedCertificates,proto3" json:"blacklisted_certificates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` 524 // UnlockKeys defines the keys that lock node data at rest. For example, 525 // this would contain the key encrypting key (KEK) that will encrypt the 526 // manager TLS keys at rest and the raft encryption keys at rest. 527 // If the key is empty, the node will be unlocked (will not require a key 528 // to start up from a shut down state). 529 UnlockKeys []*EncryptionKey `protobuf:"bytes,9,rep,name=unlock_keys,json=unlockKeys,proto3" json:"unlock_keys,omitempty"` 530 // FIPS specifies whether this cluster should be in FIPS mode. This changes 531 // the format of the join tokens, and nodes that are not FIPS-enabled should 532 // reject joining the cluster. Nodes that report themselves to be non-FIPS 533 // should be rejected from the cluster. 534 FIPS bool `protobuf:"varint,10,opt,name=fips,proto3" json:"fips,omitempty"` 535 // This field specifies default subnet pools for global scope networks. If 536 // unspecified, Docker will use the predefined subnets as it works on older releases. 537 // Format Example : {"20.20.0.0/16",""20.20.0.0/16"} 538 DefaultAddressPool []string `protobuf:"bytes,11,rep,name=defaultAddressPool,proto3" json:"defaultAddressPool,omitempty"` 539 // This flag specifies the default subnet size of global scope networks by giving 540 // the length of the subnet masks for every such network 541 SubnetSize uint32 `protobuf:"varint,12,opt,name=subnetSize,proto3" json:"subnetSize,omitempty"` 542 // VXLANUDPPort specifies the UDP port for VXLAN traffic. 543 VXLANUDPPort uint32 `protobuf:"varint,13,opt,name=VXLANUDPPort,proto3" json:"VXLANUDPPort,omitempty"` 544 } 545 546 func (m *Cluster) Reset() { *m = Cluster{} } 547 func (*Cluster) ProtoMessage() {} 548 func (*Cluster) Descriptor() ([]byte, []int) { 549 return fileDescriptor_6218a23329ef342d, []int{7} 550 } 551 func (m *Cluster) XXX_Unmarshal(b []byte) error { 552 return m.Unmarshal(b) 553 } 554 func (m *Cluster) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 555 if deterministic { 556 return xxx_messageInfo_Cluster.Marshal(b, m, deterministic) 557 } else { 558 b = b[:cap(b)] 559 n, err := m.MarshalTo(b) 560 if err != nil { 561 return nil, err 562 } 563 return b[:n], nil 564 } 565 } 566 func (m *Cluster) XXX_Merge(src proto.Message) { 567 xxx_messageInfo_Cluster.Merge(m, src) 568 } 569 func (m *Cluster) XXX_Size() int { 570 return m.Size() 571 } 572 func (m *Cluster) XXX_DiscardUnknown() { 573 xxx_messageInfo_Cluster.DiscardUnknown(m) 574 } 575 576 var xxx_messageInfo_Cluster proto.InternalMessageInfo 577 578 // Secret represents a secret that should be passed to a container or a node, 579 // and is immutable. 580 type Secret struct { 581 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 582 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 583 // Spec contains the actual secret data, as well as any context around the 584 // secret data that the user provides. 585 Spec SecretSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 586 // Whether the secret is an internal secret (not set by a user) or not. 587 Internal bool `protobuf:"varint,4,opt,name=internal,proto3" json:"internal,omitempty"` 588 } 589 590 func (m *Secret) Reset() { *m = Secret{} } 591 func (*Secret) ProtoMessage() {} 592 func (*Secret) Descriptor() ([]byte, []int) { 593 return fileDescriptor_6218a23329ef342d, []int{8} 594 } 595 func (m *Secret) XXX_Unmarshal(b []byte) error { 596 return m.Unmarshal(b) 597 } 598 func (m *Secret) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 599 if deterministic { 600 return xxx_messageInfo_Secret.Marshal(b, m, deterministic) 601 } else { 602 b = b[:cap(b)] 603 n, err := m.MarshalTo(b) 604 if err != nil { 605 return nil, err 606 } 607 return b[:n], nil 608 } 609 } 610 func (m *Secret) XXX_Merge(src proto.Message) { 611 xxx_messageInfo_Secret.Merge(m, src) 612 } 613 func (m *Secret) XXX_Size() int { 614 return m.Size() 615 } 616 func (m *Secret) XXX_DiscardUnknown() { 617 xxx_messageInfo_Secret.DiscardUnknown(m) 618 } 619 620 var xxx_messageInfo_Secret proto.InternalMessageInfo 621 622 // Config represents a set of configuration files that should be passed to a 623 // container. 624 type Config struct { 625 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 626 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 627 // Spec contains the actual config data, as well as any context around the 628 // config data that the user provides. 629 Spec ConfigSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"` 630 } 631 632 func (m *Config) Reset() { *m = Config{} } 633 func (*Config) ProtoMessage() {} 634 func (*Config) Descriptor() ([]byte, []int) { 635 return fileDescriptor_6218a23329ef342d, []int{9} 636 } 637 func (m *Config) XXX_Unmarshal(b []byte) error { 638 return m.Unmarshal(b) 639 } 640 func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 641 if deterministic { 642 return xxx_messageInfo_Config.Marshal(b, m, deterministic) 643 } else { 644 b = b[:cap(b)] 645 n, err := m.MarshalTo(b) 646 if err != nil { 647 return nil, err 648 } 649 return b[:n], nil 650 } 651 } 652 func (m *Config) XXX_Merge(src proto.Message) { 653 xxx_messageInfo_Config.Merge(m, src) 654 } 655 func (m *Config) XXX_Size() int { 656 return m.Size() 657 } 658 func (m *Config) XXX_DiscardUnknown() { 659 xxx_messageInfo_Config.DiscardUnknown(m) 660 } 661 662 var xxx_messageInfo_Config proto.InternalMessageInfo 663 664 // Resource is a top-level object with externally defined content and indexing. 665 // SwarmKit can serve as a store for these objects without understanding their 666 // meanings. 667 type Resource struct { 668 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 669 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 670 Annotations Annotations `protobuf:"bytes,3,opt,name=annotations,proto3" json:"annotations"` 671 // Kind identifies this class of object. It is essentially a namespace 672 // to keep IDs or indices from colliding between unrelated Resource 673 // objects. This must correspond to the name of an Extension. 674 Kind string `protobuf:"bytes,4,opt,name=kind,proto3" json:"kind,omitempty"` 675 // Payload bytes. This data is not interpreted in any way by SwarmKit. 676 // By convention, it should be a marshalled protocol buffers message. 677 Payload *types.Any `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"` 678 } 679 680 func (m *Resource) Reset() { *m = Resource{} } 681 func (*Resource) ProtoMessage() {} 682 func (*Resource) Descriptor() ([]byte, []int) { 683 return fileDescriptor_6218a23329ef342d, []int{10} 684 } 685 func (m *Resource) XXX_Unmarshal(b []byte) error { 686 return m.Unmarshal(b) 687 } 688 func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 689 if deterministic { 690 return xxx_messageInfo_Resource.Marshal(b, m, deterministic) 691 } else { 692 b = b[:cap(b)] 693 n, err := m.MarshalTo(b) 694 if err != nil { 695 return nil, err 696 } 697 return b[:n], nil 698 } 699 } 700 func (m *Resource) XXX_Merge(src proto.Message) { 701 xxx_messageInfo_Resource.Merge(m, src) 702 } 703 func (m *Resource) XXX_Size() int { 704 return m.Size() 705 } 706 func (m *Resource) XXX_DiscardUnknown() { 707 xxx_messageInfo_Resource.DiscardUnknown(m) 708 } 709 710 var xxx_messageInfo_Resource proto.InternalMessageInfo 711 712 // Extension declares a type of "resource" object. This message provides some 713 // metadata about the objects. 714 type Extension struct { 715 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 716 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"` 717 Annotations Annotations `protobuf:"bytes,3,opt,name=annotations,proto3" json:"annotations"` 718 Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` 719 } 720 721 func (m *Extension) Reset() { *m = Extension{} } 722 func (*Extension) ProtoMessage() {} 723 func (*Extension) Descriptor() ([]byte, []int) { 724 return fileDescriptor_6218a23329ef342d, []int{11} 725 } 726 func (m *Extension) XXX_Unmarshal(b []byte) error { 727 return m.Unmarshal(b) 728 } 729 func (m *Extension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 730 if deterministic { 731 return xxx_messageInfo_Extension.Marshal(b, m, deterministic) 732 } else { 733 b = b[:cap(b)] 734 n, err := m.MarshalTo(b) 735 if err != nil { 736 return nil, err 737 } 738 return b[:n], nil 739 } 740 } 741 func (m *Extension) XXX_Merge(src proto.Message) { 742 xxx_messageInfo_Extension.Merge(m, src) 743 } 744 func (m *Extension) XXX_Size() int { 745 return m.Size() 746 } 747 func (m *Extension) XXX_DiscardUnknown() { 748 xxx_messageInfo_Extension.DiscardUnknown(m) 749 } 750 751 var xxx_messageInfo_Extension proto.InternalMessageInfo 752 753 func init() { 754 proto.RegisterType((*Meta)(nil), "docker.swarmkit.v1.Meta") 755 proto.RegisterType((*Node)(nil), "docker.swarmkit.v1.Node") 756 proto.RegisterType((*Service)(nil), "docker.swarmkit.v1.Service") 757 proto.RegisterType((*Endpoint)(nil), "docker.swarmkit.v1.Endpoint") 758 proto.RegisterType((*Endpoint_VirtualIP)(nil), "docker.swarmkit.v1.Endpoint.VirtualIP") 759 proto.RegisterType((*Task)(nil), "docker.swarmkit.v1.Task") 760 proto.RegisterType((*NetworkAttachment)(nil), "docker.swarmkit.v1.NetworkAttachment") 761 proto.RegisterMapType((map[string]string)(nil), "docker.swarmkit.v1.NetworkAttachment.DriverAttachmentOptsEntry") 762 proto.RegisterType((*Network)(nil), "docker.swarmkit.v1.Network") 763 proto.RegisterType((*Cluster)(nil), "docker.swarmkit.v1.Cluster") 764 proto.RegisterMapType((map[string]*BlacklistedCertificate)(nil), "docker.swarmkit.v1.Cluster.BlacklistedCertificatesEntry") 765 proto.RegisterType((*Secret)(nil), "docker.swarmkit.v1.Secret") 766 proto.RegisterType((*Config)(nil), "docker.swarmkit.v1.Config") 767 proto.RegisterType((*Resource)(nil), "docker.swarmkit.v1.Resource") 768 proto.RegisterType((*Extension)(nil), "docker.swarmkit.v1.Extension") 769 } 770 771 func init() { 772 proto.RegisterFile("github.com/docker/swarmkit/api/objects.proto", fileDescriptor_6218a23329ef342d) 773 } 774 775 var fileDescriptor_6218a23329ef342d = []byte{ 776 // 1700 bytes of a gzipped FileDescriptorProto 777 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x73, 0x1b, 0x49, 778 0x15, 0xf7, 0xc8, 0x13, 0x49, 0xf3, 0xf4, 0x81, 0xe9, 0x35, 0x66, 0x62, 0x8c, 0x6c, 0xb4, 0x2c, 779 0x95, 0xda, 0x4a, 0xc9, 0x4b, 0x58, 0xc0, 0x31, 0xbb, 0x6c, 0x24, 0xdb, 0x64, 0xc5, 0x6e, 0x36, 780 0xae, 0xf6, 0x6e, 0x76, 0x6f, 0x43, 0x6b, 0xa6, 0xad, 0x4c, 0x34, 0x9a, 0x9e, 0x9a, 0x6e, 0x69, 781 0x11, 0x27, 0xce, 0x39, 0x71, 0xcb, 0x8d, 0x03, 0xc5, 0x3f, 0xc1, 0x85, 0x03, 0x07, 0x2a, 0x1c, 782 0xa8, 0xda, 0x13, 0x95, 0x93, 0x8b, 0x28, 0x7f, 0x05, 0x37, 0xaa, 0x7b, 0x7a, 0xa4, 0x71, 0x34, 783 0xb6, 0x1c, 0x2a, 0x95, 0xe2, 0xa4, 0xfe, 0xf8, 0xfd, 0x5e, 0xbf, 0xf7, 0xe6, 0x7d, 0x74, 0x0b, 784 0x6e, 0xf6, 0x7d, 0xf1, 0x70, 0xd4, 0x6b, 0xb9, 0x6c, 0xb8, 0xeb, 0x31, 0x77, 0x40, 0xe3, 0x5d, 785 0xfe, 0x35, 0x89, 0x87, 0x03, 0x5f, 0xec, 0x92, 0xc8, 0xdf, 0x65, 0xbd, 0x47, 0xd4, 0x15, 0xbc, 786 0x15, 0xc5, 0x4c, 0x30, 0x84, 0x12, 0x48, 0x2b, 0x85, 0xb4, 0xc6, 0x3f, 0xde, 0x7c, 0x77, 0x89, 787 0x04, 0x31, 0x89, 0xa8, 0xe6, 0x2f, 0xc5, 0xf2, 0x88, 0xba, 0x29, 0x76, 0xbb, 0xcf, 0x58, 0x3f, 788 0xa0, 0xbb, 0x6a, 0xd6, 0x1b, 0x9d, 0xee, 0x0a, 0x7f, 0x48, 0xb9, 0x20, 0xc3, 0x48, 0x03, 0xd6, 789 0xfb, 0xac, 0xcf, 0xd4, 0x70, 0x57, 0x8e, 0xf4, 0xea, 0xf5, 0x97, 0x69, 0x24, 0x9c, 0xe8, 0xad, 790 0x9f, 0x5f, 0x72, 0xfa, 0x0c, 0x1e, 0x05, 0xa3, 0xbe, 0x1f, 0xea, 0x9f, 0x84, 0xd8, 0xfc, 0x8b, 791 0x01, 0xe6, 0x3d, 0x2a, 0x08, 0xfa, 0x05, 0x94, 0xc6, 0x34, 0xe6, 0x3e, 0x0b, 0x6d, 0x63, 0xc7, 792 0xb8, 0x51, 0xb9, 0xf5, 0xbd, 0xd6, 0xa2, 0x47, 0x5a, 0x0f, 0x12, 0x48, 0xc7, 0x7c, 0x7a, 0xb6, 793 0xbd, 0x82, 0x53, 0x06, 0xba, 0x0d, 0xe0, 0xc6, 0x94, 0x08, 0xea, 0x39, 0x44, 0xd8, 0x05, 0xc5, 794 0xdf, 0x6c, 0x25, 0xea, 0xb6, 0xd2, 0xf3, 0x5b, 0x9f, 0xa7, 0x56, 0x62, 0x4b, 0xa3, 0xdb, 0x42, 795 0x52, 0x47, 0x91, 0x97, 0x52, 0x57, 0x97, 0x53, 0x35, 0xba, 0x2d, 0x9a, 0x7f, 0xbe, 0x06, 0xe6, 796 0x67, 0xcc, 0xa3, 0x68, 0x03, 0x0a, 0xbe, 0xa7, 0xd4, 0xb6, 0x3a, 0xc5, 0xe9, 0xd9, 0x76, 0xa1, 797 0x7b, 0x88, 0x0b, 0xbe, 0x87, 0x6e, 0x81, 0x39, 0xa4, 0x82, 0x68, 0x85, 0xec, 0x3c, 0x83, 0xa4, 798 0xed, 0xda, 0x1a, 0x85, 0x45, 0x3f, 0x03, 0x53, 0x7e, 0x2a, 0xad, 0xc9, 0x56, 0x1e, 0x47, 0x9e, 799 0x79, 0x12, 0x51, 0x37, 0xe5, 0x49, 0x3c, 0x3a, 0x82, 0x8a, 0x47, 0xb9, 0x1b, 0xfb, 0x91, 0x90, 800 0x3e, 0x34, 0x15, 0xfd, 0xed, 0x8b, 0xe8, 0x87, 0x73, 0x28, 0xce, 0xf2, 0xd0, 0x07, 0x50, 0xe4, 801 0x82, 0x88, 0x11, 0xb7, 0xaf, 0x29, 0x09, 0x8d, 0x0b, 0x15, 0x50, 0x28, 0xad, 0x82, 0xe6, 0xa0, 802 0x8f, 0xa1, 0x3e, 0x24, 0x21, 0xe9, 0xd3, 0xd8, 0xd1, 0x52, 0x8a, 0x4a, 0xca, 0x0f, 0x72, 0x4d, 803 0x4f, 0x90, 0x89, 0x20, 0x5c, 0x1b, 0x66, 0xa7, 0xa8, 0x0b, 0x40, 0x84, 0x20, 0xee, 0xc3, 0x21, 804 0x0d, 0x85, 0x5d, 0x52, 0x52, 0xde, 0xc9, 0xd5, 0x85, 0x8a, 0xaf, 0x59, 0x3c, 0x68, 0xcf, 0xc0, 805 0x9d, 0x82, 0x6d, 0xe0, 0x0c, 0x19, 0xdd, 0x85, 0x8a, 0x4b, 0x63, 0xe1, 0x9f, 0xfa, 0x2e, 0x11, 806 0xd4, 0x2e, 0x2b, 0x59, 0xdb, 0x79, 0xb2, 0x0e, 0xe6, 0x30, 0x6d, 0x58, 0x96, 0x89, 0xde, 0x03, 807 0x33, 0x66, 0x01, 0xb5, 0xad, 0x1d, 0xe3, 0x46, 0xfd, 0xe2, 0x4f, 0x83, 0x59, 0x40, 0xb1, 0x42, 808 0xca, 0xa3, 0xe7, 0x8a, 0x70, 0x1b, 0x76, 0x56, 0xaf, 0x6c, 0x06, 0xce, 0x32, 0x51, 0x13, 0xaa, 809 0x0f, 0xbe, 0xfa, 0xb4, 0xfd, 0xd9, 0x17, 0x87, 0xc7, 0xc7, 0x2c, 0x16, 0x76, 0x65, 0xc7, 0xb8, 810 0x51, 0xc3, 0xe7, 0xd6, 0xf6, 0x37, 0x1e, 0x3f, 0x69, 0x22, 0x58, 0x2b, 0x1b, 0x6b, 0x86, 0x8a, 811 0x45, 0xe3, 0x3d, 0xe3, 0x2b, 0xe3, 0x37, 0x46, 0xf3, 0xb9, 0x09, 0xa5, 0x13, 0x1a, 0x8f, 0x7d, 812 0xf7, 0xf5, 0x46, 0xea, 0xed, 0x73, 0x91, 0x9a, 0xeb, 0x50, 0x7d, 0xec, 0x42, 0xb0, 0xfe, 0x12, 813 0xaa, 0xf2, 0xd7, 0x49, 0x33, 0x1e, 0x96, 0x66, 0x3c, 0xae, 0x48, 0x82, 0x9e, 0xa0, 0x43, 0xa8, 814 0x45, 0x31, 0x1d, 0xfb, 0x6c, 0xc4, 0x1d, 0xa5, 0x43, 0xf1, 0x4a, 0x3a, 0xe0, 0x6a, 0xca, 0x92, 815 0x33, 0x74, 0x1f, 0xbe, 0x73, 0x4e, 0xca, 0x4c, 0x9d, 0xca, 0x72, 0x75, 0xde, 0xca, 0x4a, 0x4a, 816 0xd5, 0xda, 0x83, 0x32, 0x0d, 0xbd, 0x88, 0xf9, 0xa1, 0xd0, 0x09, 0x98, 0x1b, 0x24, 0x47, 0x1a, 817 0x83, 0x67, 0x68, 0x74, 0x04, 0xb5, 0xa4, 0xae, 0x38, 0xe7, 0xb2, 0x6f, 0x27, 0x8f, 0xfe, 0x85, 818 0x02, 0xea, 0xb4, 0xa9, 0x8e, 0x32, 0x33, 0xf4, 0x01, 0xc0, 0x23, 0xd6, 0x4b, 0x65, 0x54, 0x95, 819 0x8c, 0xef, 0xe7, 0xc9, 0xf8, 0x35, 0xeb, 0x69, 0x01, 0xd6, 0xa3, 0x74, 0x88, 0xde, 0x81, 0x7a, 820 0x44, 0x43, 0xcf, 0x0f, 0xfb, 0x8e, 0x47, 0x03, 0x2a, 0xa8, 0xca, 0xbb, 0x32, 0xae, 0xe9, 0xd5, 821 0x43, 0xb5, 0xb8, 0x8f, 0x1e, 0x3f, 0x69, 0xd6, 0xa1, 0x9a, 0x8d, 0xb3, 0xe6, 0x1f, 0x0b, 0x50, 822 0x4e, 0xcd, 0x42, 0xef, 0xeb, 0xc0, 0x30, 0x2e, 0xb6, 0x21, 0xc5, 0xaa, 0xaf, 0x92, 0xc4, 0xc4, 823 0xfb, 0x70, 0x2d, 0x62, 0xb1, 0xe0, 0x76, 0x41, 0x65, 0x49, 0x6e, 0xe1, 0x91, 0x71, 0x7e, 0xc0, 824 0xc2, 0x53, 0xbf, 0x8f, 0x13, 0x30, 0xfa, 0x12, 0x2a, 0x63, 0x3f, 0x16, 0x23, 0x12, 0x38, 0x7e, 825 0xc4, 0xed, 0x55, 0xc5, 0xfd, 0xd1, 0x65, 0x47, 0xb6, 0x1e, 0x24, 0xf8, 0xee, 0x71, 0xa7, 0x3e, 826 0x3d, 0xdb, 0x86, 0xd9, 0x94, 0x63, 0xd0, 0xa2, 0xba, 0x11, 0xdf, 0xbc, 0x07, 0xd6, 0x6c, 0x07, 827 0xdd, 0x04, 0x08, 0x93, 0x04, 0x75, 0x66, 0xe9, 0x53, 0x9b, 0x9e, 0x6d, 0x5b, 0x3a, 0x6d, 0xbb, 828 0x87, 0xd8, 0xd2, 0x80, 0xae, 0x87, 0x10, 0x98, 0xc4, 0xf3, 0x62, 0x95, 0x4c, 0x16, 0x56, 0xe3, 829 0xe6, 0x3f, 0x4b, 0x60, 0x7e, 0x4e, 0xf8, 0xe0, 0x4d, 0xf7, 0x0a, 0x79, 0xe6, 0xd2, 0xf4, 0xab, 830 0xbf, 0x62, 0xfa, 0xdd, 0x04, 0xe0, 0x49, 0x56, 0x49, 0x77, 0x98, 0x73, 0x77, 0xe8, 0x5c, 0x93, 831 0xee, 0xd0, 0x80, 0xc4, 0x1d, 0x3c, 0x60, 0x42, 0x85, 0xb4, 0x89, 0xd5, 0x18, 0xbd, 0x0d, 0xa5, 832 0x90, 0x79, 0x8a, 0x5e, 0x54, 0x74, 0x98, 0x9e, 0x6d, 0x17, 0x65, 0xf5, 0xec, 0x1e, 0xe2, 0xa2, 833 0xdc, 0xea, 0x7a, 0xaa, 0x7a, 0x86, 0x21, 0x13, 0x44, 0x76, 0x26, 0xae, 0x9b, 0x40, 0x6e, 0x8e, 834 0xb7, 0xe7, 0xb0, 0xb4, 0x70, 0x67, 0x98, 0xe8, 0x01, 0xbc, 0x95, 0xea, 0x9b, 0x15, 0x58, 0x7e, 835 0x15, 0x81, 0x48, 0x4b, 0xc8, 0xec, 0x64, 0x9a, 0xa5, 0x75, 0x71, 0xb3, 0x54, 0x5f, 0x20, 0xaf, 836 0x59, 0x76, 0xa0, 0xe6, 0x51, 0xee, 0xc7, 0xd4, 0x53, 0x09, 0x4b, 0x55, 0x15, 0xac, 0xe7, 0xe7, 837 0x6b, 0x2a, 0x84, 0xe2, 0xaa, 0xe6, 0xa8, 0x19, 0x6a, 0x43, 0x59, 0xc7, 0x1d, 0xb7, 0x2b, 0xaf, 838 0xd2, 0x5d, 0x66, 0xb4, 0x73, 0x45, 0xab, 0xfa, 0x4a, 0x45, 0xeb, 0x36, 0x40, 0xc0, 0xfa, 0x8e, 839 0x17, 0xfb, 0x63, 0x1a, 0xdb, 0x35, 0x7d, 0x75, 0xca, 0xe1, 0x1e, 0x2a, 0x04, 0xb6, 0x02, 0xd6, 840 0x4f, 0x86, 0x88, 0xc0, 0x26, 0xe1, 0xdc, 0xef, 0x87, 0xd4, 0x73, 0xfa, 0x34, 0xa4, 0xb1, 0xef, 841 0x3a, 0x31, 0xe5, 0x6c, 0x14, 0xbb, 0x94, 0xdb, 0xdf, 0x52, 0x96, 0xe4, 0x5e, 0x5e, 0xee, 0x26, 842 0x60, 0xac, 0xb1, 0xd8, 0x4e, 0xc5, 0xbc, 0xb4, 0xc1, 0xd1, 0x1d, 0xa8, 0xc9, 0x5a, 0xe8, 0x0b, 843 0x1a, 0xab, 0xcf, 0x65, 0xaf, 0x2d, 0x8f, 0xf2, 0xea, 0x23, 0xd6, 0xeb, 0xa6, 0x84, 0xfd, 0xcd, 844 0xc7, 0x4f, 0x9a, 0x1b, 0xb0, 0x9e, 0x2d, 0x74, 0x7b, 0xc6, 0x1d, 0xe3, 0x63, 0xe3, 0xd8, 0x68, 845 0xfe, 0xad, 0x00, 0xdf, 0x5e, 0xf0, 0x2a, 0xfa, 0x29, 0x94, 0xb4, 0x5f, 0x2f, 0xbb, 0xc4, 0x6a, 846 0x1e, 0x4e, 0xb1, 0x68, 0x0b, 0x2c, 0x59, 0x24, 0x28, 0xe7, 0x34, 0x29, 0x7f, 0x16, 0x9e, 0x2f, 847 0x20, 0x1b, 0x4a, 0x24, 0xf0, 0x89, 0xdc, 0x5b, 0x55, 0x7b, 0xe9, 0x14, 0x8d, 0x60, 0x23, 0x71, 848 0xbe, 0x33, 0xbf, 0x2b, 0x38, 0x2c, 0x12, 0xdc, 0x36, 0x95, 0x07, 0x3f, 0xba, 0x52, 0x2c, 0xe8, 849 0xcf, 0x33, 0x5f, 0xb8, 0x1f, 0x09, 0x7e, 0x14, 0x8a, 0x78, 0x82, 0xd7, 0xbd, 0x9c, 0xad, 0xcd, 850 0xbb, 0x70, 0xfd, 0x42, 0x0a, 0x5a, 0x83, 0xd5, 0x01, 0x9d, 0x24, 0x05, 0x0e, 0xcb, 0x21, 0x5a, 851 0x87, 0x6b, 0x63, 0x12, 0x8c, 0xa8, 0xae, 0x87, 0xc9, 0x64, 0xbf, 0xb0, 0x67, 0x34, 0xff, 0x51, 852 0x80, 0x92, 0x56, 0xe7, 0x4d, 0xdf, 0x4c, 0xf4, 0xb1, 0x0b, 0xa5, 0xf1, 0x43, 0xa8, 0x6a, 0x97, 853 0x26, 0x39, 0x69, 0x2e, 0x8d, 0xea, 0x4a, 0x82, 0x4f, 0xf2, 0xf1, 0x43, 0x30, 0xfd, 0x88, 0x0c, 854 0x75, 0xfb, 0xce, 0x3d, 0xb9, 0x7b, 0xdc, 0xbe, 0x77, 0x3f, 0x4a, 0x4a, 0x4b, 0x79, 0x7a, 0xb6, 855 0x6d, 0xca, 0x05, 0xac, 0x68, 0x39, 0x1d, 0xb8, 0x78, 0xd5, 0x0e, 0xfc, 0xf7, 0x22, 0x94, 0x0e, 856 0x82, 0x11, 0x17, 0x34, 0x7e, 0xd3, 0xbe, 0xd4, 0xc7, 0x2e, 0xf8, 0xf2, 0x00, 0x4a, 0x31, 0x63, 857 0xc2, 0x71, 0xc9, 0x65, 0x6e, 0xc4, 0x8c, 0x89, 0x83, 0x76, 0xa7, 0x2e, 0x89, 0xb2, 0x09, 0x24, 858 0x73, 0x5c, 0x94, 0xd4, 0x03, 0x82, 0xbe, 0x84, 0x8d, 0xb4, 0xf5, 0xf6, 0x18, 0x13, 0x5c, 0xc4, 859 0x24, 0x72, 0x06, 0x74, 0x22, 0xaf, 0x48, 0xab, 0x17, 0x3d, 0x2d, 0x8e, 0x42, 0x37, 0x9e, 0x28, 860 0x1f, 0x7f, 0x42, 0x27, 0x78, 0x5d, 0x0b, 0xe8, 0xa4, 0xfc, 0x4f, 0xe8, 0x84, 0xa3, 0x8f, 0x60, 861 0x8b, 0xce, 0x60, 0x52, 0xa2, 0x13, 0x90, 0xa1, 0xbc, 0x54, 0x38, 0x6e, 0xc0, 0xdc, 0x81, 0xf2, 862 0xbc, 0x89, 0xaf, 0xd3, 0xac, 0xa8, 0x4f, 0x13, 0xc4, 0x81, 0x04, 0x20, 0x0e, 0x76, 0x2f, 0x20, 863 0xee, 0x20, 0xf0, 0xb9, 0x7c, 0x3d, 0x66, 0x5e, 0x0a, 0xb2, 0xb5, 0x48, 0xdd, 0xf6, 0x2e, 0xf1, 864 0x56, 0xab, 0x33, 0xe7, 0x66, 0xde, 0x1d, 0x3a, 0xf1, 0xbe, 0xdb, 0xcb, 0xdf, 0x45, 0x1d, 0xa8, 865 0x8c, 0x42, 0x79, 0x7c, 0xe2, 0x03, 0xeb, 0xaa, 0x3e, 0x80, 0x84, 0xa5, 0x2c, 0xdf, 0x02, 0xf3, 866 0x54, 0x5e, 0x96, 0x64, 0xbf, 0x29, 0x27, 0x31, 0xf8, 0xab, 0xee, 0xf1, 0x09, 0x56, 0xab, 0xa8, 867 0x05, 0xc8, 0xa3, 0xa7, 0x64, 0x14, 0x88, 0x76, 0x52, 0x82, 0x8e, 0x19, 0x0b, 0x54, 0x73, 0xb1, 868 0x70, 0xce, 0x0e, 0x6a, 0x00, 0xf0, 0x51, 0x2f, 0xa4, 0xe2, 0xc4, 0xff, 0x1d, 0x55, 0x1d, 0xa4, 869 0x86, 0x33, 0x2b, 0x0b, 0x4f, 0x97, 0xda, 0xe2, 0xd3, 0x65, 0x73, 0x0c, 0x5b, 0x97, 0xb9, 0x23, 870 0xa7, 0xa8, 0xdc, 0xc9, 0x16, 0x95, 0xca, 0xad, 0x77, 0xf3, 0x3c, 0x90, 0x2f, 0x32, 0x53, 0x80, 871 0x72, 0x13, 0xe9, 0xaf, 0x06, 0x14, 0x4f, 0xa8, 0x1b, 0x53, 0xf1, 0x5a, 0xf3, 0x68, 0xef, 0x5c, 872 0x1e, 0x35, 0xf2, 0x5f, 0x2a, 0xf2, 0xd4, 0x85, 0x34, 0xda, 0x84, 0xb2, 0x1f, 0x0a, 0x1a, 0x87, 873 0x24, 0x50, 0x79, 0x54, 0xc6, 0xb3, 0x79, 0xae, 0x01, 0x7f, 0x32, 0xa0, 0x98, 0x5c, 0x92, 0xdf, 874 0xb4, 0x01, 0xc9, 0xa9, 0x2f, 0x1b, 0x90, 0xab, 0xe4, 0x7f, 0x0c, 0x28, 0xa7, 0xbd, 0xfa, 0xb5, 875 0xaa, 0xf9, 0xd2, 0xa5, 0x71, 0xf5, 0x7f, 0xbe, 0x34, 0x22, 0x30, 0x07, 0x7e, 0xa8, 0xaf, 0xb7, 876 0x58, 0x8d, 0x51, 0x0b, 0x4a, 0x11, 0x99, 0x04, 0x8c, 0x78, 0xba, 0xc2, 0xaf, 0x2f, 0xfc, 0x53, 877 0xd4, 0x0e, 0x27, 0x38, 0x05, 0xed, 0xaf, 0x3f, 0x7e, 0xd2, 0x5c, 0x83, 0x7a, 0xd6, 0xf2, 0x87, 878 0x46, 0xf3, 0x5f, 0x06, 0x58, 0x47, 0xbf, 0x15, 0x34, 0x54, 0x97, 0xe9, 0xff, 0x4b, 0xe3, 0x77, 879 0x16, 0xff, 0x4d, 0xb2, 0xce, 0xfd, 0x51, 0x94, 0xf7, 0x51, 0x3b, 0x3f, 0x7c, 0xfa, 0xbc, 0xb1, 880 0xf2, 0xec, 0x79, 0x63, 0xe5, 0xf7, 0xd3, 0x86, 0xf1, 0x74, 0xda, 0x30, 0xbe, 0x99, 0x36, 0x8c, 881 0x7f, 0x4f, 0x1b, 0xc6, 0x1f, 0x5e, 0x34, 0x56, 0xbe, 0x79, 0xd1, 0x58, 0x79, 0xf6, 0xa2, 0xb1, 882 0xd2, 0x2b, 0x2a, 0x5f, 0xfd, 0xe4, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xda, 0xee, 0xd3, 883 0x20, 0x15, 0x00, 0x00, 884 } 885 886 func (m *Meta) Copy() *Meta { 887 if m == nil { 888 return nil 889 } 890 o := &Meta{} 891 o.CopyFrom(m) 892 return o 893 } 894 895 func (m *Meta) CopyFrom(src interface{}) { 896 897 o := src.(*Meta) 898 *m = *o 899 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Version, &o.Version) 900 if o.CreatedAt != nil { 901 m.CreatedAt = &types.Timestamp{} 902 github_com_docker_swarmkit_api_deepcopy.Copy(m.CreatedAt, o.CreatedAt) 903 } 904 if o.UpdatedAt != nil { 905 m.UpdatedAt = &types.Timestamp{} 906 github_com_docker_swarmkit_api_deepcopy.Copy(m.UpdatedAt, o.UpdatedAt) 907 } 908 } 909 910 func (m *Node) Copy() *Node { 911 if m == nil { 912 return nil 913 } 914 o := &Node{} 915 o.CopyFrom(m) 916 return o 917 } 918 919 func (m *Node) CopyFrom(src interface{}) { 920 921 o := src.(*Node) 922 *m = *o 923 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 924 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 925 if o.Description != nil { 926 m.Description = &NodeDescription{} 927 github_com_docker_swarmkit_api_deepcopy.Copy(m.Description, o.Description) 928 } 929 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Status, &o.Status) 930 if o.ManagerStatus != nil { 931 m.ManagerStatus = &ManagerStatus{} 932 github_com_docker_swarmkit_api_deepcopy.Copy(m.ManagerStatus, o.ManagerStatus) 933 } 934 if o.Attachment != nil { 935 m.Attachment = &NetworkAttachment{} 936 github_com_docker_swarmkit_api_deepcopy.Copy(m.Attachment, o.Attachment) 937 } 938 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Certificate, &o.Certificate) 939 if o.Attachments != nil { 940 m.Attachments = make([]*NetworkAttachment, len(o.Attachments)) 941 for i := range m.Attachments { 942 m.Attachments[i] = &NetworkAttachment{} 943 github_com_docker_swarmkit_api_deepcopy.Copy(m.Attachments[i], o.Attachments[i]) 944 } 945 } 946 947 } 948 949 func (m *Service) Copy() *Service { 950 if m == nil { 951 return nil 952 } 953 o := &Service{} 954 o.CopyFrom(m) 955 return o 956 } 957 958 func (m *Service) CopyFrom(src interface{}) { 959 960 o := src.(*Service) 961 *m = *o 962 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 963 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 964 if o.SpecVersion != nil { 965 m.SpecVersion = &Version{} 966 github_com_docker_swarmkit_api_deepcopy.Copy(m.SpecVersion, o.SpecVersion) 967 } 968 if o.PreviousSpec != nil { 969 m.PreviousSpec = &ServiceSpec{} 970 github_com_docker_swarmkit_api_deepcopy.Copy(m.PreviousSpec, o.PreviousSpec) 971 } 972 if o.PreviousSpecVersion != nil { 973 m.PreviousSpecVersion = &Version{} 974 github_com_docker_swarmkit_api_deepcopy.Copy(m.PreviousSpecVersion, o.PreviousSpecVersion) 975 } 976 if o.Endpoint != nil { 977 m.Endpoint = &Endpoint{} 978 github_com_docker_swarmkit_api_deepcopy.Copy(m.Endpoint, o.Endpoint) 979 } 980 if o.UpdateStatus != nil { 981 m.UpdateStatus = &UpdateStatus{} 982 github_com_docker_swarmkit_api_deepcopy.Copy(m.UpdateStatus, o.UpdateStatus) 983 } 984 if o.JobStatus != nil { 985 m.JobStatus = &JobStatus{} 986 github_com_docker_swarmkit_api_deepcopy.Copy(m.JobStatus, o.JobStatus) 987 } 988 } 989 990 func (m *Endpoint) Copy() *Endpoint { 991 if m == nil { 992 return nil 993 } 994 o := &Endpoint{} 995 o.CopyFrom(m) 996 return o 997 } 998 999 func (m *Endpoint) CopyFrom(src interface{}) { 1000 1001 o := src.(*Endpoint) 1002 *m = *o 1003 if o.Spec != nil { 1004 m.Spec = &EndpointSpec{} 1005 github_com_docker_swarmkit_api_deepcopy.Copy(m.Spec, o.Spec) 1006 } 1007 if o.Ports != nil { 1008 m.Ports = make([]*PortConfig, len(o.Ports)) 1009 for i := range m.Ports { 1010 m.Ports[i] = &PortConfig{} 1011 github_com_docker_swarmkit_api_deepcopy.Copy(m.Ports[i], o.Ports[i]) 1012 } 1013 } 1014 1015 if o.VirtualIPs != nil { 1016 m.VirtualIPs = make([]*Endpoint_VirtualIP, len(o.VirtualIPs)) 1017 for i := range m.VirtualIPs { 1018 m.VirtualIPs[i] = &Endpoint_VirtualIP{} 1019 github_com_docker_swarmkit_api_deepcopy.Copy(m.VirtualIPs[i], o.VirtualIPs[i]) 1020 } 1021 } 1022 1023 } 1024 1025 func (m *Endpoint_VirtualIP) Copy() *Endpoint_VirtualIP { 1026 if m == nil { 1027 return nil 1028 } 1029 o := &Endpoint_VirtualIP{} 1030 o.CopyFrom(m) 1031 return o 1032 } 1033 1034 func (m *Endpoint_VirtualIP) CopyFrom(src interface{}) { 1035 1036 o := src.(*Endpoint_VirtualIP) 1037 *m = *o 1038 } 1039 1040 func (m *Task) Copy() *Task { 1041 if m == nil { 1042 return nil 1043 } 1044 o := &Task{} 1045 o.CopyFrom(m) 1046 return o 1047 } 1048 1049 func (m *Task) CopyFrom(src interface{}) { 1050 1051 o := src.(*Task) 1052 *m = *o 1053 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1054 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 1055 if o.SpecVersion != nil { 1056 m.SpecVersion = &Version{} 1057 github_com_docker_swarmkit_api_deepcopy.Copy(m.SpecVersion, o.SpecVersion) 1058 } 1059 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Annotations, &o.Annotations) 1060 github_com_docker_swarmkit_api_deepcopy.Copy(&m.ServiceAnnotations, &o.ServiceAnnotations) 1061 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Status, &o.Status) 1062 if o.Networks != nil { 1063 m.Networks = make([]*NetworkAttachment, len(o.Networks)) 1064 for i := range m.Networks { 1065 m.Networks[i] = &NetworkAttachment{} 1066 github_com_docker_swarmkit_api_deepcopy.Copy(m.Networks[i], o.Networks[i]) 1067 } 1068 } 1069 1070 if o.Endpoint != nil { 1071 m.Endpoint = &Endpoint{} 1072 github_com_docker_swarmkit_api_deepcopy.Copy(m.Endpoint, o.Endpoint) 1073 } 1074 if o.LogDriver != nil { 1075 m.LogDriver = &Driver{} 1076 github_com_docker_swarmkit_api_deepcopy.Copy(m.LogDriver, o.LogDriver) 1077 } 1078 if o.AssignedGenericResources != nil { 1079 m.AssignedGenericResources = make([]*GenericResource, len(o.AssignedGenericResources)) 1080 for i := range m.AssignedGenericResources { 1081 m.AssignedGenericResources[i] = &GenericResource{} 1082 github_com_docker_swarmkit_api_deepcopy.Copy(m.AssignedGenericResources[i], o.AssignedGenericResources[i]) 1083 } 1084 } 1085 1086 if o.JobIteration != nil { 1087 m.JobIteration = &Version{} 1088 github_com_docker_swarmkit_api_deepcopy.Copy(m.JobIteration, o.JobIteration) 1089 } 1090 } 1091 1092 func (m *NetworkAttachment) Copy() *NetworkAttachment { 1093 if m == nil { 1094 return nil 1095 } 1096 o := &NetworkAttachment{} 1097 o.CopyFrom(m) 1098 return o 1099 } 1100 1101 func (m *NetworkAttachment) CopyFrom(src interface{}) { 1102 1103 o := src.(*NetworkAttachment) 1104 *m = *o 1105 if o.Network != nil { 1106 m.Network = &Network{} 1107 github_com_docker_swarmkit_api_deepcopy.Copy(m.Network, o.Network) 1108 } 1109 if o.Addresses != nil { 1110 m.Addresses = make([]string, len(o.Addresses)) 1111 copy(m.Addresses, o.Addresses) 1112 } 1113 1114 if o.Aliases != nil { 1115 m.Aliases = make([]string, len(o.Aliases)) 1116 copy(m.Aliases, o.Aliases) 1117 } 1118 1119 if o.DriverAttachmentOpts != nil { 1120 m.DriverAttachmentOpts = make(map[string]string, len(o.DriverAttachmentOpts)) 1121 for k, v := range o.DriverAttachmentOpts { 1122 m.DriverAttachmentOpts[k] = v 1123 } 1124 } 1125 1126 } 1127 1128 func (m *Network) Copy() *Network { 1129 if m == nil { 1130 return nil 1131 } 1132 o := &Network{} 1133 o.CopyFrom(m) 1134 return o 1135 } 1136 1137 func (m *Network) CopyFrom(src interface{}) { 1138 1139 o := src.(*Network) 1140 *m = *o 1141 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1142 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 1143 if o.DriverState != nil { 1144 m.DriverState = &Driver{} 1145 github_com_docker_swarmkit_api_deepcopy.Copy(m.DriverState, o.DriverState) 1146 } 1147 if o.IPAM != nil { 1148 m.IPAM = &IPAMOptions{} 1149 github_com_docker_swarmkit_api_deepcopy.Copy(m.IPAM, o.IPAM) 1150 } 1151 } 1152 1153 func (m *Cluster) Copy() *Cluster { 1154 if m == nil { 1155 return nil 1156 } 1157 o := &Cluster{} 1158 o.CopyFrom(m) 1159 return o 1160 } 1161 1162 func (m *Cluster) CopyFrom(src interface{}) { 1163 1164 o := src.(*Cluster) 1165 *m = *o 1166 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1167 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 1168 github_com_docker_swarmkit_api_deepcopy.Copy(&m.RootCA, &o.RootCA) 1169 if o.NetworkBootstrapKeys != nil { 1170 m.NetworkBootstrapKeys = make([]*EncryptionKey, len(o.NetworkBootstrapKeys)) 1171 for i := range m.NetworkBootstrapKeys { 1172 m.NetworkBootstrapKeys[i] = &EncryptionKey{} 1173 github_com_docker_swarmkit_api_deepcopy.Copy(m.NetworkBootstrapKeys[i], o.NetworkBootstrapKeys[i]) 1174 } 1175 } 1176 1177 if o.BlacklistedCertificates != nil { 1178 m.BlacklistedCertificates = make(map[string]*BlacklistedCertificate, len(o.BlacklistedCertificates)) 1179 for k, v := range o.BlacklistedCertificates { 1180 m.BlacklistedCertificates[k] = &BlacklistedCertificate{} 1181 github_com_docker_swarmkit_api_deepcopy.Copy(m.BlacklistedCertificates[k], v) 1182 } 1183 } 1184 1185 if o.UnlockKeys != nil { 1186 m.UnlockKeys = make([]*EncryptionKey, len(o.UnlockKeys)) 1187 for i := range m.UnlockKeys { 1188 m.UnlockKeys[i] = &EncryptionKey{} 1189 github_com_docker_swarmkit_api_deepcopy.Copy(m.UnlockKeys[i], o.UnlockKeys[i]) 1190 } 1191 } 1192 1193 if o.DefaultAddressPool != nil { 1194 m.DefaultAddressPool = make([]string, len(o.DefaultAddressPool)) 1195 copy(m.DefaultAddressPool, o.DefaultAddressPool) 1196 } 1197 1198 } 1199 1200 func (m *Secret) Copy() *Secret { 1201 if m == nil { 1202 return nil 1203 } 1204 o := &Secret{} 1205 o.CopyFrom(m) 1206 return o 1207 } 1208 1209 func (m *Secret) CopyFrom(src interface{}) { 1210 1211 o := src.(*Secret) 1212 *m = *o 1213 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1214 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 1215 } 1216 1217 func (m *Config) Copy() *Config { 1218 if m == nil { 1219 return nil 1220 } 1221 o := &Config{} 1222 o.CopyFrom(m) 1223 return o 1224 } 1225 1226 func (m *Config) CopyFrom(src interface{}) { 1227 1228 o := src.(*Config) 1229 *m = *o 1230 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1231 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Spec, &o.Spec) 1232 } 1233 1234 func (m *Resource) Copy() *Resource { 1235 if m == nil { 1236 return nil 1237 } 1238 o := &Resource{} 1239 o.CopyFrom(m) 1240 return o 1241 } 1242 1243 func (m *Resource) CopyFrom(src interface{}) { 1244 1245 o := src.(*Resource) 1246 *m = *o 1247 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1248 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Annotations, &o.Annotations) 1249 if o.Payload != nil { 1250 m.Payload = &types.Any{} 1251 github_com_docker_swarmkit_api_deepcopy.Copy(m.Payload, o.Payload) 1252 } 1253 } 1254 1255 func (m *Extension) Copy() *Extension { 1256 if m == nil { 1257 return nil 1258 } 1259 o := &Extension{} 1260 o.CopyFrom(m) 1261 return o 1262 } 1263 1264 func (m *Extension) CopyFrom(src interface{}) { 1265 1266 o := src.(*Extension) 1267 *m = *o 1268 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Meta, &o.Meta) 1269 github_com_docker_swarmkit_api_deepcopy.Copy(&m.Annotations, &o.Annotations) 1270 } 1271 1272 func (m *Meta) Marshal() (dAtA []byte, err error) { 1273 size := m.Size() 1274 dAtA = make([]byte, size) 1275 n, err := m.MarshalTo(dAtA) 1276 if err != nil { 1277 return nil, err 1278 } 1279 return dAtA[:n], nil 1280 } 1281 1282 func (m *Meta) MarshalTo(dAtA []byte) (int, error) { 1283 var i int 1284 _ = i 1285 var l int 1286 _ = l 1287 dAtA[i] = 0xa 1288 i++ 1289 i = encodeVarintObjects(dAtA, i, uint64(m.Version.Size())) 1290 n1, err := m.Version.MarshalTo(dAtA[i:]) 1291 if err != nil { 1292 return 0, err 1293 } 1294 i += n1 1295 if m.CreatedAt != nil { 1296 dAtA[i] = 0x12 1297 i++ 1298 i = encodeVarintObjects(dAtA, i, uint64(m.CreatedAt.Size())) 1299 n2, err := m.CreatedAt.MarshalTo(dAtA[i:]) 1300 if err != nil { 1301 return 0, err 1302 } 1303 i += n2 1304 } 1305 if m.UpdatedAt != nil { 1306 dAtA[i] = 0x1a 1307 i++ 1308 i = encodeVarintObjects(dAtA, i, uint64(m.UpdatedAt.Size())) 1309 n3, err := m.UpdatedAt.MarshalTo(dAtA[i:]) 1310 if err != nil { 1311 return 0, err 1312 } 1313 i += n3 1314 } 1315 return i, nil 1316 } 1317 1318 func (m *Node) Marshal() (dAtA []byte, err error) { 1319 size := m.Size() 1320 dAtA = make([]byte, size) 1321 n, err := m.MarshalTo(dAtA) 1322 if err != nil { 1323 return nil, err 1324 } 1325 return dAtA[:n], nil 1326 } 1327 1328 func (m *Node) MarshalTo(dAtA []byte) (int, error) { 1329 var i int 1330 _ = i 1331 var l int 1332 _ = l 1333 if len(m.ID) > 0 { 1334 dAtA[i] = 0xa 1335 i++ 1336 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 1337 i += copy(dAtA[i:], m.ID) 1338 } 1339 dAtA[i] = 0x12 1340 i++ 1341 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 1342 n4, err := m.Meta.MarshalTo(dAtA[i:]) 1343 if err != nil { 1344 return 0, err 1345 } 1346 i += n4 1347 dAtA[i] = 0x1a 1348 i++ 1349 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1350 n5, err := m.Spec.MarshalTo(dAtA[i:]) 1351 if err != nil { 1352 return 0, err 1353 } 1354 i += n5 1355 if m.Description != nil { 1356 dAtA[i] = 0x22 1357 i++ 1358 i = encodeVarintObjects(dAtA, i, uint64(m.Description.Size())) 1359 n6, err := m.Description.MarshalTo(dAtA[i:]) 1360 if err != nil { 1361 return 0, err 1362 } 1363 i += n6 1364 } 1365 dAtA[i] = 0x2a 1366 i++ 1367 i = encodeVarintObjects(dAtA, i, uint64(m.Status.Size())) 1368 n7, err := m.Status.MarshalTo(dAtA[i:]) 1369 if err != nil { 1370 return 0, err 1371 } 1372 i += n7 1373 if m.ManagerStatus != nil { 1374 dAtA[i] = 0x32 1375 i++ 1376 i = encodeVarintObjects(dAtA, i, uint64(m.ManagerStatus.Size())) 1377 n8, err := m.ManagerStatus.MarshalTo(dAtA[i:]) 1378 if err != nil { 1379 return 0, err 1380 } 1381 i += n8 1382 } 1383 if m.Attachment != nil { 1384 dAtA[i] = 0x3a 1385 i++ 1386 i = encodeVarintObjects(dAtA, i, uint64(m.Attachment.Size())) 1387 n9, err := m.Attachment.MarshalTo(dAtA[i:]) 1388 if err != nil { 1389 return 0, err 1390 } 1391 i += n9 1392 } 1393 dAtA[i] = 0x42 1394 i++ 1395 i = encodeVarintObjects(dAtA, i, uint64(m.Certificate.Size())) 1396 n10, err := m.Certificate.MarshalTo(dAtA[i:]) 1397 if err != nil { 1398 return 0, err 1399 } 1400 i += n10 1401 if m.Role != 0 { 1402 dAtA[i] = 0x48 1403 i++ 1404 i = encodeVarintObjects(dAtA, i, uint64(m.Role)) 1405 } 1406 if len(m.Attachments) > 0 { 1407 for _, msg := range m.Attachments { 1408 dAtA[i] = 0x52 1409 i++ 1410 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1411 n, err := msg.MarshalTo(dAtA[i:]) 1412 if err != nil { 1413 return 0, err 1414 } 1415 i += n 1416 } 1417 } 1418 if m.VXLANUDPPort != 0 { 1419 dAtA[i] = 0x58 1420 i++ 1421 i = encodeVarintObjects(dAtA, i, uint64(m.VXLANUDPPort)) 1422 } 1423 return i, nil 1424 } 1425 1426 func (m *Service) Marshal() (dAtA []byte, err error) { 1427 size := m.Size() 1428 dAtA = make([]byte, size) 1429 n, err := m.MarshalTo(dAtA) 1430 if err != nil { 1431 return nil, err 1432 } 1433 return dAtA[:n], nil 1434 } 1435 1436 func (m *Service) MarshalTo(dAtA []byte) (int, error) { 1437 var i int 1438 _ = i 1439 var l int 1440 _ = l 1441 if len(m.ID) > 0 { 1442 dAtA[i] = 0xa 1443 i++ 1444 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 1445 i += copy(dAtA[i:], m.ID) 1446 } 1447 dAtA[i] = 0x12 1448 i++ 1449 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 1450 n11, err := m.Meta.MarshalTo(dAtA[i:]) 1451 if err != nil { 1452 return 0, err 1453 } 1454 i += n11 1455 dAtA[i] = 0x1a 1456 i++ 1457 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1458 n12, err := m.Spec.MarshalTo(dAtA[i:]) 1459 if err != nil { 1460 return 0, err 1461 } 1462 i += n12 1463 if m.Endpoint != nil { 1464 dAtA[i] = 0x22 1465 i++ 1466 i = encodeVarintObjects(dAtA, i, uint64(m.Endpoint.Size())) 1467 n13, err := m.Endpoint.MarshalTo(dAtA[i:]) 1468 if err != nil { 1469 return 0, err 1470 } 1471 i += n13 1472 } 1473 if m.UpdateStatus != nil { 1474 dAtA[i] = 0x2a 1475 i++ 1476 i = encodeVarintObjects(dAtA, i, uint64(m.UpdateStatus.Size())) 1477 n14, err := m.UpdateStatus.MarshalTo(dAtA[i:]) 1478 if err != nil { 1479 return 0, err 1480 } 1481 i += n14 1482 } 1483 if m.PreviousSpec != nil { 1484 dAtA[i] = 0x32 1485 i++ 1486 i = encodeVarintObjects(dAtA, i, uint64(m.PreviousSpec.Size())) 1487 n15, err := m.PreviousSpec.MarshalTo(dAtA[i:]) 1488 if err != nil { 1489 return 0, err 1490 } 1491 i += n15 1492 } 1493 if m.PendingDelete { 1494 dAtA[i] = 0x38 1495 i++ 1496 if m.PendingDelete { 1497 dAtA[i] = 1 1498 } else { 1499 dAtA[i] = 0 1500 } 1501 i++ 1502 } 1503 if m.SpecVersion != nil { 1504 dAtA[i] = 0x52 1505 i++ 1506 i = encodeVarintObjects(dAtA, i, uint64(m.SpecVersion.Size())) 1507 n16, err := m.SpecVersion.MarshalTo(dAtA[i:]) 1508 if err != nil { 1509 return 0, err 1510 } 1511 i += n16 1512 } 1513 if m.PreviousSpecVersion != nil { 1514 dAtA[i] = 0x5a 1515 i++ 1516 i = encodeVarintObjects(dAtA, i, uint64(m.PreviousSpecVersion.Size())) 1517 n17, err := m.PreviousSpecVersion.MarshalTo(dAtA[i:]) 1518 if err != nil { 1519 return 0, err 1520 } 1521 i += n17 1522 } 1523 if m.JobStatus != nil { 1524 dAtA[i] = 0x62 1525 i++ 1526 i = encodeVarintObjects(dAtA, i, uint64(m.JobStatus.Size())) 1527 n18, err := m.JobStatus.MarshalTo(dAtA[i:]) 1528 if err != nil { 1529 return 0, err 1530 } 1531 i += n18 1532 } 1533 return i, nil 1534 } 1535 1536 func (m *Endpoint) Marshal() (dAtA []byte, err error) { 1537 size := m.Size() 1538 dAtA = make([]byte, size) 1539 n, err := m.MarshalTo(dAtA) 1540 if err != nil { 1541 return nil, err 1542 } 1543 return dAtA[:n], nil 1544 } 1545 1546 func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { 1547 var i int 1548 _ = i 1549 var l int 1550 _ = l 1551 if m.Spec != nil { 1552 dAtA[i] = 0xa 1553 i++ 1554 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1555 n19, err := m.Spec.MarshalTo(dAtA[i:]) 1556 if err != nil { 1557 return 0, err 1558 } 1559 i += n19 1560 } 1561 if len(m.Ports) > 0 { 1562 for _, msg := range m.Ports { 1563 dAtA[i] = 0x12 1564 i++ 1565 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1566 n, err := msg.MarshalTo(dAtA[i:]) 1567 if err != nil { 1568 return 0, err 1569 } 1570 i += n 1571 } 1572 } 1573 if len(m.VirtualIPs) > 0 { 1574 for _, msg := range m.VirtualIPs { 1575 dAtA[i] = 0x1a 1576 i++ 1577 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1578 n, err := msg.MarshalTo(dAtA[i:]) 1579 if err != nil { 1580 return 0, err 1581 } 1582 i += n 1583 } 1584 } 1585 return i, nil 1586 } 1587 1588 func (m *Endpoint_VirtualIP) Marshal() (dAtA []byte, err error) { 1589 size := m.Size() 1590 dAtA = make([]byte, size) 1591 n, err := m.MarshalTo(dAtA) 1592 if err != nil { 1593 return nil, err 1594 } 1595 return dAtA[:n], nil 1596 } 1597 1598 func (m *Endpoint_VirtualIP) MarshalTo(dAtA []byte) (int, error) { 1599 var i int 1600 _ = i 1601 var l int 1602 _ = l 1603 if len(m.NetworkID) > 0 { 1604 dAtA[i] = 0xa 1605 i++ 1606 i = encodeVarintObjects(dAtA, i, uint64(len(m.NetworkID))) 1607 i += copy(dAtA[i:], m.NetworkID) 1608 } 1609 if len(m.Addr) > 0 { 1610 dAtA[i] = 0x12 1611 i++ 1612 i = encodeVarintObjects(dAtA, i, uint64(len(m.Addr))) 1613 i += copy(dAtA[i:], m.Addr) 1614 } 1615 return i, nil 1616 } 1617 1618 func (m *Task) Marshal() (dAtA []byte, err error) { 1619 size := m.Size() 1620 dAtA = make([]byte, size) 1621 n, err := m.MarshalTo(dAtA) 1622 if err != nil { 1623 return nil, err 1624 } 1625 return dAtA[:n], nil 1626 } 1627 1628 func (m *Task) MarshalTo(dAtA []byte) (int, error) { 1629 var i int 1630 _ = i 1631 var l int 1632 _ = l 1633 if len(m.ID) > 0 { 1634 dAtA[i] = 0xa 1635 i++ 1636 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 1637 i += copy(dAtA[i:], m.ID) 1638 } 1639 dAtA[i] = 0x12 1640 i++ 1641 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 1642 n20, err := m.Meta.MarshalTo(dAtA[i:]) 1643 if err != nil { 1644 return 0, err 1645 } 1646 i += n20 1647 dAtA[i] = 0x1a 1648 i++ 1649 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1650 n21, err := m.Spec.MarshalTo(dAtA[i:]) 1651 if err != nil { 1652 return 0, err 1653 } 1654 i += n21 1655 if len(m.ServiceID) > 0 { 1656 dAtA[i] = 0x22 1657 i++ 1658 i = encodeVarintObjects(dAtA, i, uint64(len(m.ServiceID))) 1659 i += copy(dAtA[i:], m.ServiceID) 1660 } 1661 if m.Slot != 0 { 1662 dAtA[i] = 0x28 1663 i++ 1664 i = encodeVarintObjects(dAtA, i, uint64(m.Slot)) 1665 } 1666 if len(m.NodeID) > 0 { 1667 dAtA[i] = 0x32 1668 i++ 1669 i = encodeVarintObjects(dAtA, i, uint64(len(m.NodeID))) 1670 i += copy(dAtA[i:], m.NodeID) 1671 } 1672 dAtA[i] = 0x3a 1673 i++ 1674 i = encodeVarintObjects(dAtA, i, uint64(m.Annotations.Size())) 1675 n22, err := m.Annotations.MarshalTo(dAtA[i:]) 1676 if err != nil { 1677 return 0, err 1678 } 1679 i += n22 1680 dAtA[i] = 0x42 1681 i++ 1682 i = encodeVarintObjects(dAtA, i, uint64(m.ServiceAnnotations.Size())) 1683 n23, err := m.ServiceAnnotations.MarshalTo(dAtA[i:]) 1684 if err != nil { 1685 return 0, err 1686 } 1687 i += n23 1688 dAtA[i] = 0x4a 1689 i++ 1690 i = encodeVarintObjects(dAtA, i, uint64(m.Status.Size())) 1691 n24, err := m.Status.MarshalTo(dAtA[i:]) 1692 if err != nil { 1693 return 0, err 1694 } 1695 i += n24 1696 if m.DesiredState != 0 { 1697 dAtA[i] = 0x50 1698 i++ 1699 i = encodeVarintObjects(dAtA, i, uint64(m.DesiredState)) 1700 } 1701 if len(m.Networks) > 0 { 1702 for _, msg := range m.Networks { 1703 dAtA[i] = 0x5a 1704 i++ 1705 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1706 n, err := msg.MarshalTo(dAtA[i:]) 1707 if err != nil { 1708 return 0, err 1709 } 1710 i += n 1711 } 1712 } 1713 if m.Endpoint != nil { 1714 dAtA[i] = 0x62 1715 i++ 1716 i = encodeVarintObjects(dAtA, i, uint64(m.Endpoint.Size())) 1717 n25, err := m.Endpoint.MarshalTo(dAtA[i:]) 1718 if err != nil { 1719 return 0, err 1720 } 1721 i += n25 1722 } 1723 if m.LogDriver != nil { 1724 dAtA[i] = 0x6a 1725 i++ 1726 i = encodeVarintObjects(dAtA, i, uint64(m.LogDriver.Size())) 1727 n26, err := m.LogDriver.MarshalTo(dAtA[i:]) 1728 if err != nil { 1729 return 0, err 1730 } 1731 i += n26 1732 } 1733 if m.SpecVersion != nil { 1734 dAtA[i] = 0x72 1735 i++ 1736 i = encodeVarintObjects(dAtA, i, uint64(m.SpecVersion.Size())) 1737 n27, err := m.SpecVersion.MarshalTo(dAtA[i:]) 1738 if err != nil { 1739 return 0, err 1740 } 1741 i += n27 1742 } 1743 if len(m.AssignedGenericResources) > 0 { 1744 for _, msg := range m.AssignedGenericResources { 1745 dAtA[i] = 0x7a 1746 i++ 1747 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1748 n, err := msg.MarshalTo(dAtA[i:]) 1749 if err != nil { 1750 return 0, err 1751 } 1752 i += n 1753 } 1754 } 1755 if m.JobIteration != nil { 1756 dAtA[i] = 0x82 1757 i++ 1758 dAtA[i] = 0x1 1759 i++ 1760 i = encodeVarintObjects(dAtA, i, uint64(m.JobIteration.Size())) 1761 n28, err := m.JobIteration.MarshalTo(dAtA[i:]) 1762 if err != nil { 1763 return 0, err 1764 } 1765 i += n28 1766 } 1767 return i, nil 1768 } 1769 1770 func (m *NetworkAttachment) Marshal() (dAtA []byte, err error) { 1771 size := m.Size() 1772 dAtA = make([]byte, size) 1773 n, err := m.MarshalTo(dAtA) 1774 if err != nil { 1775 return nil, err 1776 } 1777 return dAtA[:n], nil 1778 } 1779 1780 func (m *NetworkAttachment) MarshalTo(dAtA []byte) (int, error) { 1781 var i int 1782 _ = i 1783 var l int 1784 _ = l 1785 if m.Network != nil { 1786 dAtA[i] = 0xa 1787 i++ 1788 i = encodeVarintObjects(dAtA, i, uint64(m.Network.Size())) 1789 n29, err := m.Network.MarshalTo(dAtA[i:]) 1790 if err != nil { 1791 return 0, err 1792 } 1793 i += n29 1794 } 1795 if len(m.Addresses) > 0 { 1796 for _, s := range m.Addresses { 1797 dAtA[i] = 0x12 1798 i++ 1799 l = len(s) 1800 for l >= 1<<7 { 1801 dAtA[i] = uint8(uint64(l)&0x7f | 0x80) 1802 l >>= 7 1803 i++ 1804 } 1805 dAtA[i] = uint8(l) 1806 i++ 1807 i += copy(dAtA[i:], s) 1808 } 1809 } 1810 if len(m.Aliases) > 0 { 1811 for _, s := range m.Aliases { 1812 dAtA[i] = 0x1a 1813 i++ 1814 l = len(s) 1815 for l >= 1<<7 { 1816 dAtA[i] = uint8(uint64(l)&0x7f | 0x80) 1817 l >>= 7 1818 i++ 1819 } 1820 dAtA[i] = uint8(l) 1821 i++ 1822 i += copy(dAtA[i:], s) 1823 } 1824 } 1825 if len(m.DriverAttachmentOpts) > 0 { 1826 for k, _ := range m.DriverAttachmentOpts { 1827 dAtA[i] = 0x22 1828 i++ 1829 v := m.DriverAttachmentOpts[k] 1830 mapSize := 1 + len(k) + sovObjects(uint64(len(k))) + 1 + len(v) + sovObjects(uint64(len(v))) 1831 i = encodeVarintObjects(dAtA, i, uint64(mapSize)) 1832 dAtA[i] = 0xa 1833 i++ 1834 i = encodeVarintObjects(dAtA, i, uint64(len(k))) 1835 i += copy(dAtA[i:], k) 1836 dAtA[i] = 0x12 1837 i++ 1838 i = encodeVarintObjects(dAtA, i, uint64(len(v))) 1839 i += copy(dAtA[i:], v) 1840 } 1841 } 1842 return i, nil 1843 } 1844 1845 func (m *Network) Marshal() (dAtA []byte, err error) { 1846 size := m.Size() 1847 dAtA = make([]byte, size) 1848 n, err := m.MarshalTo(dAtA) 1849 if err != nil { 1850 return nil, err 1851 } 1852 return dAtA[:n], nil 1853 } 1854 1855 func (m *Network) MarshalTo(dAtA []byte) (int, error) { 1856 var i int 1857 _ = i 1858 var l int 1859 _ = l 1860 if len(m.ID) > 0 { 1861 dAtA[i] = 0xa 1862 i++ 1863 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 1864 i += copy(dAtA[i:], m.ID) 1865 } 1866 dAtA[i] = 0x12 1867 i++ 1868 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 1869 n30, err := m.Meta.MarshalTo(dAtA[i:]) 1870 if err != nil { 1871 return 0, err 1872 } 1873 i += n30 1874 dAtA[i] = 0x1a 1875 i++ 1876 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1877 n31, err := m.Spec.MarshalTo(dAtA[i:]) 1878 if err != nil { 1879 return 0, err 1880 } 1881 i += n31 1882 if m.DriverState != nil { 1883 dAtA[i] = 0x22 1884 i++ 1885 i = encodeVarintObjects(dAtA, i, uint64(m.DriverState.Size())) 1886 n32, err := m.DriverState.MarshalTo(dAtA[i:]) 1887 if err != nil { 1888 return 0, err 1889 } 1890 i += n32 1891 } 1892 if m.IPAM != nil { 1893 dAtA[i] = 0x2a 1894 i++ 1895 i = encodeVarintObjects(dAtA, i, uint64(m.IPAM.Size())) 1896 n33, err := m.IPAM.MarshalTo(dAtA[i:]) 1897 if err != nil { 1898 return 0, err 1899 } 1900 i += n33 1901 } 1902 if m.PendingDelete { 1903 dAtA[i] = 0x30 1904 i++ 1905 if m.PendingDelete { 1906 dAtA[i] = 1 1907 } else { 1908 dAtA[i] = 0 1909 } 1910 i++ 1911 } 1912 return i, nil 1913 } 1914 1915 func (m *Cluster) Marshal() (dAtA []byte, err error) { 1916 size := m.Size() 1917 dAtA = make([]byte, size) 1918 n, err := m.MarshalTo(dAtA) 1919 if err != nil { 1920 return nil, err 1921 } 1922 return dAtA[:n], nil 1923 } 1924 1925 func (m *Cluster) MarshalTo(dAtA []byte) (int, error) { 1926 var i int 1927 _ = i 1928 var l int 1929 _ = l 1930 if len(m.ID) > 0 { 1931 dAtA[i] = 0xa 1932 i++ 1933 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 1934 i += copy(dAtA[i:], m.ID) 1935 } 1936 dAtA[i] = 0x12 1937 i++ 1938 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 1939 n34, err := m.Meta.MarshalTo(dAtA[i:]) 1940 if err != nil { 1941 return 0, err 1942 } 1943 i += n34 1944 dAtA[i] = 0x1a 1945 i++ 1946 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 1947 n35, err := m.Spec.MarshalTo(dAtA[i:]) 1948 if err != nil { 1949 return 0, err 1950 } 1951 i += n35 1952 dAtA[i] = 0x22 1953 i++ 1954 i = encodeVarintObjects(dAtA, i, uint64(m.RootCA.Size())) 1955 n36, err := m.RootCA.MarshalTo(dAtA[i:]) 1956 if err != nil { 1957 return 0, err 1958 } 1959 i += n36 1960 if len(m.NetworkBootstrapKeys) > 0 { 1961 for _, msg := range m.NetworkBootstrapKeys { 1962 dAtA[i] = 0x2a 1963 i++ 1964 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 1965 n, err := msg.MarshalTo(dAtA[i:]) 1966 if err != nil { 1967 return 0, err 1968 } 1969 i += n 1970 } 1971 } 1972 if m.EncryptionKeyLamportClock != 0 { 1973 dAtA[i] = 0x30 1974 i++ 1975 i = encodeVarintObjects(dAtA, i, uint64(m.EncryptionKeyLamportClock)) 1976 } 1977 if len(m.BlacklistedCertificates) > 0 { 1978 for k, _ := range m.BlacklistedCertificates { 1979 dAtA[i] = 0x42 1980 i++ 1981 v := m.BlacklistedCertificates[k] 1982 msgSize := 0 1983 if v != nil { 1984 msgSize = v.Size() 1985 msgSize += 1 + sovObjects(uint64(msgSize)) 1986 } 1987 mapSize := 1 + len(k) + sovObjects(uint64(len(k))) + msgSize 1988 i = encodeVarintObjects(dAtA, i, uint64(mapSize)) 1989 dAtA[i] = 0xa 1990 i++ 1991 i = encodeVarintObjects(dAtA, i, uint64(len(k))) 1992 i += copy(dAtA[i:], k) 1993 if v != nil { 1994 dAtA[i] = 0x12 1995 i++ 1996 i = encodeVarintObjects(dAtA, i, uint64(v.Size())) 1997 n37, err := v.MarshalTo(dAtA[i:]) 1998 if err != nil { 1999 return 0, err 2000 } 2001 i += n37 2002 } 2003 } 2004 } 2005 if len(m.UnlockKeys) > 0 { 2006 for _, msg := range m.UnlockKeys { 2007 dAtA[i] = 0x4a 2008 i++ 2009 i = encodeVarintObjects(dAtA, i, uint64(msg.Size())) 2010 n, err := msg.MarshalTo(dAtA[i:]) 2011 if err != nil { 2012 return 0, err 2013 } 2014 i += n 2015 } 2016 } 2017 if m.FIPS { 2018 dAtA[i] = 0x50 2019 i++ 2020 if m.FIPS { 2021 dAtA[i] = 1 2022 } else { 2023 dAtA[i] = 0 2024 } 2025 i++ 2026 } 2027 if len(m.DefaultAddressPool) > 0 { 2028 for _, s := range m.DefaultAddressPool { 2029 dAtA[i] = 0x5a 2030 i++ 2031 l = len(s) 2032 for l >= 1<<7 { 2033 dAtA[i] = uint8(uint64(l)&0x7f | 0x80) 2034 l >>= 7 2035 i++ 2036 } 2037 dAtA[i] = uint8(l) 2038 i++ 2039 i += copy(dAtA[i:], s) 2040 } 2041 } 2042 if m.SubnetSize != 0 { 2043 dAtA[i] = 0x60 2044 i++ 2045 i = encodeVarintObjects(dAtA, i, uint64(m.SubnetSize)) 2046 } 2047 if m.VXLANUDPPort != 0 { 2048 dAtA[i] = 0x68 2049 i++ 2050 i = encodeVarintObjects(dAtA, i, uint64(m.VXLANUDPPort)) 2051 } 2052 return i, nil 2053 } 2054 2055 func (m *Secret) Marshal() (dAtA []byte, err error) { 2056 size := m.Size() 2057 dAtA = make([]byte, size) 2058 n, err := m.MarshalTo(dAtA) 2059 if err != nil { 2060 return nil, err 2061 } 2062 return dAtA[:n], nil 2063 } 2064 2065 func (m *Secret) MarshalTo(dAtA []byte) (int, error) { 2066 var i int 2067 _ = i 2068 var l int 2069 _ = l 2070 if len(m.ID) > 0 { 2071 dAtA[i] = 0xa 2072 i++ 2073 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 2074 i += copy(dAtA[i:], m.ID) 2075 } 2076 dAtA[i] = 0x12 2077 i++ 2078 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 2079 n38, err := m.Meta.MarshalTo(dAtA[i:]) 2080 if err != nil { 2081 return 0, err 2082 } 2083 i += n38 2084 dAtA[i] = 0x1a 2085 i++ 2086 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 2087 n39, err := m.Spec.MarshalTo(dAtA[i:]) 2088 if err != nil { 2089 return 0, err 2090 } 2091 i += n39 2092 if m.Internal { 2093 dAtA[i] = 0x20 2094 i++ 2095 if m.Internal { 2096 dAtA[i] = 1 2097 } else { 2098 dAtA[i] = 0 2099 } 2100 i++ 2101 } 2102 return i, nil 2103 } 2104 2105 func (m *Config) Marshal() (dAtA []byte, err error) { 2106 size := m.Size() 2107 dAtA = make([]byte, size) 2108 n, err := m.MarshalTo(dAtA) 2109 if err != nil { 2110 return nil, err 2111 } 2112 return dAtA[:n], nil 2113 } 2114 2115 func (m *Config) MarshalTo(dAtA []byte) (int, error) { 2116 var i int 2117 _ = i 2118 var l int 2119 _ = l 2120 if len(m.ID) > 0 { 2121 dAtA[i] = 0xa 2122 i++ 2123 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 2124 i += copy(dAtA[i:], m.ID) 2125 } 2126 dAtA[i] = 0x12 2127 i++ 2128 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 2129 n40, err := m.Meta.MarshalTo(dAtA[i:]) 2130 if err != nil { 2131 return 0, err 2132 } 2133 i += n40 2134 dAtA[i] = 0x1a 2135 i++ 2136 i = encodeVarintObjects(dAtA, i, uint64(m.Spec.Size())) 2137 n41, err := m.Spec.MarshalTo(dAtA[i:]) 2138 if err != nil { 2139 return 0, err 2140 } 2141 i += n41 2142 return i, nil 2143 } 2144 2145 func (m *Resource) Marshal() (dAtA []byte, err error) { 2146 size := m.Size() 2147 dAtA = make([]byte, size) 2148 n, err := m.MarshalTo(dAtA) 2149 if err != nil { 2150 return nil, err 2151 } 2152 return dAtA[:n], nil 2153 } 2154 2155 func (m *Resource) MarshalTo(dAtA []byte) (int, error) { 2156 var i int 2157 _ = i 2158 var l int 2159 _ = l 2160 if len(m.ID) > 0 { 2161 dAtA[i] = 0xa 2162 i++ 2163 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 2164 i += copy(dAtA[i:], m.ID) 2165 } 2166 dAtA[i] = 0x12 2167 i++ 2168 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 2169 n42, err := m.Meta.MarshalTo(dAtA[i:]) 2170 if err != nil { 2171 return 0, err 2172 } 2173 i += n42 2174 dAtA[i] = 0x1a 2175 i++ 2176 i = encodeVarintObjects(dAtA, i, uint64(m.Annotations.Size())) 2177 n43, err := m.Annotations.MarshalTo(dAtA[i:]) 2178 if err != nil { 2179 return 0, err 2180 } 2181 i += n43 2182 if len(m.Kind) > 0 { 2183 dAtA[i] = 0x22 2184 i++ 2185 i = encodeVarintObjects(dAtA, i, uint64(len(m.Kind))) 2186 i += copy(dAtA[i:], m.Kind) 2187 } 2188 if m.Payload != nil { 2189 dAtA[i] = 0x2a 2190 i++ 2191 i = encodeVarintObjects(dAtA, i, uint64(m.Payload.Size())) 2192 n44, err := m.Payload.MarshalTo(dAtA[i:]) 2193 if err != nil { 2194 return 0, err 2195 } 2196 i += n44 2197 } 2198 return i, nil 2199 } 2200 2201 func (m *Extension) Marshal() (dAtA []byte, err error) { 2202 size := m.Size() 2203 dAtA = make([]byte, size) 2204 n, err := m.MarshalTo(dAtA) 2205 if err != nil { 2206 return nil, err 2207 } 2208 return dAtA[:n], nil 2209 } 2210 2211 func (m *Extension) MarshalTo(dAtA []byte) (int, error) { 2212 var i int 2213 _ = i 2214 var l int 2215 _ = l 2216 if len(m.ID) > 0 { 2217 dAtA[i] = 0xa 2218 i++ 2219 i = encodeVarintObjects(dAtA, i, uint64(len(m.ID))) 2220 i += copy(dAtA[i:], m.ID) 2221 } 2222 dAtA[i] = 0x12 2223 i++ 2224 i = encodeVarintObjects(dAtA, i, uint64(m.Meta.Size())) 2225 n45, err := m.Meta.MarshalTo(dAtA[i:]) 2226 if err != nil { 2227 return 0, err 2228 } 2229 i += n45 2230 dAtA[i] = 0x1a 2231 i++ 2232 i = encodeVarintObjects(dAtA, i, uint64(m.Annotations.Size())) 2233 n46, err := m.Annotations.MarshalTo(dAtA[i:]) 2234 if err != nil { 2235 return 0, err 2236 } 2237 i += n46 2238 if len(m.Description) > 0 { 2239 dAtA[i] = 0x22 2240 i++ 2241 i = encodeVarintObjects(dAtA, i, uint64(len(m.Description))) 2242 i += copy(dAtA[i:], m.Description) 2243 } 2244 return i, nil 2245 } 2246 2247 func encodeVarintObjects(dAtA []byte, offset int, v uint64) int { 2248 for v >= 1<<7 { 2249 dAtA[offset] = uint8(v&0x7f | 0x80) 2250 v >>= 7 2251 offset++ 2252 } 2253 dAtA[offset] = uint8(v) 2254 return offset + 1 2255 } 2256 func (m *Meta) Size() (n int) { 2257 if m == nil { 2258 return 0 2259 } 2260 var l int 2261 _ = l 2262 l = m.Version.Size() 2263 n += 1 + l + sovObjects(uint64(l)) 2264 if m.CreatedAt != nil { 2265 l = m.CreatedAt.Size() 2266 n += 1 + l + sovObjects(uint64(l)) 2267 } 2268 if m.UpdatedAt != nil { 2269 l = m.UpdatedAt.Size() 2270 n += 1 + l + sovObjects(uint64(l)) 2271 } 2272 return n 2273 } 2274 2275 func (m *Node) Size() (n int) { 2276 if m == nil { 2277 return 0 2278 } 2279 var l int 2280 _ = l 2281 l = len(m.ID) 2282 if l > 0 { 2283 n += 1 + l + sovObjects(uint64(l)) 2284 } 2285 l = m.Meta.Size() 2286 n += 1 + l + sovObjects(uint64(l)) 2287 l = m.Spec.Size() 2288 n += 1 + l + sovObjects(uint64(l)) 2289 if m.Description != nil { 2290 l = m.Description.Size() 2291 n += 1 + l + sovObjects(uint64(l)) 2292 } 2293 l = m.Status.Size() 2294 n += 1 + l + sovObjects(uint64(l)) 2295 if m.ManagerStatus != nil { 2296 l = m.ManagerStatus.Size() 2297 n += 1 + l + sovObjects(uint64(l)) 2298 } 2299 if m.Attachment != nil { 2300 l = m.Attachment.Size() 2301 n += 1 + l + sovObjects(uint64(l)) 2302 } 2303 l = m.Certificate.Size() 2304 n += 1 + l + sovObjects(uint64(l)) 2305 if m.Role != 0 { 2306 n += 1 + sovObjects(uint64(m.Role)) 2307 } 2308 if len(m.Attachments) > 0 { 2309 for _, e := range m.Attachments { 2310 l = e.Size() 2311 n += 1 + l + sovObjects(uint64(l)) 2312 } 2313 } 2314 if m.VXLANUDPPort != 0 { 2315 n += 1 + sovObjects(uint64(m.VXLANUDPPort)) 2316 } 2317 return n 2318 } 2319 2320 func (m *Service) Size() (n int) { 2321 if m == nil { 2322 return 0 2323 } 2324 var l int 2325 _ = l 2326 l = len(m.ID) 2327 if l > 0 { 2328 n += 1 + l + sovObjects(uint64(l)) 2329 } 2330 l = m.Meta.Size() 2331 n += 1 + l + sovObjects(uint64(l)) 2332 l = m.Spec.Size() 2333 n += 1 + l + sovObjects(uint64(l)) 2334 if m.Endpoint != nil { 2335 l = m.Endpoint.Size() 2336 n += 1 + l + sovObjects(uint64(l)) 2337 } 2338 if m.UpdateStatus != nil { 2339 l = m.UpdateStatus.Size() 2340 n += 1 + l + sovObjects(uint64(l)) 2341 } 2342 if m.PreviousSpec != nil { 2343 l = m.PreviousSpec.Size() 2344 n += 1 + l + sovObjects(uint64(l)) 2345 } 2346 if m.PendingDelete { 2347 n += 2 2348 } 2349 if m.SpecVersion != nil { 2350 l = m.SpecVersion.Size() 2351 n += 1 + l + sovObjects(uint64(l)) 2352 } 2353 if m.PreviousSpecVersion != nil { 2354 l = m.PreviousSpecVersion.Size() 2355 n += 1 + l + sovObjects(uint64(l)) 2356 } 2357 if m.JobStatus != nil { 2358 l = m.JobStatus.Size() 2359 n += 1 + l + sovObjects(uint64(l)) 2360 } 2361 return n 2362 } 2363 2364 func (m *Endpoint) Size() (n int) { 2365 if m == nil { 2366 return 0 2367 } 2368 var l int 2369 _ = l 2370 if m.Spec != nil { 2371 l = m.Spec.Size() 2372 n += 1 + l + sovObjects(uint64(l)) 2373 } 2374 if len(m.Ports) > 0 { 2375 for _, e := range m.Ports { 2376 l = e.Size() 2377 n += 1 + l + sovObjects(uint64(l)) 2378 } 2379 } 2380 if len(m.VirtualIPs) > 0 { 2381 for _, e := range m.VirtualIPs { 2382 l = e.Size() 2383 n += 1 + l + sovObjects(uint64(l)) 2384 } 2385 } 2386 return n 2387 } 2388 2389 func (m *Endpoint_VirtualIP) Size() (n int) { 2390 if m == nil { 2391 return 0 2392 } 2393 var l int 2394 _ = l 2395 l = len(m.NetworkID) 2396 if l > 0 { 2397 n += 1 + l + sovObjects(uint64(l)) 2398 } 2399 l = len(m.Addr) 2400 if l > 0 { 2401 n += 1 + l + sovObjects(uint64(l)) 2402 } 2403 return n 2404 } 2405 2406 func (m *Task) Size() (n int) { 2407 if m == nil { 2408 return 0 2409 } 2410 var l int 2411 _ = l 2412 l = len(m.ID) 2413 if l > 0 { 2414 n += 1 + l + sovObjects(uint64(l)) 2415 } 2416 l = m.Meta.Size() 2417 n += 1 + l + sovObjects(uint64(l)) 2418 l = m.Spec.Size() 2419 n += 1 + l + sovObjects(uint64(l)) 2420 l = len(m.ServiceID) 2421 if l > 0 { 2422 n += 1 + l + sovObjects(uint64(l)) 2423 } 2424 if m.Slot != 0 { 2425 n += 1 + sovObjects(uint64(m.Slot)) 2426 } 2427 l = len(m.NodeID) 2428 if l > 0 { 2429 n += 1 + l + sovObjects(uint64(l)) 2430 } 2431 l = m.Annotations.Size() 2432 n += 1 + l + sovObjects(uint64(l)) 2433 l = m.ServiceAnnotations.Size() 2434 n += 1 + l + sovObjects(uint64(l)) 2435 l = m.Status.Size() 2436 n += 1 + l + sovObjects(uint64(l)) 2437 if m.DesiredState != 0 { 2438 n += 1 + sovObjects(uint64(m.DesiredState)) 2439 } 2440 if len(m.Networks) > 0 { 2441 for _, e := range m.Networks { 2442 l = e.Size() 2443 n += 1 + l + sovObjects(uint64(l)) 2444 } 2445 } 2446 if m.Endpoint != nil { 2447 l = m.Endpoint.Size() 2448 n += 1 + l + sovObjects(uint64(l)) 2449 } 2450 if m.LogDriver != nil { 2451 l = m.LogDriver.Size() 2452 n += 1 + l + sovObjects(uint64(l)) 2453 } 2454 if m.SpecVersion != nil { 2455 l = m.SpecVersion.Size() 2456 n += 1 + l + sovObjects(uint64(l)) 2457 } 2458 if len(m.AssignedGenericResources) > 0 { 2459 for _, e := range m.AssignedGenericResources { 2460 l = e.Size() 2461 n += 1 + l + sovObjects(uint64(l)) 2462 } 2463 } 2464 if m.JobIteration != nil { 2465 l = m.JobIteration.Size() 2466 n += 2 + l + sovObjects(uint64(l)) 2467 } 2468 return n 2469 } 2470 2471 func (m *NetworkAttachment) Size() (n int) { 2472 if m == nil { 2473 return 0 2474 } 2475 var l int 2476 _ = l 2477 if m.Network != nil { 2478 l = m.Network.Size() 2479 n += 1 + l + sovObjects(uint64(l)) 2480 } 2481 if len(m.Addresses) > 0 { 2482 for _, s := range m.Addresses { 2483 l = len(s) 2484 n += 1 + l + sovObjects(uint64(l)) 2485 } 2486 } 2487 if len(m.Aliases) > 0 { 2488 for _, s := range m.Aliases { 2489 l = len(s) 2490 n += 1 + l + sovObjects(uint64(l)) 2491 } 2492 } 2493 if len(m.DriverAttachmentOpts) > 0 { 2494 for k, v := range m.DriverAttachmentOpts { 2495 _ = k 2496 _ = v 2497 mapEntrySize := 1 + len(k) + sovObjects(uint64(len(k))) + 1 + len(v) + sovObjects(uint64(len(v))) 2498 n += mapEntrySize + 1 + sovObjects(uint64(mapEntrySize)) 2499 } 2500 } 2501 return n 2502 } 2503 2504 func (m *Network) Size() (n int) { 2505 if m == nil { 2506 return 0 2507 } 2508 var l int 2509 _ = l 2510 l = len(m.ID) 2511 if l > 0 { 2512 n += 1 + l + sovObjects(uint64(l)) 2513 } 2514 l = m.Meta.Size() 2515 n += 1 + l + sovObjects(uint64(l)) 2516 l = m.Spec.Size() 2517 n += 1 + l + sovObjects(uint64(l)) 2518 if m.DriverState != nil { 2519 l = m.DriverState.Size() 2520 n += 1 + l + sovObjects(uint64(l)) 2521 } 2522 if m.IPAM != nil { 2523 l = m.IPAM.Size() 2524 n += 1 + l + sovObjects(uint64(l)) 2525 } 2526 if m.PendingDelete { 2527 n += 2 2528 } 2529 return n 2530 } 2531 2532 func (m *Cluster) Size() (n int) { 2533 if m == nil { 2534 return 0 2535 } 2536 var l int 2537 _ = l 2538 l = len(m.ID) 2539 if l > 0 { 2540 n += 1 + l + sovObjects(uint64(l)) 2541 } 2542 l = m.Meta.Size() 2543 n += 1 + l + sovObjects(uint64(l)) 2544 l = m.Spec.Size() 2545 n += 1 + l + sovObjects(uint64(l)) 2546 l = m.RootCA.Size() 2547 n += 1 + l + sovObjects(uint64(l)) 2548 if len(m.NetworkBootstrapKeys) > 0 { 2549 for _, e := range m.NetworkBootstrapKeys { 2550 l = e.Size() 2551 n += 1 + l + sovObjects(uint64(l)) 2552 } 2553 } 2554 if m.EncryptionKeyLamportClock != 0 { 2555 n += 1 + sovObjects(uint64(m.EncryptionKeyLamportClock)) 2556 } 2557 if len(m.BlacklistedCertificates) > 0 { 2558 for k, v := range m.BlacklistedCertificates { 2559 _ = k 2560 _ = v 2561 l = 0 2562 if v != nil { 2563 l = v.Size() 2564 l += 1 + sovObjects(uint64(l)) 2565 } 2566 mapEntrySize := 1 + len(k) + sovObjects(uint64(len(k))) + l 2567 n += mapEntrySize + 1 + sovObjects(uint64(mapEntrySize)) 2568 } 2569 } 2570 if len(m.UnlockKeys) > 0 { 2571 for _, e := range m.UnlockKeys { 2572 l = e.Size() 2573 n += 1 + l + sovObjects(uint64(l)) 2574 } 2575 } 2576 if m.FIPS { 2577 n += 2 2578 } 2579 if len(m.DefaultAddressPool) > 0 { 2580 for _, s := range m.DefaultAddressPool { 2581 l = len(s) 2582 n += 1 + l + sovObjects(uint64(l)) 2583 } 2584 } 2585 if m.SubnetSize != 0 { 2586 n += 1 + sovObjects(uint64(m.SubnetSize)) 2587 } 2588 if m.VXLANUDPPort != 0 { 2589 n += 1 + sovObjects(uint64(m.VXLANUDPPort)) 2590 } 2591 return n 2592 } 2593 2594 func (m *Secret) Size() (n int) { 2595 if m == nil { 2596 return 0 2597 } 2598 var l int 2599 _ = l 2600 l = len(m.ID) 2601 if l > 0 { 2602 n += 1 + l + sovObjects(uint64(l)) 2603 } 2604 l = m.Meta.Size() 2605 n += 1 + l + sovObjects(uint64(l)) 2606 l = m.Spec.Size() 2607 n += 1 + l + sovObjects(uint64(l)) 2608 if m.Internal { 2609 n += 2 2610 } 2611 return n 2612 } 2613 2614 func (m *Config) Size() (n int) { 2615 if m == nil { 2616 return 0 2617 } 2618 var l int 2619 _ = l 2620 l = len(m.ID) 2621 if l > 0 { 2622 n += 1 + l + sovObjects(uint64(l)) 2623 } 2624 l = m.Meta.Size() 2625 n += 1 + l + sovObjects(uint64(l)) 2626 l = m.Spec.Size() 2627 n += 1 + l + sovObjects(uint64(l)) 2628 return n 2629 } 2630 2631 func (m *Resource) Size() (n int) { 2632 if m == nil { 2633 return 0 2634 } 2635 var l int 2636 _ = l 2637 l = len(m.ID) 2638 if l > 0 { 2639 n += 1 + l + sovObjects(uint64(l)) 2640 } 2641 l = m.Meta.Size() 2642 n += 1 + l + sovObjects(uint64(l)) 2643 l = m.Annotations.Size() 2644 n += 1 + l + sovObjects(uint64(l)) 2645 l = len(m.Kind) 2646 if l > 0 { 2647 n += 1 + l + sovObjects(uint64(l)) 2648 } 2649 if m.Payload != nil { 2650 l = m.Payload.Size() 2651 n += 1 + l + sovObjects(uint64(l)) 2652 } 2653 return n 2654 } 2655 2656 func (m *Extension) Size() (n int) { 2657 if m == nil { 2658 return 0 2659 } 2660 var l int 2661 _ = l 2662 l = len(m.ID) 2663 if l > 0 { 2664 n += 1 + l + sovObjects(uint64(l)) 2665 } 2666 l = m.Meta.Size() 2667 n += 1 + l + sovObjects(uint64(l)) 2668 l = m.Annotations.Size() 2669 n += 1 + l + sovObjects(uint64(l)) 2670 l = len(m.Description) 2671 if l > 0 { 2672 n += 1 + l + sovObjects(uint64(l)) 2673 } 2674 return n 2675 } 2676 2677 func sovObjects(x uint64) (n int) { 2678 for { 2679 n++ 2680 x >>= 7 2681 if x == 0 { 2682 break 2683 } 2684 } 2685 return n 2686 } 2687 func sozObjects(x uint64) (n int) { 2688 return sovObjects(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 2689 } 2690 2691 type NodeCheckFunc func(t1, t2 *Node) bool 2692 2693 type EventNode interface { 2694 IsEventNode() bool 2695 } 2696 2697 type EventCreateNode struct { 2698 Node *Node 2699 Checks []NodeCheckFunc 2700 } 2701 2702 func (e EventCreateNode) Matches(apiEvent github_com_docker_go_events.Event) bool { 2703 typedEvent, ok := apiEvent.(EventCreateNode) 2704 if !ok { 2705 return false 2706 } 2707 2708 for _, check := range e.Checks { 2709 if !check(e.Node, typedEvent.Node) { 2710 return false 2711 } 2712 } 2713 return true 2714 } 2715 2716 func (e EventCreateNode) IsEventCreate() bool { 2717 return true 2718 } 2719 2720 func (e EventCreateNode) IsEventNode() bool { 2721 return true 2722 } 2723 2724 type EventUpdateNode struct { 2725 Node *Node 2726 OldNode *Node 2727 Checks []NodeCheckFunc 2728 } 2729 2730 func (e EventUpdateNode) Matches(apiEvent github_com_docker_go_events.Event) bool { 2731 typedEvent, ok := apiEvent.(EventUpdateNode) 2732 if !ok { 2733 return false 2734 } 2735 2736 for _, check := range e.Checks { 2737 if !check(e.Node, typedEvent.Node) { 2738 return false 2739 } 2740 } 2741 return true 2742 } 2743 2744 func (e EventUpdateNode) IsEventUpdate() bool { 2745 return true 2746 } 2747 2748 func (e EventUpdateNode) IsEventNode() bool { 2749 return true 2750 } 2751 2752 type EventDeleteNode struct { 2753 Node *Node 2754 Checks []NodeCheckFunc 2755 } 2756 2757 func (e EventDeleteNode) Matches(apiEvent github_com_docker_go_events.Event) bool { 2758 typedEvent, ok := apiEvent.(EventDeleteNode) 2759 if !ok { 2760 return false 2761 } 2762 2763 for _, check := range e.Checks { 2764 if !check(e.Node, typedEvent.Node) { 2765 return false 2766 } 2767 } 2768 return true 2769 } 2770 2771 func (e EventDeleteNode) IsEventDelete() bool { 2772 return true 2773 } 2774 2775 func (e EventDeleteNode) IsEventNode() bool { 2776 return true 2777 } 2778 2779 func (m *Node) CopyStoreObject() StoreObject { 2780 return m.Copy() 2781 } 2782 2783 func (m *Node) GetMeta() Meta { 2784 return m.Meta 2785 } 2786 2787 func (m *Node) SetMeta(meta Meta) { 2788 m.Meta = meta 2789 } 2790 2791 func (m *Node) GetID() string { 2792 return m.ID 2793 } 2794 2795 func (m *Node) EventCreate() Event { 2796 return EventCreateNode{Node: m} 2797 } 2798 2799 func (m *Node) EventUpdate(oldObject StoreObject) Event { 2800 if oldObject != nil { 2801 return EventUpdateNode{Node: m, OldNode: oldObject.(*Node)} 2802 } else { 2803 return EventUpdateNode{Node: m} 2804 } 2805 } 2806 2807 func (m *Node) EventDelete() Event { 2808 return EventDeleteNode{Node: m} 2809 } 2810 2811 func NodeCheckID(v1, v2 *Node) bool { 2812 return v1.ID == v2.ID 2813 } 2814 2815 func NodeCheckIDPrefix(v1, v2 *Node) bool { 2816 return strings.HasPrefix(v2.ID, v1.ID) 2817 } 2818 2819 func NodeCheckName(v1, v2 *Node) bool { 2820 if v1.Description == nil || v2.Description == nil { 2821 return false 2822 } 2823 return v1.Description.Hostname == v2.Description.Hostname 2824 } 2825 2826 func NodeCheckNamePrefix(v1, v2 *Node) bool { 2827 if v1.Description == nil || v2.Description == nil { 2828 return false 2829 } 2830 return strings.HasPrefix(v2.Description.Hostname, v1.Description.Hostname) 2831 } 2832 2833 func NodeCheckCustom(v1, v2 *Node) bool { 2834 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 2835 } 2836 2837 func NodeCheckCustomPrefix(v1, v2 *Node) bool { 2838 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 2839 } 2840 2841 func NodeCheckRole(v1, v2 *Node) bool { 2842 return v1.Role == v2.Role 2843 } 2844 2845 func NodeCheckMembership(v1, v2 *Node) bool { 2846 return v1.Spec.Membership == v2.Spec.Membership 2847 } 2848 2849 func ConvertNodeWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 2850 var ( 2851 m Node 2852 checkFuncs []NodeCheckFunc 2853 hasRole bool 2854 hasMembership bool 2855 ) 2856 2857 for _, filter := range filters { 2858 switch v := filter.By.(type) { 2859 case *SelectBy_ID: 2860 if m.ID != "" { 2861 return nil, errConflictingFilters 2862 } 2863 m.ID = v.ID 2864 checkFuncs = append(checkFuncs, NodeCheckID) 2865 case *SelectBy_IDPrefix: 2866 if m.ID != "" { 2867 return nil, errConflictingFilters 2868 } 2869 m.ID = v.IDPrefix 2870 checkFuncs = append(checkFuncs, NodeCheckIDPrefix) 2871 case *SelectBy_Name: 2872 if m.Description != nil { 2873 return nil, errConflictingFilters 2874 } 2875 m.Description = &NodeDescription{Hostname: v.Name} 2876 checkFuncs = append(checkFuncs, NodeCheckName) 2877 case *SelectBy_NamePrefix: 2878 if m.Description != nil { 2879 return nil, errConflictingFilters 2880 } 2881 m.Description = &NodeDescription{Hostname: v.NamePrefix} 2882 checkFuncs = append(checkFuncs, NodeCheckNamePrefix) 2883 case *SelectBy_Custom: 2884 if len(m.Spec.Annotations.Indices) != 0 { 2885 return nil, errConflictingFilters 2886 } 2887 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 2888 checkFuncs = append(checkFuncs, NodeCheckCustom) 2889 case *SelectBy_CustomPrefix: 2890 if len(m.Spec.Annotations.Indices) != 0 { 2891 return nil, errConflictingFilters 2892 } 2893 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 2894 checkFuncs = append(checkFuncs, NodeCheckCustomPrefix) 2895 case *SelectBy_Role: 2896 if hasRole { 2897 return nil, errConflictingFilters 2898 } 2899 hasRole = true 2900 m.Role = v.Role 2901 checkFuncs = append(checkFuncs, NodeCheckRole) 2902 case *SelectBy_Membership: 2903 if hasMembership { 2904 return nil, errConflictingFilters 2905 } 2906 hasMembership = true 2907 m.Spec.Membership = v.Membership 2908 checkFuncs = append(checkFuncs, NodeCheckMembership) 2909 } 2910 } 2911 var events []Event 2912 if (action & WatchActionKindCreate) != 0 { 2913 events = append(events, EventCreateNode{Node: &m, Checks: checkFuncs}) 2914 } 2915 if (action & WatchActionKindUpdate) != 0 { 2916 events = append(events, EventUpdateNode{Node: &m, Checks: checkFuncs}) 2917 } 2918 if (action & WatchActionKindRemove) != 0 { 2919 events = append(events, EventDeleteNode{Node: &m, Checks: checkFuncs}) 2920 } 2921 if len(events) == 0 { 2922 return nil, errUnrecognizedAction 2923 } 2924 return events, nil 2925 } 2926 2927 type NodeIndexerByID struct{} 2928 2929 func (indexer NodeIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 2930 return fromArgs(args...) 2931 } 2932 func (indexer NodeIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 2933 return prefixFromArgs(args...) 2934 } 2935 func (indexer NodeIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 2936 m := obj.(*Node) 2937 return true, []byte(m.ID + "\x00"), nil 2938 } 2939 2940 type NodeIndexerByName struct{} 2941 2942 func (indexer NodeIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 2943 return fromArgs(args...) 2944 } 2945 func (indexer NodeIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 2946 return prefixFromArgs(args...) 2947 } 2948 func (indexer NodeIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 2949 m := obj.(*Node) 2950 val := m.Spec.Annotations.Name 2951 return true, []byte(strings.ToLower(val) + "\x00"), nil 2952 } 2953 2954 type NodeCustomIndexer struct{} 2955 2956 func (indexer NodeCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 2957 return fromArgs(args...) 2958 } 2959 func (indexer NodeCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 2960 return prefixFromArgs(args...) 2961 } 2962 func (indexer NodeCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 2963 m := obj.(*Node) 2964 return customIndexer("", &m.Spec.Annotations) 2965 } 2966 2967 type ServiceCheckFunc func(t1, t2 *Service) bool 2968 2969 type EventService interface { 2970 IsEventService() bool 2971 } 2972 2973 type EventCreateService struct { 2974 Service *Service 2975 Checks []ServiceCheckFunc 2976 } 2977 2978 func (e EventCreateService) Matches(apiEvent github_com_docker_go_events.Event) bool { 2979 typedEvent, ok := apiEvent.(EventCreateService) 2980 if !ok { 2981 return false 2982 } 2983 2984 for _, check := range e.Checks { 2985 if !check(e.Service, typedEvent.Service) { 2986 return false 2987 } 2988 } 2989 return true 2990 } 2991 2992 func (e EventCreateService) IsEventCreate() bool { 2993 return true 2994 } 2995 2996 func (e EventCreateService) IsEventService() bool { 2997 return true 2998 } 2999 3000 type EventUpdateService struct { 3001 Service *Service 3002 OldService *Service 3003 Checks []ServiceCheckFunc 3004 } 3005 3006 func (e EventUpdateService) Matches(apiEvent github_com_docker_go_events.Event) bool { 3007 typedEvent, ok := apiEvent.(EventUpdateService) 3008 if !ok { 3009 return false 3010 } 3011 3012 for _, check := range e.Checks { 3013 if !check(e.Service, typedEvent.Service) { 3014 return false 3015 } 3016 } 3017 return true 3018 } 3019 3020 func (e EventUpdateService) IsEventUpdate() bool { 3021 return true 3022 } 3023 3024 func (e EventUpdateService) IsEventService() bool { 3025 return true 3026 } 3027 3028 type EventDeleteService struct { 3029 Service *Service 3030 Checks []ServiceCheckFunc 3031 } 3032 3033 func (e EventDeleteService) Matches(apiEvent github_com_docker_go_events.Event) bool { 3034 typedEvent, ok := apiEvent.(EventDeleteService) 3035 if !ok { 3036 return false 3037 } 3038 3039 for _, check := range e.Checks { 3040 if !check(e.Service, typedEvent.Service) { 3041 return false 3042 } 3043 } 3044 return true 3045 } 3046 3047 func (e EventDeleteService) IsEventDelete() bool { 3048 return true 3049 } 3050 3051 func (e EventDeleteService) IsEventService() bool { 3052 return true 3053 } 3054 3055 func (m *Service) CopyStoreObject() StoreObject { 3056 return m.Copy() 3057 } 3058 3059 func (m *Service) GetMeta() Meta { 3060 return m.Meta 3061 } 3062 3063 func (m *Service) SetMeta(meta Meta) { 3064 m.Meta = meta 3065 } 3066 3067 func (m *Service) GetID() string { 3068 return m.ID 3069 } 3070 3071 func (m *Service) EventCreate() Event { 3072 return EventCreateService{Service: m} 3073 } 3074 3075 func (m *Service) EventUpdate(oldObject StoreObject) Event { 3076 if oldObject != nil { 3077 return EventUpdateService{Service: m, OldService: oldObject.(*Service)} 3078 } else { 3079 return EventUpdateService{Service: m} 3080 } 3081 } 3082 3083 func (m *Service) EventDelete() Event { 3084 return EventDeleteService{Service: m} 3085 } 3086 3087 func ServiceCheckID(v1, v2 *Service) bool { 3088 return v1.ID == v2.ID 3089 } 3090 3091 func ServiceCheckIDPrefix(v1, v2 *Service) bool { 3092 return strings.HasPrefix(v2.ID, v1.ID) 3093 } 3094 3095 func ServiceCheckName(v1, v2 *Service) bool { 3096 return v1.Spec.Annotations.Name == v2.Spec.Annotations.Name 3097 } 3098 3099 func ServiceCheckNamePrefix(v1, v2 *Service) bool { 3100 return strings.HasPrefix(v2.Spec.Annotations.Name, v1.Spec.Annotations.Name) 3101 } 3102 3103 func ServiceCheckCustom(v1, v2 *Service) bool { 3104 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 3105 } 3106 3107 func ServiceCheckCustomPrefix(v1, v2 *Service) bool { 3108 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 3109 } 3110 3111 func ConvertServiceWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 3112 var ( 3113 m Service 3114 checkFuncs []ServiceCheckFunc 3115 ) 3116 3117 for _, filter := range filters { 3118 switch v := filter.By.(type) { 3119 case *SelectBy_ID: 3120 if m.ID != "" { 3121 return nil, errConflictingFilters 3122 } 3123 m.ID = v.ID 3124 checkFuncs = append(checkFuncs, ServiceCheckID) 3125 case *SelectBy_IDPrefix: 3126 if m.ID != "" { 3127 return nil, errConflictingFilters 3128 } 3129 m.ID = v.IDPrefix 3130 checkFuncs = append(checkFuncs, ServiceCheckIDPrefix) 3131 case *SelectBy_Name: 3132 if m.Spec.Annotations.Name != "" { 3133 return nil, errConflictingFilters 3134 } 3135 m.Spec.Annotations.Name = v.Name 3136 checkFuncs = append(checkFuncs, ServiceCheckName) 3137 case *SelectBy_NamePrefix: 3138 if m.Spec.Annotations.Name != "" { 3139 return nil, errConflictingFilters 3140 } 3141 m.Spec.Annotations.Name = v.NamePrefix 3142 checkFuncs = append(checkFuncs, ServiceCheckNamePrefix) 3143 case *SelectBy_Custom: 3144 if len(m.Spec.Annotations.Indices) != 0 { 3145 return nil, errConflictingFilters 3146 } 3147 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 3148 checkFuncs = append(checkFuncs, ServiceCheckCustom) 3149 case *SelectBy_CustomPrefix: 3150 if len(m.Spec.Annotations.Indices) != 0 { 3151 return nil, errConflictingFilters 3152 } 3153 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 3154 checkFuncs = append(checkFuncs, ServiceCheckCustomPrefix) 3155 } 3156 } 3157 var events []Event 3158 if (action & WatchActionKindCreate) != 0 { 3159 events = append(events, EventCreateService{Service: &m, Checks: checkFuncs}) 3160 } 3161 if (action & WatchActionKindUpdate) != 0 { 3162 events = append(events, EventUpdateService{Service: &m, Checks: checkFuncs}) 3163 } 3164 if (action & WatchActionKindRemove) != 0 { 3165 events = append(events, EventDeleteService{Service: &m, Checks: checkFuncs}) 3166 } 3167 if len(events) == 0 { 3168 return nil, errUnrecognizedAction 3169 } 3170 return events, nil 3171 } 3172 3173 type ServiceIndexerByID struct{} 3174 3175 func (indexer ServiceIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 3176 return fromArgs(args...) 3177 } 3178 func (indexer ServiceIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3179 return prefixFromArgs(args...) 3180 } 3181 func (indexer ServiceIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 3182 m := obj.(*Service) 3183 return true, []byte(m.ID + "\x00"), nil 3184 } 3185 3186 type ServiceIndexerByName struct{} 3187 3188 func (indexer ServiceIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 3189 return fromArgs(args...) 3190 } 3191 func (indexer ServiceIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3192 return prefixFromArgs(args...) 3193 } 3194 func (indexer ServiceIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 3195 m := obj.(*Service) 3196 val := m.Spec.Annotations.Name 3197 return true, []byte(strings.ToLower(val) + "\x00"), nil 3198 } 3199 3200 type ServiceCustomIndexer struct{} 3201 3202 func (indexer ServiceCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 3203 return fromArgs(args...) 3204 } 3205 func (indexer ServiceCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3206 return prefixFromArgs(args...) 3207 } 3208 func (indexer ServiceCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 3209 m := obj.(*Service) 3210 return customIndexer("", &m.Spec.Annotations) 3211 } 3212 3213 type TaskCheckFunc func(t1, t2 *Task) bool 3214 3215 type EventTask interface { 3216 IsEventTask() bool 3217 } 3218 3219 type EventCreateTask struct { 3220 Task *Task 3221 Checks []TaskCheckFunc 3222 } 3223 3224 func (e EventCreateTask) Matches(apiEvent github_com_docker_go_events.Event) bool { 3225 typedEvent, ok := apiEvent.(EventCreateTask) 3226 if !ok { 3227 return false 3228 } 3229 3230 for _, check := range e.Checks { 3231 if !check(e.Task, typedEvent.Task) { 3232 return false 3233 } 3234 } 3235 return true 3236 } 3237 3238 func (e EventCreateTask) IsEventCreate() bool { 3239 return true 3240 } 3241 3242 func (e EventCreateTask) IsEventTask() bool { 3243 return true 3244 } 3245 3246 type EventUpdateTask struct { 3247 Task *Task 3248 OldTask *Task 3249 Checks []TaskCheckFunc 3250 } 3251 3252 func (e EventUpdateTask) Matches(apiEvent github_com_docker_go_events.Event) bool { 3253 typedEvent, ok := apiEvent.(EventUpdateTask) 3254 if !ok { 3255 return false 3256 } 3257 3258 for _, check := range e.Checks { 3259 if !check(e.Task, typedEvent.Task) { 3260 return false 3261 } 3262 } 3263 return true 3264 } 3265 3266 func (e EventUpdateTask) IsEventUpdate() bool { 3267 return true 3268 } 3269 3270 func (e EventUpdateTask) IsEventTask() bool { 3271 return true 3272 } 3273 3274 type EventDeleteTask struct { 3275 Task *Task 3276 Checks []TaskCheckFunc 3277 } 3278 3279 func (e EventDeleteTask) Matches(apiEvent github_com_docker_go_events.Event) bool { 3280 typedEvent, ok := apiEvent.(EventDeleteTask) 3281 if !ok { 3282 return false 3283 } 3284 3285 for _, check := range e.Checks { 3286 if !check(e.Task, typedEvent.Task) { 3287 return false 3288 } 3289 } 3290 return true 3291 } 3292 3293 func (e EventDeleteTask) IsEventDelete() bool { 3294 return true 3295 } 3296 3297 func (e EventDeleteTask) IsEventTask() bool { 3298 return true 3299 } 3300 3301 func (m *Task) CopyStoreObject() StoreObject { 3302 return m.Copy() 3303 } 3304 3305 func (m *Task) GetMeta() Meta { 3306 return m.Meta 3307 } 3308 3309 func (m *Task) SetMeta(meta Meta) { 3310 m.Meta = meta 3311 } 3312 3313 func (m *Task) GetID() string { 3314 return m.ID 3315 } 3316 3317 func (m *Task) EventCreate() Event { 3318 return EventCreateTask{Task: m} 3319 } 3320 3321 func (m *Task) EventUpdate(oldObject StoreObject) Event { 3322 if oldObject != nil { 3323 return EventUpdateTask{Task: m, OldTask: oldObject.(*Task)} 3324 } else { 3325 return EventUpdateTask{Task: m} 3326 } 3327 } 3328 3329 func (m *Task) EventDelete() Event { 3330 return EventDeleteTask{Task: m} 3331 } 3332 3333 func TaskCheckID(v1, v2 *Task) bool { 3334 return v1.ID == v2.ID 3335 } 3336 3337 func TaskCheckIDPrefix(v1, v2 *Task) bool { 3338 return strings.HasPrefix(v2.ID, v1.ID) 3339 } 3340 3341 func TaskCheckName(v1, v2 *Task) bool { 3342 return v1.Annotations.Name == v2.Annotations.Name 3343 } 3344 3345 func TaskCheckNamePrefix(v1, v2 *Task) bool { 3346 return strings.HasPrefix(v2.Annotations.Name, v1.Annotations.Name) 3347 } 3348 3349 func TaskCheckCustom(v1, v2 *Task) bool { 3350 return checkCustom(v1.Annotations, v2.Annotations) 3351 } 3352 3353 func TaskCheckCustomPrefix(v1, v2 *Task) bool { 3354 return checkCustomPrefix(v1.Annotations, v2.Annotations) 3355 } 3356 3357 func TaskCheckNodeID(v1, v2 *Task) bool { 3358 return v1.NodeID == v2.NodeID 3359 } 3360 3361 func TaskCheckServiceID(v1, v2 *Task) bool { 3362 return v1.ServiceID == v2.ServiceID 3363 } 3364 3365 func TaskCheckSlot(v1, v2 *Task) bool { 3366 return v1.Slot == v2.Slot 3367 } 3368 3369 func TaskCheckDesiredState(v1, v2 *Task) bool { 3370 return v1.DesiredState == v2.DesiredState 3371 } 3372 3373 func ConvertTaskWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 3374 var ( 3375 m Task 3376 checkFuncs []TaskCheckFunc 3377 hasDesiredState bool 3378 ) 3379 3380 for _, filter := range filters { 3381 switch v := filter.By.(type) { 3382 case *SelectBy_ID: 3383 if m.ID != "" { 3384 return nil, errConflictingFilters 3385 } 3386 m.ID = v.ID 3387 checkFuncs = append(checkFuncs, TaskCheckID) 3388 case *SelectBy_IDPrefix: 3389 if m.ID != "" { 3390 return nil, errConflictingFilters 3391 } 3392 m.ID = v.IDPrefix 3393 checkFuncs = append(checkFuncs, TaskCheckIDPrefix) 3394 case *SelectBy_Name: 3395 if m.Annotations.Name != "" { 3396 return nil, errConflictingFilters 3397 } 3398 m.Annotations.Name = v.Name 3399 checkFuncs = append(checkFuncs, TaskCheckName) 3400 case *SelectBy_NamePrefix: 3401 if m.Annotations.Name != "" { 3402 return nil, errConflictingFilters 3403 } 3404 m.Annotations.Name = v.NamePrefix 3405 checkFuncs = append(checkFuncs, TaskCheckNamePrefix) 3406 case *SelectBy_Custom: 3407 if len(m.Annotations.Indices) != 0 { 3408 return nil, errConflictingFilters 3409 } 3410 m.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 3411 checkFuncs = append(checkFuncs, TaskCheckCustom) 3412 case *SelectBy_CustomPrefix: 3413 if len(m.Annotations.Indices) != 0 { 3414 return nil, errConflictingFilters 3415 } 3416 m.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 3417 checkFuncs = append(checkFuncs, TaskCheckCustomPrefix) 3418 case *SelectBy_ServiceID: 3419 if m.ServiceID != "" { 3420 return nil, errConflictingFilters 3421 } 3422 m.ServiceID = v.ServiceID 3423 checkFuncs = append(checkFuncs, TaskCheckServiceID) 3424 case *SelectBy_NodeID: 3425 if m.NodeID != "" { 3426 return nil, errConflictingFilters 3427 } 3428 m.NodeID = v.NodeID 3429 checkFuncs = append(checkFuncs, TaskCheckNodeID) 3430 case *SelectBy_Slot: 3431 if m.Slot != 0 || m.ServiceID != "" { 3432 return nil, errConflictingFilters 3433 } 3434 m.ServiceID = v.Slot.ServiceID 3435 m.Slot = v.Slot.Slot 3436 checkFuncs = append(checkFuncs, TaskCheckNodeID, TaskCheckSlot) 3437 case *SelectBy_DesiredState: 3438 if hasDesiredState { 3439 return nil, errConflictingFilters 3440 } 3441 hasDesiredState = true 3442 m.DesiredState = v.DesiredState 3443 checkFuncs = append(checkFuncs, TaskCheckDesiredState) 3444 } 3445 } 3446 var events []Event 3447 if (action & WatchActionKindCreate) != 0 { 3448 events = append(events, EventCreateTask{Task: &m, Checks: checkFuncs}) 3449 } 3450 if (action & WatchActionKindUpdate) != 0 { 3451 events = append(events, EventUpdateTask{Task: &m, Checks: checkFuncs}) 3452 } 3453 if (action & WatchActionKindRemove) != 0 { 3454 events = append(events, EventDeleteTask{Task: &m, Checks: checkFuncs}) 3455 } 3456 if len(events) == 0 { 3457 return nil, errUnrecognizedAction 3458 } 3459 return events, nil 3460 } 3461 3462 type TaskIndexerByID struct{} 3463 3464 func (indexer TaskIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 3465 return fromArgs(args...) 3466 } 3467 func (indexer TaskIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3468 return prefixFromArgs(args...) 3469 } 3470 func (indexer TaskIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 3471 m := obj.(*Task) 3472 return true, []byte(m.ID + "\x00"), nil 3473 } 3474 3475 type TaskIndexerByName struct{} 3476 3477 func (indexer TaskIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 3478 return fromArgs(args...) 3479 } 3480 func (indexer TaskIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3481 return prefixFromArgs(args...) 3482 } 3483 func (indexer TaskIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 3484 m := obj.(*Task) 3485 val := m.Annotations.Name 3486 return true, []byte(strings.ToLower(val) + "\x00"), nil 3487 } 3488 3489 type TaskCustomIndexer struct{} 3490 3491 func (indexer TaskCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 3492 return fromArgs(args...) 3493 } 3494 func (indexer TaskCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3495 return prefixFromArgs(args...) 3496 } 3497 func (indexer TaskCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 3498 m := obj.(*Task) 3499 return customIndexer("", &m.Annotations) 3500 } 3501 3502 type NetworkCheckFunc func(t1, t2 *Network) bool 3503 3504 type EventNetwork interface { 3505 IsEventNetwork() bool 3506 } 3507 3508 type EventCreateNetwork struct { 3509 Network *Network 3510 Checks []NetworkCheckFunc 3511 } 3512 3513 func (e EventCreateNetwork) Matches(apiEvent github_com_docker_go_events.Event) bool { 3514 typedEvent, ok := apiEvent.(EventCreateNetwork) 3515 if !ok { 3516 return false 3517 } 3518 3519 for _, check := range e.Checks { 3520 if !check(e.Network, typedEvent.Network) { 3521 return false 3522 } 3523 } 3524 return true 3525 } 3526 3527 func (e EventCreateNetwork) IsEventCreate() bool { 3528 return true 3529 } 3530 3531 func (e EventCreateNetwork) IsEventNetwork() bool { 3532 return true 3533 } 3534 3535 type EventUpdateNetwork struct { 3536 Network *Network 3537 OldNetwork *Network 3538 Checks []NetworkCheckFunc 3539 } 3540 3541 func (e EventUpdateNetwork) Matches(apiEvent github_com_docker_go_events.Event) bool { 3542 typedEvent, ok := apiEvent.(EventUpdateNetwork) 3543 if !ok { 3544 return false 3545 } 3546 3547 for _, check := range e.Checks { 3548 if !check(e.Network, typedEvent.Network) { 3549 return false 3550 } 3551 } 3552 return true 3553 } 3554 3555 func (e EventUpdateNetwork) IsEventUpdate() bool { 3556 return true 3557 } 3558 3559 func (e EventUpdateNetwork) IsEventNetwork() bool { 3560 return true 3561 } 3562 3563 type EventDeleteNetwork struct { 3564 Network *Network 3565 Checks []NetworkCheckFunc 3566 } 3567 3568 func (e EventDeleteNetwork) Matches(apiEvent github_com_docker_go_events.Event) bool { 3569 typedEvent, ok := apiEvent.(EventDeleteNetwork) 3570 if !ok { 3571 return false 3572 } 3573 3574 for _, check := range e.Checks { 3575 if !check(e.Network, typedEvent.Network) { 3576 return false 3577 } 3578 } 3579 return true 3580 } 3581 3582 func (e EventDeleteNetwork) IsEventDelete() bool { 3583 return true 3584 } 3585 3586 func (e EventDeleteNetwork) IsEventNetwork() bool { 3587 return true 3588 } 3589 3590 func (m *Network) CopyStoreObject() StoreObject { 3591 return m.Copy() 3592 } 3593 3594 func (m *Network) GetMeta() Meta { 3595 return m.Meta 3596 } 3597 3598 func (m *Network) SetMeta(meta Meta) { 3599 m.Meta = meta 3600 } 3601 3602 func (m *Network) GetID() string { 3603 return m.ID 3604 } 3605 3606 func (m *Network) EventCreate() Event { 3607 return EventCreateNetwork{Network: m} 3608 } 3609 3610 func (m *Network) EventUpdate(oldObject StoreObject) Event { 3611 if oldObject != nil { 3612 return EventUpdateNetwork{Network: m, OldNetwork: oldObject.(*Network)} 3613 } else { 3614 return EventUpdateNetwork{Network: m} 3615 } 3616 } 3617 3618 func (m *Network) EventDelete() Event { 3619 return EventDeleteNetwork{Network: m} 3620 } 3621 3622 func NetworkCheckID(v1, v2 *Network) bool { 3623 return v1.ID == v2.ID 3624 } 3625 3626 func NetworkCheckIDPrefix(v1, v2 *Network) bool { 3627 return strings.HasPrefix(v2.ID, v1.ID) 3628 } 3629 3630 func NetworkCheckName(v1, v2 *Network) bool { 3631 return v1.Spec.Annotations.Name == v2.Spec.Annotations.Name 3632 } 3633 3634 func NetworkCheckNamePrefix(v1, v2 *Network) bool { 3635 return strings.HasPrefix(v2.Spec.Annotations.Name, v1.Spec.Annotations.Name) 3636 } 3637 3638 func NetworkCheckCustom(v1, v2 *Network) bool { 3639 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 3640 } 3641 3642 func NetworkCheckCustomPrefix(v1, v2 *Network) bool { 3643 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 3644 } 3645 3646 func ConvertNetworkWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 3647 var ( 3648 m Network 3649 checkFuncs []NetworkCheckFunc 3650 ) 3651 3652 for _, filter := range filters { 3653 switch v := filter.By.(type) { 3654 case *SelectBy_ID: 3655 if m.ID != "" { 3656 return nil, errConflictingFilters 3657 } 3658 m.ID = v.ID 3659 checkFuncs = append(checkFuncs, NetworkCheckID) 3660 case *SelectBy_IDPrefix: 3661 if m.ID != "" { 3662 return nil, errConflictingFilters 3663 } 3664 m.ID = v.IDPrefix 3665 checkFuncs = append(checkFuncs, NetworkCheckIDPrefix) 3666 case *SelectBy_Name: 3667 if m.Spec.Annotations.Name != "" { 3668 return nil, errConflictingFilters 3669 } 3670 m.Spec.Annotations.Name = v.Name 3671 checkFuncs = append(checkFuncs, NetworkCheckName) 3672 case *SelectBy_NamePrefix: 3673 if m.Spec.Annotations.Name != "" { 3674 return nil, errConflictingFilters 3675 } 3676 m.Spec.Annotations.Name = v.NamePrefix 3677 checkFuncs = append(checkFuncs, NetworkCheckNamePrefix) 3678 case *SelectBy_Custom: 3679 if len(m.Spec.Annotations.Indices) != 0 { 3680 return nil, errConflictingFilters 3681 } 3682 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 3683 checkFuncs = append(checkFuncs, NetworkCheckCustom) 3684 case *SelectBy_CustomPrefix: 3685 if len(m.Spec.Annotations.Indices) != 0 { 3686 return nil, errConflictingFilters 3687 } 3688 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 3689 checkFuncs = append(checkFuncs, NetworkCheckCustomPrefix) 3690 } 3691 } 3692 var events []Event 3693 if (action & WatchActionKindCreate) != 0 { 3694 events = append(events, EventCreateNetwork{Network: &m, Checks: checkFuncs}) 3695 } 3696 if (action & WatchActionKindUpdate) != 0 { 3697 events = append(events, EventUpdateNetwork{Network: &m, Checks: checkFuncs}) 3698 } 3699 if (action & WatchActionKindRemove) != 0 { 3700 events = append(events, EventDeleteNetwork{Network: &m, Checks: checkFuncs}) 3701 } 3702 if len(events) == 0 { 3703 return nil, errUnrecognizedAction 3704 } 3705 return events, nil 3706 } 3707 3708 type NetworkIndexerByID struct{} 3709 3710 func (indexer NetworkIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 3711 return fromArgs(args...) 3712 } 3713 func (indexer NetworkIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3714 return prefixFromArgs(args...) 3715 } 3716 func (indexer NetworkIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 3717 m := obj.(*Network) 3718 return true, []byte(m.ID + "\x00"), nil 3719 } 3720 3721 type NetworkIndexerByName struct{} 3722 3723 func (indexer NetworkIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 3724 return fromArgs(args...) 3725 } 3726 func (indexer NetworkIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3727 return prefixFromArgs(args...) 3728 } 3729 func (indexer NetworkIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 3730 m := obj.(*Network) 3731 val := m.Spec.Annotations.Name 3732 return true, []byte(strings.ToLower(val) + "\x00"), nil 3733 } 3734 3735 type NetworkCustomIndexer struct{} 3736 3737 func (indexer NetworkCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 3738 return fromArgs(args...) 3739 } 3740 func (indexer NetworkCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3741 return prefixFromArgs(args...) 3742 } 3743 func (indexer NetworkCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 3744 m := obj.(*Network) 3745 return customIndexer("", &m.Spec.Annotations) 3746 } 3747 3748 type ClusterCheckFunc func(t1, t2 *Cluster) bool 3749 3750 type EventCluster interface { 3751 IsEventCluster() bool 3752 } 3753 3754 type EventCreateCluster struct { 3755 Cluster *Cluster 3756 Checks []ClusterCheckFunc 3757 } 3758 3759 func (e EventCreateCluster) Matches(apiEvent github_com_docker_go_events.Event) bool { 3760 typedEvent, ok := apiEvent.(EventCreateCluster) 3761 if !ok { 3762 return false 3763 } 3764 3765 for _, check := range e.Checks { 3766 if !check(e.Cluster, typedEvent.Cluster) { 3767 return false 3768 } 3769 } 3770 return true 3771 } 3772 3773 func (e EventCreateCluster) IsEventCreate() bool { 3774 return true 3775 } 3776 3777 func (e EventCreateCluster) IsEventCluster() bool { 3778 return true 3779 } 3780 3781 type EventUpdateCluster struct { 3782 Cluster *Cluster 3783 OldCluster *Cluster 3784 Checks []ClusterCheckFunc 3785 } 3786 3787 func (e EventUpdateCluster) Matches(apiEvent github_com_docker_go_events.Event) bool { 3788 typedEvent, ok := apiEvent.(EventUpdateCluster) 3789 if !ok { 3790 return false 3791 } 3792 3793 for _, check := range e.Checks { 3794 if !check(e.Cluster, typedEvent.Cluster) { 3795 return false 3796 } 3797 } 3798 return true 3799 } 3800 3801 func (e EventUpdateCluster) IsEventUpdate() bool { 3802 return true 3803 } 3804 3805 func (e EventUpdateCluster) IsEventCluster() bool { 3806 return true 3807 } 3808 3809 type EventDeleteCluster struct { 3810 Cluster *Cluster 3811 Checks []ClusterCheckFunc 3812 } 3813 3814 func (e EventDeleteCluster) Matches(apiEvent github_com_docker_go_events.Event) bool { 3815 typedEvent, ok := apiEvent.(EventDeleteCluster) 3816 if !ok { 3817 return false 3818 } 3819 3820 for _, check := range e.Checks { 3821 if !check(e.Cluster, typedEvent.Cluster) { 3822 return false 3823 } 3824 } 3825 return true 3826 } 3827 3828 func (e EventDeleteCluster) IsEventDelete() bool { 3829 return true 3830 } 3831 3832 func (e EventDeleteCluster) IsEventCluster() bool { 3833 return true 3834 } 3835 3836 func (m *Cluster) CopyStoreObject() StoreObject { 3837 return m.Copy() 3838 } 3839 3840 func (m *Cluster) GetMeta() Meta { 3841 return m.Meta 3842 } 3843 3844 func (m *Cluster) SetMeta(meta Meta) { 3845 m.Meta = meta 3846 } 3847 3848 func (m *Cluster) GetID() string { 3849 return m.ID 3850 } 3851 3852 func (m *Cluster) EventCreate() Event { 3853 return EventCreateCluster{Cluster: m} 3854 } 3855 3856 func (m *Cluster) EventUpdate(oldObject StoreObject) Event { 3857 if oldObject != nil { 3858 return EventUpdateCluster{Cluster: m, OldCluster: oldObject.(*Cluster)} 3859 } else { 3860 return EventUpdateCluster{Cluster: m} 3861 } 3862 } 3863 3864 func (m *Cluster) EventDelete() Event { 3865 return EventDeleteCluster{Cluster: m} 3866 } 3867 3868 func ClusterCheckID(v1, v2 *Cluster) bool { 3869 return v1.ID == v2.ID 3870 } 3871 3872 func ClusterCheckIDPrefix(v1, v2 *Cluster) bool { 3873 return strings.HasPrefix(v2.ID, v1.ID) 3874 } 3875 3876 func ClusterCheckName(v1, v2 *Cluster) bool { 3877 return v1.Spec.Annotations.Name == v2.Spec.Annotations.Name 3878 } 3879 3880 func ClusterCheckNamePrefix(v1, v2 *Cluster) bool { 3881 return strings.HasPrefix(v2.Spec.Annotations.Name, v1.Spec.Annotations.Name) 3882 } 3883 3884 func ClusterCheckCustom(v1, v2 *Cluster) bool { 3885 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 3886 } 3887 3888 func ClusterCheckCustomPrefix(v1, v2 *Cluster) bool { 3889 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 3890 } 3891 3892 func ConvertClusterWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 3893 var ( 3894 m Cluster 3895 checkFuncs []ClusterCheckFunc 3896 ) 3897 3898 for _, filter := range filters { 3899 switch v := filter.By.(type) { 3900 case *SelectBy_ID: 3901 if m.ID != "" { 3902 return nil, errConflictingFilters 3903 } 3904 m.ID = v.ID 3905 checkFuncs = append(checkFuncs, ClusterCheckID) 3906 case *SelectBy_IDPrefix: 3907 if m.ID != "" { 3908 return nil, errConflictingFilters 3909 } 3910 m.ID = v.IDPrefix 3911 checkFuncs = append(checkFuncs, ClusterCheckIDPrefix) 3912 case *SelectBy_Name: 3913 if m.Spec.Annotations.Name != "" { 3914 return nil, errConflictingFilters 3915 } 3916 m.Spec.Annotations.Name = v.Name 3917 checkFuncs = append(checkFuncs, ClusterCheckName) 3918 case *SelectBy_NamePrefix: 3919 if m.Spec.Annotations.Name != "" { 3920 return nil, errConflictingFilters 3921 } 3922 m.Spec.Annotations.Name = v.NamePrefix 3923 checkFuncs = append(checkFuncs, ClusterCheckNamePrefix) 3924 case *SelectBy_Custom: 3925 if len(m.Spec.Annotations.Indices) != 0 { 3926 return nil, errConflictingFilters 3927 } 3928 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 3929 checkFuncs = append(checkFuncs, ClusterCheckCustom) 3930 case *SelectBy_CustomPrefix: 3931 if len(m.Spec.Annotations.Indices) != 0 { 3932 return nil, errConflictingFilters 3933 } 3934 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 3935 checkFuncs = append(checkFuncs, ClusterCheckCustomPrefix) 3936 } 3937 } 3938 var events []Event 3939 if (action & WatchActionKindCreate) != 0 { 3940 events = append(events, EventCreateCluster{Cluster: &m, Checks: checkFuncs}) 3941 } 3942 if (action & WatchActionKindUpdate) != 0 { 3943 events = append(events, EventUpdateCluster{Cluster: &m, Checks: checkFuncs}) 3944 } 3945 if (action & WatchActionKindRemove) != 0 { 3946 events = append(events, EventDeleteCluster{Cluster: &m, Checks: checkFuncs}) 3947 } 3948 if len(events) == 0 { 3949 return nil, errUnrecognizedAction 3950 } 3951 return events, nil 3952 } 3953 3954 type ClusterIndexerByID struct{} 3955 3956 func (indexer ClusterIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 3957 return fromArgs(args...) 3958 } 3959 func (indexer ClusterIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3960 return prefixFromArgs(args...) 3961 } 3962 func (indexer ClusterIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 3963 m := obj.(*Cluster) 3964 return true, []byte(m.ID + "\x00"), nil 3965 } 3966 3967 type ClusterIndexerByName struct{} 3968 3969 func (indexer ClusterIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 3970 return fromArgs(args...) 3971 } 3972 func (indexer ClusterIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3973 return prefixFromArgs(args...) 3974 } 3975 func (indexer ClusterIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 3976 m := obj.(*Cluster) 3977 val := m.Spec.Annotations.Name 3978 return true, []byte(strings.ToLower(val) + "\x00"), nil 3979 } 3980 3981 type ClusterCustomIndexer struct{} 3982 3983 func (indexer ClusterCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 3984 return fromArgs(args...) 3985 } 3986 func (indexer ClusterCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 3987 return prefixFromArgs(args...) 3988 } 3989 func (indexer ClusterCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 3990 m := obj.(*Cluster) 3991 return customIndexer("", &m.Spec.Annotations) 3992 } 3993 3994 type SecretCheckFunc func(t1, t2 *Secret) bool 3995 3996 type EventSecret interface { 3997 IsEventSecret() bool 3998 } 3999 4000 type EventCreateSecret struct { 4001 Secret *Secret 4002 Checks []SecretCheckFunc 4003 } 4004 4005 func (e EventCreateSecret) Matches(apiEvent github_com_docker_go_events.Event) bool { 4006 typedEvent, ok := apiEvent.(EventCreateSecret) 4007 if !ok { 4008 return false 4009 } 4010 4011 for _, check := range e.Checks { 4012 if !check(e.Secret, typedEvent.Secret) { 4013 return false 4014 } 4015 } 4016 return true 4017 } 4018 4019 func (e EventCreateSecret) IsEventCreate() bool { 4020 return true 4021 } 4022 4023 func (e EventCreateSecret) IsEventSecret() bool { 4024 return true 4025 } 4026 4027 type EventUpdateSecret struct { 4028 Secret *Secret 4029 OldSecret *Secret 4030 Checks []SecretCheckFunc 4031 } 4032 4033 func (e EventUpdateSecret) Matches(apiEvent github_com_docker_go_events.Event) bool { 4034 typedEvent, ok := apiEvent.(EventUpdateSecret) 4035 if !ok { 4036 return false 4037 } 4038 4039 for _, check := range e.Checks { 4040 if !check(e.Secret, typedEvent.Secret) { 4041 return false 4042 } 4043 } 4044 return true 4045 } 4046 4047 func (e EventUpdateSecret) IsEventUpdate() bool { 4048 return true 4049 } 4050 4051 func (e EventUpdateSecret) IsEventSecret() bool { 4052 return true 4053 } 4054 4055 type EventDeleteSecret struct { 4056 Secret *Secret 4057 Checks []SecretCheckFunc 4058 } 4059 4060 func (e EventDeleteSecret) Matches(apiEvent github_com_docker_go_events.Event) bool { 4061 typedEvent, ok := apiEvent.(EventDeleteSecret) 4062 if !ok { 4063 return false 4064 } 4065 4066 for _, check := range e.Checks { 4067 if !check(e.Secret, typedEvent.Secret) { 4068 return false 4069 } 4070 } 4071 return true 4072 } 4073 4074 func (e EventDeleteSecret) IsEventDelete() bool { 4075 return true 4076 } 4077 4078 func (e EventDeleteSecret) IsEventSecret() bool { 4079 return true 4080 } 4081 4082 func (m *Secret) CopyStoreObject() StoreObject { 4083 return m.Copy() 4084 } 4085 4086 func (m *Secret) GetMeta() Meta { 4087 return m.Meta 4088 } 4089 4090 func (m *Secret) SetMeta(meta Meta) { 4091 m.Meta = meta 4092 } 4093 4094 func (m *Secret) GetID() string { 4095 return m.ID 4096 } 4097 4098 func (m *Secret) EventCreate() Event { 4099 return EventCreateSecret{Secret: m} 4100 } 4101 4102 func (m *Secret) EventUpdate(oldObject StoreObject) Event { 4103 if oldObject != nil { 4104 return EventUpdateSecret{Secret: m, OldSecret: oldObject.(*Secret)} 4105 } else { 4106 return EventUpdateSecret{Secret: m} 4107 } 4108 } 4109 4110 func (m *Secret) EventDelete() Event { 4111 return EventDeleteSecret{Secret: m} 4112 } 4113 4114 func SecretCheckID(v1, v2 *Secret) bool { 4115 return v1.ID == v2.ID 4116 } 4117 4118 func SecretCheckIDPrefix(v1, v2 *Secret) bool { 4119 return strings.HasPrefix(v2.ID, v1.ID) 4120 } 4121 4122 func SecretCheckName(v1, v2 *Secret) bool { 4123 return v1.Spec.Annotations.Name == v2.Spec.Annotations.Name 4124 } 4125 4126 func SecretCheckNamePrefix(v1, v2 *Secret) bool { 4127 return strings.HasPrefix(v2.Spec.Annotations.Name, v1.Spec.Annotations.Name) 4128 } 4129 4130 func SecretCheckCustom(v1, v2 *Secret) bool { 4131 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 4132 } 4133 4134 func SecretCheckCustomPrefix(v1, v2 *Secret) bool { 4135 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 4136 } 4137 4138 func ConvertSecretWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 4139 var ( 4140 m Secret 4141 checkFuncs []SecretCheckFunc 4142 ) 4143 4144 for _, filter := range filters { 4145 switch v := filter.By.(type) { 4146 case *SelectBy_ID: 4147 if m.ID != "" { 4148 return nil, errConflictingFilters 4149 } 4150 m.ID = v.ID 4151 checkFuncs = append(checkFuncs, SecretCheckID) 4152 case *SelectBy_IDPrefix: 4153 if m.ID != "" { 4154 return nil, errConflictingFilters 4155 } 4156 m.ID = v.IDPrefix 4157 checkFuncs = append(checkFuncs, SecretCheckIDPrefix) 4158 case *SelectBy_Name: 4159 if m.Spec.Annotations.Name != "" { 4160 return nil, errConflictingFilters 4161 } 4162 m.Spec.Annotations.Name = v.Name 4163 checkFuncs = append(checkFuncs, SecretCheckName) 4164 case *SelectBy_NamePrefix: 4165 if m.Spec.Annotations.Name != "" { 4166 return nil, errConflictingFilters 4167 } 4168 m.Spec.Annotations.Name = v.NamePrefix 4169 checkFuncs = append(checkFuncs, SecretCheckNamePrefix) 4170 case *SelectBy_Custom: 4171 if len(m.Spec.Annotations.Indices) != 0 { 4172 return nil, errConflictingFilters 4173 } 4174 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 4175 checkFuncs = append(checkFuncs, SecretCheckCustom) 4176 case *SelectBy_CustomPrefix: 4177 if len(m.Spec.Annotations.Indices) != 0 { 4178 return nil, errConflictingFilters 4179 } 4180 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 4181 checkFuncs = append(checkFuncs, SecretCheckCustomPrefix) 4182 } 4183 } 4184 var events []Event 4185 if (action & WatchActionKindCreate) != 0 { 4186 events = append(events, EventCreateSecret{Secret: &m, Checks: checkFuncs}) 4187 } 4188 if (action & WatchActionKindUpdate) != 0 { 4189 events = append(events, EventUpdateSecret{Secret: &m, Checks: checkFuncs}) 4190 } 4191 if (action & WatchActionKindRemove) != 0 { 4192 events = append(events, EventDeleteSecret{Secret: &m, Checks: checkFuncs}) 4193 } 4194 if len(events) == 0 { 4195 return nil, errUnrecognizedAction 4196 } 4197 return events, nil 4198 } 4199 4200 type SecretIndexerByID struct{} 4201 4202 func (indexer SecretIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 4203 return fromArgs(args...) 4204 } 4205 func (indexer SecretIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4206 return prefixFromArgs(args...) 4207 } 4208 func (indexer SecretIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 4209 m := obj.(*Secret) 4210 return true, []byte(m.ID + "\x00"), nil 4211 } 4212 4213 type SecretIndexerByName struct{} 4214 4215 func (indexer SecretIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 4216 return fromArgs(args...) 4217 } 4218 func (indexer SecretIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4219 return prefixFromArgs(args...) 4220 } 4221 func (indexer SecretIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 4222 m := obj.(*Secret) 4223 val := m.Spec.Annotations.Name 4224 return true, []byte(strings.ToLower(val) + "\x00"), nil 4225 } 4226 4227 type SecretCustomIndexer struct{} 4228 4229 func (indexer SecretCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 4230 return fromArgs(args...) 4231 } 4232 func (indexer SecretCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4233 return prefixFromArgs(args...) 4234 } 4235 func (indexer SecretCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 4236 m := obj.(*Secret) 4237 return customIndexer("", &m.Spec.Annotations) 4238 } 4239 4240 type ConfigCheckFunc func(t1, t2 *Config) bool 4241 4242 type EventConfig interface { 4243 IsEventConfig() bool 4244 } 4245 4246 type EventCreateConfig struct { 4247 Config *Config 4248 Checks []ConfigCheckFunc 4249 } 4250 4251 func (e EventCreateConfig) Matches(apiEvent github_com_docker_go_events.Event) bool { 4252 typedEvent, ok := apiEvent.(EventCreateConfig) 4253 if !ok { 4254 return false 4255 } 4256 4257 for _, check := range e.Checks { 4258 if !check(e.Config, typedEvent.Config) { 4259 return false 4260 } 4261 } 4262 return true 4263 } 4264 4265 func (e EventCreateConfig) IsEventCreate() bool { 4266 return true 4267 } 4268 4269 func (e EventCreateConfig) IsEventConfig() bool { 4270 return true 4271 } 4272 4273 type EventUpdateConfig struct { 4274 Config *Config 4275 OldConfig *Config 4276 Checks []ConfigCheckFunc 4277 } 4278 4279 func (e EventUpdateConfig) Matches(apiEvent github_com_docker_go_events.Event) bool { 4280 typedEvent, ok := apiEvent.(EventUpdateConfig) 4281 if !ok { 4282 return false 4283 } 4284 4285 for _, check := range e.Checks { 4286 if !check(e.Config, typedEvent.Config) { 4287 return false 4288 } 4289 } 4290 return true 4291 } 4292 4293 func (e EventUpdateConfig) IsEventUpdate() bool { 4294 return true 4295 } 4296 4297 func (e EventUpdateConfig) IsEventConfig() bool { 4298 return true 4299 } 4300 4301 type EventDeleteConfig struct { 4302 Config *Config 4303 Checks []ConfigCheckFunc 4304 } 4305 4306 func (e EventDeleteConfig) Matches(apiEvent github_com_docker_go_events.Event) bool { 4307 typedEvent, ok := apiEvent.(EventDeleteConfig) 4308 if !ok { 4309 return false 4310 } 4311 4312 for _, check := range e.Checks { 4313 if !check(e.Config, typedEvent.Config) { 4314 return false 4315 } 4316 } 4317 return true 4318 } 4319 4320 func (e EventDeleteConfig) IsEventDelete() bool { 4321 return true 4322 } 4323 4324 func (e EventDeleteConfig) IsEventConfig() bool { 4325 return true 4326 } 4327 4328 func (m *Config) CopyStoreObject() StoreObject { 4329 return m.Copy() 4330 } 4331 4332 func (m *Config) GetMeta() Meta { 4333 return m.Meta 4334 } 4335 4336 func (m *Config) SetMeta(meta Meta) { 4337 m.Meta = meta 4338 } 4339 4340 func (m *Config) GetID() string { 4341 return m.ID 4342 } 4343 4344 func (m *Config) EventCreate() Event { 4345 return EventCreateConfig{Config: m} 4346 } 4347 4348 func (m *Config) EventUpdate(oldObject StoreObject) Event { 4349 if oldObject != nil { 4350 return EventUpdateConfig{Config: m, OldConfig: oldObject.(*Config)} 4351 } else { 4352 return EventUpdateConfig{Config: m} 4353 } 4354 } 4355 4356 func (m *Config) EventDelete() Event { 4357 return EventDeleteConfig{Config: m} 4358 } 4359 4360 func ConfigCheckID(v1, v2 *Config) bool { 4361 return v1.ID == v2.ID 4362 } 4363 4364 func ConfigCheckIDPrefix(v1, v2 *Config) bool { 4365 return strings.HasPrefix(v2.ID, v1.ID) 4366 } 4367 4368 func ConfigCheckName(v1, v2 *Config) bool { 4369 return v1.Spec.Annotations.Name == v2.Spec.Annotations.Name 4370 } 4371 4372 func ConfigCheckNamePrefix(v1, v2 *Config) bool { 4373 return strings.HasPrefix(v2.Spec.Annotations.Name, v1.Spec.Annotations.Name) 4374 } 4375 4376 func ConfigCheckCustom(v1, v2 *Config) bool { 4377 return checkCustom(v1.Spec.Annotations, v2.Spec.Annotations) 4378 } 4379 4380 func ConfigCheckCustomPrefix(v1, v2 *Config) bool { 4381 return checkCustomPrefix(v1.Spec.Annotations, v2.Spec.Annotations) 4382 } 4383 4384 func ConvertConfigWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 4385 var ( 4386 m Config 4387 checkFuncs []ConfigCheckFunc 4388 ) 4389 4390 for _, filter := range filters { 4391 switch v := filter.By.(type) { 4392 case *SelectBy_ID: 4393 if m.ID != "" { 4394 return nil, errConflictingFilters 4395 } 4396 m.ID = v.ID 4397 checkFuncs = append(checkFuncs, ConfigCheckID) 4398 case *SelectBy_IDPrefix: 4399 if m.ID != "" { 4400 return nil, errConflictingFilters 4401 } 4402 m.ID = v.IDPrefix 4403 checkFuncs = append(checkFuncs, ConfigCheckIDPrefix) 4404 case *SelectBy_Name: 4405 if m.Spec.Annotations.Name != "" { 4406 return nil, errConflictingFilters 4407 } 4408 m.Spec.Annotations.Name = v.Name 4409 checkFuncs = append(checkFuncs, ConfigCheckName) 4410 case *SelectBy_NamePrefix: 4411 if m.Spec.Annotations.Name != "" { 4412 return nil, errConflictingFilters 4413 } 4414 m.Spec.Annotations.Name = v.NamePrefix 4415 checkFuncs = append(checkFuncs, ConfigCheckNamePrefix) 4416 case *SelectBy_Custom: 4417 if len(m.Spec.Annotations.Indices) != 0 { 4418 return nil, errConflictingFilters 4419 } 4420 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 4421 checkFuncs = append(checkFuncs, ConfigCheckCustom) 4422 case *SelectBy_CustomPrefix: 4423 if len(m.Spec.Annotations.Indices) != 0 { 4424 return nil, errConflictingFilters 4425 } 4426 m.Spec.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 4427 checkFuncs = append(checkFuncs, ConfigCheckCustomPrefix) 4428 } 4429 } 4430 var events []Event 4431 if (action & WatchActionKindCreate) != 0 { 4432 events = append(events, EventCreateConfig{Config: &m, Checks: checkFuncs}) 4433 } 4434 if (action & WatchActionKindUpdate) != 0 { 4435 events = append(events, EventUpdateConfig{Config: &m, Checks: checkFuncs}) 4436 } 4437 if (action & WatchActionKindRemove) != 0 { 4438 events = append(events, EventDeleteConfig{Config: &m, Checks: checkFuncs}) 4439 } 4440 if len(events) == 0 { 4441 return nil, errUnrecognizedAction 4442 } 4443 return events, nil 4444 } 4445 4446 type ConfigIndexerByID struct{} 4447 4448 func (indexer ConfigIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 4449 return fromArgs(args...) 4450 } 4451 func (indexer ConfigIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4452 return prefixFromArgs(args...) 4453 } 4454 func (indexer ConfigIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 4455 m := obj.(*Config) 4456 return true, []byte(m.ID + "\x00"), nil 4457 } 4458 4459 type ConfigIndexerByName struct{} 4460 4461 func (indexer ConfigIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 4462 return fromArgs(args...) 4463 } 4464 func (indexer ConfigIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4465 return prefixFromArgs(args...) 4466 } 4467 func (indexer ConfigIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 4468 m := obj.(*Config) 4469 val := m.Spec.Annotations.Name 4470 return true, []byte(strings.ToLower(val) + "\x00"), nil 4471 } 4472 4473 type ConfigCustomIndexer struct{} 4474 4475 func (indexer ConfigCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 4476 return fromArgs(args...) 4477 } 4478 func (indexer ConfigCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4479 return prefixFromArgs(args...) 4480 } 4481 func (indexer ConfigCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 4482 m := obj.(*Config) 4483 return customIndexer("", &m.Spec.Annotations) 4484 } 4485 4486 type ResourceCheckFunc func(t1, t2 *Resource) bool 4487 4488 type EventResource interface { 4489 IsEventResource() bool 4490 } 4491 4492 type EventCreateResource struct { 4493 Resource *Resource 4494 Checks []ResourceCheckFunc 4495 } 4496 4497 func (e EventCreateResource) Matches(apiEvent github_com_docker_go_events.Event) bool { 4498 typedEvent, ok := apiEvent.(EventCreateResource) 4499 if !ok { 4500 return false 4501 } 4502 4503 for _, check := range e.Checks { 4504 if !check(e.Resource, typedEvent.Resource) { 4505 return false 4506 } 4507 } 4508 return true 4509 } 4510 4511 func (e EventCreateResource) IsEventCreate() bool { 4512 return true 4513 } 4514 4515 func (e EventCreateResource) IsEventResource() bool { 4516 return true 4517 } 4518 4519 type EventUpdateResource struct { 4520 Resource *Resource 4521 OldResource *Resource 4522 Checks []ResourceCheckFunc 4523 } 4524 4525 func (e EventUpdateResource) Matches(apiEvent github_com_docker_go_events.Event) bool { 4526 typedEvent, ok := apiEvent.(EventUpdateResource) 4527 if !ok { 4528 return false 4529 } 4530 4531 for _, check := range e.Checks { 4532 if !check(e.Resource, typedEvent.Resource) { 4533 return false 4534 } 4535 } 4536 return true 4537 } 4538 4539 func (e EventUpdateResource) IsEventUpdate() bool { 4540 return true 4541 } 4542 4543 func (e EventUpdateResource) IsEventResource() bool { 4544 return true 4545 } 4546 4547 type EventDeleteResource struct { 4548 Resource *Resource 4549 Checks []ResourceCheckFunc 4550 } 4551 4552 func (e EventDeleteResource) Matches(apiEvent github_com_docker_go_events.Event) bool { 4553 typedEvent, ok := apiEvent.(EventDeleteResource) 4554 if !ok { 4555 return false 4556 } 4557 4558 for _, check := range e.Checks { 4559 if !check(e.Resource, typedEvent.Resource) { 4560 return false 4561 } 4562 } 4563 return true 4564 } 4565 4566 func (e EventDeleteResource) IsEventDelete() bool { 4567 return true 4568 } 4569 4570 func (e EventDeleteResource) IsEventResource() bool { 4571 return true 4572 } 4573 4574 func (m *Resource) CopyStoreObject() StoreObject { 4575 return m.Copy() 4576 } 4577 4578 func (m *Resource) GetMeta() Meta { 4579 return m.Meta 4580 } 4581 4582 func (m *Resource) SetMeta(meta Meta) { 4583 m.Meta = meta 4584 } 4585 4586 func (m *Resource) GetID() string { 4587 return m.ID 4588 } 4589 4590 func (m *Resource) EventCreate() Event { 4591 return EventCreateResource{Resource: m} 4592 } 4593 4594 func (m *Resource) EventUpdate(oldObject StoreObject) Event { 4595 if oldObject != nil { 4596 return EventUpdateResource{Resource: m, OldResource: oldObject.(*Resource)} 4597 } else { 4598 return EventUpdateResource{Resource: m} 4599 } 4600 } 4601 4602 func (m *Resource) EventDelete() Event { 4603 return EventDeleteResource{Resource: m} 4604 } 4605 4606 func ResourceCheckID(v1, v2 *Resource) bool { 4607 return v1.ID == v2.ID 4608 } 4609 4610 func ResourceCheckIDPrefix(v1, v2 *Resource) bool { 4611 return strings.HasPrefix(v2.ID, v1.ID) 4612 } 4613 4614 func ResourceCheckName(v1, v2 *Resource) bool { 4615 return v1.Annotations.Name == v2.Annotations.Name 4616 } 4617 4618 func ResourceCheckNamePrefix(v1, v2 *Resource) bool { 4619 return strings.HasPrefix(v2.Annotations.Name, v1.Annotations.Name) 4620 } 4621 4622 func ResourceCheckCustom(v1, v2 *Resource) bool { 4623 return checkCustom(v1.Annotations, v2.Annotations) 4624 } 4625 4626 func ResourceCheckCustomPrefix(v1, v2 *Resource) bool { 4627 return checkCustomPrefix(v1.Annotations, v2.Annotations) 4628 } 4629 4630 func ResourceCheckKind(v1, v2 *Resource) bool { 4631 return v1.Kind == v2.Kind 4632 } 4633 4634 func ConvertResourceWatch(action WatchActionKind, filters []*SelectBy, kind string) ([]Event, error) { 4635 var ( 4636 m Resource 4637 checkFuncs []ResourceCheckFunc 4638 ) 4639 m.Kind = kind 4640 checkFuncs = append(checkFuncs, ResourceCheckKind) 4641 4642 for _, filter := range filters { 4643 switch v := filter.By.(type) { 4644 case *SelectBy_ID: 4645 if m.ID != "" { 4646 return nil, errConflictingFilters 4647 } 4648 m.ID = v.ID 4649 checkFuncs = append(checkFuncs, ResourceCheckID) 4650 case *SelectBy_IDPrefix: 4651 if m.ID != "" { 4652 return nil, errConflictingFilters 4653 } 4654 m.ID = v.IDPrefix 4655 checkFuncs = append(checkFuncs, ResourceCheckIDPrefix) 4656 case *SelectBy_Name: 4657 if m.Annotations.Name != "" { 4658 return nil, errConflictingFilters 4659 } 4660 m.Annotations.Name = v.Name 4661 checkFuncs = append(checkFuncs, ResourceCheckName) 4662 case *SelectBy_NamePrefix: 4663 if m.Annotations.Name != "" { 4664 return nil, errConflictingFilters 4665 } 4666 m.Annotations.Name = v.NamePrefix 4667 checkFuncs = append(checkFuncs, ResourceCheckNamePrefix) 4668 case *SelectBy_Custom: 4669 if len(m.Annotations.Indices) != 0 { 4670 return nil, errConflictingFilters 4671 } 4672 m.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 4673 checkFuncs = append(checkFuncs, ResourceCheckCustom) 4674 case *SelectBy_CustomPrefix: 4675 if len(m.Annotations.Indices) != 0 { 4676 return nil, errConflictingFilters 4677 } 4678 m.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 4679 checkFuncs = append(checkFuncs, ResourceCheckCustomPrefix) 4680 } 4681 } 4682 var events []Event 4683 if (action & WatchActionKindCreate) != 0 { 4684 events = append(events, EventCreateResource{Resource: &m, Checks: checkFuncs}) 4685 } 4686 if (action & WatchActionKindUpdate) != 0 { 4687 events = append(events, EventUpdateResource{Resource: &m, Checks: checkFuncs}) 4688 } 4689 if (action & WatchActionKindRemove) != 0 { 4690 events = append(events, EventDeleteResource{Resource: &m, Checks: checkFuncs}) 4691 } 4692 if len(events) == 0 { 4693 return nil, errUnrecognizedAction 4694 } 4695 return events, nil 4696 } 4697 4698 type ResourceIndexerByID struct{} 4699 4700 func (indexer ResourceIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 4701 return fromArgs(args...) 4702 } 4703 func (indexer ResourceIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4704 return prefixFromArgs(args...) 4705 } 4706 func (indexer ResourceIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 4707 m := obj.(*Resource) 4708 return true, []byte(m.ID + "\x00"), nil 4709 } 4710 4711 type ResourceIndexerByName struct{} 4712 4713 func (indexer ResourceIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 4714 return fromArgs(args...) 4715 } 4716 func (indexer ResourceIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4717 return prefixFromArgs(args...) 4718 } 4719 func (indexer ResourceIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 4720 m := obj.(*Resource) 4721 val := m.Annotations.Name 4722 return true, []byte(strings.ToLower(val) + "\x00"), nil 4723 } 4724 4725 type ResourceCustomIndexer struct{} 4726 4727 func (indexer ResourceCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 4728 return fromArgs(args...) 4729 } 4730 func (indexer ResourceCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4731 return prefixFromArgs(args...) 4732 } 4733 func (indexer ResourceCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 4734 m := obj.(*Resource) 4735 return customIndexer("", &m.Annotations) 4736 } 4737 4738 type ExtensionCheckFunc func(t1, t2 *Extension) bool 4739 4740 type EventExtension interface { 4741 IsEventExtension() bool 4742 } 4743 4744 type EventCreateExtension struct { 4745 Extension *Extension 4746 Checks []ExtensionCheckFunc 4747 } 4748 4749 func (e EventCreateExtension) Matches(apiEvent github_com_docker_go_events.Event) bool { 4750 typedEvent, ok := apiEvent.(EventCreateExtension) 4751 if !ok { 4752 return false 4753 } 4754 4755 for _, check := range e.Checks { 4756 if !check(e.Extension, typedEvent.Extension) { 4757 return false 4758 } 4759 } 4760 return true 4761 } 4762 4763 func (e EventCreateExtension) IsEventCreate() bool { 4764 return true 4765 } 4766 4767 func (e EventCreateExtension) IsEventExtension() bool { 4768 return true 4769 } 4770 4771 type EventUpdateExtension struct { 4772 Extension *Extension 4773 OldExtension *Extension 4774 Checks []ExtensionCheckFunc 4775 } 4776 4777 func (e EventUpdateExtension) Matches(apiEvent github_com_docker_go_events.Event) bool { 4778 typedEvent, ok := apiEvent.(EventUpdateExtension) 4779 if !ok { 4780 return false 4781 } 4782 4783 for _, check := range e.Checks { 4784 if !check(e.Extension, typedEvent.Extension) { 4785 return false 4786 } 4787 } 4788 return true 4789 } 4790 4791 func (e EventUpdateExtension) IsEventUpdate() bool { 4792 return true 4793 } 4794 4795 func (e EventUpdateExtension) IsEventExtension() bool { 4796 return true 4797 } 4798 4799 type EventDeleteExtension struct { 4800 Extension *Extension 4801 Checks []ExtensionCheckFunc 4802 } 4803 4804 func (e EventDeleteExtension) Matches(apiEvent github_com_docker_go_events.Event) bool { 4805 typedEvent, ok := apiEvent.(EventDeleteExtension) 4806 if !ok { 4807 return false 4808 } 4809 4810 for _, check := range e.Checks { 4811 if !check(e.Extension, typedEvent.Extension) { 4812 return false 4813 } 4814 } 4815 return true 4816 } 4817 4818 func (e EventDeleteExtension) IsEventDelete() bool { 4819 return true 4820 } 4821 4822 func (e EventDeleteExtension) IsEventExtension() bool { 4823 return true 4824 } 4825 4826 func (m *Extension) CopyStoreObject() StoreObject { 4827 return m.Copy() 4828 } 4829 4830 func (m *Extension) GetMeta() Meta { 4831 return m.Meta 4832 } 4833 4834 func (m *Extension) SetMeta(meta Meta) { 4835 m.Meta = meta 4836 } 4837 4838 func (m *Extension) GetID() string { 4839 return m.ID 4840 } 4841 4842 func (m *Extension) EventCreate() Event { 4843 return EventCreateExtension{Extension: m} 4844 } 4845 4846 func (m *Extension) EventUpdate(oldObject StoreObject) Event { 4847 if oldObject != nil { 4848 return EventUpdateExtension{Extension: m, OldExtension: oldObject.(*Extension)} 4849 } else { 4850 return EventUpdateExtension{Extension: m} 4851 } 4852 } 4853 4854 func (m *Extension) EventDelete() Event { 4855 return EventDeleteExtension{Extension: m} 4856 } 4857 4858 func ExtensionCheckID(v1, v2 *Extension) bool { 4859 return v1.ID == v2.ID 4860 } 4861 4862 func ExtensionCheckIDPrefix(v1, v2 *Extension) bool { 4863 return strings.HasPrefix(v2.ID, v1.ID) 4864 } 4865 4866 func ExtensionCheckName(v1, v2 *Extension) bool { 4867 return v1.Annotations.Name == v2.Annotations.Name 4868 } 4869 4870 func ExtensionCheckNamePrefix(v1, v2 *Extension) bool { 4871 return strings.HasPrefix(v2.Annotations.Name, v1.Annotations.Name) 4872 } 4873 4874 func ExtensionCheckCustom(v1, v2 *Extension) bool { 4875 return checkCustom(v1.Annotations, v2.Annotations) 4876 } 4877 4878 func ExtensionCheckCustomPrefix(v1, v2 *Extension) bool { 4879 return checkCustomPrefix(v1.Annotations, v2.Annotations) 4880 } 4881 4882 func ConvertExtensionWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) { 4883 var ( 4884 m Extension 4885 checkFuncs []ExtensionCheckFunc 4886 ) 4887 4888 for _, filter := range filters { 4889 switch v := filter.By.(type) { 4890 case *SelectBy_ID: 4891 if m.ID != "" { 4892 return nil, errConflictingFilters 4893 } 4894 m.ID = v.ID 4895 checkFuncs = append(checkFuncs, ExtensionCheckID) 4896 case *SelectBy_IDPrefix: 4897 if m.ID != "" { 4898 return nil, errConflictingFilters 4899 } 4900 m.ID = v.IDPrefix 4901 checkFuncs = append(checkFuncs, ExtensionCheckIDPrefix) 4902 case *SelectBy_Name: 4903 if m.Annotations.Name != "" { 4904 return nil, errConflictingFilters 4905 } 4906 m.Annotations.Name = v.Name 4907 checkFuncs = append(checkFuncs, ExtensionCheckName) 4908 case *SelectBy_NamePrefix: 4909 if m.Annotations.Name != "" { 4910 return nil, errConflictingFilters 4911 } 4912 m.Annotations.Name = v.NamePrefix 4913 checkFuncs = append(checkFuncs, ExtensionCheckNamePrefix) 4914 case *SelectBy_Custom: 4915 if len(m.Annotations.Indices) != 0 { 4916 return nil, errConflictingFilters 4917 } 4918 m.Annotations.Indices = []IndexEntry{{Key: v.Custom.Index, Val: v.Custom.Value}} 4919 checkFuncs = append(checkFuncs, ExtensionCheckCustom) 4920 case *SelectBy_CustomPrefix: 4921 if len(m.Annotations.Indices) != 0 { 4922 return nil, errConflictingFilters 4923 } 4924 m.Annotations.Indices = []IndexEntry{{Key: v.CustomPrefix.Index, Val: v.CustomPrefix.Value}} 4925 checkFuncs = append(checkFuncs, ExtensionCheckCustomPrefix) 4926 } 4927 } 4928 var events []Event 4929 if (action & WatchActionKindCreate) != 0 { 4930 events = append(events, EventCreateExtension{Extension: &m, Checks: checkFuncs}) 4931 } 4932 if (action & WatchActionKindUpdate) != 0 { 4933 events = append(events, EventUpdateExtension{Extension: &m, Checks: checkFuncs}) 4934 } 4935 if (action & WatchActionKindRemove) != 0 { 4936 events = append(events, EventDeleteExtension{Extension: &m, Checks: checkFuncs}) 4937 } 4938 if len(events) == 0 { 4939 return nil, errUnrecognizedAction 4940 } 4941 return events, nil 4942 } 4943 4944 type ExtensionIndexerByID struct{} 4945 4946 func (indexer ExtensionIndexerByID) FromArgs(args ...interface{}) ([]byte, error) { 4947 return fromArgs(args...) 4948 } 4949 func (indexer ExtensionIndexerByID) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4950 return prefixFromArgs(args...) 4951 } 4952 func (indexer ExtensionIndexerByID) FromObject(obj interface{}) (bool, []byte, error) { 4953 m := obj.(*Extension) 4954 return true, []byte(m.ID + "\x00"), nil 4955 } 4956 4957 type ExtensionIndexerByName struct{} 4958 4959 func (indexer ExtensionIndexerByName) FromArgs(args ...interface{}) ([]byte, error) { 4960 return fromArgs(args...) 4961 } 4962 func (indexer ExtensionIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4963 return prefixFromArgs(args...) 4964 } 4965 func (indexer ExtensionIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { 4966 m := obj.(*Extension) 4967 val := m.Annotations.Name 4968 return true, []byte(strings.ToLower(val) + "\x00"), nil 4969 } 4970 4971 type ExtensionCustomIndexer struct{} 4972 4973 func (indexer ExtensionCustomIndexer) FromArgs(args ...interface{}) ([]byte, error) { 4974 return fromArgs(args...) 4975 } 4976 func (indexer ExtensionCustomIndexer) PrefixFromArgs(args ...interface{}) ([]byte, error) { 4977 return prefixFromArgs(args...) 4978 } 4979 func (indexer ExtensionCustomIndexer) FromObject(obj interface{}) (bool, [][]byte, error) { 4980 m := obj.(*Extension) 4981 return customIndexer("", &m.Annotations) 4982 } 4983 func NewStoreAction(c Event) (StoreAction, error) { 4984 var sa StoreAction 4985 switch v := c.(type) { 4986 case EventCreateNode: 4987 sa.Action = StoreActionKindCreate 4988 sa.Target = &StoreAction_Node{Node: v.Node} 4989 case EventUpdateNode: 4990 sa.Action = StoreActionKindUpdate 4991 sa.Target = &StoreAction_Node{Node: v.Node} 4992 case EventDeleteNode: 4993 sa.Action = StoreActionKindRemove 4994 sa.Target = &StoreAction_Node{Node: v.Node} 4995 case EventCreateService: 4996 sa.Action = StoreActionKindCreate 4997 sa.Target = &StoreAction_Service{Service: v.Service} 4998 case EventUpdateService: 4999 sa.Action = StoreActionKindUpdate 5000 sa.Target = &StoreAction_Service{Service: v.Service} 5001 case EventDeleteService: 5002 sa.Action = StoreActionKindRemove 5003 sa.Target = &StoreAction_Service{Service: v.Service} 5004 case EventCreateTask: 5005 sa.Action = StoreActionKindCreate 5006 sa.Target = &StoreAction_Task{Task: v.Task} 5007 case EventUpdateTask: 5008 sa.Action = StoreActionKindUpdate 5009 sa.Target = &StoreAction_Task{Task: v.Task} 5010 case EventDeleteTask: 5011 sa.Action = StoreActionKindRemove 5012 sa.Target = &StoreAction_Task{Task: v.Task} 5013 case EventCreateNetwork: 5014 sa.Action = StoreActionKindCreate 5015 sa.Target = &StoreAction_Network{Network: v.Network} 5016 case EventUpdateNetwork: 5017 sa.Action = StoreActionKindUpdate 5018 sa.Target = &StoreAction_Network{Network: v.Network} 5019 case EventDeleteNetwork: 5020 sa.Action = StoreActionKindRemove 5021 sa.Target = &StoreAction_Network{Network: v.Network} 5022 case EventCreateCluster: 5023 sa.Action = StoreActionKindCreate 5024 sa.Target = &StoreAction_Cluster{Cluster: v.Cluster} 5025 case EventUpdateCluster: 5026 sa.Action = StoreActionKindUpdate 5027 sa.Target = &StoreAction_Cluster{Cluster: v.Cluster} 5028 case EventDeleteCluster: 5029 sa.Action = StoreActionKindRemove 5030 sa.Target = &StoreAction_Cluster{Cluster: v.Cluster} 5031 case EventCreateSecret: 5032 sa.Action = StoreActionKindCreate 5033 sa.Target = &StoreAction_Secret{Secret: v.Secret} 5034 case EventUpdateSecret: 5035 sa.Action = StoreActionKindUpdate 5036 sa.Target = &StoreAction_Secret{Secret: v.Secret} 5037 case EventDeleteSecret: 5038 sa.Action = StoreActionKindRemove 5039 sa.Target = &StoreAction_Secret{Secret: v.Secret} 5040 case EventCreateConfig: 5041 sa.Action = StoreActionKindCreate 5042 sa.Target = &StoreAction_Config{Config: v.Config} 5043 case EventUpdateConfig: 5044 sa.Action = StoreActionKindUpdate 5045 sa.Target = &StoreAction_Config{Config: v.Config} 5046 case EventDeleteConfig: 5047 sa.Action = StoreActionKindRemove 5048 sa.Target = &StoreAction_Config{Config: v.Config} 5049 case EventCreateResource: 5050 sa.Action = StoreActionKindCreate 5051 sa.Target = &StoreAction_Resource{Resource: v.Resource} 5052 case EventUpdateResource: 5053 sa.Action = StoreActionKindUpdate 5054 sa.Target = &StoreAction_Resource{Resource: v.Resource} 5055 case EventDeleteResource: 5056 sa.Action = StoreActionKindRemove 5057 sa.Target = &StoreAction_Resource{Resource: v.Resource} 5058 case EventCreateExtension: 5059 sa.Action = StoreActionKindCreate 5060 sa.Target = &StoreAction_Extension{Extension: v.Extension} 5061 case EventUpdateExtension: 5062 sa.Action = StoreActionKindUpdate 5063 sa.Target = &StoreAction_Extension{Extension: v.Extension} 5064 case EventDeleteExtension: 5065 sa.Action = StoreActionKindRemove 5066 sa.Target = &StoreAction_Extension{Extension: v.Extension} 5067 default: 5068 return StoreAction{}, errUnknownStoreAction 5069 } 5070 return sa, nil 5071 } 5072 5073 func EventFromStoreAction(sa StoreAction, oldObject StoreObject) (Event, error) { 5074 switch v := sa.Target.(type) { 5075 case *StoreAction_Node: 5076 switch sa.Action { 5077 case StoreActionKindCreate: 5078 return EventCreateNode{Node: v.Node}, nil 5079 case StoreActionKindUpdate: 5080 if oldObject != nil { 5081 return EventUpdateNode{Node: v.Node, OldNode: oldObject.(*Node)}, nil 5082 } else { 5083 return EventUpdateNode{Node: v.Node}, nil 5084 } 5085 case StoreActionKindRemove: 5086 return EventDeleteNode{Node: v.Node}, nil 5087 } 5088 case *StoreAction_Service: 5089 switch sa.Action { 5090 case StoreActionKindCreate: 5091 return EventCreateService{Service: v.Service}, nil 5092 case StoreActionKindUpdate: 5093 if oldObject != nil { 5094 return EventUpdateService{Service: v.Service, OldService: oldObject.(*Service)}, nil 5095 } else { 5096 return EventUpdateService{Service: v.Service}, nil 5097 } 5098 case StoreActionKindRemove: 5099 return EventDeleteService{Service: v.Service}, nil 5100 } 5101 case *StoreAction_Task: 5102 switch sa.Action { 5103 case StoreActionKindCreate: 5104 return EventCreateTask{Task: v.Task}, nil 5105 case StoreActionKindUpdate: 5106 if oldObject != nil { 5107 return EventUpdateTask{Task: v.Task, OldTask: oldObject.(*Task)}, nil 5108 } else { 5109 return EventUpdateTask{Task: v.Task}, nil 5110 } 5111 case StoreActionKindRemove: 5112 return EventDeleteTask{Task: v.Task}, nil 5113 } 5114 case *StoreAction_Network: 5115 switch sa.Action { 5116 case StoreActionKindCreate: 5117 return EventCreateNetwork{Network: v.Network}, nil 5118 case StoreActionKindUpdate: 5119 if oldObject != nil { 5120 return EventUpdateNetwork{Network: v.Network, OldNetwork: oldObject.(*Network)}, nil 5121 } else { 5122 return EventUpdateNetwork{Network: v.Network}, nil 5123 } 5124 case StoreActionKindRemove: 5125 return EventDeleteNetwork{Network: v.Network}, nil 5126 } 5127 case *StoreAction_Cluster: 5128 switch sa.Action { 5129 case StoreActionKindCreate: 5130 return EventCreateCluster{Cluster: v.Cluster}, nil 5131 case StoreActionKindUpdate: 5132 if oldObject != nil { 5133 return EventUpdateCluster{Cluster: v.Cluster, OldCluster: oldObject.(*Cluster)}, nil 5134 } else { 5135 return EventUpdateCluster{Cluster: v.Cluster}, nil 5136 } 5137 case StoreActionKindRemove: 5138 return EventDeleteCluster{Cluster: v.Cluster}, nil 5139 } 5140 case *StoreAction_Secret: 5141 switch sa.Action { 5142 case StoreActionKindCreate: 5143 return EventCreateSecret{Secret: v.Secret}, nil 5144 case StoreActionKindUpdate: 5145 if oldObject != nil { 5146 return EventUpdateSecret{Secret: v.Secret, OldSecret: oldObject.(*Secret)}, nil 5147 } else { 5148 return EventUpdateSecret{Secret: v.Secret}, nil 5149 } 5150 case StoreActionKindRemove: 5151 return EventDeleteSecret{Secret: v.Secret}, nil 5152 } 5153 case *StoreAction_Config: 5154 switch sa.Action { 5155 case StoreActionKindCreate: 5156 return EventCreateConfig{Config: v.Config}, nil 5157 case StoreActionKindUpdate: 5158 if oldObject != nil { 5159 return EventUpdateConfig{Config: v.Config, OldConfig: oldObject.(*Config)}, nil 5160 } else { 5161 return EventUpdateConfig{Config: v.Config}, nil 5162 } 5163 case StoreActionKindRemove: 5164 return EventDeleteConfig{Config: v.Config}, nil 5165 } 5166 case *StoreAction_Resource: 5167 switch sa.Action { 5168 case StoreActionKindCreate: 5169 return EventCreateResource{Resource: v.Resource}, nil 5170 case StoreActionKindUpdate: 5171 if oldObject != nil { 5172 return EventUpdateResource{Resource: v.Resource, OldResource: oldObject.(*Resource)}, nil 5173 } else { 5174 return EventUpdateResource{Resource: v.Resource}, nil 5175 } 5176 case StoreActionKindRemove: 5177 return EventDeleteResource{Resource: v.Resource}, nil 5178 } 5179 case *StoreAction_Extension: 5180 switch sa.Action { 5181 case StoreActionKindCreate: 5182 return EventCreateExtension{Extension: v.Extension}, nil 5183 case StoreActionKindUpdate: 5184 if oldObject != nil { 5185 return EventUpdateExtension{Extension: v.Extension, OldExtension: oldObject.(*Extension)}, nil 5186 } else { 5187 return EventUpdateExtension{Extension: v.Extension}, nil 5188 } 5189 case StoreActionKindRemove: 5190 return EventDeleteExtension{Extension: v.Extension}, nil 5191 } 5192 } 5193 return nil, errUnknownStoreAction 5194 } 5195 5196 func WatchMessageEvent(c Event) *WatchMessage_Event { 5197 switch v := c.(type) { 5198 case EventCreateNode: 5199 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Node{Node: v.Node}}} 5200 case EventUpdateNode: 5201 if v.OldNode != nil { 5202 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Node{Node: v.Node}}, OldObject: &Object{Object: &Object_Node{Node: v.OldNode}}} 5203 } else { 5204 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Node{Node: v.Node}}} 5205 } 5206 case EventDeleteNode: 5207 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Node{Node: v.Node}}} 5208 case EventCreateService: 5209 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Service{Service: v.Service}}} 5210 case EventUpdateService: 5211 if v.OldService != nil { 5212 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Service{Service: v.Service}}, OldObject: &Object{Object: &Object_Service{Service: v.OldService}}} 5213 } else { 5214 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Service{Service: v.Service}}} 5215 } 5216 case EventDeleteService: 5217 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Service{Service: v.Service}}} 5218 case EventCreateTask: 5219 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Task{Task: v.Task}}} 5220 case EventUpdateTask: 5221 if v.OldTask != nil { 5222 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Task{Task: v.Task}}, OldObject: &Object{Object: &Object_Task{Task: v.OldTask}}} 5223 } else { 5224 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Task{Task: v.Task}}} 5225 } 5226 case EventDeleteTask: 5227 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Task{Task: v.Task}}} 5228 case EventCreateNetwork: 5229 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Network{Network: v.Network}}} 5230 case EventUpdateNetwork: 5231 if v.OldNetwork != nil { 5232 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Network{Network: v.Network}}, OldObject: &Object{Object: &Object_Network{Network: v.OldNetwork}}} 5233 } else { 5234 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Network{Network: v.Network}}} 5235 } 5236 case EventDeleteNetwork: 5237 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Network{Network: v.Network}}} 5238 case EventCreateCluster: 5239 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}} 5240 case EventUpdateCluster: 5241 if v.OldCluster != nil { 5242 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}, OldObject: &Object{Object: &Object_Cluster{Cluster: v.OldCluster}}} 5243 } else { 5244 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}} 5245 } 5246 case EventDeleteCluster: 5247 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}} 5248 case EventCreateSecret: 5249 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}} 5250 case EventUpdateSecret: 5251 if v.OldSecret != nil { 5252 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}, OldObject: &Object{Object: &Object_Secret{Secret: v.OldSecret}}} 5253 } else { 5254 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}} 5255 } 5256 case EventDeleteSecret: 5257 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}} 5258 case EventCreateConfig: 5259 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Config{Config: v.Config}}} 5260 case EventUpdateConfig: 5261 if v.OldConfig != nil { 5262 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Config{Config: v.Config}}, OldObject: &Object{Object: &Object_Config{Config: v.OldConfig}}} 5263 } else { 5264 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Config{Config: v.Config}}} 5265 } 5266 case EventDeleteConfig: 5267 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Config{Config: v.Config}}} 5268 case EventCreateResource: 5269 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}} 5270 case EventUpdateResource: 5271 if v.OldResource != nil { 5272 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}, OldObject: &Object{Object: &Object_Resource{Resource: v.OldResource}}} 5273 } else { 5274 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}} 5275 } 5276 case EventDeleteResource: 5277 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}} 5278 case EventCreateExtension: 5279 return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}} 5280 case EventUpdateExtension: 5281 if v.OldExtension != nil { 5282 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}, OldObject: &Object{Object: &Object_Extension{Extension: v.OldExtension}}} 5283 } else { 5284 return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}} 5285 } 5286 case EventDeleteExtension: 5287 return &WatchMessage_Event{Action: WatchActionKindRemove, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}} 5288 } 5289 return nil 5290 } 5291 5292 func ConvertWatchArgs(entries []*WatchRequest_WatchEntry) ([]Event, error) { 5293 var events []Event 5294 for _, entry := range entries { 5295 var newEvents []Event 5296 var err error 5297 switch entry.Kind { 5298 case "": 5299 return nil, errNoKindSpecified 5300 case "node": 5301 newEvents, err = ConvertNodeWatch(entry.Action, entry.Filters) 5302 case "service": 5303 newEvents, err = ConvertServiceWatch(entry.Action, entry.Filters) 5304 case "task": 5305 newEvents, err = ConvertTaskWatch(entry.Action, entry.Filters) 5306 case "network": 5307 newEvents, err = ConvertNetworkWatch(entry.Action, entry.Filters) 5308 case "cluster": 5309 newEvents, err = ConvertClusterWatch(entry.Action, entry.Filters) 5310 case "secret": 5311 newEvents, err = ConvertSecretWatch(entry.Action, entry.Filters) 5312 case "config": 5313 newEvents, err = ConvertConfigWatch(entry.Action, entry.Filters) 5314 default: 5315 newEvents, err = ConvertResourceWatch(entry.Action, entry.Filters, entry.Kind) 5316 case "extension": 5317 newEvents, err = ConvertExtensionWatch(entry.Action, entry.Filters) 5318 } 5319 if err != nil { 5320 return nil, err 5321 } 5322 events = append(events, newEvents...) 5323 } 5324 return events, nil 5325 } 5326 5327 func (this *Meta) String() string { 5328 if this == nil { 5329 return "nil" 5330 } 5331 s := strings.Join([]string{`&Meta{`, 5332 `Version:` + strings.Replace(strings.Replace(this.Version.String(), "Version", "Version", 1), `&`, ``, 1) + `,`, 5333 `CreatedAt:` + strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1) + `,`, 5334 `UpdatedAt:` + strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1) + `,`, 5335 `}`, 5336 }, "") 5337 return s 5338 } 5339 func (this *Node) String() string { 5340 if this == nil { 5341 return "nil" 5342 } 5343 s := strings.Join([]string{`&Node{`, 5344 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5345 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5346 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NodeSpec", "NodeSpec", 1), `&`, ``, 1) + `,`, 5347 `Description:` + strings.Replace(fmt.Sprintf("%v", this.Description), "NodeDescription", "NodeDescription", 1) + `,`, 5348 `Status:` + strings.Replace(strings.Replace(this.Status.String(), "NodeStatus", "NodeStatus", 1), `&`, ``, 1) + `,`, 5349 `ManagerStatus:` + strings.Replace(fmt.Sprintf("%v", this.ManagerStatus), "ManagerStatus", "ManagerStatus", 1) + `,`, 5350 `Attachment:` + strings.Replace(fmt.Sprintf("%v", this.Attachment), "NetworkAttachment", "NetworkAttachment", 1) + `,`, 5351 `Certificate:` + strings.Replace(strings.Replace(this.Certificate.String(), "Certificate", "Certificate", 1), `&`, ``, 1) + `,`, 5352 `Role:` + fmt.Sprintf("%v", this.Role) + `,`, 5353 `Attachments:` + strings.Replace(fmt.Sprintf("%v", this.Attachments), "NetworkAttachment", "NetworkAttachment", 1) + `,`, 5354 `VXLANUDPPort:` + fmt.Sprintf("%v", this.VXLANUDPPort) + `,`, 5355 `}`, 5356 }, "") 5357 return s 5358 } 5359 func (this *Service) String() string { 5360 if this == nil { 5361 return "nil" 5362 } 5363 s := strings.Join([]string{`&Service{`, 5364 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5365 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5366 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ServiceSpec", "ServiceSpec", 1), `&`, ``, 1) + `,`, 5367 `Endpoint:` + strings.Replace(fmt.Sprintf("%v", this.Endpoint), "Endpoint", "Endpoint", 1) + `,`, 5368 `UpdateStatus:` + strings.Replace(fmt.Sprintf("%v", this.UpdateStatus), "UpdateStatus", "UpdateStatus", 1) + `,`, 5369 `PreviousSpec:` + strings.Replace(fmt.Sprintf("%v", this.PreviousSpec), "ServiceSpec", "ServiceSpec", 1) + `,`, 5370 `PendingDelete:` + fmt.Sprintf("%v", this.PendingDelete) + `,`, 5371 `SpecVersion:` + strings.Replace(fmt.Sprintf("%v", this.SpecVersion), "Version", "Version", 1) + `,`, 5372 `PreviousSpecVersion:` + strings.Replace(fmt.Sprintf("%v", this.PreviousSpecVersion), "Version", "Version", 1) + `,`, 5373 `JobStatus:` + strings.Replace(fmt.Sprintf("%v", this.JobStatus), "JobStatus", "JobStatus", 1) + `,`, 5374 `}`, 5375 }, "") 5376 return s 5377 } 5378 func (this *Endpoint) String() string { 5379 if this == nil { 5380 return "nil" 5381 } 5382 s := strings.Join([]string{`&Endpoint{`, 5383 `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "EndpointSpec", "EndpointSpec", 1) + `,`, 5384 `Ports:` + strings.Replace(fmt.Sprintf("%v", this.Ports), "PortConfig", "PortConfig", 1) + `,`, 5385 `VirtualIPs:` + strings.Replace(fmt.Sprintf("%v", this.VirtualIPs), "Endpoint_VirtualIP", "Endpoint_VirtualIP", 1) + `,`, 5386 `}`, 5387 }, "") 5388 return s 5389 } 5390 func (this *Endpoint_VirtualIP) String() string { 5391 if this == nil { 5392 return "nil" 5393 } 5394 s := strings.Join([]string{`&Endpoint_VirtualIP{`, 5395 `NetworkID:` + fmt.Sprintf("%v", this.NetworkID) + `,`, 5396 `Addr:` + fmt.Sprintf("%v", this.Addr) + `,`, 5397 `}`, 5398 }, "") 5399 return s 5400 } 5401 func (this *Task) String() string { 5402 if this == nil { 5403 return "nil" 5404 } 5405 s := strings.Join([]string{`&Task{`, 5406 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5407 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5408 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "TaskSpec", "TaskSpec", 1), `&`, ``, 1) + `,`, 5409 `ServiceID:` + fmt.Sprintf("%v", this.ServiceID) + `,`, 5410 `Slot:` + fmt.Sprintf("%v", this.Slot) + `,`, 5411 `NodeID:` + fmt.Sprintf("%v", this.NodeID) + `,`, 5412 `Annotations:` + strings.Replace(strings.Replace(this.Annotations.String(), "Annotations", "Annotations", 1), `&`, ``, 1) + `,`, 5413 `ServiceAnnotations:` + strings.Replace(strings.Replace(this.ServiceAnnotations.String(), "Annotations", "Annotations", 1), `&`, ``, 1) + `,`, 5414 `Status:` + strings.Replace(strings.Replace(this.Status.String(), "TaskStatus", "TaskStatus", 1), `&`, ``, 1) + `,`, 5415 `DesiredState:` + fmt.Sprintf("%v", this.DesiredState) + `,`, 5416 `Networks:` + strings.Replace(fmt.Sprintf("%v", this.Networks), "NetworkAttachment", "NetworkAttachment", 1) + `,`, 5417 `Endpoint:` + strings.Replace(fmt.Sprintf("%v", this.Endpoint), "Endpoint", "Endpoint", 1) + `,`, 5418 `LogDriver:` + strings.Replace(fmt.Sprintf("%v", this.LogDriver), "Driver", "Driver", 1) + `,`, 5419 `SpecVersion:` + strings.Replace(fmt.Sprintf("%v", this.SpecVersion), "Version", "Version", 1) + `,`, 5420 `AssignedGenericResources:` + strings.Replace(fmt.Sprintf("%v", this.AssignedGenericResources), "GenericResource", "GenericResource", 1) + `,`, 5421 `JobIteration:` + strings.Replace(fmt.Sprintf("%v", this.JobIteration), "Version", "Version", 1) + `,`, 5422 `}`, 5423 }, "") 5424 return s 5425 } 5426 func (this *NetworkAttachment) String() string { 5427 if this == nil { 5428 return "nil" 5429 } 5430 keysForDriverAttachmentOpts := make([]string, 0, len(this.DriverAttachmentOpts)) 5431 for k, _ := range this.DriverAttachmentOpts { 5432 keysForDriverAttachmentOpts = append(keysForDriverAttachmentOpts, k) 5433 } 5434 github_com_gogo_protobuf_sortkeys.Strings(keysForDriverAttachmentOpts) 5435 mapStringForDriverAttachmentOpts := "map[string]string{" 5436 for _, k := range keysForDriverAttachmentOpts { 5437 mapStringForDriverAttachmentOpts += fmt.Sprintf("%v: %v,", k, this.DriverAttachmentOpts[k]) 5438 } 5439 mapStringForDriverAttachmentOpts += "}" 5440 s := strings.Join([]string{`&NetworkAttachment{`, 5441 `Network:` + strings.Replace(fmt.Sprintf("%v", this.Network), "Network", "Network", 1) + `,`, 5442 `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, 5443 `Aliases:` + fmt.Sprintf("%v", this.Aliases) + `,`, 5444 `DriverAttachmentOpts:` + mapStringForDriverAttachmentOpts + `,`, 5445 `}`, 5446 }, "") 5447 return s 5448 } 5449 func (this *Network) String() string { 5450 if this == nil { 5451 return "nil" 5452 } 5453 s := strings.Join([]string{`&Network{`, 5454 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5455 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5456 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "NetworkSpec", "NetworkSpec", 1), `&`, ``, 1) + `,`, 5457 `DriverState:` + strings.Replace(fmt.Sprintf("%v", this.DriverState), "Driver", "Driver", 1) + `,`, 5458 `IPAM:` + strings.Replace(fmt.Sprintf("%v", this.IPAM), "IPAMOptions", "IPAMOptions", 1) + `,`, 5459 `PendingDelete:` + fmt.Sprintf("%v", this.PendingDelete) + `,`, 5460 `}`, 5461 }, "") 5462 return s 5463 } 5464 func (this *Cluster) String() string { 5465 if this == nil { 5466 return "nil" 5467 } 5468 keysForBlacklistedCertificates := make([]string, 0, len(this.BlacklistedCertificates)) 5469 for k, _ := range this.BlacklistedCertificates { 5470 keysForBlacklistedCertificates = append(keysForBlacklistedCertificates, k) 5471 } 5472 github_com_gogo_protobuf_sortkeys.Strings(keysForBlacklistedCertificates) 5473 mapStringForBlacklistedCertificates := "map[string]*BlacklistedCertificate{" 5474 for _, k := range keysForBlacklistedCertificates { 5475 mapStringForBlacklistedCertificates += fmt.Sprintf("%v: %v,", k, this.BlacklistedCertificates[k]) 5476 } 5477 mapStringForBlacklistedCertificates += "}" 5478 s := strings.Join([]string{`&Cluster{`, 5479 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5480 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5481 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterSpec", "ClusterSpec", 1), `&`, ``, 1) + `,`, 5482 `RootCA:` + strings.Replace(strings.Replace(this.RootCA.String(), "RootCA", "RootCA", 1), `&`, ``, 1) + `,`, 5483 `NetworkBootstrapKeys:` + strings.Replace(fmt.Sprintf("%v", this.NetworkBootstrapKeys), "EncryptionKey", "EncryptionKey", 1) + `,`, 5484 `EncryptionKeyLamportClock:` + fmt.Sprintf("%v", this.EncryptionKeyLamportClock) + `,`, 5485 `BlacklistedCertificates:` + mapStringForBlacklistedCertificates + `,`, 5486 `UnlockKeys:` + strings.Replace(fmt.Sprintf("%v", this.UnlockKeys), "EncryptionKey", "EncryptionKey", 1) + `,`, 5487 `FIPS:` + fmt.Sprintf("%v", this.FIPS) + `,`, 5488 `DefaultAddressPool:` + fmt.Sprintf("%v", this.DefaultAddressPool) + `,`, 5489 `SubnetSize:` + fmt.Sprintf("%v", this.SubnetSize) + `,`, 5490 `VXLANUDPPort:` + fmt.Sprintf("%v", this.VXLANUDPPort) + `,`, 5491 `}`, 5492 }, "") 5493 return s 5494 } 5495 func (this *Secret) String() string { 5496 if this == nil { 5497 return "nil" 5498 } 5499 s := strings.Join([]string{`&Secret{`, 5500 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5501 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5502 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "SecretSpec", "SecretSpec", 1), `&`, ``, 1) + `,`, 5503 `Internal:` + fmt.Sprintf("%v", this.Internal) + `,`, 5504 `}`, 5505 }, "") 5506 return s 5507 } 5508 func (this *Config) String() string { 5509 if this == nil { 5510 return "nil" 5511 } 5512 s := strings.Join([]string{`&Config{`, 5513 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5514 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5515 `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ConfigSpec", "ConfigSpec", 1), `&`, ``, 1) + `,`, 5516 `}`, 5517 }, "") 5518 return s 5519 } 5520 func (this *Resource) String() string { 5521 if this == nil { 5522 return "nil" 5523 } 5524 s := strings.Join([]string{`&Resource{`, 5525 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5526 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5527 `Annotations:` + strings.Replace(strings.Replace(this.Annotations.String(), "Annotations", "Annotations", 1), `&`, ``, 1) + `,`, 5528 `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, 5529 `Payload:` + strings.Replace(fmt.Sprintf("%v", this.Payload), "Any", "types.Any", 1) + `,`, 5530 `}`, 5531 }, "") 5532 return s 5533 } 5534 func (this *Extension) String() string { 5535 if this == nil { 5536 return "nil" 5537 } 5538 s := strings.Join([]string{`&Extension{`, 5539 `ID:` + fmt.Sprintf("%v", this.ID) + `,`, 5540 `Meta:` + strings.Replace(strings.Replace(this.Meta.String(), "Meta", "Meta", 1), `&`, ``, 1) + `,`, 5541 `Annotations:` + strings.Replace(strings.Replace(this.Annotations.String(), "Annotations", "Annotations", 1), `&`, ``, 1) + `,`, 5542 `Description:` + fmt.Sprintf("%v", this.Description) + `,`, 5543 `}`, 5544 }, "") 5545 return s 5546 } 5547 func valueToStringObjects(v interface{}) string { 5548 rv := reflect.ValueOf(v) 5549 if rv.IsNil() { 5550 return "nil" 5551 } 5552 pv := reflect.Indirect(rv).Interface() 5553 return fmt.Sprintf("*%v", pv) 5554 } 5555 func (m *Meta) Unmarshal(dAtA []byte) error { 5556 l := len(dAtA) 5557 iNdEx := 0 5558 for iNdEx < l { 5559 preIndex := iNdEx 5560 var wire uint64 5561 for shift := uint(0); ; shift += 7 { 5562 if shift >= 64 { 5563 return ErrIntOverflowObjects 5564 } 5565 if iNdEx >= l { 5566 return io.ErrUnexpectedEOF 5567 } 5568 b := dAtA[iNdEx] 5569 iNdEx++ 5570 wire |= uint64(b&0x7F) << shift 5571 if b < 0x80 { 5572 break 5573 } 5574 } 5575 fieldNum := int32(wire >> 3) 5576 wireType := int(wire & 0x7) 5577 if wireType == 4 { 5578 return fmt.Errorf("proto: Meta: wiretype end group for non-group") 5579 } 5580 if fieldNum <= 0 { 5581 return fmt.Errorf("proto: Meta: illegal tag %d (wire type %d)", fieldNum, wire) 5582 } 5583 switch fieldNum { 5584 case 1: 5585 if wireType != 2 { 5586 return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) 5587 } 5588 var msglen int 5589 for shift := uint(0); ; shift += 7 { 5590 if shift >= 64 { 5591 return ErrIntOverflowObjects 5592 } 5593 if iNdEx >= l { 5594 return io.ErrUnexpectedEOF 5595 } 5596 b := dAtA[iNdEx] 5597 iNdEx++ 5598 msglen |= int(b&0x7F) << shift 5599 if b < 0x80 { 5600 break 5601 } 5602 } 5603 if msglen < 0 { 5604 return ErrInvalidLengthObjects 5605 } 5606 postIndex := iNdEx + msglen 5607 if postIndex < 0 { 5608 return ErrInvalidLengthObjects 5609 } 5610 if postIndex > l { 5611 return io.ErrUnexpectedEOF 5612 } 5613 if err := m.Version.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5614 return err 5615 } 5616 iNdEx = postIndex 5617 case 2: 5618 if wireType != 2 { 5619 return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) 5620 } 5621 var msglen int 5622 for shift := uint(0); ; shift += 7 { 5623 if shift >= 64 { 5624 return ErrIntOverflowObjects 5625 } 5626 if iNdEx >= l { 5627 return io.ErrUnexpectedEOF 5628 } 5629 b := dAtA[iNdEx] 5630 iNdEx++ 5631 msglen |= int(b&0x7F) << shift 5632 if b < 0x80 { 5633 break 5634 } 5635 } 5636 if msglen < 0 { 5637 return ErrInvalidLengthObjects 5638 } 5639 postIndex := iNdEx + msglen 5640 if postIndex < 0 { 5641 return ErrInvalidLengthObjects 5642 } 5643 if postIndex > l { 5644 return io.ErrUnexpectedEOF 5645 } 5646 if m.CreatedAt == nil { 5647 m.CreatedAt = &types.Timestamp{} 5648 } 5649 if err := m.CreatedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5650 return err 5651 } 5652 iNdEx = postIndex 5653 case 3: 5654 if wireType != 2 { 5655 return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", wireType) 5656 } 5657 var msglen int 5658 for shift := uint(0); ; shift += 7 { 5659 if shift >= 64 { 5660 return ErrIntOverflowObjects 5661 } 5662 if iNdEx >= l { 5663 return io.ErrUnexpectedEOF 5664 } 5665 b := dAtA[iNdEx] 5666 iNdEx++ 5667 msglen |= int(b&0x7F) << shift 5668 if b < 0x80 { 5669 break 5670 } 5671 } 5672 if msglen < 0 { 5673 return ErrInvalidLengthObjects 5674 } 5675 postIndex := iNdEx + msglen 5676 if postIndex < 0 { 5677 return ErrInvalidLengthObjects 5678 } 5679 if postIndex > l { 5680 return io.ErrUnexpectedEOF 5681 } 5682 if m.UpdatedAt == nil { 5683 m.UpdatedAt = &types.Timestamp{} 5684 } 5685 if err := m.UpdatedAt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5686 return err 5687 } 5688 iNdEx = postIndex 5689 default: 5690 iNdEx = preIndex 5691 skippy, err := skipObjects(dAtA[iNdEx:]) 5692 if err != nil { 5693 return err 5694 } 5695 if skippy < 0 { 5696 return ErrInvalidLengthObjects 5697 } 5698 if (iNdEx + skippy) < 0 { 5699 return ErrInvalidLengthObjects 5700 } 5701 if (iNdEx + skippy) > l { 5702 return io.ErrUnexpectedEOF 5703 } 5704 iNdEx += skippy 5705 } 5706 } 5707 5708 if iNdEx > l { 5709 return io.ErrUnexpectedEOF 5710 } 5711 return nil 5712 } 5713 func (m *Node) Unmarshal(dAtA []byte) error { 5714 l := len(dAtA) 5715 iNdEx := 0 5716 for iNdEx < l { 5717 preIndex := iNdEx 5718 var wire uint64 5719 for shift := uint(0); ; shift += 7 { 5720 if shift >= 64 { 5721 return ErrIntOverflowObjects 5722 } 5723 if iNdEx >= l { 5724 return io.ErrUnexpectedEOF 5725 } 5726 b := dAtA[iNdEx] 5727 iNdEx++ 5728 wire |= uint64(b&0x7F) << shift 5729 if b < 0x80 { 5730 break 5731 } 5732 } 5733 fieldNum := int32(wire >> 3) 5734 wireType := int(wire & 0x7) 5735 if wireType == 4 { 5736 return fmt.Errorf("proto: Node: wiretype end group for non-group") 5737 } 5738 if fieldNum <= 0 { 5739 return fmt.Errorf("proto: Node: illegal tag %d (wire type %d)", fieldNum, wire) 5740 } 5741 switch fieldNum { 5742 case 1: 5743 if wireType != 2 { 5744 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 5745 } 5746 var stringLen uint64 5747 for shift := uint(0); ; shift += 7 { 5748 if shift >= 64 { 5749 return ErrIntOverflowObjects 5750 } 5751 if iNdEx >= l { 5752 return io.ErrUnexpectedEOF 5753 } 5754 b := dAtA[iNdEx] 5755 iNdEx++ 5756 stringLen |= uint64(b&0x7F) << shift 5757 if b < 0x80 { 5758 break 5759 } 5760 } 5761 intStringLen := int(stringLen) 5762 if intStringLen < 0 { 5763 return ErrInvalidLengthObjects 5764 } 5765 postIndex := iNdEx + intStringLen 5766 if postIndex < 0 { 5767 return ErrInvalidLengthObjects 5768 } 5769 if postIndex > l { 5770 return io.ErrUnexpectedEOF 5771 } 5772 m.ID = string(dAtA[iNdEx:postIndex]) 5773 iNdEx = postIndex 5774 case 2: 5775 if wireType != 2 { 5776 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 5777 } 5778 var msglen int 5779 for shift := uint(0); ; shift += 7 { 5780 if shift >= 64 { 5781 return ErrIntOverflowObjects 5782 } 5783 if iNdEx >= l { 5784 return io.ErrUnexpectedEOF 5785 } 5786 b := dAtA[iNdEx] 5787 iNdEx++ 5788 msglen |= int(b&0x7F) << shift 5789 if b < 0x80 { 5790 break 5791 } 5792 } 5793 if msglen < 0 { 5794 return ErrInvalidLengthObjects 5795 } 5796 postIndex := iNdEx + msglen 5797 if postIndex < 0 { 5798 return ErrInvalidLengthObjects 5799 } 5800 if postIndex > l { 5801 return io.ErrUnexpectedEOF 5802 } 5803 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5804 return err 5805 } 5806 iNdEx = postIndex 5807 case 3: 5808 if wireType != 2 { 5809 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 5810 } 5811 var msglen int 5812 for shift := uint(0); ; shift += 7 { 5813 if shift >= 64 { 5814 return ErrIntOverflowObjects 5815 } 5816 if iNdEx >= l { 5817 return io.ErrUnexpectedEOF 5818 } 5819 b := dAtA[iNdEx] 5820 iNdEx++ 5821 msglen |= int(b&0x7F) << shift 5822 if b < 0x80 { 5823 break 5824 } 5825 } 5826 if msglen < 0 { 5827 return ErrInvalidLengthObjects 5828 } 5829 postIndex := iNdEx + msglen 5830 if postIndex < 0 { 5831 return ErrInvalidLengthObjects 5832 } 5833 if postIndex > l { 5834 return io.ErrUnexpectedEOF 5835 } 5836 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5837 return err 5838 } 5839 iNdEx = postIndex 5840 case 4: 5841 if wireType != 2 { 5842 return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) 5843 } 5844 var msglen int 5845 for shift := uint(0); ; shift += 7 { 5846 if shift >= 64 { 5847 return ErrIntOverflowObjects 5848 } 5849 if iNdEx >= l { 5850 return io.ErrUnexpectedEOF 5851 } 5852 b := dAtA[iNdEx] 5853 iNdEx++ 5854 msglen |= int(b&0x7F) << shift 5855 if b < 0x80 { 5856 break 5857 } 5858 } 5859 if msglen < 0 { 5860 return ErrInvalidLengthObjects 5861 } 5862 postIndex := iNdEx + msglen 5863 if postIndex < 0 { 5864 return ErrInvalidLengthObjects 5865 } 5866 if postIndex > l { 5867 return io.ErrUnexpectedEOF 5868 } 5869 if m.Description == nil { 5870 m.Description = &NodeDescription{} 5871 } 5872 if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5873 return err 5874 } 5875 iNdEx = postIndex 5876 case 5: 5877 if wireType != 2 { 5878 return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) 5879 } 5880 var msglen int 5881 for shift := uint(0); ; shift += 7 { 5882 if shift >= 64 { 5883 return ErrIntOverflowObjects 5884 } 5885 if iNdEx >= l { 5886 return io.ErrUnexpectedEOF 5887 } 5888 b := dAtA[iNdEx] 5889 iNdEx++ 5890 msglen |= int(b&0x7F) << shift 5891 if b < 0x80 { 5892 break 5893 } 5894 } 5895 if msglen < 0 { 5896 return ErrInvalidLengthObjects 5897 } 5898 postIndex := iNdEx + msglen 5899 if postIndex < 0 { 5900 return ErrInvalidLengthObjects 5901 } 5902 if postIndex > l { 5903 return io.ErrUnexpectedEOF 5904 } 5905 if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5906 return err 5907 } 5908 iNdEx = postIndex 5909 case 6: 5910 if wireType != 2 { 5911 return fmt.Errorf("proto: wrong wireType = %d for field ManagerStatus", wireType) 5912 } 5913 var msglen int 5914 for shift := uint(0); ; shift += 7 { 5915 if shift >= 64 { 5916 return ErrIntOverflowObjects 5917 } 5918 if iNdEx >= l { 5919 return io.ErrUnexpectedEOF 5920 } 5921 b := dAtA[iNdEx] 5922 iNdEx++ 5923 msglen |= int(b&0x7F) << shift 5924 if b < 0x80 { 5925 break 5926 } 5927 } 5928 if msglen < 0 { 5929 return ErrInvalidLengthObjects 5930 } 5931 postIndex := iNdEx + msglen 5932 if postIndex < 0 { 5933 return ErrInvalidLengthObjects 5934 } 5935 if postIndex > l { 5936 return io.ErrUnexpectedEOF 5937 } 5938 if m.ManagerStatus == nil { 5939 m.ManagerStatus = &ManagerStatus{} 5940 } 5941 if err := m.ManagerStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5942 return err 5943 } 5944 iNdEx = postIndex 5945 case 7: 5946 if wireType != 2 { 5947 return fmt.Errorf("proto: wrong wireType = %d for field Attachment", wireType) 5948 } 5949 var msglen int 5950 for shift := uint(0); ; shift += 7 { 5951 if shift >= 64 { 5952 return ErrIntOverflowObjects 5953 } 5954 if iNdEx >= l { 5955 return io.ErrUnexpectedEOF 5956 } 5957 b := dAtA[iNdEx] 5958 iNdEx++ 5959 msglen |= int(b&0x7F) << shift 5960 if b < 0x80 { 5961 break 5962 } 5963 } 5964 if msglen < 0 { 5965 return ErrInvalidLengthObjects 5966 } 5967 postIndex := iNdEx + msglen 5968 if postIndex < 0 { 5969 return ErrInvalidLengthObjects 5970 } 5971 if postIndex > l { 5972 return io.ErrUnexpectedEOF 5973 } 5974 if m.Attachment == nil { 5975 m.Attachment = &NetworkAttachment{} 5976 } 5977 if err := m.Attachment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 5978 return err 5979 } 5980 iNdEx = postIndex 5981 case 8: 5982 if wireType != 2 { 5983 return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) 5984 } 5985 var msglen int 5986 for shift := uint(0); ; shift += 7 { 5987 if shift >= 64 { 5988 return ErrIntOverflowObjects 5989 } 5990 if iNdEx >= l { 5991 return io.ErrUnexpectedEOF 5992 } 5993 b := dAtA[iNdEx] 5994 iNdEx++ 5995 msglen |= int(b&0x7F) << shift 5996 if b < 0x80 { 5997 break 5998 } 5999 } 6000 if msglen < 0 { 6001 return ErrInvalidLengthObjects 6002 } 6003 postIndex := iNdEx + msglen 6004 if postIndex < 0 { 6005 return ErrInvalidLengthObjects 6006 } 6007 if postIndex > l { 6008 return io.ErrUnexpectedEOF 6009 } 6010 if err := m.Certificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6011 return err 6012 } 6013 iNdEx = postIndex 6014 case 9: 6015 if wireType != 0 { 6016 return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) 6017 } 6018 m.Role = 0 6019 for shift := uint(0); ; shift += 7 { 6020 if shift >= 64 { 6021 return ErrIntOverflowObjects 6022 } 6023 if iNdEx >= l { 6024 return io.ErrUnexpectedEOF 6025 } 6026 b := dAtA[iNdEx] 6027 iNdEx++ 6028 m.Role |= NodeRole(b&0x7F) << shift 6029 if b < 0x80 { 6030 break 6031 } 6032 } 6033 case 10: 6034 if wireType != 2 { 6035 return fmt.Errorf("proto: wrong wireType = %d for field Attachments", wireType) 6036 } 6037 var msglen int 6038 for shift := uint(0); ; shift += 7 { 6039 if shift >= 64 { 6040 return ErrIntOverflowObjects 6041 } 6042 if iNdEx >= l { 6043 return io.ErrUnexpectedEOF 6044 } 6045 b := dAtA[iNdEx] 6046 iNdEx++ 6047 msglen |= int(b&0x7F) << shift 6048 if b < 0x80 { 6049 break 6050 } 6051 } 6052 if msglen < 0 { 6053 return ErrInvalidLengthObjects 6054 } 6055 postIndex := iNdEx + msglen 6056 if postIndex < 0 { 6057 return ErrInvalidLengthObjects 6058 } 6059 if postIndex > l { 6060 return io.ErrUnexpectedEOF 6061 } 6062 m.Attachments = append(m.Attachments, &NetworkAttachment{}) 6063 if err := m.Attachments[len(m.Attachments)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6064 return err 6065 } 6066 iNdEx = postIndex 6067 case 11: 6068 if wireType != 0 { 6069 return fmt.Errorf("proto: wrong wireType = %d for field VXLANUDPPort", wireType) 6070 } 6071 m.VXLANUDPPort = 0 6072 for shift := uint(0); ; shift += 7 { 6073 if shift >= 64 { 6074 return ErrIntOverflowObjects 6075 } 6076 if iNdEx >= l { 6077 return io.ErrUnexpectedEOF 6078 } 6079 b := dAtA[iNdEx] 6080 iNdEx++ 6081 m.VXLANUDPPort |= uint32(b&0x7F) << shift 6082 if b < 0x80 { 6083 break 6084 } 6085 } 6086 default: 6087 iNdEx = preIndex 6088 skippy, err := skipObjects(dAtA[iNdEx:]) 6089 if err != nil { 6090 return err 6091 } 6092 if skippy < 0 { 6093 return ErrInvalidLengthObjects 6094 } 6095 if (iNdEx + skippy) < 0 { 6096 return ErrInvalidLengthObjects 6097 } 6098 if (iNdEx + skippy) > l { 6099 return io.ErrUnexpectedEOF 6100 } 6101 iNdEx += skippy 6102 } 6103 } 6104 6105 if iNdEx > l { 6106 return io.ErrUnexpectedEOF 6107 } 6108 return nil 6109 } 6110 func (m *Service) Unmarshal(dAtA []byte) error { 6111 l := len(dAtA) 6112 iNdEx := 0 6113 for iNdEx < l { 6114 preIndex := iNdEx 6115 var wire uint64 6116 for shift := uint(0); ; shift += 7 { 6117 if shift >= 64 { 6118 return ErrIntOverflowObjects 6119 } 6120 if iNdEx >= l { 6121 return io.ErrUnexpectedEOF 6122 } 6123 b := dAtA[iNdEx] 6124 iNdEx++ 6125 wire |= uint64(b&0x7F) << shift 6126 if b < 0x80 { 6127 break 6128 } 6129 } 6130 fieldNum := int32(wire >> 3) 6131 wireType := int(wire & 0x7) 6132 if wireType == 4 { 6133 return fmt.Errorf("proto: Service: wiretype end group for non-group") 6134 } 6135 if fieldNum <= 0 { 6136 return fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire) 6137 } 6138 switch fieldNum { 6139 case 1: 6140 if wireType != 2 { 6141 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 6142 } 6143 var stringLen uint64 6144 for shift := uint(0); ; shift += 7 { 6145 if shift >= 64 { 6146 return ErrIntOverflowObjects 6147 } 6148 if iNdEx >= l { 6149 return io.ErrUnexpectedEOF 6150 } 6151 b := dAtA[iNdEx] 6152 iNdEx++ 6153 stringLen |= uint64(b&0x7F) << shift 6154 if b < 0x80 { 6155 break 6156 } 6157 } 6158 intStringLen := int(stringLen) 6159 if intStringLen < 0 { 6160 return ErrInvalidLengthObjects 6161 } 6162 postIndex := iNdEx + intStringLen 6163 if postIndex < 0 { 6164 return ErrInvalidLengthObjects 6165 } 6166 if postIndex > l { 6167 return io.ErrUnexpectedEOF 6168 } 6169 m.ID = string(dAtA[iNdEx:postIndex]) 6170 iNdEx = postIndex 6171 case 2: 6172 if wireType != 2 { 6173 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 6174 } 6175 var msglen int 6176 for shift := uint(0); ; shift += 7 { 6177 if shift >= 64 { 6178 return ErrIntOverflowObjects 6179 } 6180 if iNdEx >= l { 6181 return io.ErrUnexpectedEOF 6182 } 6183 b := dAtA[iNdEx] 6184 iNdEx++ 6185 msglen |= int(b&0x7F) << shift 6186 if b < 0x80 { 6187 break 6188 } 6189 } 6190 if msglen < 0 { 6191 return ErrInvalidLengthObjects 6192 } 6193 postIndex := iNdEx + msglen 6194 if postIndex < 0 { 6195 return ErrInvalidLengthObjects 6196 } 6197 if postIndex > l { 6198 return io.ErrUnexpectedEOF 6199 } 6200 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6201 return err 6202 } 6203 iNdEx = postIndex 6204 case 3: 6205 if wireType != 2 { 6206 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 6207 } 6208 var msglen int 6209 for shift := uint(0); ; shift += 7 { 6210 if shift >= 64 { 6211 return ErrIntOverflowObjects 6212 } 6213 if iNdEx >= l { 6214 return io.ErrUnexpectedEOF 6215 } 6216 b := dAtA[iNdEx] 6217 iNdEx++ 6218 msglen |= int(b&0x7F) << shift 6219 if b < 0x80 { 6220 break 6221 } 6222 } 6223 if msglen < 0 { 6224 return ErrInvalidLengthObjects 6225 } 6226 postIndex := iNdEx + msglen 6227 if postIndex < 0 { 6228 return ErrInvalidLengthObjects 6229 } 6230 if postIndex > l { 6231 return io.ErrUnexpectedEOF 6232 } 6233 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6234 return err 6235 } 6236 iNdEx = postIndex 6237 case 4: 6238 if wireType != 2 { 6239 return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) 6240 } 6241 var msglen int 6242 for shift := uint(0); ; shift += 7 { 6243 if shift >= 64 { 6244 return ErrIntOverflowObjects 6245 } 6246 if iNdEx >= l { 6247 return io.ErrUnexpectedEOF 6248 } 6249 b := dAtA[iNdEx] 6250 iNdEx++ 6251 msglen |= int(b&0x7F) << shift 6252 if b < 0x80 { 6253 break 6254 } 6255 } 6256 if msglen < 0 { 6257 return ErrInvalidLengthObjects 6258 } 6259 postIndex := iNdEx + msglen 6260 if postIndex < 0 { 6261 return ErrInvalidLengthObjects 6262 } 6263 if postIndex > l { 6264 return io.ErrUnexpectedEOF 6265 } 6266 if m.Endpoint == nil { 6267 m.Endpoint = &Endpoint{} 6268 } 6269 if err := m.Endpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6270 return err 6271 } 6272 iNdEx = postIndex 6273 case 5: 6274 if wireType != 2 { 6275 return fmt.Errorf("proto: wrong wireType = %d for field UpdateStatus", wireType) 6276 } 6277 var msglen int 6278 for shift := uint(0); ; shift += 7 { 6279 if shift >= 64 { 6280 return ErrIntOverflowObjects 6281 } 6282 if iNdEx >= l { 6283 return io.ErrUnexpectedEOF 6284 } 6285 b := dAtA[iNdEx] 6286 iNdEx++ 6287 msglen |= int(b&0x7F) << shift 6288 if b < 0x80 { 6289 break 6290 } 6291 } 6292 if msglen < 0 { 6293 return ErrInvalidLengthObjects 6294 } 6295 postIndex := iNdEx + msglen 6296 if postIndex < 0 { 6297 return ErrInvalidLengthObjects 6298 } 6299 if postIndex > l { 6300 return io.ErrUnexpectedEOF 6301 } 6302 if m.UpdateStatus == nil { 6303 m.UpdateStatus = &UpdateStatus{} 6304 } 6305 if err := m.UpdateStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6306 return err 6307 } 6308 iNdEx = postIndex 6309 case 6: 6310 if wireType != 2 { 6311 return fmt.Errorf("proto: wrong wireType = %d for field PreviousSpec", wireType) 6312 } 6313 var msglen int 6314 for shift := uint(0); ; shift += 7 { 6315 if shift >= 64 { 6316 return ErrIntOverflowObjects 6317 } 6318 if iNdEx >= l { 6319 return io.ErrUnexpectedEOF 6320 } 6321 b := dAtA[iNdEx] 6322 iNdEx++ 6323 msglen |= int(b&0x7F) << shift 6324 if b < 0x80 { 6325 break 6326 } 6327 } 6328 if msglen < 0 { 6329 return ErrInvalidLengthObjects 6330 } 6331 postIndex := iNdEx + msglen 6332 if postIndex < 0 { 6333 return ErrInvalidLengthObjects 6334 } 6335 if postIndex > l { 6336 return io.ErrUnexpectedEOF 6337 } 6338 if m.PreviousSpec == nil { 6339 m.PreviousSpec = &ServiceSpec{} 6340 } 6341 if err := m.PreviousSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6342 return err 6343 } 6344 iNdEx = postIndex 6345 case 7: 6346 if wireType != 0 { 6347 return fmt.Errorf("proto: wrong wireType = %d for field PendingDelete", wireType) 6348 } 6349 var v int 6350 for shift := uint(0); ; shift += 7 { 6351 if shift >= 64 { 6352 return ErrIntOverflowObjects 6353 } 6354 if iNdEx >= l { 6355 return io.ErrUnexpectedEOF 6356 } 6357 b := dAtA[iNdEx] 6358 iNdEx++ 6359 v |= int(b&0x7F) << shift 6360 if b < 0x80 { 6361 break 6362 } 6363 } 6364 m.PendingDelete = bool(v != 0) 6365 case 10: 6366 if wireType != 2 { 6367 return fmt.Errorf("proto: wrong wireType = %d for field SpecVersion", wireType) 6368 } 6369 var msglen int 6370 for shift := uint(0); ; shift += 7 { 6371 if shift >= 64 { 6372 return ErrIntOverflowObjects 6373 } 6374 if iNdEx >= l { 6375 return io.ErrUnexpectedEOF 6376 } 6377 b := dAtA[iNdEx] 6378 iNdEx++ 6379 msglen |= int(b&0x7F) << shift 6380 if b < 0x80 { 6381 break 6382 } 6383 } 6384 if msglen < 0 { 6385 return ErrInvalidLengthObjects 6386 } 6387 postIndex := iNdEx + msglen 6388 if postIndex < 0 { 6389 return ErrInvalidLengthObjects 6390 } 6391 if postIndex > l { 6392 return io.ErrUnexpectedEOF 6393 } 6394 if m.SpecVersion == nil { 6395 m.SpecVersion = &Version{} 6396 } 6397 if err := m.SpecVersion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6398 return err 6399 } 6400 iNdEx = postIndex 6401 case 11: 6402 if wireType != 2 { 6403 return fmt.Errorf("proto: wrong wireType = %d for field PreviousSpecVersion", wireType) 6404 } 6405 var msglen int 6406 for shift := uint(0); ; shift += 7 { 6407 if shift >= 64 { 6408 return ErrIntOverflowObjects 6409 } 6410 if iNdEx >= l { 6411 return io.ErrUnexpectedEOF 6412 } 6413 b := dAtA[iNdEx] 6414 iNdEx++ 6415 msglen |= int(b&0x7F) << shift 6416 if b < 0x80 { 6417 break 6418 } 6419 } 6420 if msglen < 0 { 6421 return ErrInvalidLengthObjects 6422 } 6423 postIndex := iNdEx + msglen 6424 if postIndex < 0 { 6425 return ErrInvalidLengthObjects 6426 } 6427 if postIndex > l { 6428 return io.ErrUnexpectedEOF 6429 } 6430 if m.PreviousSpecVersion == nil { 6431 m.PreviousSpecVersion = &Version{} 6432 } 6433 if err := m.PreviousSpecVersion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6434 return err 6435 } 6436 iNdEx = postIndex 6437 case 12: 6438 if wireType != 2 { 6439 return fmt.Errorf("proto: wrong wireType = %d for field JobStatus", wireType) 6440 } 6441 var msglen int 6442 for shift := uint(0); ; shift += 7 { 6443 if shift >= 64 { 6444 return ErrIntOverflowObjects 6445 } 6446 if iNdEx >= l { 6447 return io.ErrUnexpectedEOF 6448 } 6449 b := dAtA[iNdEx] 6450 iNdEx++ 6451 msglen |= int(b&0x7F) << shift 6452 if b < 0x80 { 6453 break 6454 } 6455 } 6456 if msglen < 0 { 6457 return ErrInvalidLengthObjects 6458 } 6459 postIndex := iNdEx + msglen 6460 if postIndex < 0 { 6461 return ErrInvalidLengthObjects 6462 } 6463 if postIndex > l { 6464 return io.ErrUnexpectedEOF 6465 } 6466 if m.JobStatus == nil { 6467 m.JobStatus = &JobStatus{} 6468 } 6469 if err := m.JobStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6470 return err 6471 } 6472 iNdEx = postIndex 6473 default: 6474 iNdEx = preIndex 6475 skippy, err := skipObjects(dAtA[iNdEx:]) 6476 if err != nil { 6477 return err 6478 } 6479 if skippy < 0 { 6480 return ErrInvalidLengthObjects 6481 } 6482 if (iNdEx + skippy) < 0 { 6483 return ErrInvalidLengthObjects 6484 } 6485 if (iNdEx + skippy) > l { 6486 return io.ErrUnexpectedEOF 6487 } 6488 iNdEx += skippy 6489 } 6490 } 6491 6492 if iNdEx > l { 6493 return io.ErrUnexpectedEOF 6494 } 6495 return nil 6496 } 6497 func (m *Endpoint) Unmarshal(dAtA []byte) error { 6498 l := len(dAtA) 6499 iNdEx := 0 6500 for iNdEx < l { 6501 preIndex := iNdEx 6502 var wire uint64 6503 for shift := uint(0); ; shift += 7 { 6504 if shift >= 64 { 6505 return ErrIntOverflowObjects 6506 } 6507 if iNdEx >= l { 6508 return io.ErrUnexpectedEOF 6509 } 6510 b := dAtA[iNdEx] 6511 iNdEx++ 6512 wire |= uint64(b&0x7F) << shift 6513 if b < 0x80 { 6514 break 6515 } 6516 } 6517 fieldNum := int32(wire >> 3) 6518 wireType := int(wire & 0x7) 6519 if wireType == 4 { 6520 return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") 6521 } 6522 if fieldNum <= 0 { 6523 return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) 6524 } 6525 switch fieldNum { 6526 case 1: 6527 if wireType != 2 { 6528 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 6529 } 6530 var msglen int 6531 for shift := uint(0); ; shift += 7 { 6532 if shift >= 64 { 6533 return ErrIntOverflowObjects 6534 } 6535 if iNdEx >= l { 6536 return io.ErrUnexpectedEOF 6537 } 6538 b := dAtA[iNdEx] 6539 iNdEx++ 6540 msglen |= int(b&0x7F) << shift 6541 if b < 0x80 { 6542 break 6543 } 6544 } 6545 if msglen < 0 { 6546 return ErrInvalidLengthObjects 6547 } 6548 postIndex := iNdEx + msglen 6549 if postIndex < 0 { 6550 return ErrInvalidLengthObjects 6551 } 6552 if postIndex > l { 6553 return io.ErrUnexpectedEOF 6554 } 6555 if m.Spec == nil { 6556 m.Spec = &EndpointSpec{} 6557 } 6558 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6559 return err 6560 } 6561 iNdEx = postIndex 6562 case 2: 6563 if wireType != 2 { 6564 return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) 6565 } 6566 var msglen int 6567 for shift := uint(0); ; shift += 7 { 6568 if shift >= 64 { 6569 return ErrIntOverflowObjects 6570 } 6571 if iNdEx >= l { 6572 return io.ErrUnexpectedEOF 6573 } 6574 b := dAtA[iNdEx] 6575 iNdEx++ 6576 msglen |= int(b&0x7F) << shift 6577 if b < 0x80 { 6578 break 6579 } 6580 } 6581 if msglen < 0 { 6582 return ErrInvalidLengthObjects 6583 } 6584 postIndex := iNdEx + msglen 6585 if postIndex < 0 { 6586 return ErrInvalidLengthObjects 6587 } 6588 if postIndex > l { 6589 return io.ErrUnexpectedEOF 6590 } 6591 m.Ports = append(m.Ports, &PortConfig{}) 6592 if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6593 return err 6594 } 6595 iNdEx = postIndex 6596 case 3: 6597 if wireType != 2 { 6598 return fmt.Errorf("proto: wrong wireType = %d for field VirtualIPs", wireType) 6599 } 6600 var msglen int 6601 for shift := uint(0); ; shift += 7 { 6602 if shift >= 64 { 6603 return ErrIntOverflowObjects 6604 } 6605 if iNdEx >= l { 6606 return io.ErrUnexpectedEOF 6607 } 6608 b := dAtA[iNdEx] 6609 iNdEx++ 6610 msglen |= int(b&0x7F) << shift 6611 if b < 0x80 { 6612 break 6613 } 6614 } 6615 if msglen < 0 { 6616 return ErrInvalidLengthObjects 6617 } 6618 postIndex := iNdEx + msglen 6619 if postIndex < 0 { 6620 return ErrInvalidLengthObjects 6621 } 6622 if postIndex > l { 6623 return io.ErrUnexpectedEOF 6624 } 6625 m.VirtualIPs = append(m.VirtualIPs, &Endpoint_VirtualIP{}) 6626 if err := m.VirtualIPs[len(m.VirtualIPs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6627 return err 6628 } 6629 iNdEx = postIndex 6630 default: 6631 iNdEx = preIndex 6632 skippy, err := skipObjects(dAtA[iNdEx:]) 6633 if err != nil { 6634 return err 6635 } 6636 if skippy < 0 { 6637 return ErrInvalidLengthObjects 6638 } 6639 if (iNdEx + skippy) < 0 { 6640 return ErrInvalidLengthObjects 6641 } 6642 if (iNdEx + skippy) > l { 6643 return io.ErrUnexpectedEOF 6644 } 6645 iNdEx += skippy 6646 } 6647 } 6648 6649 if iNdEx > l { 6650 return io.ErrUnexpectedEOF 6651 } 6652 return nil 6653 } 6654 func (m *Endpoint_VirtualIP) Unmarshal(dAtA []byte) error { 6655 l := len(dAtA) 6656 iNdEx := 0 6657 for iNdEx < l { 6658 preIndex := iNdEx 6659 var wire uint64 6660 for shift := uint(0); ; shift += 7 { 6661 if shift >= 64 { 6662 return ErrIntOverflowObjects 6663 } 6664 if iNdEx >= l { 6665 return io.ErrUnexpectedEOF 6666 } 6667 b := dAtA[iNdEx] 6668 iNdEx++ 6669 wire |= uint64(b&0x7F) << shift 6670 if b < 0x80 { 6671 break 6672 } 6673 } 6674 fieldNum := int32(wire >> 3) 6675 wireType := int(wire & 0x7) 6676 if wireType == 4 { 6677 return fmt.Errorf("proto: VirtualIP: wiretype end group for non-group") 6678 } 6679 if fieldNum <= 0 { 6680 return fmt.Errorf("proto: VirtualIP: illegal tag %d (wire type %d)", fieldNum, wire) 6681 } 6682 switch fieldNum { 6683 case 1: 6684 if wireType != 2 { 6685 return fmt.Errorf("proto: wrong wireType = %d for field NetworkID", wireType) 6686 } 6687 var stringLen uint64 6688 for shift := uint(0); ; shift += 7 { 6689 if shift >= 64 { 6690 return ErrIntOverflowObjects 6691 } 6692 if iNdEx >= l { 6693 return io.ErrUnexpectedEOF 6694 } 6695 b := dAtA[iNdEx] 6696 iNdEx++ 6697 stringLen |= uint64(b&0x7F) << shift 6698 if b < 0x80 { 6699 break 6700 } 6701 } 6702 intStringLen := int(stringLen) 6703 if intStringLen < 0 { 6704 return ErrInvalidLengthObjects 6705 } 6706 postIndex := iNdEx + intStringLen 6707 if postIndex < 0 { 6708 return ErrInvalidLengthObjects 6709 } 6710 if postIndex > l { 6711 return io.ErrUnexpectedEOF 6712 } 6713 m.NetworkID = string(dAtA[iNdEx:postIndex]) 6714 iNdEx = postIndex 6715 case 2: 6716 if wireType != 2 { 6717 return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) 6718 } 6719 var stringLen uint64 6720 for shift := uint(0); ; shift += 7 { 6721 if shift >= 64 { 6722 return ErrIntOverflowObjects 6723 } 6724 if iNdEx >= l { 6725 return io.ErrUnexpectedEOF 6726 } 6727 b := dAtA[iNdEx] 6728 iNdEx++ 6729 stringLen |= uint64(b&0x7F) << shift 6730 if b < 0x80 { 6731 break 6732 } 6733 } 6734 intStringLen := int(stringLen) 6735 if intStringLen < 0 { 6736 return ErrInvalidLengthObjects 6737 } 6738 postIndex := iNdEx + intStringLen 6739 if postIndex < 0 { 6740 return ErrInvalidLengthObjects 6741 } 6742 if postIndex > l { 6743 return io.ErrUnexpectedEOF 6744 } 6745 m.Addr = string(dAtA[iNdEx:postIndex]) 6746 iNdEx = postIndex 6747 default: 6748 iNdEx = preIndex 6749 skippy, err := skipObjects(dAtA[iNdEx:]) 6750 if err != nil { 6751 return err 6752 } 6753 if skippy < 0 { 6754 return ErrInvalidLengthObjects 6755 } 6756 if (iNdEx + skippy) < 0 { 6757 return ErrInvalidLengthObjects 6758 } 6759 if (iNdEx + skippy) > l { 6760 return io.ErrUnexpectedEOF 6761 } 6762 iNdEx += skippy 6763 } 6764 } 6765 6766 if iNdEx > l { 6767 return io.ErrUnexpectedEOF 6768 } 6769 return nil 6770 } 6771 func (m *Task) Unmarshal(dAtA []byte) error { 6772 l := len(dAtA) 6773 iNdEx := 0 6774 for iNdEx < l { 6775 preIndex := iNdEx 6776 var wire uint64 6777 for shift := uint(0); ; shift += 7 { 6778 if shift >= 64 { 6779 return ErrIntOverflowObjects 6780 } 6781 if iNdEx >= l { 6782 return io.ErrUnexpectedEOF 6783 } 6784 b := dAtA[iNdEx] 6785 iNdEx++ 6786 wire |= uint64(b&0x7F) << shift 6787 if b < 0x80 { 6788 break 6789 } 6790 } 6791 fieldNum := int32(wire >> 3) 6792 wireType := int(wire & 0x7) 6793 if wireType == 4 { 6794 return fmt.Errorf("proto: Task: wiretype end group for non-group") 6795 } 6796 if fieldNum <= 0 { 6797 return fmt.Errorf("proto: Task: illegal tag %d (wire type %d)", fieldNum, wire) 6798 } 6799 switch fieldNum { 6800 case 1: 6801 if wireType != 2 { 6802 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 6803 } 6804 var stringLen uint64 6805 for shift := uint(0); ; shift += 7 { 6806 if shift >= 64 { 6807 return ErrIntOverflowObjects 6808 } 6809 if iNdEx >= l { 6810 return io.ErrUnexpectedEOF 6811 } 6812 b := dAtA[iNdEx] 6813 iNdEx++ 6814 stringLen |= uint64(b&0x7F) << shift 6815 if b < 0x80 { 6816 break 6817 } 6818 } 6819 intStringLen := int(stringLen) 6820 if intStringLen < 0 { 6821 return ErrInvalidLengthObjects 6822 } 6823 postIndex := iNdEx + intStringLen 6824 if postIndex < 0 { 6825 return ErrInvalidLengthObjects 6826 } 6827 if postIndex > l { 6828 return io.ErrUnexpectedEOF 6829 } 6830 m.ID = string(dAtA[iNdEx:postIndex]) 6831 iNdEx = postIndex 6832 case 2: 6833 if wireType != 2 { 6834 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 6835 } 6836 var msglen int 6837 for shift := uint(0); ; shift += 7 { 6838 if shift >= 64 { 6839 return ErrIntOverflowObjects 6840 } 6841 if iNdEx >= l { 6842 return io.ErrUnexpectedEOF 6843 } 6844 b := dAtA[iNdEx] 6845 iNdEx++ 6846 msglen |= int(b&0x7F) << shift 6847 if b < 0x80 { 6848 break 6849 } 6850 } 6851 if msglen < 0 { 6852 return ErrInvalidLengthObjects 6853 } 6854 postIndex := iNdEx + msglen 6855 if postIndex < 0 { 6856 return ErrInvalidLengthObjects 6857 } 6858 if postIndex > l { 6859 return io.ErrUnexpectedEOF 6860 } 6861 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6862 return err 6863 } 6864 iNdEx = postIndex 6865 case 3: 6866 if wireType != 2 { 6867 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 6868 } 6869 var msglen int 6870 for shift := uint(0); ; shift += 7 { 6871 if shift >= 64 { 6872 return ErrIntOverflowObjects 6873 } 6874 if iNdEx >= l { 6875 return io.ErrUnexpectedEOF 6876 } 6877 b := dAtA[iNdEx] 6878 iNdEx++ 6879 msglen |= int(b&0x7F) << shift 6880 if b < 0x80 { 6881 break 6882 } 6883 } 6884 if msglen < 0 { 6885 return ErrInvalidLengthObjects 6886 } 6887 postIndex := iNdEx + msglen 6888 if postIndex < 0 { 6889 return ErrInvalidLengthObjects 6890 } 6891 if postIndex > l { 6892 return io.ErrUnexpectedEOF 6893 } 6894 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 6895 return err 6896 } 6897 iNdEx = postIndex 6898 case 4: 6899 if wireType != 2 { 6900 return fmt.Errorf("proto: wrong wireType = %d for field ServiceID", wireType) 6901 } 6902 var stringLen uint64 6903 for shift := uint(0); ; shift += 7 { 6904 if shift >= 64 { 6905 return ErrIntOverflowObjects 6906 } 6907 if iNdEx >= l { 6908 return io.ErrUnexpectedEOF 6909 } 6910 b := dAtA[iNdEx] 6911 iNdEx++ 6912 stringLen |= uint64(b&0x7F) << shift 6913 if b < 0x80 { 6914 break 6915 } 6916 } 6917 intStringLen := int(stringLen) 6918 if intStringLen < 0 { 6919 return ErrInvalidLengthObjects 6920 } 6921 postIndex := iNdEx + intStringLen 6922 if postIndex < 0 { 6923 return ErrInvalidLengthObjects 6924 } 6925 if postIndex > l { 6926 return io.ErrUnexpectedEOF 6927 } 6928 m.ServiceID = string(dAtA[iNdEx:postIndex]) 6929 iNdEx = postIndex 6930 case 5: 6931 if wireType != 0 { 6932 return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType) 6933 } 6934 m.Slot = 0 6935 for shift := uint(0); ; shift += 7 { 6936 if shift >= 64 { 6937 return ErrIntOverflowObjects 6938 } 6939 if iNdEx >= l { 6940 return io.ErrUnexpectedEOF 6941 } 6942 b := dAtA[iNdEx] 6943 iNdEx++ 6944 m.Slot |= uint64(b&0x7F) << shift 6945 if b < 0x80 { 6946 break 6947 } 6948 } 6949 case 6: 6950 if wireType != 2 { 6951 return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) 6952 } 6953 var stringLen uint64 6954 for shift := uint(0); ; shift += 7 { 6955 if shift >= 64 { 6956 return ErrIntOverflowObjects 6957 } 6958 if iNdEx >= l { 6959 return io.ErrUnexpectedEOF 6960 } 6961 b := dAtA[iNdEx] 6962 iNdEx++ 6963 stringLen |= uint64(b&0x7F) << shift 6964 if b < 0x80 { 6965 break 6966 } 6967 } 6968 intStringLen := int(stringLen) 6969 if intStringLen < 0 { 6970 return ErrInvalidLengthObjects 6971 } 6972 postIndex := iNdEx + intStringLen 6973 if postIndex < 0 { 6974 return ErrInvalidLengthObjects 6975 } 6976 if postIndex > l { 6977 return io.ErrUnexpectedEOF 6978 } 6979 m.NodeID = string(dAtA[iNdEx:postIndex]) 6980 iNdEx = postIndex 6981 case 7: 6982 if wireType != 2 { 6983 return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) 6984 } 6985 var msglen int 6986 for shift := uint(0); ; shift += 7 { 6987 if shift >= 64 { 6988 return ErrIntOverflowObjects 6989 } 6990 if iNdEx >= l { 6991 return io.ErrUnexpectedEOF 6992 } 6993 b := dAtA[iNdEx] 6994 iNdEx++ 6995 msglen |= int(b&0x7F) << shift 6996 if b < 0x80 { 6997 break 6998 } 6999 } 7000 if msglen < 0 { 7001 return ErrInvalidLengthObjects 7002 } 7003 postIndex := iNdEx + msglen 7004 if postIndex < 0 { 7005 return ErrInvalidLengthObjects 7006 } 7007 if postIndex > l { 7008 return io.ErrUnexpectedEOF 7009 } 7010 if err := m.Annotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7011 return err 7012 } 7013 iNdEx = postIndex 7014 case 8: 7015 if wireType != 2 { 7016 return fmt.Errorf("proto: wrong wireType = %d for field ServiceAnnotations", wireType) 7017 } 7018 var msglen int 7019 for shift := uint(0); ; shift += 7 { 7020 if shift >= 64 { 7021 return ErrIntOverflowObjects 7022 } 7023 if iNdEx >= l { 7024 return io.ErrUnexpectedEOF 7025 } 7026 b := dAtA[iNdEx] 7027 iNdEx++ 7028 msglen |= int(b&0x7F) << shift 7029 if b < 0x80 { 7030 break 7031 } 7032 } 7033 if msglen < 0 { 7034 return ErrInvalidLengthObjects 7035 } 7036 postIndex := iNdEx + msglen 7037 if postIndex < 0 { 7038 return ErrInvalidLengthObjects 7039 } 7040 if postIndex > l { 7041 return io.ErrUnexpectedEOF 7042 } 7043 if err := m.ServiceAnnotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7044 return err 7045 } 7046 iNdEx = postIndex 7047 case 9: 7048 if wireType != 2 { 7049 return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) 7050 } 7051 var msglen int 7052 for shift := uint(0); ; shift += 7 { 7053 if shift >= 64 { 7054 return ErrIntOverflowObjects 7055 } 7056 if iNdEx >= l { 7057 return io.ErrUnexpectedEOF 7058 } 7059 b := dAtA[iNdEx] 7060 iNdEx++ 7061 msglen |= int(b&0x7F) << shift 7062 if b < 0x80 { 7063 break 7064 } 7065 } 7066 if msglen < 0 { 7067 return ErrInvalidLengthObjects 7068 } 7069 postIndex := iNdEx + msglen 7070 if postIndex < 0 { 7071 return ErrInvalidLengthObjects 7072 } 7073 if postIndex > l { 7074 return io.ErrUnexpectedEOF 7075 } 7076 if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7077 return err 7078 } 7079 iNdEx = postIndex 7080 case 10: 7081 if wireType != 0 { 7082 return fmt.Errorf("proto: wrong wireType = %d for field DesiredState", wireType) 7083 } 7084 m.DesiredState = 0 7085 for shift := uint(0); ; shift += 7 { 7086 if shift >= 64 { 7087 return ErrIntOverflowObjects 7088 } 7089 if iNdEx >= l { 7090 return io.ErrUnexpectedEOF 7091 } 7092 b := dAtA[iNdEx] 7093 iNdEx++ 7094 m.DesiredState |= TaskState(b&0x7F) << shift 7095 if b < 0x80 { 7096 break 7097 } 7098 } 7099 case 11: 7100 if wireType != 2 { 7101 return fmt.Errorf("proto: wrong wireType = %d for field Networks", wireType) 7102 } 7103 var msglen int 7104 for shift := uint(0); ; shift += 7 { 7105 if shift >= 64 { 7106 return ErrIntOverflowObjects 7107 } 7108 if iNdEx >= l { 7109 return io.ErrUnexpectedEOF 7110 } 7111 b := dAtA[iNdEx] 7112 iNdEx++ 7113 msglen |= int(b&0x7F) << shift 7114 if b < 0x80 { 7115 break 7116 } 7117 } 7118 if msglen < 0 { 7119 return ErrInvalidLengthObjects 7120 } 7121 postIndex := iNdEx + msglen 7122 if postIndex < 0 { 7123 return ErrInvalidLengthObjects 7124 } 7125 if postIndex > l { 7126 return io.ErrUnexpectedEOF 7127 } 7128 m.Networks = append(m.Networks, &NetworkAttachment{}) 7129 if err := m.Networks[len(m.Networks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7130 return err 7131 } 7132 iNdEx = postIndex 7133 case 12: 7134 if wireType != 2 { 7135 return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) 7136 } 7137 var msglen int 7138 for shift := uint(0); ; shift += 7 { 7139 if shift >= 64 { 7140 return ErrIntOverflowObjects 7141 } 7142 if iNdEx >= l { 7143 return io.ErrUnexpectedEOF 7144 } 7145 b := dAtA[iNdEx] 7146 iNdEx++ 7147 msglen |= int(b&0x7F) << shift 7148 if b < 0x80 { 7149 break 7150 } 7151 } 7152 if msglen < 0 { 7153 return ErrInvalidLengthObjects 7154 } 7155 postIndex := iNdEx + msglen 7156 if postIndex < 0 { 7157 return ErrInvalidLengthObjects 7158 } 7159 if postIndex > l { 7160 return io.ErrUnexpectedEOF 7161 } 7162 if m.Endpoint == nil { 7163 m.Endpoint = &Endpoint{} 7164 } 7165 if err := m.Endpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7166 return err 7167 } 7168 iNdEx = postIndex 7169 case 13: 7170 if wireType != 2 { 7171 return fmt.Errorf("proto: wrong wireType = %d for field LogDriver", wireType) 7172 } 7173 var msglen int 7174 for shift := uint(0); ; shift += 7 { 7175 if shift >= 64 { 7176 return ErrIntOverflowObjects 7177 } 7178 if iNdEx >= l { 7179 return io.ErrUnexpectedEOF 7180 } 7181 b := dAtA[iNdEx] 7182 iNdEx++ 7183 msglen |= int(b&0x7F) << shift 7184 if b < 0x80 { 7185 break 7186 } 7187 } 7188 if msglen < 0 { 7189 return ErrInvalidLengthObjects 7190 } 7191 postIndex := iNdEx + msglen 7192 if postIndex < 0 { 7193 return ErrInvalidLengthObjects 7194 } 7195 if postIndex > l { 7196 return io.ErrUnexpectedEOF 7197 } 7198 if m.LogDriver == nil { 7199 m.LogDriver = &Driver{} 7200 } 7201 if err := m.LogDriver.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7202 return err 7203 } 7204 iNdEx = postIndex 7205 case 14: 7206 if wireType != 2 { 7207 return fmt.Errorf("proto: wrong wireType = %d for field SpecVersion", wireType) 7208 } 7209 var msglen int 7210 for shift := uint(0); ; shift += 7 { 7211 if shift >= 64 { 7212 return ErrIntOverflowObjects 7213 } 7214 if iNdEx >= l { 7215 return io.ErrUnexpectedEOF 7216 } 7217 b := dAtA[iNdEx] 7218 iNdEx++ 7219 msglen |= int(b&0x7F) << shift 7220 if b < 0x80 { 7221 break 7222 } 7223 } 7224 if msglen < 0 { 7225 return ErrInvalidLengthObjects 7226 } 7227 postIndex := iNdEx + msglen 7228 if postIndex < 0 { 7229 return ErrInvalidLengthObjects 7230 } 7231 if postIndex > l { 7232 return io.ErrUnexpectedEOF 7233 } 7234 if m.SpecVersion == nil { 7235 m.SpecVersion = &Version{} 7236 } 7237 if err := m.SpecVersion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7238 return err 7239 } 7240 iNdEx = postIndex 7241 case 15: 7242 if wireType != 2 { 7243 return fmt.Errorf("proto: wrong wireType = %d for field AssignedGenericResources", wireType) 7244 } 7245 var msglen int 7246 for shift := uint(0); ; shift += 7 { 7247 if shift >= 64 { 7248 return ErrIntOverflowObjects 7249 } 7250 if iNdEx >= l { 7251 return io.ErrUnexpectedEOF 7252 } 7253 b := dAtA[iNdEx] 7254 iNdEx++ 7255 msglen |= int(b&0x7F) << shift 7256 if b < 0x80 { 7257 break 7258 } 7259 } 7260 if msglen < 0 { 7261 return ErrInvalidLengthObjects 7262 } 7263 postIndex := iNdEx + msglen 7264 if postIndex < 0 { 7265 return ErrInvalidLengthObjects 7266 } 7267 if postIndex > l { 7268 return io.ErrUnexpectedEOF 7269 } 7270 m.AssignedGenericResources = append(m.AssignedGenericResources, &GenericResource{}) 7271 if err := m.AssignedGenericResources[len(m.AssignedGenericResources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7272 return err 7273 } 7274 iNdEx = postIndex 7275 case 16: 7276 if wireType != 2 { 7277 return fmt.Errorf("proto: wrong wireType = %d for field JobIteration", wireType) 7278 } 7279 var msglen int 7280 for shift := uint(0); ; shift += 7 { 7281 if shift >= 64 { 7282 return ErrIntOverflowObjects 7283 } 7284 if iNdEx >= l { 7285 return io.ErrUnexpectedEOF 7286 } 7287 b := dAtA[iNdEx] 7288 iNdEx++ 7289 msglen |= int(b&0x7F) << shift 7290 if b < 0x80 { 7291 break 7292 } 7293 } 7294 if msglen < 0 { 7295 return ErrInvalidLengthObjects 7296 } 7297 postIndex := iNdEx + msglen 7298 if postIndex < 0 { 7299 return ErrInvalidLengthObjects 7300 } 7301 if postIndex > l { 7302 return io.ErrUnexpectedEOF 7303 } 7304 if m.JobIteration == nil { 7305 m.JobIteration = &Version{} 7306 } 7307 if err := m.JobIteration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7308 return err 7309 } 7310 iNdEx = postIndex 7311 default: 7312 iNdEx = preIndex 7313 skippy, err := skipObjects(dAtA[iNdEx:]) 7314 if err != nil { 7315 return err 7316 } 7317 if skippy < 0 { 7318 return ErrInvalidLengthObjects 7319 } 7320 if (iNdEx + skippy) < 0 { 7321 return ErrInvalidLengthObjects 7322 } 7323 if (iNdEx + skippy) > l { 7324 return io.ErrUnexpectedEOF 7325 } 7326 iNdEx += skippy 7327 } 7328 } 7329 7330 if iNdEx > l { 7331 return io.ErrUnexpectedEOF 7332 } 7333 return nil 7334 } 7335 func (m *NetworkAttachment) Unmarshal(dAtA []byte) error { 7336 l := len(dAtA) 7337 iNdEx := 0 7338 for iNdEx < l { 7339 preIndex := iNdEx 7340 var wire uint64 7341 for shift := uint(0); ; shift += 7 { 7342 if shift >= 64 { 7343 return ErrIntOverflowObjects 7344 } 7345 if iNdEx >= l { 7346 return io.ErrUnexpectedEOF 7347 } 7348 b := dAtA[iNdEx] 7349 iNdEx++ 7350 wire |= uint64(b&0x7F) << shift 7351 if b < 0x80 { 7352 break 7353 } 7354 } 7355 fieldNum := int32(wire >> 3) 7356 wireType := int(wire & 0x7) 7357 if wireType == 4 { 7358 return fmt.Errorf("proto: NetworkAttachment: wiretype end group for non-group") 7359 } 7360 if fieldNum <= 0 { 7361 return fmt.Errorf("proto: NetworkAttachment: illegal tag %d (wire type %d)", fieldNum, wire) 7362 } 7363 switch fieldNum { 7364 case 1: 7365 if wireType != 2 { 7366 return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) 7367 } 7368 var msglen int 7369 for shift := uint(0); ; shift += 7 { 7370 if shift >= 64 { 7371 return ErrIntOverflowObjects 7372 } 7373 if iNdEx >= l { 7374 return io.ErrUnexpectedEOF 7375 } 7376 b := dAtA[iNdEx] 7377 iNdEx++ 7378 msglen |= int(b&0x7F) << shift 7379 if b < 0x80 { 7380 break 7381 } 7382 } 7383 if msglen < 0 { 7384 return ErrInvalidLengthObjects 7385 } 7386 postIndex := iNdEx + msglen 7387 if postIndex < 0 { 7388 return ErrInvalidLengthObjects 7389 } 7390 if postIndex > l { 7391 return io.ErrUnexpectedEOF 7392 } 7393 if m.Network == nil { 7394 m.Network = &Network{} 7395 } 7396 if err := m.Network.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7397 return err 7398 } 7399 iNdEx = postIndex 7400 case 2: 7401 if wireType != 2 { 7402 return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) 7403 } 7404 var stringLen uint64 7405 for shift := uint(0); ; shift += 7 { 7406 if shift >= 64 { 7407 return ErrIntOverflowObjects 7408 } 7409 if iNdEx >= l { 7410 return io.ErrUnexpectedEOF 7411 } 7412 b := dAtA[iNdEx] 7413 iNdEx++ 7414 stringLen |= uint64(b&0x7F) << shift 7415 if b < 0x80 { 7416 break 7417 } 7418 } 7419 intStringLen := int(stringLen) 7420 if intStringLen < 0 { 7421 return ErrInvalidLengthObjects 7422 } 7423 postIndex := iNdEx + intStringLen 7424 if postIndex < 0 { 7425 return ErrInvalidLengthObjects 7426 } 7427 if postIndex > l { 7428 return io.ErrUnexpectedEOF 7429 } 7430 m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) 7431 iNdEx = postIndex 7432 case 3: 7433 if wireType != 2 { 7434 return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType) 7435 } 7436 var stringLen uint64 7437 for shift := uint(0); ; shift += 7 { 7438 if shift >= 64 { 7439 return ErrIntOverflowObjects 7440 } 7441 if iNdEx >= l { 7442 return io.ErrUnexpectedEOF 7443 } 7444 b := dAtA[iNdEx] 7445 iNdEx++ 7446 stringLen |= uint64(b&0x7F) << shift 7447 if b < 0x80 { 7448 break 7449 } 7450 } 7451 intStringLen := int(stringLen) 7452 if intStringLen < 0 { 7453 return ErrInvalidLengthObjects 7454 } 7455 postIndex := iNdEx + intStringLen 7456 if postIndex < 0 { 7457 return ErrInvalidLengthObjects 7458 } 7459 if postIndex > l { 7460 return io.ErrUnexpectedEOF 7461 } 7462 m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex])) 7463 iNdEx = postIndex 7464 case 4: 7465 if wireType != 2 { 7466 return fmt.Errorf("proto: wrong wireType = %d for field DriverAttachmentOpts", wireType) 7467 } 7468 var msglen int 7469 for shift := uint(0); ; shift += 7 { 7470 if shift >= 64 { 7471 return ErrIntOverflowObjects 7472 } 7473 if iNdEx >= l { 7474 return io.ErrUnexpectedEOF 7475 } 7476 b := dAtA[iNdEx] 7477 iNdEx++ 7478 msglen |= int(b&0x7F) << shift 7479 if b < 0x80 { 7480 break 7481 } 7482 } 7483 if msglen < 0 { 7484 return ErrInvalidLengthObjects 7485 } 7486 postIndex := iNdEx + msglen 7487 if postIndex < 0 { 7488 return ErrInvalidLengthObjects 7489 } 7490 if postIndex > l { 7491 return io.ErrUnexpectedEOF 7492 } 7493 if m.DriverAttachmentOpts == nil { 7494 m.DriverAttachmentOpts = make(map[string]string) 7495 } 7496 var mapkey string 7497 var mapvalue string 7498 for iNdEx < postIndex { 7499 entryPreIndex := iNdEx 7500 var wire uint64 7501 for shift := uint(0); ; shift += 7 { 7502 if shift >= 64 { 7503 return ErrIntOverflowObjects 7504 } 7505 if iNdEx >= l { 7506 return io.ErrUnexpectedEOF 7507 } 7508 b := dAtA[iNdEx] 7509 iNdEx++ 7510 wire |= uint64(b&0x7F) << shift 7511 if b < 0x80 { 7512 break 7513 } 7514 } 7515 fieldNum := int32(wire >> 3) 7516 if fieldNum == 1 { 7517 var stringLenmapkey uint64 7518 for shift := uint(0); ; shift += 7 { 7519 if shift >= 64 { 7520 return ErrIntOverflowObjects 7521 } 7522 if iNdEx >= l { 7523 return io.ErrUnexpectedEOF 7524 } 7525 b := dAtA[iNdEx] 7526 iNdEx++ 7527 stringLenmapkey |= uint64(b&0x7F) << shift 7528 if b < 0x80 { 7529 break 7530 } 7531 } 7532 intStringLenmapkey := int(stringLenmapkey) 7533 if intStringLenmapkey < 0 { 7534 return ErrInvalidLengthObjects 7535 } 7536 postStringIndexmapkey := iNdEx + intStringLenmapkey 7537 if postStringIndexmapkey < 0 { 7538 return ErrInvalidLengthObjects 7539 } 7540 if postStringIndexmapkey > l { 7541 return io.ErrUnexpectedEOF 7542 } 7543 mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) 7544 iNdEx = postStringIndexmapkey 7545 } else if fieldNum == 2 { 7546 var stringLenmapvalue uint64 7547 for shift := uint(0); ; shift += 7 { 7548 if shift >= 64 { 7549 return ErrIntOverflowObjects 7550 } 7551 if iNdEx >= l { 7552 return io.ErrUnexpectedEOF 7553 } 7554 b := dAtA[iNdEx] 7555 iNdEx++ 7556 stringLenmapvalue |= uint64(b&0x7F) << shift 7557 if b < 0x80 { 7558 break 7559 } 7560 } 7561 intStringLenmapvalue := int(stringLenmapvalue) 7562 if intStringLenmapvalue < 0 { 7563 return ErrInvalidLengthObjects 7564 } 7565 postStringIndexmapvalue := iNdEx + intStringLenmapvalue 7566 if postStringIndexmapvalue < 0 { 7567 return ErrInvalidLengthObjects 7568 } 7569 if postStringIndexmapvalue > l { 7570 return io.ErrUnexpectedEOF 7571 } 7572 mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) 7573 iNdEx = postStringIndexmapvalue 7574 } else { 7575 iNdEx = entryPreIndex 7576 skippy, err := skipObjects(dAtA[iNdEx:]) 7577 if err != nil { 7578 return err 7579 } 7580 if skippy < 0 { 7581 return ErrInvalidLengthObjects 7582 } 7583 if (iNdEx + skippy) > postIndex { 7584 return io.ErrUnexpectedEOF 7585 } 7586 iNdEx += skippy 7587 } 7588 } 7589 m.DriverAttachmentOpts[mapkey] = mapvalue 7590 iNdEx = postIndex 7591 default: 7592 iNdEx = preIndex 7593 skippy, err := skipObjects(dAtA[iNdEx:]) 7594 if err != nil { 7595 return err 7596 } 7597 if skippy < 0 { 7598 return ErrInvalidLengthObjects 7599 } 7600 if (iNdEx + skippy) < 0 { 7601 return ErrInvalidLengthObjects 7602 } 7603 if (iNdEx + skippy) > l { 7604 return io.ErrUnexpectedEOF 7605 } 7606 iNdEx += skippy 7607 } 7608 } 7609 7610 if iNdEx > l { 7611 return io.ErrUnexpectedEOF 7612 } 7613 return nil 7614 } 7615 func (m *Network) Unmarshal(dAtA []byte) error { 7616 l := len(dAtA) 7617 iNdEx := 0 7618 for iNdEx < l { 7619 preIndex := iNdEx 7620 var wire uint64 7621 for shift := uint(0); ; shift += 7 { 7622 if shift >= 64 { 7623 return ErrIntOverflowObjects 7624 } 7625 if iNdEx >= l { 7626 return io.ErrUnexpectedEOF 7627 } 7628 b := dAtA[iNdEx] 7629 iNdEx++ 7630 wire |= uint64(b&0x7F) << shift 7631 if b < 0x80 { 7632 break 7633 } 7634 } 7635 fieldNum := int32(wire >> 3) 7636 wireType := int(wire & 0x7) 7637 if wireType == 4 { 7638 return fmt.Errorf("proto: Network: wiretype end group for non-group") 7639 } 7640 if fieldNum <= 0 { 7641 return fmt.Errorf("proto: Network: illegal tag %d (wire type %d)", fieldNum, wire) 7642 } 7643 switch fieldNum { 7644 case 1: 7645 if wireType != 2 { 7646 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 7647 } 7648 var stringLen uint64 7649 for shift := uint(0); ; shift += 7 { 7650 if shift >= 64 { 7651 return ErrIntOverflowObjects 7652 } 7653 if iNdEx >= l { 7654 return io.ErrUnexpectedEOF 7655 } 7656 b := dAtA[iNdEx] 7657 iNdEx++ 7658 stringLen |= uint64(b&0x7F) << shift 7659 if b < 0x80 { 7660 break 7661 } 7662 } 7663 intStringLen := int(stringLen) 7664 if intStringLen < 0 { 7665 return ErrInvalidLengthObjects 7666 } 7667 postIndex := iNdEx + intStringLen 7668 if postIndex < 0 { 7669 return ErrInvalidLengthObjects 7670 } 7671 if postIndex > l { 7672 return io.ErrUnexpectedEOF 7673 } 7674 m.ID = string(dAtA[iNdEx:postIndex]) 7675 iNdEx = postIndex 7676 case 2: 7677 if wireType != 2 { 7678 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 7679 } 7680 var msglen int 7681 for shift := uint(0); ; shift += 7 { 7682 if shift >= 64 { 7683 return ErrIntOverflowObjects 7684 } 7685 if iNdEx >= l { 7686 return io.ErrUnexpectedEOF 7687 } 7688 b := dAtA[iNdEx] 7689 iNdEx++ 7690 msglen |= int(b&0x7F) << shift 7691 if b < 0x80 { 7692 break 7693 } 7694 } 7695 if msglen < 0 { 7696 return ErrInvalidLengthObjects 7697 } 7698 postIndex := iNdEx + msglen 7699 if postIndex < 0 { 7700 return ErrInvalidLengthObjects 7701 } 7702 if postIndex > l { 7703 return io.ErrUnexpectedEOF 7704 } 7705 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7706 return err 7707 } 7708 iNdEx = postIndex 7709 case 3: 7710 if wireType != 2 { 7711 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 7712 } 7713 var msglen int 7714 for shift := uint(0); ; shift += 7 { 7715 if shift >= 64 { 7716 return ErrIntOverflowObjects 7717 } 7718 if iNdEx >= l { 7719 return io.ErrUnexpectedEOF 7720 } 7721 b := dAtA[iNdEx] 7722 iNdEx++ 7723 msglen |= int(b&0x7F) << shift 7724 if b < 0x80 { 7725 break 7726 } 7727 } 7728 if msglen < 0 { 7729 return ErrInvalidLengthObjects 7730 } 7731 postIndex := iNdEx + msglen 7732 if postIndex < 0 { 7733 return ErrInvalidLengthObjects 7734 } 7735 if postIndex > l { 7736 return io.ErrUnexpectedEOF 7737 } 7738 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7739 return err 7740 } 7741 iNdEx = postIndex 7742 case 4: 7743 if wireType != 2 { 7744 return fmt.Errorf("proto: wrong wireType = %d for field DriverState", wireType) 7745 } 7746 var msglen int 7747 for shift := uint(0); ; shift += 7 { 7748 if shift >= 64 { 7749 return ErrIntOverflowObjects 7750 } 7751 if iNdEx >= l { 7752 return io.ErrUnexpectedEOF 7753 } 7754 b := dAtA[iNdEx] 7755 iNdEx++ 7756 msglen |= int(b&0x7F) << shift 7757 if b < 0x80 { 7758 break 7759 } 7760 } 7761 if msglen < 0 { 7762 return ErrInvalidLengthObjects 7763 } 7764 postIndex := iNdEx + msglen 7765 if postIndex < 0 { 7766 return ErrInvalidLengthObjects 7767 } 7768 if postIndex > l { 7769 return io.ErrUnexpectedEOF 7770 } 7771 if m.DriverState == nil { 7772 m.DriverState = &Driver{} 7773 } 7774 if err := m.DriverState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7775 return err 7776 } 7777 iNdEx = postIndex 7778 case 5: 7779 if wireType != 2 { 7780 return fmt.Errorf("proto: wrong wireType = %d for field IPAM", wireType) 7781 } 7782 var msglen int 7783 for shift := uint(0); ; shift += 7 { 7784 if shift >= 64 { 7785 return ErrIntOverflowObjects 7786 } 7787 if iNdEx >= l { 7788 return io.ErrUnexpectedEOF 7789 } 7790 b := dAtA[iNdEx] 7791 iNdEx++ 7792 msglen |= int(b&0x7F) << shift 7793 if b < 0x80 { 7794 break 7795 } 7796 } 7797 if msglen < 0 { 7798 return ErrInvalidLengthObjects 7799 } 7800 postIndex := iNdEx + msglen 7801 if postIndex < 0 { 7802 return ErrInvalidLengthObjects 7803 } 7804 if postIndex > l { 7805 return io.ErrUnexpectedEOF 7806 } 7807 if m.IPAM == nil { 7808 m.IPAM = &IPAMOptions{} 7809 } 7810 if err := m.IPAM.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7811 return err 7812 } 7813 iNdEx = postIndex 7814 case 6: 7815 if wireType != 0 { 7816 return fmt.Errorf("proto: wrong wireType = %d for field PendingDelete", wireType) 7817 } 7818 var v int 7819 for shift := uint(0); ; shift += 7 { 7820 if shift >= 64 { 7821 return ErrIntOverflowObjects 7822 } 7823 if iNdEx >= l { 7824 return io.ErrUnexpectedEOF 7825 } 7826 b := dAtA[iNdEx] 7827 iNdEx++ 7828 v |= int(b&0x7F) << shift 7829 if b < 0x80 { 7830 break 7831 } 7832 } 7833 m.PendingDelete = bool(v != 0) 7834 default: 7835 iNdEx = preIndex 7836 skippy, err := skipObjects(dAtA[iNdEx:]) 7837 if err != nil { 7838 return err 7839 } 7840 if skippy < 0 { 7841 return ErrInvalidLengthObjects 7842 } 7843 if (iNdEx + skippy) < 0 { 7844 return ErrInvalidLengthObjects 7845 } 7846 if (iNdEx + skippy) > l { 7847 return io.ErrUnexpectedEOF 7848 } 7849 iNdEx += skippy 7850 } 7851 } 7852 7853 if iNdEx > l { 7854 return io.ErrUnexpectedEOF 7855 } 7856 return nil 7857 } 7858 func (m *Cluster) Unmarshal(dAtA []byte) error { 7859 l := len(dAtA) 7860 iNdEx := 0 7861 for iNdEx < l { 7862 preIndex := iNdEx 7863 var wire uint64 7864 for shift := uint(0); ; shift += 7 { 7865 if shift >= 64 { 7866 return ErrIntOverflowObjects 7867 } 7868 if iNdEx >= l { 7869 return io.ErrUnexpectedEOF 7870 } 7871 b := dAtA[iNdEx] 7872 iNdEx++ 7873 wire |= uint64(b&0x7F) << shift 7874 if b < 0x80 { 7875 break 7876 } 7877 } 7878 fieldNum := int32(wire >> 3) 7879 wireType := int(wire & 0x7) 7880 if wireType == 4 { 7881 return fmt.Errorf("proto: Cluster: wiretype end group for non-group") 7882 } 7883 if fieldNum <= 0 { 7884 return fmt.Errorf("proto: Cluster: illegal tag %d (wire type %d)", fieldNum, wire) 7885 } 7886 switch fieldNum { 7887 case 1: 7888 if wireType != 2 { 7889 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 7890 } 7891 var stringLen uint64 7892 for shift := uint(0); ; shift += 7 { 7893 if shift >= 64 { 7894 return ErrIntOverflowObjects 7895 } 7896 if iNdEx >= l { 7897 return io.ErrUnexpectedEOF 7898 } 7899 b := dAtA[iNdEx] 7900 iNdEx++ 7901 stringLen |= uint64(b&0x7F) << shift 7902 if b < 0x80 { 7903 break 7904 } 7905 } 7906 intStringLen := int(stringLen) 7907 if intStringLen < 0 { 7908 return ErrInvalidLengthObjects 7909 } 7910 postIndex := iNdEx + intStringLen 7911 if postIndex < 0 { 7912 return ErrInvalidLengthObjects 7913 } 7914 if postIndex > l { 7915 return io.ErrUnexpectedEOF 7916 } 7917 m.ID = string(dAtA[iNdEx:postIndex]) 7918 iNdEx = postIndex 7919 case 2: 7920 if wireType != 2 { 7921 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 7922 } 7923 var msglen int 7924 for shift := uint(0); ; shift += 7 { 7925 if shift >= 64 { 7926 return ErrIntOverflowObjects 7927 } 7928 if iNdEx >= l { 7929 return io.ErrUnexpectedEOF 7930 } 7931 b := dAtA[iNdEx] 7932 iNdEx++ 7933 msglen |= int(b&0x7F) << shift 7934 if b < 0x80 { 7935 break 7936 } 7937 } 7938 if msglen < 0 { 7939 return ErrInvalidLengthObjects 7940 } 7941 postIndex := iNdEx + msglen 7942 if postIndex < 0 { 7943 return ErrInvalidLengthObjects 7944 } 7945 if postIndex > l { 7946 return io.ErrUnexpectedEOF 7947 } 7948 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7949 return err 7950 } 7951 iNdEx = postIndex 7952 case 3: 7953 if wireType != 2 { 7954 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 7955 } 7956 var msglen int 7957 for shift := uint(0); ; shift += 7 { 7958 if shift >= 64 { 7959 return ErrIntOverflowObjects 7960 } 7961 if iNdEx >= l { 7962 return io.ErrUnexpectedEOF 7963 } 7964 b := dAtA[iNdEx] 7965 iNdEx++ 7966 msglen |= int(b&0x7F) << shift 7967 if b < 0x80 { 7968 break 7969 } 7970 } 7971 if msglen < 0 { 7972 return ErrInvalidLengthObjects 7973 } 7974 postIndex := iNdEx + msglen 7975 if postIndex < 0 { 7976 return ErrInvalidLengthObjects 7977 } 7978 if postIndex > l { 7979 return io.ErrUnexpectedEOF 7980 } 7981 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 7982 return err 7983 } 7984 iNdEx = postIndex 7985 case 4: 7986 if wireType != 2 { 7987 return fmt.Errorf("proto: wrong wireType = %d for field RootCA", wireType) 7988 } 7989 var msglen int 7990 for shift := uint(0); ; shift += 7 { 7991 if shift >= 64 { 7992 return ErrIntOverflowObjects 7993 } 7994 if iNdEx >= l { 7995 return io.ErrUnexpectedEOF 7996 } 7997 b := dAtA[iNdEx] 7998 iNdEx++ 7999 msglen |= int(b&0x7F) << shift 8000 if b < 0x80 { 8001 break 8002 } 8003 } 8004 if msglen < 0 { 8005 return ErrInvalidLengthObjects 8006 } 8007 postIndex := iNdEx + msglen 8008 if postIndex < 0 { 8009 return ErrInvalidLengthObjects 8010 } 8011 if postIndex > l { 8012 return io.ErrUnexpectedEOF 8013 } 8014 if err := m.RootCA.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8015 return err 8016 } 8017 iNdEx = postIndex 8018 case 5: 8019 if wireType != 2 { 8020 return fmt.Errorf("proto: wrong wireType = %d for field NetworkBootstrapKeys", wireType) 8021 } 8022 var msglen int 8023 for shift := uint(0); ; shift += 7 { 8024 if shift >= 64 { 8025 return ErrIntOverflowObjects 8026 } 8027 if iNdEx >= l { 8028 return io.ErrUnexpectedEOF 8029 } 8030 b := dAtA[iNdEx] 8031 iNdEx++ 8032 msglen |= int(b&0x7F) << shift 8033 if b < 0x80 { 8034 break 8035 } 8036 } 8037 if msglen < 0 { 8038 return ErrInvalidLengthObjects 8039 } 8040 postIndex := iNdEx + msglen 8041 if postIndex < 0 { 8042 return ErrInvalidLengthObjects 8043 } 8044 if postIndex > l { 8045 return io.ErrUnexpectedEOF 8046 } 8047 m.NetworkBootstrapKeys = append(m.NetworkBootstrapKeys, &EncryptionKey{}) 8048 if err := m.NetworkBootstrapKeys[len(m.NetworkBootstrapKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8049 return err 8050 } 8051 iNdEx = postIndex 8052 case 6: 8053 if wireType != 0 { 8054 return fmt.Errorf("proto: wrong wireType = %d for field EncryptionKeyLamportClock", wireType) 8055 } 8056 m.EncryptionKeyLamportClock = 0 8057 for shift := uint(0); ; shift += 7 { 8058 if shift >= 64 { 8059 return ErrIntOverflowObjects 8060 } 8061 if iNdEx >= l { 8062 return io.ErrUnexpectedEOF 8063 } 8064 b := dAtA[iNdEx] 8065 iNdEx++ 8066 m.EncryptionKeyLamportClock |= uint64(b&0x7F) << shift 8067 if b < 0x80 { 8068 break 8069 } 8070 } 8071 case 8: 8072 if wireType != 2 { 8073 return fmt.Errorf("proto: wrong wireType = %d for field BlacklistedCertificates", wireType) 8074 } 8075 var msglen int 8076 for shift := uint(0); ; shift += 7 { 8077 if shift >= 64 { 8078 return ErrIntOverflowObjects 8079 } 8080 if iNdEx >= l { 8081 return io.ErrUnexpectedEOF 8082 } 8083 b := dAtA[iNdEx] 8084 iNdEx++ 8085 msglen |= int(b&0x7F) << shift 8086 if b < 0x80 { 8087 break 8088 } 8089 } 8090 if msglen < 0 { 8091 return ErrInvalidLengthObjects 8092 } 8093 postIndex := iNdEx + msglen 8094 if postIndex < 0 { 8095 return ErrInvalidLengthObjects 8096 } 8097 if postIndex > l { 8098 return io.ErrUnexpectedEOF 8099 } 8100 if m.BlacklistedCertificates == nil { 8101 m.BlacklistedCertificates = make(map[string]*BlacklistedCertificate) 8102 } 8103 var mapkey string 8104 var mapvalue *BlacklistedCertificate 8105 for iNdEx < postIndex { 8106 entryPreIndex := iNdEx 8107 var wire uint64 8108 for shift := uint(0); ; shift += 7 { 8109 if shift >= 64 { 8110 return ErrIntOverflowObjects 8111 } 8112 if iNdEx >= l { 8113 return io.ErrUnexpectedEOF 8114 } 8115 b := dAtA[iNdEx] 8116 iNdEx++ 8117 wire |= uint64(b&0x7F) << shift 8118 if b < 0x80 { 8119 break 8120 } 8121 } 8122 fieldNum := int32(wire >> 3) 8123 if fieldNum == 1 { 8124 var stringLenmapkey uint64 8125 for shift := uint(0); ; shift += 7 { 8126 if shift >= 64 { 8127 return ErrIntOverflowObjects 8128 } 8129 if iNdEx >= l { 8130 return io.ErrUnexpectedEOF 8131 } 8132 b := dAtA[iNdEx] 8133 iNdEx++ 8134 stringLenmapkey |= uint64(b&0x7F) << shift 8135 if b < 0x80 { 8136 break 8137 } 8138 } 8139 intStringLenmapkey := int(stringLenmapkey) 8140 if intStringLenmapkey < 0 { 8141 return ErrInvalidLengthObjects 8142 } 8143 postStringIndexmapkey := iNdEx + intStringLenmapkey 8144 if postStringIndexmapkey < 0 { 8145 return ErrInvalidLengthObjects 8146 } 8147 if postStringIndexmapkey > l { 8148 return io.ErrUnexpectedEOF 8149 } 8150 mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) 8151 iNdEx = postStringIndexmapkey 8152 } else if fieldNum == 2 { 8153 var mapmsglen int 8154 for shift := uint(0); ; shift += 7 { 8155 if shift >= 64 { 8156 return ErrIntOverflowObjects 8157 } 8158 if iNdEx >= l { 8159 return io.ErrUnexpectedEOF 8160 } 8161 b := dAtA[iNdEx] 8162 iNdEx++ 8163 mapmsglen |= int(b&0x7F) << shift 8164 if b < 0x80 { 8165 break 8166 } 8167 } 8168 if mapmsglen < 0 { 8169 return ErrInvalidLengthObjects 8170 } 8171 postmsgIndex := iNdEx + mapmsglen 8172 if postmsgIndex < 0 { 8173 return ErrInvalidLengthObjects 8174 } 8175 if postmsgIndex > l { 8176 return io.ErrUnexpectedEOF 8177 } 8178 mapvalue = &BlacklistedCertificate{} 8179 if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { 8180 return err 8181 } 8182 iNdEx = postmsgIndex 8183 } else { 8184 iNdEx = entryPreIndex 8185 skippy, err := skipObjects(dAtA[iNdEx:]) 8186 if err != nil { 8187 return err 8188 } 8189 if skippy < 0 { 8190 return ErrInvalidLengthObjects 8191 } 8192 if (iNdEx + skippy) > postIndex { 8193 return io.ErrUnexpectedEOF 8194 } 8195 iNdEx += skippy 8196 } 8197 } 8198 m.BlacklistedCertificates[mapkey] = mapvalue 8199 iNdEx = postIndex 8200 case 9: 8201 if wireType != 2 { 8202 return fmt.Errorf("proto: wrong wireType = %d for field UnlockKeys", wireType) 8203 } 8204 var msglen int 8205 for shift := uint(0); ; shift += 7 { 8206 if shift >= 64 { 8207 return ErrIntOverflowObjects 8208 } 8209 if iNdEx >= l { 8210 return io.ErrUnexpectedEOF 8211 } 8212 b := dAtA[iNdEx] 8213 iNdEx++ 8214 msglen |= int(b&0x7F) << shift 8215 if b < 0x80 { 8216 break 8217 } 8218 } 8219 if msglen < 0 { 8220 return ErrInvalidLengthObjects 8221 } 8222 postIndex := iNdEx + msglen 8223 if postIndex < 0 { 8224 return ErrInvalidLengthObjects 8225 } 8226 if postIndex > l { 8227 return io.ErrUnexpectedEOF 8228 } 8229 m.UnlockKeys = append(m.UnlockKeys, &EncryptionKey{}) 8230 if err := m.UnlockKeys[len(m.UnlockKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8231 return err 8232 } 8233 iNdEx = postIndex 8234 case 10: 8235 if wireType != 0 { 8236 return fmt.Errorf("proto: wrong wireType = %d for field FIPS", wireType) 8237 } 8238 var v int 8239 for shift := uint(0); ; shift += 7 { 8240 if shift >= 64 { 8241 return ErrIntOverflowObjects 8242 } 8243 if iNdEx >= l { 8244 return io.ErrUnexpectedEOF 8245 } 8246 b := dAtA[iNdEx] 8247 iNdEx++ 8248 v |= int(b&0x7F) << shift 8249 if b < 0x80 { 8250 break 8251 } 8252 } 8253 m.FIPS = bool(v != 0) 8254 case 11: 8255 if wireType != 2 { 8256 return fmt.Errorf("proto: wrong wireType = %d for field DefaultAddressPool", wireType) 8257 } 8258 var stringLen uint64 8259 for shift := uint(0); ; shift += 7 { 8260 if shift >= 64 { 8261 return ErrIntOverflowObjects 8262 } 8263 if iNdEx >= l { 8264 return io.ErrUnexpectedEOF 8265 } 8266 b := dAtA[iNdEx] 8267 iNdEx++ 8268 stringLen |= uint64(b&0x7F) << shift 8269 if b < 0x80 { 8270 break 8271 } 8272 } 8273 intStringLen := int(stringLen) 8274 if intStringLen < 0 { 8275 return ErrInvalidLengthObjects 8276 } 8277 postIndex := iNdEx + intStringLen 8278 if postIndex < 0 { 8279 return ErrInvalidLengthObjects 8280 } 8281 if postIndex > l { 8282 return io.ErrUnexpectedEOF 8283 } 8284 m.DefaultAddressPool = append(m.DefaultAddressPool, string(dAtA[iNdEx:postIndex])) 8285 iNdEx = postIndex 8286 case 12: 8287 if wireType != 0 { 8288 return fmt.Errorf("proto: wrong wireType = %d for field SubnetSize", wireType) 8289 } 8290 m.SubnetSize = 0 8291 for shift := uint(0); ; shift += 7 { 8292 if shift >= 64 { 8293 return ErrIntOverflowObjects 8294 } 8295 if iNdEx >= l { 8296 return io.ErrUnexpectedEOF 8297 } 8298 b := dAtA[iNdEx] 8299 iNdEx++ 8300 m.SubnetSize |= uint32(b&0x7F) << shift 8301 if b < 0x80 { 8302 break 8303 } 8304 } 8305 case 13: 8306 if wireType != 0 { 8307 return fmt.Errorf("proto: wrong wireType = %d for field VXLANUDPPort", wireType) 8308 } 8309 m.VXLANUDPPort = 0 8310 for shift := uint(0); ; shift += 7 { 8311 if shift >= 64 { 8312 return ErrIntOverflowObjects 8313 } 8314 if iNdEx >= l { 8315 return io.ErrUnexpectedEOF 8316 } 8317 b := dAtA[iNdEx] 8318 iNdEx++ 8319 m.VXLANUDPPort |= uint32(b&0x7F) << shift 8320 if b < 0x80 { 8321 break 8322 } 8323 } 8324 default: 8325 iNdEx = preIndex 8326 skippy, err := skipObjects(dAtA[iNdEx:]) 8327 if err != nil { 8328 return err 8329 } 8330 if skippy < 0 { 8331 return ErrInvalidLengthObjects 8332 } 8333 if (iNdEx + skippy) < 0 { 8334 return ErrInvalidLengthObjects 8335 } 8336 if (iNdEx + skippy) > l { 8337 return io.ErrUnexpectedEOF 8338 } 8339 iNdEx += skippy 8340 } 8341 } 8342 8343 if iNdEx > l { 8344 return io.ErrUnexpectedEOF 8345 } 8346 return nil 8347 } 8348 func (m *Secret) Unmarshal(dAtA []byte) error { 8349 l := len(dAtA) 8350 iNdEx := 0 8351 for iNdEx < l { 8352 preIndex := iNdEx 8353 var wire uint64 8354 for shift := uint(0); ; shift += 7 { 8355 if shift >= 64 { 8356 return ErrIntOverflowObjects 8357 } 8358 if iNdEx >= l { 8359 return io.ErrUnexpectedEOF 8360 } 8361 b := dAtA[iNdEx] 8362 iNdEx++ 8363 wire |= uint64(b&0x7F) << shift 8364 if b < 0x80 { 8365 break 8366 } 8367 } 8368 fieldNum := int32(wire >> 3) 8369 wireType := int(wire & 0x7) 8370 if wireType == 4 { 8371 return fmt.Errorf("proto: Secret: wiretype end group for non-group") 8372 } 8373 if fieldNum <= 0 { 8374 return fmt.Errorf("proto: Secret: illegal tag %d (wire type %d)", fieldNum, wire) 8375 } 8376 switch fieldNum { 8377 case 1: 8378 if wireType != 2 { 8379 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 8380 } 8381 var stringLen uint64 8382 for shift := uint(0); ; shift += 7 { 8383 if shift >= 64 { 8384 return ErrIntOverflowObjects 8385 } 8386 if iNdEx >= l { 8387 return io.ErrUnexpectedEOF 8388 } 8389 b := dAtA[iNdEx] 8390 iNdEx++ 8391 stringLen |= uint64(b&0x7F) << shift 8392 if b < 0x80 { 8393 break 8394 } 8395 } 8396 intStringLen := int(stringLen) 8397 if intStringLen < 0 { 8398 return ErrInvalidLengthObjects 8399 } 8400 postIndex := iNdEx + intStringLen 8401 if postIndex < 0 { 8402 return ErrInvalidLengthObjects 8403 } 8404 if postIndex > l { 8405 return io.ErrUnexpectedEOF 8406 } 8407 m.ID = string(dAtA[iNdEx:postIndex]) 8408 iNdEx = postIndex 8409 case 2: 8410 if wireType != 2 { 8411 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 8412 } 8413 var msglen int 8414 for shift := uint(0); ; shift += 7 { 8415 if shift >= 64 { 8416 return ErrIntOverflowObjects 8417 } 8418 if iNdEx >= l { 8419 return io.ErrUnexpectedEOF 8420 } 8421 b := dAtA[iNdEx] 8422 iNdEx++ 8423 msglen |= int(b&0x7F) << shift 8424 if b < 0x80 { 8425 break 8426 } 8427 } 8428 if msglen < 0 { 8429 return ErrInvalidLengthObjects 8430 } 8431 postIndex := iNdEx + msglen 8432 if postIndex < 0 { 8433 return ErrInvalidLengthObjects 8434 } 8435 if postIndex > l { 8436 return io.ErrUnexpectedEOF 8437 } 8438 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8439 return err 8440 } 8441 iNdEx = postIndex 8442 case 3: 8443 if wireType != 2 { 8444 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 8445 } 8446 var msglen int 8447 for shift := uint(0); ; shift += 7 { 8448 if shift >= 64 { 8449 return ErrIntOverflowObjects 8450 } 8451 if iNdEx >= l { 8452 return io.ErrUnexpectedEOF 8453 } 8454 b := dAtA[iNdEx] 8455 iNdEx++ 8456 msglen |= int(b&0x7F) << shift 8457 if b < 0x80 { 8458 break 8459 } 8460 } 8461 if msglen < 0 { 8462 return ErrInvalidLengthObjects 8463 } 8464 postIndex := iNdEx + msglen 8465 if postIndex < 0 { 8466 return ErrInvalidLengthObjects 8467 } 8468 if postIndex > l { 8469 return io.ErrUnexpectedEOF 8470 } 8471 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8472 return err 8473 } 8474 iNdEx = postIndex 8475 case 4: 8476 if wireType != 0 { 8477 return fmt.Errorf("proto: wrong wireType = %d for field Internal", wireType) 8478 } 8479 var v int 8480 for shift := uint(0); ; shift += 7 { 8481 if shift >= 64 { 8482 return ErrIntOverflowObjects 8483 } 8484 if iNdEx >= l { 8485 return io.ErrUnexpectedEOF 8486 } 8487 b := dAtA[iNdEx] 8488 iNdEx++ 8489 v |= int(b&0x7F) << shift 8490 if b < 0x80 { 8491 break 8492 } 8493 } 8494 m.Internal = bool(v != 0) 8495 default: 8496 iNdEx = preIndex 8497 skippy, err := skipObjects(dAtA[iNdEx:]) 8498 if err != nil { 8499 return err 8500 } 8501 if skippy < 0 { 8502 return ErrInvalidLengthObjects 8503 } 8504 if (iNdEx + skippy) < 0 { 8505 return ErrInvalidLengthObjects 8506 } 8507 if (iNdEx + skippy) > l { 8508 return io.ErrUnexpectedEOF 8509 } 8510 iNdEx += skippy 8511 } 8512 } 8513 8514 if iNdEx > l { 8515 return io.ErrUnexpectedEOF 8516 } 8517 return nil 8518 } 8519 func (m *Config) Unmarshal(dAtA []byte) error { 8520 l := len(dAtA) 8521 iNdEx := 0 8522 for iNdEx < l { 8523 preIndex := iNdEx 8524 var wire uint64 8525 for shift := uint(0); ; shift += 7 { 8526 if shift >= 64 { 8527 return ErrIntOverflowObjects 8528 } 8529 if iNdEx >= l { 8530 return io.ErrUnexpectedEOF 8531 } 8532 b := dAtA[iNdEx] 8533 iNdEx++ 8534 wire |= uint64(b&0x7F) << shift 8535 if b < 0x80 { 8536 break 8537 } 8538 } 8539 fieldNum := int32(wire >> 3) 8540 wireType := int(wire & 0x7) 8541 if wireType == 4 { 8542 return fmt.Errorf("proto: Config: wiretype end group for non-group") 8543 } 8544 if fieldNum <= 0 { 8545 return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) 8546 } 8547 switch fieldNum { 8548 case 1: 8549 if wireType != 2 { 8550 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 8551 } 8552 var stringLen uint64 8553 for shift := uint(0); ; shift += 7 { 8554 if shift >= 64 { 8555 return ErrIntOverflowObjects 8556 } 8557 if iNdEx >= l { 8558 return io.ErrUnexpectedEOF 8559 } 8560 b := dAtA[iNdEx] 8561 iNdEx++ 8562 stringLen |= uint64(b&0x7F) << shift 8563 if b < 0x80 { 8564 break 8565 } 8566 } 8567 intStringLen := int(stringLen) 8568 if intStringLen < 0 { 8569 return ErrInvalidLengthObjects 8570 } 8571 postIndex := iNdEx + intStringLen 8572 if postIndex < 0 { 8573 return ErrInvalidLengthObjects 8574 } 8575 if postIndex > l { 8576 return io.ErrUnexpectedEOF 8577 } 8578 m.ID = string(dAtA[iNdEx:postIndex]) 8579 iNdEx = postIndex 8580 case 2: 8581 if wireType != 2 { 8582 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 8583 } 8584 var msglen int 8585 for shift := uint(0); ; shift += 7 { 8586 if shift >= 64 { 8587 return ErrIntOverflowObjects 8588 } 8589 if iNdEx >= l { 8590 return io.ErrUnexpectedEOF 8591 } 8592 b := dAtA[iNdEx] 8593 iNdEx++ 8594 msglen |= int(b&0x7F) << shift 8595 if b < 0x80 { 8596 break 8597 } 8598 } 8599 if msglen < 0 { 8600 return ErrInvalidLengthObjects 8601 } 8602 postIndex := iNdEx + msglen 8603 if postIndex < 0 { 8604 return ErrInvalidLengthObjects 8605 } 8606 if postIndex > l { 8607 return io.ErrUnexpectedEOF 8608 } 8609 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8610 return err 8611 } 8612 iNdEx = postIndex 8613 case 3: 8614 if wireType != 2 { 8615 return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) 8616 } 8617 var msglen int 8618 for shift := uint(0); ; shift += 7 { 8619 if shift >= 64 { 8620 return ErrIntOverflowObjects 8621 } 8622 if iNdEx >= l { 8623 return io.ErrUnexpectedEOF 8624 } 8625 b := dAtA[iNdEx] 8626 iNdEx++ 8627 msglen |= int(b&0x7F) << shift 8628 if b < 0x80 { 8629 break 8630 } 8631 } 8632 if msglen < 0 { 8633 return ErrInvalidLengthObjects 8634 } 8635 postIndex := iNdEx + msglen 8636 if postIndex < 0 { 8637 return ErrInvalidLengthObjects 8638 } 8639 if postIndex > l { 8640 return io.ErrUnexpectedEOF 8641 } 8642 if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8643 return err 8644 } 8645 iNdEx = postIndex 8646 default: 8647 iNdEx = preIndex 8648 skippy, err := skipObjects(dAtA[iNdEx:]) 8649 if err != nil { 8650 return err 8651 } 8652 if skippy < 0 { 8653 return ErrInvalidLengthObjects 8654 } 8655 if (iNdEx + skippy) < 0 { 8656 return ErrInvalidLengthObjects 8657 } 8658 if (iNdEx + skippy) > l { 8659 return io.ErrUnexpectedEOF 8660 } 8661 iNdEx += skippy 8662 } 8663 } 8664 8665 if iNdEx > l { 8666 return io.ErrUnexpectedEOF 8667 } 8668 return nil 8669 } 8670 func (m *Resource) Unmarshal(dAtA []byte) error { 8671 l := len(dAtA) 8672 iNdEx := 0 8673 for iNdEx < l { 8674 preIndex := iNdEx 8675 var wire uint64 8676 for shift := uint(0); ; shift += 7 { 8677 if shift >= 64 { 8678 return ErrIntOverflowObjects 8679 } 8680 if iNdEx >= l { 8681 return io.ErrUnexpectedEOF 8682 } 8683 b := dAtA[iNdEx] 8684 iNdEx++ 8685 wire |= uint64(b&0x7F) << shift 8686 if b < 0x80 { 8687 break 8688 } 8689 } 8690 fieldNum := int32(wire >> 3) 8691 wireType := int(wire & 0x7) 8692 if wireType == 4 { 8693 return fmt.Errorf("proto: Resource: wiretype end group for non-group") 8694 } 8695 if fieldNum <= 0 { 8696 return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) 8697 } 8698 switch fieldNum { 8699 case 1: 8700 if wireType != 2 { 8701 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 8702 } 8703 var stringLen uint64 8704 for shift := uint(0); ; shift += 7 { 8705 if shift >= 64 { 8706 return ErrIntOverflowObjects 8707 } 8708 if iNdEx >= l { 8709 return io.ErrUnexpectedEOF 8710 } 8711 b := dAtA[iNdEx] 8712 iNdEx++ 8713 stringLen |= uint64(b&0x7F) << shift 8714 if b < 0x80 { 8715 break 8716 } 8717 } 8718 intStringLen := int(stringLen) 8719 if intStringLen < 0 { 8720 return ErrInvalidLengthObjects 8721 } 8722 postIndex := iNdEx + intStringLen 8723 if postIndex < 0 { 8724 return ErrInvalidLengthObjects 8725 } 8726 if postIndex > l { 8727 return io.ErrUnexpectedEOF 8728 } 8729 m.ID = string(dAtA[iNdEx:postIndex]) 8730 iNdEx = postIndex 8731 case 2: 8732 if wireType != 2 { 8733 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 8734 } 8735 var msglen int 8736 for shift := uint(0); ; shift += 7 { 8737 if shift >= 64 { 8738 return ErrIntOverflowObjects 8739 } 8740 if iNdEx >= l { 8741 return io.ErrUnexpectedEOF 8742 } 8743 b := dAtA[iNdEx] 8744 iNdEx++ 8745 msglen |= int(b&0x7F) << shift 8746 if b < 0x80 { 8747 break 8748 } 8749 } 8750 if msglen < 0 { 8751 return ErrInvalidLengthObjects 8752 } 8753 postIndex := iNdEx + msglen 8754 if postIndex < 0 { 8755 return ErrInvalidLengthObjects 8756 } 8757 if postIndex > l { 8758 return io.ErrUnexpectedEOF 8759 } 8760 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8761 return err 8762 } 8763 iNdEx = postIndex 8764 case 3: 8765 if wireType != 2 { 8766 return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) 8767 } 8768 var msglen int 8769 for shift := uint(0); ; shift += 7 { 8770 if shift >= 64 { 8771 return ErrIntOverflowObjects 8772 } 8773 if iNdEx >= l { 8774 return io.ErrUnexpectedEOF 8775 } 8776 b := dAtA[iNdEx] 8777 iNdEx++ 8778 msglen |= int(b&0x7F) << shift 8779 if b < 0x80 { 8780 break 8781 } 8782 } 8783 if msglen < 0 { 8784 return ErrInvalidLengthObjects 8785 } 8786 postIndex := iNdEx + msglen 8787 if postIndex < 0 { 8788 return ErrInvalidLengthObjects 8789 } 8790 if postIndex > l { 8791 return io.ErrUnexpectedEOF 8792 } 8793 if err := m.Annotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8794 return err 8795 } 8796 iNdEx = postIndex 8797 case 4: 8798 if wireType != 2 { 8799 return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) 8800 } 8801 var stringLen uint64 8802 for shift := uint(0); ; shift += 7 { 8803 if shift >= 64 { 8804 return ErrIntOverflowObjects 8805 } 8806 if iNdEx >= l { 8807 return io.ErrUnexpectedEOF 8808 } 8809 b := dAtA[iNdEx] 8810 iNdEx++ 8811 stringLen |= uint64(b&0x7F) << shift 8812 if b < 0x80 { 8813 break 8814 } 8815 } 8816 intStringLen := int(stringLen) 8817 if intStringLen < 0 { 8818 return ErrInvalidLengthObjects 8819 } 8820 postIndex := iNdEx + intStringLen 8821 if postIndex < 0 { 8822 return ErrInvalidLengthObjects 8823 } 8824 if postIndex > l { 8825 return io.ErrUnexpectedEOF 8826 } 8827 m.Kind = string(dAtA[iNdEx:postIndex]) 8828 iNdEx = postIndex 8829 case 5: 8830 if wireType != 2 { 8831 return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) 8832 } 8833 var msglen int 8834 for shift := uint(0); ; shift += 7 { 8835 if shift >= 64 { 8836 return ErrIntOverflowObjects 8837 } 8838 if iNdEx >= l { 8839 return io.ErrUnexpectedEOF 8840 } 8841 b := dAtA[iNdEx] 8842 iNdEx++ 8843 msglen |= int(b&0x7F) << shift 8844 if b < 0x80 { 8845 break 8846 } 8847 } 8848 if msglen < 0 { 8849 return ErrInvalidLengthObjects 8850 } 8851 postIndex := iNdEx + msglen 8852 if postIndex < 0 { 8853 return ErrInvalidLengthObjects 8854 } 8855 if postIndex > l { 8856 return io.ErrUnexpectedEOF 8857 } 8858 if m.Payload == nil { 8859 m.Payload = &types.Any{} 8860 } 8861 if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8862 return err 8863 } 8864 iNdEx = postIndex 8865 default: 8866 iNdEx = preIndex 8867 skippy, err := skipObjects(dAtA[iNdEx:]) 8868 if err != nil { 8869 return err 8870 } 8871 if skippy < 0 { 8872 return ErrInvalidLengthObjects 8873 } 8874 if (iNdEx + skippy) < 0 { 8875 return ErrInvalidLengthObjects 8876 } 8877 if (iNdEx + skippy) > l { 8878 return io.ErrUnexpectedEOF 8879 } 8880 iNdEx += skippy 8881 } 8882 } 8883 8884 if iNdEx > l { 8885 return io.ErrUnexpectedEOF 8886 } 8887 return nil 8888 } 8889 func (m *Extension) Unmarshal(dAtA []byte) error { 8890 l := len(dAtA) 8891 iNdEx := 0 8892 for iNdEx < l { 8893 preIndex := iNdEx 8894 var wire uint64 8895 for shift := uint(0); ; shift += 7 { 8896 if shift >= 64 { 8897 return ErrIntOverflowObjects 8898 } 8899 if iNdEx >= l { 8900 return io.ErrUnexpectedEOF 8901 } 8902 b := dAtA[iNdEx] 8903 iNdEx++ 8904 wire |= uint64(b&0x7F) << shift 8905 if b < 0x80 { 8906 break 8907 } 8908 } 8909 fieldNum := int32(wire >> 3) 8910 wireType := int(wire & 0x7) 8911 if wireType == 4 { 8912 return fmt.Errorf("proto: Extension: wiretype end group for non-group") 8913 } 8914 if fieldNum <= 0 { 8915 return fmt.Errorf("proto: Extension: illegal tag %d (wire type %d)", fieldNum, wire) 8916 } 8917 switch fieldNum { 8918 case 1: 8919 if wireType != 2 { 8920 return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) 8921 } 8922 var stringLen uint64 8923 for shift := uint(0); ; shift += 7 { 8924 if shift >= 64 { 8925 return ErrIntOverflowObjects 8926 } 8927 if iNdEx >= l { 8928 return io.ErrUnexpectedEOF 8929 } 8930 b := dAtA[iNdEx] 8931 iNdEx++ 8932 stringLen |= uint64(b&0x7F) << shift 8933 if b < 0x80 { 8934 break 8935 } 8936 } 8937 intStringLen := int(stringLen) 8938 if intStringLen < 0 { 8939 return ErrInvalidLengthObjects 8940 } 8941 postIndex := iNdEx + intStringLen 8942 if postIndex < 0 { 8943 return ErrInvalidLengthObjects 8944 } 8945 if postIndex > l { 8946 return io.ErrUnexpectedEOF 8947 } 8948 m.ID = string(dAtA[iNdEx:postIndex]) 8949 iNdEx = postIndex 8950 case 2: 8951 if wireType != 2 { 8952 return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) 8953 } 8954 var msglen int 8955 for shift := uint(0); ; shift += 7 { 8956 if shift >= 64 { 8957 return ErrIntOverflowObjects 8958 } 8959 if iNdEx >= l { 8960 return io.ErrUnexpectedEOF 8961 } 8962 b := dAtA[iNdEx] 8963 iNdEx++ 8964 msglen |= int(b&0x7F) << shift 8965 if b < 0x80 { 8966 break 8967 } 8968 } 8969 if msglen < 0 { 8970 return ErrInvalidLengthObjects 8971 } 8972 postIndex := iNdEx + msglen 8973 if postIndex < 0 { 8974 return ErrInvalidLengthObjects 8975 } 8976 if postIndex > l { 8977 return io.ErrUnexpectedEOF 8978 } 8979 if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 8980 return err 8981 } 8982 iNdEx = postIndex 8983 case 3: 8984 if wireType != 2 { 8985 return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) 8986 } 8987 var msglen int 8988 for shift := uint(0); ; shift += 7 { 8989 if shift >= 64 { 8990 return ErrIntOverflowObjects 8991 } 8992 if iNdEx >= l { 8993 return io.ErrUnexpectedEOF 8994 } 8995 b := dAtA[iNdEx] 8996 iNdEx++ 8997 msglen |= int(b&0x7F) << shift 8998 if b < 0x80 { 8999 break 9000 } 9001 } 9002 if msglen < 0 { 9003 return ErrInvalidLengthObjects 9004 } 9005 postIndex := iNdEx + msglen 9006 if postIndex < 0 { 9007 return ErrInvalidLengthObjects 9008 } 9009 if postIndex > l { 9010 return io.ErrUnexpectedEOF 9011 } 9012 if err := m.Annotations.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 9013 return err 9014 } 9015 iNdEx = postIndex 9016 case 4: 9017 if wireType != 2 { 9018 return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) 9019 } 9020 var stringLen uint64 9021 for shift := uint(0); ; shift += 7 { 9022 if shift >= 64 { 9023 return ErrIntOverflowObjects 9024 } 9025 if iNdEx >= l { 9026 return io.ErrUnexpectedEOF 9027 } 9028 b := dAtA[iNdEx] 9029 iNdEx++ 9030 stringLen |= uint64(b&0x7F) << shift 9031 if b < 0x80 { 9032 break 9033 } 9034 } 9035 intStringLen := int(stringLen) 9036 if intStringLen < 0 { 9037 return ErrInvalidLengthObjects 9038 } 9039 postIndex := iNdEx + intStringLen 9040 if postIndex < 0 { 9041 return ErrInvalidLengthObjects 9042 } 9043 if postIndex > l { 9044 return io.ErrUnexpectedEOF 9045 } 9046 m.Description = string(dAtA[iNdEx:postIndex]) 9047 iNdEx = postIndex 9048 default: 9049 iNdEx = preIndex 9050 skippy, err := skipObjects(dAtA[iNdEx:]) 9051 if err != nil { 9052 return err 9053 } 9054 if skippy < 0 { 9055 return ErrInvalidLengthObjects 9056 } 9057 if (iNdEx + skippy) < 0 { 9058 return ErrInvalidLengthObjects 9059 } 9060 if (iNdEx + skippy) > l { 9061 return io.ErrUnexpectedEOF 9062 } 9063 iNdEx += skippy 9064 } 9065 } 9066 9067 if iNdEx > l { 9068 return io.ErrUnexpectedEOF 9069 } 9070 return nil 9071 } 9072 func skipObjects(dAtA []byte) (n int, err error) { 9073 l := len(dAtA) 9074 iNdEx := 0 9075 for iNdEx < l { 9076 var wire uint64 9077 for shift := uint(0); ; shift += 7 { 9078 if shift >= 64 { 9079 return 0, ErrIntOverflowObjects 9080 } 9081 if iNdEx >= l { 9082 return 0, io.ErrUnexpectedEOF 9083 } 9084 b := dAtA[iNdEx] 9085 iNdEx++ 9086 wire |= (uint64(b) & 0x7F) << shift 9087 if b < 0x80 { 9088 break 9089 } 9090 } 9091 wireType := int(wire & 0x7) 9092 switch wireType { 9093 case 0: 9094 for shift := uint(0); ; shift += 7 { 9095 if shift >= 64 { 9096 return 0, ErrIntOverflowObjects 9097 } 9098 if iNdEx >= l { 9099 return 0, io.ErrUnexpectedEOF 9100 } 9101 iNdEx++ 9102 if dAtA[iNdEx-1] < 0x80 { 9103 break 9104 } 9105 } 9106 return iNdEx, nil 9107 case 1: 9108 iNdEx += 8 9109 return iNdEx, nil 9110 case 2: 9111 var length int 9112 for shift := uint(0); ; shift += 7 { 9113 if shift >= 64 { 9114 return 0, ErrIntOverflowObjects 9115 } 9116 if iNdEx >= l { 9117 return 0, io.ErrUnexpectedEOF 9118 } 9119 b := dAtA[iNdEx] 9120 iNdEx++ 9121 length |= (int(b) & 0x7F) << shift 9122 if b < 0x80 { 9123 break 9124 } 9125 } 9126 if length < 0 { 9127 return 0, ErrInvalidLengthObjects 9128 } 9129 iNdEx += length 9130 if iNdEx < 0 { 9131 return 0, ErrInvalidLengthObjects 9132 } 9133 return iNdEx, nil 9134 case 3: 9135 for { 9136 var innerWire uint64 9137 var start int = iNdEx 9138 for shift := uint(0); ; shift += 7 { 9139 if shift >= 64 { 9140 return 0, ErrIntOverflowObjects 9141 } 9142 if iNdEx >= l { 9143 return 0, io.ErrUnexpectedEOF 9144 } 9145 b := dAtA[iNdEx] 9146 iNdEx++ 9147 innerWire |= (uint64(b) & 0x7F) << shift 9148 if b < 0x80 { 9149 break 9150 } 9151 } 9152 innerWireType := int(innerWire & 0x7) 9153 if innerWireType == 4 { 9154 break 9155 } 9156 next, err := skipObjects(dAtA[start:]) 9157 if err != nil { 9158 return 0, err 9159 } 9160 iNdEx = start + next 9161 if iNdEx < 0 { 9162 return 0, ErrInvalidLengthObjects 9163 } 9164 } 9165 return iNdEx, nil 9166 case 4: 9167 return iNdEx, nil 9168 case 5: 9169 iNdEx += 4 9170 return iNdEx, nil 9171 default: 9172 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 9173 } 9174 } 9175 panic("unreachable") 9176 } 9177 9178 var ( 9179 ErrInvalidLengthObjects = fmt.Errorf("proto: negative length found during unmarshaling") 9180 ErrIntOverflowObjects = fmt.Errorf("proto: integer overflow") 9181 )