fastly_api/apis/
tls_subscriptions_api.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
9use reqwest;
10
11use crate::apis::ResponseContent;
12use super::{Error, configuration};
13
14/// struct for passing parameters to the method [`create_globalsign_email_challenge`]
15#[derive(Clone, Debug, Default)]
16pub struct CreateGlobalsignEmailChallengeParams {
17    /// Alphanumeric string identifying a TLS subscription.
18    pub tls_subscription_id: String,
19    /// Alphanumeric string identifying a TLS subscription.
20    pub tls_authorization_id: String,
21    pub request_body: Option<::std::collections::HashMap<String, serde_json::Value>>
22}
23
24/// struct for passing parameters to the method [`create_tls_sub`]
25#[derive(Clone, Debug, Default)]
26pub struct CreateTlsSubParams {
27    pub tls_subscription: Option<crate::models::TlsSubscription>
28}
29
30/// struct for passing parameters to the method [`delete_globalsign_email_challenge`]
31#[derive(Clone, Debug, Default)]
32pub struct DeleteGlobalsignEmailChallengeParams {
33    /// Alphanumeric string identifying a TLS subscription.
34    pub tls_subscription_id: String,
35    /// Alphanumeric string identifying a TLS subscription.
36    pub tls_authorization_id: String,
37    /// Alphanumeric string identifying a GlobalSign email challenge.
38    pub globalsign_email_challenge_id: String
39}
40
41/// struct for passing parameters to the method [`delete_tls_sub`]
42#[derive(Clone, Debug, Default)]
43pub struct DeleteTlsSubParams {
44    /// Alphanumeric string identifying a TLS subscription.
45    pub tls_subscription_id: String
46}
47
48/// struct for passing parameters to the method [`get_tls_sub`]
49#[derive(Clone, Debug, Default)]
50pub struct GetTlsSubParams {
51    /// Alphanumeric string identifying a TLS subscription.
52    pub tls_subscription_id: String,
53    /// Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, `tls_authorizations.self_managed_http_challenge`, and `tls_certificates`. 
54    pub include: Option<String>
55}
56
57/// struct for passing parameters to the method [`list_tls_subs`]
58#[derive(Clone, Debug, Default)]
59pub struct ListTlsSubsParams {
60    /// Limit the returned subscriptions by state. Valid values are `pending`, `processing`, `issued`, `renewing`, and `failed`. Accepts parameters: `not` (e.g., `filter[state][not]=renewing`). 
61    pub filter_state: Option<String>,
62    /// Limit the returned subscriptions to those that include the specific domain.
63    pub filter_tls_domains_id: Option<String>,
64    /// Limit the returned subscriptions to those that have currently active orders. Permitted values: `true`. 
65    pub filter_has_active_order: Option<bool>,
66    /// Limit the returned subscriptions to a specific certification authority. Values may include `certainly`, `lets-encrypt`, or `globalsign`. 
67    pub filter_certificate_authority: Option<String>,
68    /// The order in which to list the results.
69    pub sort: Option<String>,
70    /// Include related objects. Optional, comma-separated values. Permitted values: `tls_authorizations`, `tls_authorizations.globalsign_email_challenge`, `tls_authorizations.self_managed_http_challenge`, and `tls_certificates`. 
71    pub include: Option<String>,
72    /// Current page.
73    pub page_number: Option<i32>,
74    /// Number of records per page.
75    pub page_size: Option<i32>
76}
77
78/// struct for passing parameters to the method [`patch_tls_sub`]
79#[derive(Clone, Debug, Default)]
80pub struct PatchTlsSubParams {
81    /// Alphanumeric string identifying a TLS subscription.
82    pub tls_subscription_id: String,
83    /// A flag that allows you to edit and delete a subscription with active domains. Valid to use on PATCH and DELETE actions. As a warning, removing an active domain from a subscription or forcing the deletion of a subscription may result in breaking TLS termination to that domain. 
84    pub force: Option<bool>,
85    pub tls_subscription: Option<crate::models::TlsSubscription>
86}
87
88
89/// struct for typed errors of method [`create_globalsign_email_challenge`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum CreateGlobalsignEmailChallengeError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`create_tls_sub`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum CreateTlsSubError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`delete_globalsign_email_challenge`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum DeleteGlobalsignEmailChallengeError {
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`delete_tls_sub`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum DeleteTlsSubError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`get_tls_sub`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum GetTlsSubError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`list_tls_subs`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum ListTlsSubsError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`patch_tls_sub`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum PatchTlsSubError {
135    UnknownValue(serde_json::Value),
136}
137
138
139/// Creates an email challenge for a domain on a GlobalSign subscription. An email challenge will generate an email that can be used to validate domain ownership. If this challenge is created, then the domain can only be validated using email for the given subscription. 
140pub async fn create_globalsign_email_challenge(configuration: &mut configuration::Configuration, params: CreateGlobalsignEmailChallengeParams) -> Result<serde_json::Value, Error<CreateGlobalsignEmailChallengeError>> {
141    let local_var_configuration = configuration;
142
143    // unbox the parameters
144    let tls_subscription_id = params.tls_subscription_id;
145    let tls_authorization_id = params.tls_authorization_id;
146    let request_body = params.request_body;
147
148
149    let local_var_client = &local_var_configuration.client;
150
151    let local_var_uri_str = format!("{}/tls/subscriptions/{tls_subscription_id}/authorizations/{tls_authorization_id}/globalsign_email_challenges", local_var_configuration.base_path, tls_subscription_id=crate::apis::urlencode(tls_subscription_id), tls_authorization_id=crate::apis::urlencode(tls_authorization_id));
152    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
153
154    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
155        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
156    }
157    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
158        let local_var_key = local_var_apikey.key.clone();
159        let local_var_value = match local_var_apikey.prefix {
160            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
161            None => local_var_key,
162        };
163        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
164    };
165    local_var_req_builder = local_var_req_builder.json(&request_body);
166
167    let local_var_req = local_var_req_builder.build()?;
168    let local_var_resp = local_var_client.execute(local_var_req).await?;
169
170    if "POST" != "GET" && "POST" != "HEAD" {
171      let headers = local_var_resp.headers();
172      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
173          Some(v) => v.to_str().unwrap().parse().unwrap(),
174          None => configuration::DEFAULT_RATELIMIT,
175      };
176      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
177          Some(v) => v.to_str().unwrap().parse().unwrap(),
178          None => 0,
179      };
180    }
181
182    let local_var_status = local_var_resp.status();
183    let local_var_content = local_var_resp.text().await?;
184
185    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
186        serde_json::from_str(&local_var_content).map_err(Error::from)
187    } else {
188        let local_var_entity: Option<CreateGlobalsignEmailChallengeError> = serde_json::from_str(&local_var_content).ok();
189        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
190        Err(Error::ResponseError(local_var_error))
191    }
192}
193
194/// Create a new TLS subscription. This response includes a list of possible challenges to verify domain ownership.
195pub async fn create_tls_sub(configuration: &mut configuration::Configuration, params: CreateTlsSubParams) -> Result<crate::models::TlsSubscriptionResponse, Error<CreateTlsSubError>> {
196    let local_var_configuration = configuration;
197
198    // unbox the parameters
199    let tls_subscription = params.tls_subscription;
200
201
202    let local_var_client = &local_var_configuration.client;
203
204    let local_var_uri_str = format!("{}/tls/subscriptions", local_var_configuration.base_path);
205    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
206
207    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
208        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
209    }
210    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
211        let local_var_key = local_var_apikey.key.clone();
212        let local_var_value = match local_var_apikey.prefix {
213            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
214            None => local_var_key,
215        };
216        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
217    };
218    local_var_req_builder = local_var_req_builder.json(&tls_subscription);
219
220    let local_var_req = local_var_req_builder.build()?;
221    let local_var_resp = local_var_client.execute(local_var_req).await?;
222
223    if "POST" != "GET" && "POST" != "HEAD" {
224      let headers = local_var_resp.headers();
225      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
226          Some(v) => v.to_str().unwrap().parse().unwrap(),
227          None => configuration::DEFAULT_RATELIMIT,
228      };
229      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
230          Some(v) => v.to_str().unwrap().parse().unwrap(),
231          None => 0,
232      };
233    }
234
235    let local_var_status = local_var_resp.status();
236    let local_var_content = local_var_resp.text().await?;
237
238    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
239        serde_json::from_str(&local_var_content).map_err(Error::from)
240    } else {
241        let local_var_entity: Option<CreateTlsSubError> = serde_json::from_str(&local_var_content).ok();
242        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
243        Err(Error::ResponseError(local_var_error))
244    }
245}
246
247/// Deletes a GlobalSign email challenge. After a GlobalSign email challenge is deleted, the domain can use HTTP and DNS validation methods again.
248pub async fn delete_globalsign_email_challenge(configuration: &mut configuration::Configuration, params: DeleteGlobalsignEmailChallengeParams) -> Result<(), Error<DeleteGlobalsignEmailChallengeError>> {
249    let local_var_configuration = configuration;
250
251    // unbox the parameters
252    let tls_subscription_id = params.tls_subscription_id;
253    let tls_authorization_id = params.tls_authorization_id;
254    let globalsign_email_challenge_id = params.globalsign_email_challenge_id;
255
256
257    let local_var_client = &local_var_configuration.client;
258
259    let local_var_uri_str = format!("{}/tls/subscriptions/{tls_subscription_id}/authorizations/{tls_authorization_id}/globalsign_email_challenges/{globalsign_email_challenge_id}", local_var_configuration.base_path, tls_subscription_id=crate::apis::urlencode(tls_subscription_id), tls_authorization_id=crate::apis::urlencode(tls_authorization_id), globalsign_email_challenge_id=crate::apis::urlencode(globalsign_email_challenge_id));
260    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
261
262    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
263        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
264    }
265    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
266        let local_var_key = local_var_apikey.key.clone();
267        let local_var_value = match local_var_apikey.prefix {
268            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
269            None => local_var_key,
270        };
271        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
272    };
273
274    let local_var_req = local_var_req_builder.build()?;
275    let local_var_resp = local_var_client.execute(local_var_req).await?;
276
277    if "DELETE" != "GET" && "DELETE" != "HEAD" {
278      let headers = local_var_resp.headers();
279      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
280          Some(v) => v.to_str().unwrap().parse().unwrap(),
281          None => configuration::DEFAULT_RATELIMIT,
282      };
283      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
284          Some(v) => v.to_str().unwrap().parse().unwrap(),
285          None => 0,
286      };
287    }
288
289    let local_var_status = local_var_resp.status();
290    let local_var_content = local_var_resp.text().await?;
291
292    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
293        Ok(())
294    } else {
295        let local_var_entity: Option<DeleteGlobalsignEmailChallengeError> = serde_json::from_str(&local_var_content).ok();
296        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
297        Err(Error::ResponseError(local_var_error))
298    }
299}
300
301/// Destroy a TLS subscription. A subscription cannot be destroyed if there are domains in the TLS enabled state.
302pub async fn delete_tls_sub(configuration: &mut configuration::Configuration, params: DeleteTlsSubParams) -> Result<(), Error<DeleteTlsSubError>> {
303    let local_var_configuration = configuration;
304
305    // unbox the parameters
306    let tls_subscription_id = params.tls_subscription_id;
307
308
309    let local_var_client = &local_var_configuration.client;
310
311    let local_var_uri_str = format!("{}/tls/subscriptions/{tls_subscription_id}", local_var_configuration.base_path, tls_subscription_id=crate::apis::urlencode(tls_subscription_id));
312    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
313
314    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
315        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
316    }
317    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
318        let local_var_key = local_var_apikey.key.clone();
319        let local_var_value = match local_var_apikey.prefix {
320            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
321            None => local_var_key,
322        };
323        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
324    };
325
326    let local_var_req = local_var_req_builder.build()?;
327    let local_var_resp = local_var_client.execute(local_var_req).await?;
328
329    if "DELETE" != "GET" && "DELETE" != "HEAD" {
330      let headers = local_var_resp.headers();
331      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
332          Some(v) => v.to_str().unwrap().parse().unwrap(),
333          None => configuration::DEFAULT_RATELIMIT,
334      };
335      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
336          Some(v) => v.to_str().unwrap().parse().unwrap(),
337          None => 0,
338      };
339    }
340
341    let local_var_status = local_var_resp.status();
342    let local_var_content = local_var_resp.text().await?;
343
344    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
345        Ok(())
346    } else {
347        let local_var_entity: Option<DeleteTlsSubError> = serde_json::from_str(&local_var_content).ok();
348        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
349        Err(Error::ResponseError(local_var_error))
350    }
351}
352
353/// Show a TLS subscription.
354pub async fn get_tls_sub(configuration: &mut configuration::Configuration, params: GetTlsSubParams) -> Result<crate::models::TlsSubscriptionResponse, Error<GetTlsSubError>> {
355    let local_var_configuration = configuration;
356
357    // unbox the parameters
358    let tls_subscription_id = params.tls_subscription_id;
359    let include = params.include;
360
361
362    let local_var_client = &local_var_configuration.client;
363
364    let local_var_uri_str = format!("{}/tls/subscriptions/{tls_subscription_id}", local_var_configuration.base_path, tls_subscription_id=crate::apis::urlencode(tls_subscription_id));
365    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
366
367    if let Some(ref local_var_str) = include {
368        local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]);
369    }
370    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
371        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
372    }
373    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
374        let local_var_key = local_var_apikey.key.clone();
375        let local_var_value = match local_var_apikey.prefix {
376            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
377            None => local_var_key,
378        };
379        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
380    };
381
382    let local_var_req = local_var_req_builder.build()?;
383    let local_var_resp = local_var_client.execute(local_var_req).await?;
384
385    if "GET" != "GET" && "GET" != "HEAD" {
386      let headers = local_var_resp.headers();
387      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
388          Some(v) => v.to_str().unwrap().parse().unwrap(),
389          None => configuration::DEFAULT_RATELIMIT,
390      };
391      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
392          Some(v) => v.to_str().unwrap().parse().unwrap(),
393          None => 0,
394      };
395    }
396
397    let local_var_status = local_var_resp.status();
398    let local_var_content = local_var_resp.text().await?;
399
400    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
401        serde_json::from_str(&local_var_content).map_err(Error::from)
402    } else {
403        let local_var_entity: Option<GetTlsSubError> = serde_json::from_str(&local_var_content).ok();
404        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
405        Err(Error::ResponseError(local_var_error))
406    }
407}
408
409/// List all TLS subscriptions.
410pub async fn list_tls_subs(configuration: &mut configuration::Configuration, params: ListTlsSubsParams) -> Result<crate::models::TlsSubscriptionsResponse, Error<ListTlsSubsError>> {
411    let local_var_configuration = configuration;
412
413    // unbox the parameters
414    let filter_state = params.filter_state;
415    let filter_tls_domains_id = params.filter_tls_domains_id;
416    let filter_has_active_order = params.filter_has_active_order;
417    let filter_certificate_authority = params.filter_certificate_authority;
418    let sort = params.sort;
419    let include = params.include;
420    let page_number = params.page_number;
421    let page_size = params.page_size;
422
423
424    let local_var_client = &local_var_configuration.client;
425
426    let local_var_uri_str = format!("{}/tls/subscriptions", local_var_configuration.base_path);
427    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
428
429    if let Some(ref local_var_str) = filter_state {
430        local_var_req_builder = local_var_req_builder.query(&[("filter[state]", &local_var_str.to_string())]);
431    }
432    if let Some(ref local_var_str) = filter_tls_domains_id {
433        local_var_req_builder = local_var_req_builder.query(&[("filter[tls_domains.id]", &local_var_str.to_string())]);
434    }
435    if let Some(ref local_var_str) = filter_has_active_order {
436        local_var_req_builder = local_var_req_builder.query(&[("filter[has_active_order]", &local_var_str.to_string())]);
437    }
438    if let Some(ref local_var_str) = filter_certificate_authority {
439        local_var_req_builder = local_var_req_builder.query(&[("filter[certificate_authority]", &local_var_str.to_string())]);
440    }
441    if let Some(ref local_var_str) = sort {
442        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
443    }
444    if let Some(ref local_var_str) = include {
445        local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]);
446    }
447    if let Some(ref local_var_str) = page_number {
448        local_var_req_builder = local_var_req_builder.query(&[("page[number]", &local_var_str.to_string())]);
449    }
450    if let Some(ref local_var_str) = page_size {
451        local_var_req_builder = local_var_req_builder.query(&[("page[size]", &local_var_str.to_string())]);
452    }
453    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
454        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
455    }
456    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
457        let local_var_key = local_var_apikey.key.clone();
458        let local_var_value = match local_var_apikey.prefix {
459            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
460            None => local_var_key,
461        };
462        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
463    };
464
465    let local_var_req = local_var_req_builder.build()?;
466    let local_var_resp = local_var_client.execute(local_var_req).await?;
467
468    if "GET" != "GET" && "GET" != "HEAD" {
469      let headers = local_var_resp.headers();
470      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
471          Some(v) => v.to_str().unwrap().parse().unwrap(),
472          None => configuration::DEFAULT_RATELIMIT,
473      };
474      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
475          Some(v) => v.to_str().unwrap().parse().unwrap(),
476          None => 0,
477      };
478    }
479
480    let local_var_status = local_var_resp.status();
481    let local_var_content = local_var_resp.text().await?;
482
483    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
484        serde_json::from_str(&local_var_content).map_err(Error::from)
485    } else {
486        let local_var_entity: Option<ListTlsSubsError> = serde_json::from_str(&local_var_content).ok();
487        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
488        Err(Error::ResponseError(local_var_error))
489    }
490}
491
492/// Change the TLS domains or common name associated with this subscription, update the TLS configuration for this set of domains, or retry a subscription with state `failed` by setting the state to `retry`.
493pub async fn patch_tls_sub(configuration: &mut configuration::Configuration, params: PatchTlsSubParams) -> Result<crate::models::TlsSubscriptionResponse, Error<PatchTlsSubError>> {
494    let local_var_configuration = configuration;
495
496    // unbox the parameters
497    let tls_subscription_id = params.tls_subscription_id;
498    let force = params.force;
499    let tls_subscription = params.tls_subscription;
500
501
502    let local_var_client = &local_var_configuration.client;
503
504    let local_var_uri_str = format!("{}/tls/subscriptions/{tls_subscription_id}", local_var_configuration.base_path, tls_subscription_id=crate::apis::urlencode(tls_subscription_id));
505    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
506
507    if let Some(ref local_var_str) = force {
508        local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]);
509    }
510    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
511        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
512    }
513    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
514        let local_var_key = local_var_apikey.key.clone();
515        let local_var_value = match local_var_apikey.prefix {
516            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
517            None => local_var_key,
518        };
519        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
520    };
521    local_var_req_builder = local_var_req_builder.json(&tls_subscription);
522
523    let local_var_req = local_var_req_builder.build()?;
524    let local_var_resp = local_var_client.execute(local_var_req).await?;
525
526    if "PATCH" != "GET" && "PATCH" != "HEAD" {
527      let headers = local_var_resp.headers();
528      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
529          Some(v) => v.to_str().unwrap().parse().unwrap(),
530          None => configuration::DEFAULT_RATELIMIT,
531      };
532      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
533          Some(v) => v.to_str().unwrap().parse().unwrap(),
534          None => 0,
535      };
536    }
537
538    let local_var_status = local_var_resp.status();
539    let local_var_content = local_var_resp.text().await?;
540
541    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
542        serde_json::from_str(&local_var_content).map_err(Error::from)
543    } else {
544        let local_var_entity: Option<PatchTlsSubError> = serde_json::from_str(&local_var_content).ok();
545        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
546        Err(Error::ResponseError(local_var_error))
547    }
548}
549