Skip to main content

fastly_api/models/
backend.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8
9
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct Backend {
13    /// A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend.
14    #[serde(rename = "address", skip_serializing_if = "Option::is_none")]
15    pub address: Option<String>,
16    /// Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.
17    #[serde(rename = "auto_loadbalance", skip_serializing_if = "Option::is_none")]
18    pub auto_loadbalance: Option<bool>,
19    /// Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`.
20    #[serde(rename = "between_bytes_timeout", skip_serializing_if = "Option::is_none")]
21    pub between_bytes_timeout: Option<i32>,
22    /// Unused.
23    #[serde(rename = "client_cert", skip_serializing_if = "Option::is_none")]
24    pub client_cert: Option<String>,
25    /// A freeform descriptive note.
26    #[serde(rename = "comment", skip_serializing_if = "Option::is_none")]
27    pub comment: Option<String>,
28    /// Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`.
29    #[serde(rename = "connect_timeout", skip_serializing_if = "Option::is_none")]
30    pub connect_timeout: Option<i32>,
31    /// Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`.
32    #[serde(rename = "first_byte_timeout", skip_serializing_if = "Option::is_none")]
33    pub first_byte_timeout: Option<i32>,
34    /// Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.fetch_timeout`.
35    #[serde(rename = "fetch_timeout", skip_serializing_if = "Option::is_none")]
36    pub fetch_timeout: Option<i32>,
37    /// The name of the healthcheck to use with this backend.
38    #[serde(rename = "healthcheck", skip_serializing_if = "Option::is_none")]
39    pub healthcheck: Option<String>,
40    /// The hostname of the backend. May be used as an alternative to `address` to set the backend location.
41    #[serde(rename = "hostname", skip_serializing_if = "Option::is_none")]
42    pub hostname: Option<String>,
43    /// IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.
44    #[serde(rename = "ipv4", skip_serializing_if = "Option::is_none")]
45    pub ipv4: Option<String>,
46    /// IPv6 address of the backend. May be used as an alternative to `address` to set the backend location.
47    #[serde(rename = "ipv6", skip_serializing_if = "Option::is_none")]
48    pub ipv6: Option<String>,
49    /// How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can.
50    #[serde(rename = "keepalive_time", skip_serializing_if = "Option::is_none")]
51    pub keepalive_time: Option<i32>,
52    /// Maximum number of concurrent connections this backend will accept.
53    #[serde(rename = "max_conn", skip_serializing_if = "Option::is_none")]
54    pub max_conn: Option<i32>,
55    /// Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited.
56    #[serde(rename = "max_lifetime", skip_serializing_if = "Option::is_none")]
57    pub max_lifetime: Option<i32>,
58    /// Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
59    #[serde(rename = "max_tls_version", skip_serializing_if = "Option::is_none")]
60    pub max_tls_version: Option<String>,
61    /// Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
62    #[serde(rename = "min_tls_version", skip_serializing_if = "Option::is_none")]
63    pub min_tls_version: Option<String>,
64    /// Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited.
65    #[serde(rename = "max_use", skip_serializing_if = "Option::is_none")]
66    pub max_use: Option<i32>,
67    /// The name of the backend.
68    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
69    pub name: Option<String>,
70    /// If set, will replace the client-supplied HTTP `Host` header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing `bereq.http.Host` in VCL.
71    #[serde(rename = "override_host", skip_serializing_if = "Option::is_none")]
72    pub override_host: Option<String>,
73    /// Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.
74    #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
75    pub port: Option<i32>,
76    /// Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.
77    #[serde(rename = "prefer_ipv6", skip_serializing_if = "Option::is_none")]
78    pub prefer_ipv6: Option<bool>,
79    /// Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.
80    #[serde(rename = "request_condition", skip_serializing_if = "Option::is_none")]
81    pub request_condition: Option<String>,
82    /// Value that when shared across backends will enable those backends to share the same health check.
83    #[serde(rename = "share_key", skip_serializing_if = "Option::is_none")]
84    pub share_key: Option<String>,
85    /// Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).
86    #[serde(rename = "shield", skip_serializing_if = "Option::is_none")]
87    pub shield: Option<String>,
88    /// CA certificate attached to origin.
89    #[serde(rename = "ssl_ca_cert", skip_serializing_if = "Option::is_none")]
90    pub ssl_ca_cert: Option<String>,
91    /// Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all.
92    #[serde(rename = "ssl_cert_hostname", skip_serializing_if = "Option::is_none")]
93    pub ssl_cert_hostname: Option<String>,
94    /// Be strict on checking SSL certs.
95    #[serde(rename = "ssl_check_cert", skip_serializing_if = "Option::is_none")]
96    pub ssl_check_cert: Option<bool>,
97    /// List of [OpenSSL ciphers](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html) to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic `503` error response will be generated.
98    #[serde(rename = "ssl_ciphers", skip_serializing_if = "Option::is_none")]
99    pub ssl_ciphers: Option<String>,
100    /// Client certificate attached to origin.
101    #[serde(rename = "ssl_client_cert", skip_serializing_if = "Option::is_none")]
102    pub ssl_client_cert: Option<String>,
103    /// Client key attached to origin.
104    #[serde(rename = "ssl_client_key", skip_serializing_if = "Option::is_none")]
105    pub ssl_client_key: Option<String>,
106    /// Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation.
107    #[serde(rename = "ssl_hostname", skip_serializing_if = "Option::is_none")]
108    pub ssl_hostname: Option<String>,
109    /// Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all.
110    #[serde(rename = "ssl_sni_hostname", skip_serializing_if = "Option::is_none")]
111    pub ssl_sni_hostname: Option<String>,
112    /// Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified.
113    #[serde(rename = "tcp_keepalive_enable", skip_serializing_if = "Option::is_none")]
114    pub tcp_keepalive_enable: Option<bool>,
115    /// Interval in seconds between subsequent keepalive probes.
116    #[serde(rename = "tcp_keepalive_interval", skip_serializing_if = "Option::is_none")]
117    pub tcp_keepalive_interval: Option<i32>,
118    /// Number of unacknowledged probes to send before considering the connection dead.
119    #[serde(rename = "tcp_keepalive_probes", skip_serializing_if = "Option::is_none")]
120    pub tcp_keepalive_probes: Option<i32>,
121    /// Interval in seconds between the last data packet sent and the first keepalive probe.
122    #[serde(rename = "tcp_keepalive_time", skip_serializing_if = "Option::is_none")]
123    pub tcp_keepalive_time: Option<i32>,
124    /// Whether or not to require TLS for connections to this backend.
125    #[serde(rename = "use_ssl", skip_serializing_if = "Option::is_none")]
126    pub use_ssl: Option<bool>,
127    /// Weight used to load balance this backend against others. May be any positive integer. If `auto_loadbalance` is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have `auto_loadbalance` set to true.
128    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
129    pub weight: Option<i32>,
130}
131
132impl Backend {
133    pub fn new() -> Backend {
134        Backend {
135            address: None,
136            auto_loadbalance: None,
137            between_bytes_timeout: None,
138            client_cert: None,
139            comment: None,
140            connect_timeout: None,
141            first_byte_timeout: None,
142            fetch_timeout: None,
143            healthcheck: None,
144            hostname: None,
145            ipv4: None,
146            ipv6: None,
147            keepalive_time: None,
148            max_conn: None,
149            max_lifetime: None,
150            max_tls_version: None,
151            min_tls_version: None,
152            max_use: None,
153            name: None,
154            override_host: None,
155            port: None,
156            prefer_ipv6: None,
157            request_condition: None,
158            share_key: None,
159            shield: None,
160            ssl_ca_cert: None,
161            ssl_cert_hostname: None,
162            ssl_check_cert: None,
163            ssl_ciphers: None,
164            ssl_client_cert: None,
165            ssl_client_key: None,
166            ssl_hostname: None,
167            ssl_sni_hostname: None,
168            tcp_keepalive_enable: None,
169            tcp_keepalive_interval: None,
170            tcp_keepalive_probes: None,
171            tcp_keepalive_time: None,
172            use_ssl: None,
173            weight: None,
174        }
175    }
176}
177
178