github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/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  
    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  // serviceCreate represents the body of the "publish service" http request message
    53  type serviceCreate struct {
    54  	Name      string   `json:"name"`
    55  	MyAliases []string `json:"my_aliases"`
    56  	Network   string   `json:"network_name"`
    57  }
    58  
    59  // serviceDelete represents the body of the "unpublish service" http request message
    60  type serviceDelete struct {
    61  	Name  string `json:"name"`
    62  	Force bool   `json:"force"`
    63  }
    64  
    65  // serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages
    66  type serviceAttach struct {
    67  	SandboxID string   `json:"sandbox_id"`
    68  	Aliases   []string `json:"aliases"`
    69  }
    70  
    71  // SandboxCreate is the body of the "post /sandboxes" http request message
    72  type SandboxCreate struct {
    73  	ContainerID       string                `json:"container_id"`
    74  	HostName          string                `json:"host_name"`
    75  	DomainName        string                `json:"domain_name"`
    76  	HostsPath         string                `json:"hosts_path"`
    77  	ResolvConfPath    string                `json:"resolv_conf_path"`
    78  	DNS               []string              `json:"dns"`
    79  	ExtraHosts        []extraHost           `json:"extra_hosts"`
    80  	UseDefaultSandbox bool                  `json:"use_default_sandbox"`
    81  	ExposedPorts      []types.TransportPort `json:"exposed_ports"`
    82  	PortMapping       []types.PortBinding   `json:"port_mapping"`
    83  }
    84  
    85  // extraHost represents the extra host object
    86  type extraHost struct {
    87  	Name    string `json:"name"`
    88  	Address string `json:"address"`
    89  }
    90  
    91  // sandboxParentUpdate is the object carrying the information about the
    92  // sandbox parent that needs to be updated.
    93  type sandboxParentUpdate struct {
    94  	ContainerID string `json:"container_id"`
    95  	Name        string `json:"name"`
    96  	Address     string `json:"address"`
    97  }