github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/libnetwork/client/types.go (about) 1 package client 2 3 import "github.com/docker/libnetwork/types" 4 5 /*********** 6 Resources 7 ************/ 8 9 // networkResource is the body of the "get network" http response message 10 type networkResource struct { 11 Name string `json:"name"` 12 ID string `json:"id"` 13 Type string `json:"type"` 14 Services []*serviceResource `json:"services"` 15 } 16 17 // serviceResource is the body of the "get service" http response message 18 type serviceResource struct { 19 Name string `json:"name"` 20 ID string `json:"id"` 21 Network string `json:"network"` 22 } 23 24 // SandboxResource is the body of "get service backend" response message 25 type SandboxResource struct { 26 ID string `json:"id"` 27 Key string `json:"key"` 28 ContainerID string `json:"container_id"` 29 } 30 31 /*********** 32 Body types 33 ************/ 34 type ipamConf struct { 35 PreferredPool string 36 SubPool string 37 Gateway string 38 AuxAddresses map[string]string 39 } 40 41 // networkCreate is the expected body of the "create network" http request message 42 type networkCreate struct { 43 Name string `json:"name"` 44 ID string `json:"id"` 45 NetworkType string `json:"network_type"` 46 IPv4Conf []ipamConf `json:"ipv4_configuration"` 47 DriverOpts map[string]string `json:"driver_opts"` 48 NetworkOpts map[string]string `json:"network_opts"` 49 } 50 51 // serviceCreate represents the body of the "publish service" http request message 52 type serviceCreate struct { 53 Name string `json:"name"` 54 MyAliases []string `json:"my_aliases"` 55 Network string `json:"network_name"` 56 } 57 58 // serviceDelete represents the body of the "unpublish service" http request message 59 type serviceDelete struct { 60 Name string `json:"name"` 61 Force bool `json:"force"` 62 } 63 64 // serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages 65 type serviceAttach struct { 66 SandboxID string `json:"sandbox_id"` 67 Aliases []string `json:"aliases"` 68 } 69 70 // SandboxCreate is the body of the "post /sandboxes" http request message 71 type SandboxCreate struct { 72 ContainerID string `json:"container_id"` 73 HostName string `json:"host_name"` 74 DomainName string `json:"domain_name"` 75 HostsPath string `json:"hosts_path"` 76 ResolvConfPath string `json:"resolv_conf_path"` 77 DNS []string `json:"dns"` 78 ExtraHosts []extraHost `json:"extra_hosts"` 79 UseDefaultSandbox bool `json:"use_default_sandbox"` 80 ExposedPorts []types.TransportPort `json:"exposed_ports"` 81 PortMapping []types.PortBinding `json:"port_mapping"` 82 } 83 84 // extraHost represents the extra host object 85 type extraHost struct { 86 Name string `json:"name"` 87 Address string `json:"address"` 88 } 89 90 // sandboxParentUpdate is the object carrying the information about the 91 // sandbox parent that needs to be updated. 92 type sandboxParentUpdate struct { 93 ContainerID string `json:"container_id"` 94 Name string `json:"name"` 95 Address string `json:"address"` 96 }