podman_rest_client/v5/models/port_mapping.rs
1use serde::{Deserialize, Serialize};
2#[derive(Default, Debug, Serialize, Deserialize)]
3/// PortMapping is one or more ports that will be mapped into the container.
4pub struct PortMapping {
5 /// ContainerPort is the port number that will be exposed from the
6 /// container.
7 /// Mandatory.
8 pub container_port: Option<u16>,
9 /// HostIP is the IP that we will bind to on the host.
10 /// If unset, assumed to be 0.0.0.0 (all interfaces).
11 pub host_ip: Option<String>,
12 /// HostPort is the port number that will be forwarded from the host into
13 /// the container.
14 /// If omitted, a random port on the host (guaranteed to be over 1024)
15 /// will be assigned.
16 pub host_port: Option<u16>,
17 /// Protocol is the protocol forward.
18 /// Must be either "tcp", "udp", and "sctp", or some combination of these
19 /// separated by commas.
20 /// If unset, assumed to be TCP.
21 pub protocol: Option<String>,
22 /// Range is the number of ports that will be forwarded, starting at
23 /// HostPort and ContainerPort and counting up.
24 /// This is 1-indexed, so 1 is assumed to be a single port (only the
25 /// Hostport:Containerport mapping will be added), 2 is two ports (both
26 /// Hostport:Containerport and Hostport+1:Containerport+1), etc.
27 /// If unset, assumed to be 1 (a single port).
28 /// Both hostport + range and containerport + range must be less than
29 /// 65536.
30 pub range: Option<u16>,
31}