github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/libnetwork/api/types.go (about) 1 package api 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 Endpoints []*endpointResource `json:"endpoints"` 15 } 16 17 // endpointResource is the body of the "get endpoint" http response message 18 type endpointResource 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 35 type ipamConf struct { 36 PreferredPool string 37 SubPool string 38 Gateway string 39 AuxAddresses map[string]string 40 } 41 42 // networkCreate is the expected body of the "create network" http request message 43 type networkCreate struct { 44 Name string `json:"name"` 45 ID string `json:"id"` 46 NetworkType string `json:"network_type"` 47 IPv4Conf []ipamConf `json:"ipv4_configuration"` 48 DriverOpts map[string]string `json:"driver_opts"` 49 NetworkOpts map[string]string `json:"network_opts"` 50 } 51 52 // endpointCreate represents the body of the "create endpoint" http request message 53 type endpointCreate struct { 54 Name string `json:"name"` 55 MyAliases []string `json:"my_aliases"` 56 } 57 58 // sandboxCreate is the expected body of the "create sandbox" http request message 59 type sandboxCreate struct { 60 ContainerID string `json:"container_id"` 61 HostName string `json:"host_name"` 62 DomainName string `json:"domain_name"` 63 HostsPath string `json:"hosts_path"` 64 ResolvConfPath string `json:"resolv_conf_path"` 65 DNS []string `json:"dns"` 66 ExtraHosts []extraHost `json:"extra_hosts"` 67 UseDefaultSandbox bool `json:"use_default_sandbox"` 68 UseExternalKey bool `json:"use_external_key"` 69 ExposedPorts []types.TransportPort `json:"exposed_ports"` 70 PortMapping []types.PortBinding `json:"port_mapping"` 71 } 72 73 // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages 74 type endpointJoin struct { 75 SandboxID string `json:"sandbox_id"` 76 Aliases []string `json:"aliases"` 77 } 78 79 // servicePublish represents the body of the "publish service" http request message 80 type servicePublish struct { 81 Name string `json:"name"` 82 MyAliases []string `json:"my_aliases"` 83 Network string `json:"network_name"` 84 } 85 86 // serviceDelete represents the body of the "unpublish service" http request message 87 type serviceDelete struct { 88 Name string `json:"name"` 89 Force bool `json:"force"` 90 } 91 92 // extraHost represents the extra host object 93 type extraHost struct { 94 Name string `json:"name"` 95 Address string `json:"address"` 96 }