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 /// The name of the healthcheck to use with this backend.
35 #[serde(rename = "healthcheck", skip_serializing_if = "Option::is_none")]
36 pub healthcheck: Option<String>,
37 /// The hostname of the backend. May be used as an alternative to `address` to set the backend location.
38 #[serde(rename = "hostname", skip_serializing_if = "Option::is_none")]
39 pub hostname: Option<String>,
40 /// IPv4 address of the backend. May be used as an alternative to `address` to set the backend location.
41 #[serde(rename = "ipv4", skip_serializing_if = "Option::is_none")]
42 pub ipv4: Option<String>,
43 /// IPv6 address of the backend. May be used as an alternative to `address` to set the backend location.
44 #[serde(rename = "ipv6", skip_serializing_if = "Option::is_none")]
45 pub ipv6: Option<String>,
46 /// How long in seconds to keep a persistent connection to the backend between requests. By default, Varnish keeps connections open as long as it can.
47 #[serde(rename = "keepalive_time", skip_serializing_if = "Option::is_none")]
48 pub keepalive_time: Option<i32>,
49 /// Maximum number of concurrent connections this backend will accept.
50 #[serde(rename = "max_conn", skip_serializing_if = "Option::is_none")]
51 pub max_conn: Option<i32>,
52 /// 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.
53 #[serde(rename = "max_tls_version", skip_serializing_if = "Option::is_none")]
54 pub max_tls_version: Option<String>,
55 /// 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.
56 #[serde(rename = "min_tls_version", skip_serializing_if = "Option::is_none")]
57 pub min_tls_version: Option<String>,
58 /// The name of the backend.
59 #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
60 pub name: Option<String>,
61 /// 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.
62 #[serde(rename = "override_host", skip_serializing_if = "Option::is_none")]
63 pub override_host: Option<String>,
64 /// 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.
65 #[serde(rename = "port", skip_serializing_if = "Option::is_none")]
66 pub port: Option<i32>,
67 /// Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.
68 #[serde(rename = "prefer_ipv6", skip_serializing_if = "Option::is_none")]
69 pub prefer_ipv6: Option<bool>,
70 /// 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.
71 #[serde(rename = "request_condition", skip_serializing_if = "Option::is_none")]
72 pub request_condition: Option<String>,
73 /// Value that when shared across backends will enable those backends to share the same health check.
74 #[serde(rename = "share_key", skip_serializing_if = "Option::is_none")]
75 pub share_key: Option<String>,
76 /// Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).
77 #[serde(rename = "shield", skip_serializing_if = "Option::is_none")]
78 pub shield: Option<String>,
79 /// CA certificate attached to origin.
80 #[serde(rename = "ssl_ca_cert", skip_serializing_if = "Option::is_none")]
81 pub ssl_ca_cert: Option<String>,
82 /// Overrides `ssl_hostname`, but only for cert verification. Does not affect SNI at all.
83 #[serde(rename = "ssl_cert_hostname", skip_serializing_if = "Option::is_none")]
84 pub ssl_cert_hostname: Option<String>,
85 /// Be strict on checking SSL certs.
86 #[serde(rename = "ssl_check_cert", skip_serializing_if = "Option::is_none")]
87 pub ssl_check_cert: Option<bool>,
88 /// 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.
89 #[serde(rename = "ssl_ciphers", skip_serializing_if = "Option::is_none")]
90 pub ssl_ciphers: Option<String>,
91 /// Client certificate attached to origin.
92 #[serde(rename = "ssl_client_cert", skip_serializing_if = "Option::is_none")]
93 pub ssl_client_cert: Option<String>,
94 /// Client key attached to origin.
95 #[serde(rename = "ssl_client_key", skip_serializing_if = "Option::is_none")]
96 pub ssl_client_key: Option<String>,
97 /// Use `ssl_cert_hostname` and `ssl_sni_hostname` to configure certificate validation.
98 #[serde(rename = "ssl_hostname", skip_serializing_if = "Option::is_none")]
99 pub ssl_hostname: Option<String>,
100 /// Overrides `ssl_hostname`, but only for SNI in the handshake. Does not affect cert validation at all.
101 #[serde(rename = "ssl_sni_hostname", skip_serializing_if = "Option::is_none")]
102 pub ssl_sni_hostname: Option<String>,
103 /// Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified.
104 #[serde(rename = "tcp_keepalive_enable", skip_serializing_if = "Option::is_none")]
105 pub tcp_keepalive_enable: Option<bool>,
106 /// Interval in seconds between subsequent keepalive probes.
107 #[serde(rename = "tcp_keepalive_interval", skip_serializing_if = "Option::is_none")]
108 pub tcp_keepalive_interval: Option<i32>,
109 /// Number of unacknowledged probes to send before considering the connection dead.
110 #[serde(rename = "tcp_keepalive_probes", skip_serializing_if = "Option::is_none")]
111 pub tcp_keepalive_probes: Option<i32>,
112 /// Interval in seconds between the last data packet sent and the first keepalive probe.
113 #[serde(rename = "tcp_keepalive_time", skip_serializing_if = "Option::is_none")]
114 pub tcp_keepalive_time: Option<i32>,
115 /// Whether or not to require TLS for connections to this backend.
116 #[serde(rename = "use_ssl", skip_serializing_if = "Option::is_none")]
117 pub use_ssl: Option<bool>,
118 /// 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.
119 #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
120 pub weight: Option<i32>,
121}
122
123impl Backend {
124 pub fn new() -> Backend {
125 Backend {
126 address: None,
127 auto_loadbalance: None,
128 between_bytes_timeout: None,
129 client_cert: None,
130 comment: None,
131 connect_timeout: None,
132 first_byte_timeout: None,
133 healthcheck: None,
134 hostname: None,
135 ipv4: None,
136 ipv6: None,
137 keepalive_time: None,
138 max_conn: None,
139 max_tls_version: None,
140 min_tls_version: None,
141 name: None,
142 override_host: None,
143 port: None,
144 prefer_ipv6: None,
145 request_condition: None,
146 share_key: None,
147 shield: None,
148 ssl_ca_cert: None,
149 ssl_cert_hostname: None,
150 ssl_check_cert: None,
151 ssl_ciphers: None,
152 ssl_client_cert: None,
153 ssl_client_key: None,
154 ssl_hostname: None,
155 ssl_sni_hostname: None,
156 tcp_keepalive_enable: None,
157 tcp_keepalive_interval: None,
158 tcp_keepalive_probes: None,
159 tcp_keepalive_time: None,
160 use_ssl: None,
161 weight: None,
162 }
163 }
164}
165
166