Skip to main content

fastly_api/apis/
network_protect_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_network_protect_endpoint`]
15#[derive(Clone, Debug, Default)]
16pub struct CreateNetworkProtectEndpointParams {
17    pub network_protect_endpoint_create: crate::models::NetworkProtectEndpointCreate
18}
19
20/// struct for passing parameters to the method [`create_network_protect_network`]
21#[derive(Clone, Debug, Default)]
22pub struct CreateNetworkProtectNetworkParams {
23    pub network_protect_network_create: crate::models::NetworkProtectNetworkCreate
24}
25
26/// struct for passing parameters to the method [`create_network_protect_prefix_list`]
27#[derive(Clone, Debug, Default)]
28pub struct CreateNetworkProtectPrefixListParams {
29    pub network_protect_prefix_list_create: crate::models::NetworkProtectPrefixListCreate
30}
31
32/// struct for passing parameters to the method [`create_network_protect_rule_set`]
33#[derive(Clone, Debug, Default)]
34pub struct CreateNetworkProtectRuleSetParams {
35    pub network_protect_rule_set_create: crate::models::NetworkProtectRuleSetCreate
36}
37
38/// struct for passing parameters to the method [`delete_network_protect_endpoint`]
39#[derive(Clone, Debug, Default)]
40pub struct DeleteNetworkProtectEndpointParams {
41    /// Unique identifier of the Network Protect endpoint.
42    pub endpoint_id: String
43}
44
45/// struct for passing parameters to the method [`delete_network_protect_network`]
46#[derive(Clone, Debug, Default)]
47pub struct DeleteNetworkProtectNetworkParams {
48    /// Unique identifier of the Network Protect network.
49    pub network_id: String
50}
51
52/// struct for passing parameters to the method [`delete_network_protect_prefix_list`]
53#[derive(Clone, Debug, Default)]
54pub struct DeleteNetworkProtectPrefixListParams {
55    /// Unique identifier of the Network Protect prefix list.
56    pub prefix_list_id: String
57}
58
59/// struct for passing parameters to the method [`delete_network_protect_rule_set`]
60#[derive(Clone, Debug, Default)]
61pub struct DeleteNetworkProtectRuleSetParams {
62    /// Unique identifier of the Network Protect rule set.
63    pub rule_set_id: String
64}
65
66/// struct for passing parameters to the method [`get_network_protect_endpoint`]
67#[derive(Clone, Debug, Default)]
68pub struct GetNetworkProtectEndpointParams {
69    /// Unique identifier of the Network Protect endpoint.
70    pub endpoint_id: String
71}
72
73/// struct for passing parameters to the method [`get_network_protect_network`]
74#[derive(Clone, Debug, Default)]
75pub struct GetNetworkProtectNetworkParams {
76    /// Unique identifier of the Network Protect network.
77    pub network_id: String
78}
79
80/// struct for passing parameters to the method [`get_network_protect_prefix_list`]
81#[derive(Clone, Debug, Default)]
82pub struct GetNetworkProtectPrefixListParams {
83    /// Unique identifier of the Network Protect prefix list.
84    pub prefix_list_id: String
85}
86
87/// struct for passing parameters to the method [`get_network_protect_rule_set`]
88#[derive(Clone, Debug, Default)]
89pub struct GetNetworkProtectRuleSetParams {
90    /// Unique identifier of the Network Protect rule set.
91    pub rule_set_id: String
92}
93
94/// struct for passing parameters to the method [`list_network_protect_endpoints`]
95#[derive(Clone, Debug, Default)]
96pub struct ListNetworkProtectEndpointsParams {
97    /// Maximum resources to return. Defaults to 100. Positive values above 1000 are accepted and clamped to 1000; the effective value is reported in meta.limit. Zero, negative, and non-integer values return a `400 Bad Request` error.
98    pub limit: Option<i64>,
99    /// Continuation value from a previous response's meta.next_cursor. Omit this parameter to request the first page.
100    pub cursor: Option<String>
101}
102
103/// struct for passing parameters to the method [`list_network_protect_networks`]
104#[derive(Clone, Debug, Default)]
105pub struct ListNetworkProtectNetworksParams {
106    /// Maximum resources to return. Defaults to 100. Positive values above 1000 are accepted and clamped to 1000; the effective value is reported in meta.limit. Zero, negative, and non-integer values return a `400 Bad Request` error.
107    pub limit: Option<i64>,
108    /// Continuation value from a previous response's meta.next_cursor. Omit this parameter to request the first page.
109    pub cursor: Option<String>
110}
111
112/// struct for passing parameters to the method [`list_network_protect_prefix_lists`]
113#[derive(Clone, Debug, Default)]
114pub struct ListNetworkProtectPrefixListsParams {
115    /// Maximum resources to return. Defaults to 100. Positive values above 1000 are accepted and clamped to 1000; the effective value is reported in meta.limit. Zero, negative, and non-integer values return a `400 Bad Request` error.
116    pub limit: Option<i64>,
117    /// Continuation value from a previous response's meta.next_cursor. Omit this parameter to request the first page.
118    pub cursor: Option<String>
119}
120
121/// struct for passing parameters to the method [`list_network_protect_rule_sets`]
122#[derive(Clone, Debug, Default)]
123pub struct ListNetworkProtectRuleSetsParams {
124    /// Maximum resources to return. Defaults to 100. Positive values above 1000 are accepted and clamped to 1000; the effective value is reported in meta.limit. Zero, negative, and non-integer values return a `400 Bad Request` error.
125    pub limit: Option<i64>,
126    /// Continuation value from a previous response's meta.next_cursor. Omit this parameter to request the first page.
127    pub cursor: Option<String>
128}
129
130/// struct for passing parameters to the method [`update_network_protect_endpoint`]
131#[derive(Clone, Debug, Default)]
132pub struct UpdateNetworkProtectEndpointParams {
133    /// Unique identifier of the Network Protect endpoint.
134    pub endpoint_id: String,
135    pub network_protect_endpoint_update: crate::models::NetworkProtectEndpointUpdate
136}
137
138/// struct for passing parameters to the method [`update_network_protect_network`]
139#[derive(Clone, Debug, Default)]
140pub struct UpdateNetworkProtectNetworkParams {
141    /// Unique identifier of the Network Protect network.
142    pub network_id: String,
143    pub network_protect_network_update: crate::models::NetworkProtectNetworkUpdate
144}
145
146/// struct for passing parameters to the method [`update_network_protect_prefix_list`]
147#[derive(Clone, Debug, Default)]
148pub struct UpdateNetworkProtectPrefixListParams {
149    /// Unique identifier of the Network Protect prefix list.
150    pub prefix_list_id: String,
151    pub network_protect_prefix_list_update: crate::models::NetworkProtectPrefixListUpdate
152}
153
154/// struct for passing parameters to the method [`update_network_protect_rule_set`]
155#[derive(Clone, Debug, Default)]
156pub struct UpdateNetworkProtectRuleSetParams {
157    /// Unique identifier of the Network Protect rule set.
158    pub rule_set_id: String,
159    pub network_protect_rule_set_update: crate::models::NetworkProtectRuleSetUpdate
160}
161
162
163/// struct for typed errors of method [`create_network_protect_endpoint`]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum CreateNetworkProtectEndpointError {
167    Status400(crate::models::NetworkProtectInvalidRequest),
168    Status401(serde_json::Value),
169    Status403(serde_json::Value),
170    Status409(crate::models::NetworkProtectConflict),
171    Status429(serde_json::Value),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`create_network_protect_network`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum CreateNetworkProtectNetworkError {
179    Status400(crate::models::NetworkProtectInvalidRequest),
180    Status401(serde_json::Value),
181    Status403(serde_json::Value),
182    Status409(crate::models::NetworkProtectConflict),
183    Status429(serde_json::Value),
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`create_network_protect_prefix_list`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum CreateNetworkProtectPrefixListError {
191    Status400(crate::models::NetworkProtectInvalidRequest),
192    Status401(serde_json::Value),
193    Status403(serde_json::Value),
194    Status409(crate::models::NetworkProtectConflict),
195    Status429(serde_json::Value),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`create_network_protect_rule_set`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum CreateNetworkProtectRuleSetError {
203    Status400(crate::models::NetworkProtectInvalidRequest),
204    Status401(serde_json::Value),
205    Status403(serde_json::Value),
206    Status409(crate::models::NetworkProtectConflict),
207    Status429(serde_json::Value),
208    UnknownValue(serde_json::Value),
209}
210
211/// struct for typed errors of method [`delete_network_protect_endpoint`]
212#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum DeleteNetworkProtectEndpointError {
215    Status401(serde_json::Value),
216    Status403(serde_json::Value),
217    Status404(serde_json::Value),
218    Status409(crate::models::NetworkProtectConflict),
219    Status429(serde_json::Value),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`delete_network_protect_network`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum DeleteNetworkProtectNetworkError {
227    Status401(serde_json::Value),
228    Status403(serde_json::Value),
229    Status404(serde_json::Value),
230    Status429(serde_json::Value),
231    UnknownValue(serde_json::Value),
232}
233
234/// struct for typed errors of method [`delete_network_protect_prefix_list`]
235#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum DeleteNetworkProtectPrefixListError {
238    Status401(serde_json::Value),
239    Status403(serde_json::Value),
240    Status404(serde_json::Value),
241    Status409(crate::models::NetworkProtectConflict),
242    Status429(serde_json::Value),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`delete_network_protect_rule_set`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum DeleteNetworkProtectRuleSetError {
250    Status401(serde_json::Value),
251    Status403(serde_json::Value),
252    Status404(serde_json::Value),
253    Status409(crate::models::NetworkProtectConflict),
254    Status429(serde_json::Value),
255    UnknownValue(serde_json::Value),
256}
257
258/// struct for typed errors of method [`get_network_protect_endpoint`]
259#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum GetNetworkProtectEndpointError {
262    Status401(serde_json::Value),
263    Status403(serde_json::Value),
264    Status404(serde_json::Value),
265    Status429(serde_json::Value),
266    UnknownValue(serde_json::Value),
267}
268
269/// struct for typed errors of method [`get_network_protect_network`]
270#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum GetNetworkProtectNetworkError {
273    Status401(serde_json::Value),
274    Status403(serde_json::Value),
275    Status404(serde_json::Value),
276    Status429(serde_json::Value),
277    UnknownValue(serde_json::Value),
278}
279
280/// struct for typed errors of method [`get_network_protect_prefix_list`]
281#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum GetNetworkProtectPrefixListError {
284    Status401(serde_json::Value),
285    Status403(serde_json::Value),
286    Status404(serde_json::Value),
287    Status429(serde_json::Value),
288    UnknownValue(serde_json::Value),
289}
290
291/// struct for typed errors of method [`get_network_protect_rule_set`]
292#[derive(Debug, Clone, Serialize, Deserialize)]
293#[serde(untagged)]
294pub enum GetNetworkProtectRuleSetError {
295    Status401(serde_json::Value),
296    Status403(serde_json::Value),
297    Status404(serde_json::Value),
298    Status429(serde_json::Value),
299    UnknownValue(serde_json::Value),
300}
301
302/// struct for typed errors of method [`list_network_protect_endpoints`]
303#[derive(Debug, Clone, Serialize, Deserialize)]
304#[serde(untagged)]
305pub enum ListNetworkProtectEndpointsError {
306    Status400(crate::models::NetworkProtectInvalidRequest),
307    Status401(serde_json::Value),
308    Status403(serde_json::Value),
309    Status429(serde_json::Value),
310    UnknownValue(serde_json::Value),
311}
312
313/// struct for typed errors of method [`list_network_protect_networks`]
314#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum ListNetworkProtectNetworksError {
317    Status400(crate::models::NetworkProtectInvalidRequest),
318    Status401(serde_json::Value),
319    Status403(serde_json::Value),
320    Status429(serde_json::Value),
321    UnknownValue(serde_json::Value),
322}
323
324/// struct for typed errors of method [`list_network_protect_prefix_lists`]
325#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum ListNetworkProtectPrefixListsError {
328    Status400(crate::models::NetworkProtectInvalidRequest),
329    Status401(serde_json::Value),
330    Status403(serde_json::Value),
331    Status429(serde_json::Value),
332    UnknownValue(serde_json::Value),
333}
334
335/// struct for typed errors of method [`list_network_protect_rule_sets`]
336#[derive(Debug, Clone, Serialize, Deserialize)]
337#[serde(untagged)]
338pub enum ListNetworkProtectRuleSetsError {
339    Status400(crate::models::NetworkProtectInvalidRequest),
340    Status401(serde_json::Value),
341    Status403(serde_json::Value),
342    Status429(serde_json::Value),
343    UnknownValue(serde_json::Value),
344}
345
346/// struct for typed errors of method [`update_network_protect_endpoint`]
347#[derive(Debug, Clone, Serialize, Deserialize)]
348#[serde(untagged)]
349pub enum UpdateNetworkProtectEndpointError {
350    Status400(crate::models::NetworkProtectInvalidRequest),
351    Status401(serde_json::Value),
352    Status403(serde_json::Value),
353    Status404(serde_json::Value),
354    Status409(crate::models::NetworkProtectConflict),
355    Status429(serde_json::Value),
356    UnknownValue(serde_json::Value),
357}
358
359/// struct for typed errors of method [`update_network_protect_network`]
360#[derive(Debug, Clone, Serialize, Deserialize)]
361#[serde(untagged)]
362pub enum UpdateNetworkProtectNetworkError {
363    Status400(crate::models::NetworkProtectInvalidRequest),
364    Status401(serde_json::Value),
365    Status403(serde_json::Value),
366    Status404(serde_json::Value),
367    Status409(crate::models::NetworkProtectConflict),
368    Status429(serde_json::Value),
369    UnknownValue(serde_json::Value),
370}
371
372/// struct for typed errors of method [`update_network_protect_prefix_list`]
373#[derive(Debug, Clone, Serialize, Deserialize)]
374#[serde(untagged)]
375pub enum UpdateNetworkProtectPrefixListError {
376    Status400(crate::models::NetworkProtectInvalidRequest),
377    Status401(serde_json::Value),
378    Status403(serde_json::Value),
379    Status404(serde_json::Value),
380    Status409(crate::models::NetworkProtectConflict),
381    Status429(serde_json::Value),
382    UnknownValue(serde_json::Value),
383}
384
385/// struct for typed errors of method [`update_network_protect_rule_set`]
386#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum UpdateNetworkProtectRuleSetError {
389    Status400(crate::models::NetworkProtectInvalidRequest),
390    Status401(serde_json::Value),
391    Status403(serde_json::Value),
392    Status404(serde_json::Value),
393    Status409(crate::models::NetworkProtectConflict),
394    Status429(serde_json::Value),
395    UnknownValue(serde_json::Value),
396}
397
398
399/// Creates a GRE delivery destination. A new endpoint is not attached to a network until it is added to an endpoint policy.
400pub async fn create_network_protect_endpoint(configuration: &mut configuration::Configuration, params: CreateNetworkProtectEndpointParams) -> Result<crate::models::NetworkProtectEndpointResponse, Error<CreateNetworkProtectEndpointError>> {
401    let local_var_configuration = configuration;
402
403    // unbox the parameters
404    let network_protect_endpoint_create = params.network_protect_endpoint_create;
405
406
407    let local_var_client = &local_var_configuration.client;
408
409    let local_var_uri_str = format!("{}/network-protect/v1/endpoints", local_var_configuration.base_path);
410    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
411
412    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
413        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
414    }
415    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
416        let local_var_key = local_var_apikey.key.clone();
417        let local_var_value = match local_var_apikey.prefix {
418            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
419            None => local_var_key,
420        };
421        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
422    };
423    local_var_req_builder = local_var_req_builder.json(&network_protect_endpoint_create);
424
425    let local_var_req = local_var_req_builder.build()?;
426    let local_var_resp = local_var_client.execute(local_var_req).await?;
427
428    if "POST" != "GET" && "POST" != "HEAD" {
429      let headers = local_var_resp.headers();
430      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
431          Some(v) => v.to_str().unwrap().parse().unwrap(),
432          None => configuration::DEFAULT_RATELIMIT,
433      };
434      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
435          Some(v) => v.to_str().unwrap().parse().unwrap(),
436          None => 0,
437      };
438    }
439
440    let local_var_status = local_var_resp.status();
441    let local_var_content = local_var_resp.text().await?;
442
443    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
444        serde_json::from_str(&local_var_content).map_err(Error::from)
445    } else {
446        let local_var_entity: Option<CreateNetworkProtectEndpointError> = serde_json::from_str(&local_var_content).ok();
447        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
448        Err(Error::ResponseError(local_var_error))
449    }
450}
451
452/// Registers customer-owned IP space for protection. The network starts with advertisement disabled and Fastly does not announce its prefix. Turn advertisement on after LOA and ROA authorization are ready. The create request cannot include advertise; sending it returns a `400 Bad Request` error.
453pub async fn create_network_protect_network(configuration: &mut configuration::Configuration, params: CreateNetworkProtectNetworkParams) -> Result<crate::models::NetworkProtectNetworkResponse, Error<CreateNetworkProtectNetworkError>> {
454    let local_var_configuration = configuration;
455
456    // unbox the parameters
457    let network_protect_network_create = params.network_protect_network_create;
458
459
460    let local_var_client = &local_var_configuration.client;
461
462    let local_var_uri_str = format!("{}/network-protect/v1/networks", local_var_configuration.base_path);
463    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
464
465    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
466        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
467    }
468    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
469        let local_var_key = local_var_apikey.key.clone();
470        let local_var_value = match local_var_apikey.prefix {
471            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
472            None => local_var_key,
473        };
474        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
475    };
476    local_var_req_builder = local_var_req_builder.json(&network_protect_network_create);
477
478    let local_var_req = local_var_req_builder.build()?;
479    let local_var_resp = local_var_client.execute(local_var_req).await?;
480
481    if "POST" != "GET" && "POST" != "HEAD" {
482      let headers = local_var_resp.headers();
483      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
484          Some(v) => v.to_str().unwrap().parse().unwrap(),
485          None => configuration::DEFAULT_RATELIMIT,
486      };
487      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
488          Some(v) => v.to_str().unwrap().parse().unwrap(),
489          None => 0,
490      };
491    }
492
493    let local_var_status = local_var_resp.status();
494    let local_var_content = local_var_resp.text().await?;
495
496    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
497        serde_json::from_str(&local_var_content).map_err(Error::from)
498    } else {
499        let local_var_entity: Option<CreateNetworkProtectNetworkError> = serde_json::from_str(&local_var_content).ok();
500        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
501        Err(Error::ResponseError(local_var_error))
502    }
503}
504
505/// Creates a typed list of addresses that rules can reference. The family is required and cannot be changed. The addresses list may remain empty.
506pub async fn create_network_protect_prefix_list(configuration: &mut configuration::Configuration, params: CreateNetworkProtectPrefixListParams) -> Result<crate::models::NetworkProtectPrefixListResponse, Error<CreateNetworkProtectPrefixListError>> {
507    let local_var_configuration = configuration;
508
509    // unbox the parameters
510    let network_protect_prefix_list_create = params.network_protect_prefix_list_create;
511
512
513    let local_var_client = &local_var_configuration.client;
514
515    let local_var_uri_str = format!("{}/network-protect/v1/prefix-lists", local_var_configuration.base_path);
516    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
517
518    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
519        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
520    }
521    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
522        let local_var_key = local_var_apikey.key.clone();
523        let local_var_value = match local_var_apikey.prefix {
524            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
525            None => local_var_key,
526        };
527        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
528    };
529    local_var_req_builder = local_var_req_builder.json(&network_protect_prefix_list_create);
530
531    let local_var_req = local_var_req_builder.build()?;
532    let local_var_resp = local_var_client.execute(local_var_req).await?;
533
534    if "POST" != "GET" && "POST" != "HEAD" {
535      let headers = local_var_resp.headers();
536      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
537          Some(v) => v.to_str().unwrap().parse().unwrap(),
538          None => configuration::DEFAULT_RATELIMIT,
539      };
540      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
541          Some(v) => v.to_str().unwrap().parse().unwrap(),
542          None => 0,
543      };
544    }
545
546    let local_var_status = local_var_resp.status();
547    let local_var_content = local_var_resp.text().await?;
548
549    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
550        serde_json::from_str(&local_var_content).map_err(Error::from)
551    } else {
552        let local_var_entity: Option<CreateNetworkProtectPrefixListError> = serde_json::from_str(&local_var_content).ok();
553        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
554        Err(Error::ResponseError(local_var_error))
555    }
556}
557
558/// Creates an ordered rule set and stores its filtering intent. A rule set has at most 64 rules and uses the default action when no rule matches. Custom attachment and detachment are restricted in this release.
559pub async fn create_network_protect_rule_set(configuration: &mut configuration::Configuration, params: CreateNetworkProtectRuleSetParams) -> Result<crate::models::NetworkProtectRuleSetResponse, Error<CreateNetworkProtectRuleSetError>> {
560    let local_var_configuration = configuration;
561
562    // unbox the parameters
563    let network_protect_rule_set_create = params.network_protect_rule_set_create;
564
565
566    let local_var_client = &local_var_configuration.client;
567
568    let local_var_uri_str = format!("{}/network-protect/v1/rule-sets", local_var_configuration.base_path);
569    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
570
571    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
572        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
573    }
574    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
575        let local_var_key = local_var_apikey.key.clone();
576        let local_var_value = match local_var_apikey.prefix {
577            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
578            None => local_var_key,
579        };
580        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
581    };
582    local_var_req_builder = local_var_req_builder.json(&network_protect_rule_set_create);
583
584    let local_var_req = local_var_req_builder.build()?;
585    let local_var_resp = local_var_client.execute(local_var_req).await?;
586
587    if "POST" != "GET" && "POST" != "HEAD" {
588      let headers = local_var_resp.headers();
589      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
590          Some(v) => v.to_str().unwrap().parse().unwrap(),
591          None => configuration::DEFAULT_RATELIMIT,
592      };
593      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
594          Some(v) => v.to_str().unwrap().parse().unwrap(),
595          None => 0,
596      };
597    }
598
599    let local_var_status = local_var_resp.status();
600    let local_var_content = local_var_resp.text().await?;
601
602    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
603        serde_json::from_str(&local_var_content).map_err(Error::from)
604    } else {
605        let local_var_entity: Option<CreateNetworkProtectRuleSetError> = serde_json::from_str(&local_var_content).ok();
606        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
607        Err(Error::ResponseError(local_var_error))
608    }
609}
610
611/// Deletes an endpoint. The endpoint must first be removed from every network policy; active references return a `409 Conflict` error.
612pub async fn delete_network_protect_endpoint(configuration: &mut configuration::Configuration, params: DeleteNetworkProtectEndpointParams) -> Result<(), Error<DeleteNetworkProtectEndpointError>> {
613    let local_var_configuration = configuration;
614
615    // unbox the parameters
616    let endpoint_id = params.endpoint_id;
617
618
619    let local_var_client = &local_var_configuration.client;
620
621    let local_var_uri_str = format!("{}/network-protect/v1/endpoints/{endpoint_id}", local_var_configuration.base_path, endpoint_id=crate::apis::urlencode(endpoint_id));
622    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
623
624    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
625        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
626    }
627    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
628        let local_var_key = local_var_apikey.key.clone();
629        let local_var_value = match local_var_apikey.prefix {
630            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
631            None => local_var_key,
632        };
633        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
634    };
635
636    let local_var_req = local_var_req_builder.build()?;
637    let local_var_resp = local_var_client.execute(local_var_req).await?;
638
639    if "DELETE" != "GET" && "DELETE" != "HEAD" {
640      let headers = local_var_resp.headers();
641      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
642          Some(v) => v.to_str().unwrap().parse().unwrap(),
643          None => configuration::DEFAULT_RATELIMIT,
644      };
645      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
646          Some(v) => v.to_str().unwrap().parse().unwrap(),
647          None => 0,
648      };
649    }
650
651    let local_var_status = local_var_resp.status();
652    let local_var_content = local_var_resp.text().await?;
653
654    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
655        Ok(())
656    } else {
657        let local_var_entity: Option<DeleteNetworkProtectEndpointError> = serde_json::from_str(&local_var_content).ok();
658        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
659        Err(Error::ResponseError(local_var_error))
660    }
661}
662
663/// Deletes a network and stops its advertisement and filtering. Endpoints and rule sets used by the network are not deleted.
664pub async fn delete_network_protect_network(configuration: &mut configuration::Configuration, params: DeleteNetworkProtectNetworkParams) -> Result<(), Error<DeleteNetworkProtectNetworkError>> {
665    let local_var_configuration = configuration;
666
667    // unbox the parameters
668    let network_id = params.network_id;
669
670
671    let local_var_client = &local_var_configuration.client;
672
673    let local_var_uri_str = format!("{}/network-protect/v1/networks/{network_id}", local_var_configuration.base_path, network_id=crate::apis::urlencode(network_id));
674    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
675
676    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678    }
679    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
680        let local_var_key = local_var_apikey.key.clone();
681        let local_var_value = match local_var_apikey.prefix {
682            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
683            None => local_var_key,
684        };
685        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
686    };
687
688    let local_var_req = local_var_req_builder.build()?;
689    let local_var_resp = local_var_client.execute(local_var_req).await?;
690
691    if "DELETE" != "GET" && "DELETE" != "HEAD" {
692      let headers = local_var_resp.headers();
693      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
694          Some(v) => v.to_str().unwrap().parse().unwrap(),
695          None => configuration::DEFAULT_RATELIMIT,
696      };
697      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
698          Some(v) => v.to_str().unwrap().parse().unwrap(),
699          None => 0,
700      };
701    }
702
703    let local_var_status = local_var_resp.status();
704    let local_var_content = local_var_resp.text().await?;
705
706    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
707        Ok(())
708    } else {
709        let local_var_entity: Option<DeleteNetworkProtectNetworkError> = serde_json::from_str(&local_var_content).ok();
710        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
711        Err(Error::ResponseError(local_var_error))
712    }
713}
714
715/// Deletes a prefix list. Active rule references must be removed first; referenced lists return a `409 Conflict` error. Unknown and foreign IDs are indistinguishable and return a `404 Not Found` error.
716pub async fn delete_network_protect_prefix_list(configuration: &mut configuration::Configuration, params: DeleteNetworkProtectPrefixListParams) -> Result<(), Error<DeleteNetworkProtectPrefixListError>> {
717    let local_var_configuration = configuration;
718
719    // unbox the parameters
720    let prefix_list_id = params.prefix_list_id;
721
722
723    let local_var_client = &local_var_configuration.client;
724
725    let local_var_uri_str = format!("{}/network-protect/v1/prefix-lists/{prefix_list_id}", local_var_configuration.base_path, prefix_list_id=crate::apis::urlencode(prefix_list_id));
726    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
727
728    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
729        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
730    }
731    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
732        let local_var_key = local_var_apikey.key.clone();
733        let local_var_value = match local_var_apikey.prefix {
734            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
735            None => local_var_key,
736        };
737        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
738    };
739
740    let local_var_req = local_var_req_builder.build()?;
741    let local_var_resp = local_var_client.execute(local_var_req).await?;
742
743    if "DELETE" != "GET" && "DELETE" != "HEAD" {
744      let headers = local_var_resp.headers();
745      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
746          Some(v) => v.to_str().unwrap().parse().unwrap(),
747          None => configuration::DEFAULT_RATELIMIT,
748      };
749      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
750          Some(v) => v.to_str().unwrap().parse().unwrap(),
751          None => 0,
752      };
753    }
754
755    let local_var_status = local_var_resp.status();
756    let local_var_content = local_var_resp.text().await?;
757
758    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
759        Ok(())
760    } else {
761        let local_var_entity: Option<DeleteNetworkProtectPrefixListError> = serde_json::from_str(&local_var_content).ok();
762        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
763        Err(Error::ResponseError(local_var_error))
764    }
765}
766
767/// Deletes a rule set. Attached rule sets cannot be deleted and return a `409 Conflict` error until their references are removed.
768pub async fn delete_network_protect_rule_set(configuration: &mut configuration::Configuration, params: DeleteNetworkProtectRuleSetParams) -> Result<(), Error<DeleteNetworkProtectRuleSetError>> {
769    let local_var_configuration = configuration;
770
771    // unbox the parameters
772    let rule_set_id = params.rule_set_id;
773
774
775    let local_var_client = &local_var_configuration.client;
776
777    let local_var_uri_str = format!("{}/network-protect/v1/rule-sets/{rule_set_id}", local_var_configuration.base_path, rule_set_id=crate::apis::urlencode(rule_set_id));
778    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
779
780    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
781        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
782    }
783    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
784        let local_var_key = local_var_apikey.key.clone();
785        let local_var_value = match local_var_apikey.prefix {
786            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
787            None => local_var_key,
788        };
789        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
790    };
791
792    let local_var_req = local_var_req_builder.build()?;
793    let local_var_resp = local_var_client.execute(local_var_req).await?;
794
795    if "DELETE" != "GET" && "DELETE" != "HEAD" {
796      let headers = local_var_resp.headers();
797      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
798          Some(v) => v.to_str().unwrap().parse().unwrap(),
799          None => configuration::DEFAULT_RATELIMIT,
800      };
801      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
802          Some(v) => v.to_str().unwrap().parse().unwrap(),
803          None => 0,
804      };
805    }
806
807    let local_var_status = local_var_resp.status();
808    let local_var_content = local_var_resp.text().await?;
809
810    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
811        Ok(())
812    } else {
813        let local_var_entity: Option<DeleteNetworkProtectRuleSetError> = serde_json::from_str(&local_var_content).ok();
814        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
815        Err(Error::ResponseError(local_var_error))
816    }
817}
818
819/// Retrieves a single endpoint by its identifier.
820pub async fn get_network_protect_endpoint(configuration: &mut configuration::Configuration, params: GetNetworkProtectEndpointParams) -> Result<crate::models::NetworkProtectEndpointResponse, Error<GetNetworkProtectEndpointError>> {
821    let local_var_configuration = configuration;
822
823    // unbox the parameters
824    let endpoint_id = params.endpoint_id;
825
826
827    let local_var_client = &local_var_configuration.client;
828
829    let local_var_uri_str = format!("{}/network-protect/v1/endpoints/{endpoint_id}", local_var_configuration.base_path, endpoint_id=crate::apis::urlencode(endpoint_id));
830    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
831
832    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
833        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
834    }
835    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
836        let local_var_key = local_var_apikey.key.clone();
837        let local_var_value = match local_var_apikey.prefix {
838            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
839            None => local_var_key,
840        };
841        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
842    };
843
844    let local_var_req = local_var_req_builder.build()?;
845    let local_var_resp = local_var_client.execute(local_var_req).await?;
846
847    if "GET" != "GET" && "GET" != "HEAD" {
848      let headers = local_var_resp.headers();
849      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
850          Some(v) => v.to_str().unwrap().parse().unwrap(),
851          None => configuration::DEFAULT_RATELIMIT,
852      };
853      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
854          Some(v) => v.to_str().unwrap().parse().unwrap(),
855          None => 0,
856      };
857    }
858
859    let local_var_status = local_var_resp.status();
860    let local_var_content = local_var_resp.text().await?;
861
862    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
863        serde_json::from_str(&local_var_content).map_err(Error::from)
864    } else {
865        let local_var_entity: Option<GetNetworkProtectEndpointError> = serde_json::from_str(&local_var_content).ok();
866        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
867        Err(Error::ResponseError(local_var_error))
868    }
869}
870
871/// Retrieves a single network by its identifier.
872pub async fn get_network_protect_network(configuration: &mut configuration::Configuration, params: GetNetworkProtectNetworkParams) -> Result<crate::models::NetworkProtectNetworkResponse, Error<GetNetworkProtectNetworkError>> {
873    let local_var_configuration = configuration;
874
875    // unbox the parameters
876    let network_id = params.network_id;
877
878
879    let local_var_client = &local_var_configuration.client;
880
881    let local_var_uri_str = format!("{}/network-protect/v1/networks/{network_id}", local_var_configuration.base_path, network_id=crate::apis::urlencode(network_id));
882    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
883
884    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
885        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
886    }
887    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
888        let local_var_key = local_var_apikey.key.clone();
889        let local_var_value = match local_var_apikey.prefix {
890            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
891            None => local_var_key,
892        };
893        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
894    };
895
896    let local_var_req = local_var_req_builder.build()?;
897    let local_var_resp = local_var_client.execute(local_var_req).await?;
898
899    if "GET" != "GET" && "GET" != "HEAD" {
900      let headers = local_var_resp.headers();
901      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
902          Some(v) => v.to_str().unwrap().parse().unwrap(),
903          None => configuration::DEFAULT_RATELIMIT,
904      };
905      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
906          Some(v) => v.to_str().unwrap().parse().unwrap(),
907          None => 0,
908      };
909    }
910
911    let local_var_status = local_var_resp.status();
912    let local_var_content = local_var_resp.text().await?;
913
914    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
915        serde_json::from_str(&local_var_content).map_err(Error::from)
916    } else {
917        let local_var_entity: Option<GetNetworkProtectNetworkError> = serde_json::from_str(&local_var_content).ok();
918        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
919        Err(Error::ResponseError(local_var_error))
920    }
921}
922
923/// Retrieves a single prefix list by its identifier. Unknown and foreign IDs are indistinguishable and return a `404 Not Found` error.
924pub async fn get_network_protect_prefix_list(configuration: &mut configuration::Configuration, params: GetNetworkProtectPrefixListParams) -> Result<crate::models::NetworkProtectPrefixListResponse, Error<GetNetworkProtectPrefixListError>> {
925    let local_var_configuration = configuration;
926
927    // unbox the parameters
928    let prefix_list_id = params.prefix_list_id;
929
930
931    let local_var_client = &local_var_configuration.client;
932
933    let local_var_uri_str = format!("{}/network-protect/v1/prefix-lists/{prefix_list_id}", local_var_configuration.base_path, prefix_list_id=crate::apis::urlencode(prefix_list_id));
934    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
935
936    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
937        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
938    }
939    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
940        let local_var_key = local_var_apikey.key.clone();
941        let local_var_value = match local_var_apikey.prefix {
942            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
943            None => local_var_key,
944        };
945        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
946    };
947
948    let local_var_req = local_var_req_builder.build()?;
949    let local_var_resp = local_var_client.execute(local_var_req).await?;
950
951    if "GET" != "GET" && "GET" != "HEAD" {
952      let headers = local_var_resp.headers();
953      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
954          Some(v) => v.to_str().unwrap().parse().unwrap(),
955          None => configuration::DEFAULT_RATELIMIT,
956      };
957      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
958          Some(v) => v.to_str().unwrap().parse().unwrap(),
959          None => 0,
960      };
961    }
962
963    let local_var_status = local_var_resp.status();
964    let local_var_content = local_var_resp.text().await?;
965
966    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
967        serde_json::from_str(&local_var_content).map_err(Error::from)
968    } else {
969        let local_var_entity: Option<GetNetworkProtectPrefixListError> = serde_json::from_str(&local_var_content).ok();
970        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
971        Err(Error::ResponseError(local_var_error))
972    }
973}
974
975/// Retrieves a single rule set with rules in evaluation order.
976pub async fn get_network_protect_rule_set(configuration: &mut configuration::Configuration, params: GetNetworkProtectRuleSetParams) -> Result<crate::models::NetworkProtectRuleSetResponse, Error<GetNetworkProtectRuleSetError>> {
977    let local_var_configuration = configuration;
978
979    // unbox the parameters
980    let rule_set_id = params.rule_set_id;
981
982
983    let local_var_client = &local_var_configuration.client;
984
985    let local_var_uri_str = format!("{}/network-protect/v1/rule-sets/{rule_set_id}", local_var_configuration.base_path, rule_set_id=crate::apis::urlencode(rule_set_id));
986    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
987
988    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
989        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
990    }
991    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
992        let local_var_key = local_var_apikey.key.clone();
993        let local_var_value = match local_var_apikey.prefix {
994            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
995            None => local_var_key,
996        };
997        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
998    };
999
1000    let local_var_req = local_var_req_builder.build()?;
1001    let local_var_resp = local_var_client.execute(local_var_req).await?;
1002
1003    if "GET" != "GET" && "GET" != "HEAD" {
1004      let headers = local_var_resp.headers();
1005      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1006          Some(v) => v.to_str().unwrap().parse().unwrap(),
1007          None => configuration::DEFAULT_RATELIMIT,
1008      };
1009      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1010          Some(v) => v.to_str().unwrap().parse().unwrap(),
1011          None => 0,
1012      };
1013    }
1014
1015    let local_var_status = local_var_resp.status();
1016    let local_var_content = local_var_resp.text().await?;
1017
1018    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1019        serde_json::from_str(&local_var_content).map_err(Error::from)
1020    } else {
1021        let local_var_entity: Option<GetNetworkProtectRuleSetError> = serde_json::from_str(&local_var_content).ok();
1022        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1023        Err(Error::ResponseError(local_var_error))
1024    }
1025}
1026
1027/// Lists the customer's GRE delivery endpoints in ascending ID order. The response is cursor-paginated and includes the effective page limit.
1028pub async fn list_network_protect_endpoints(configuration: &mut configuration::Configuration, params: ListNetworkProtectEndpointsParams) -> Result<crate::models::NetworkProtectEndpointsResponse, Error<ListNetworkProtectEndpointsError>> {
1029    let local_var_configuration = configuration;
1030
1031    // unbox the parameters
1032    let limit = params.limit;
1033    let cursor = params.cursor;
1034
1035
1036    let local_var_client = &local_var_configuration.client;
1037
1038    let local_var_uri_str = format!("{}/network-protect/v1/endpoints", local_var_configuration.base_path);
1039    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1040
1041    if let Some(ref local_var_str) = limit {
1042        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1043    }
1044    if let Some(ref local_var_str) = cursor {
1045        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1046    }
1047    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1048        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1049    }
1050    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1051        let local_var_key = local_var_apikey.key.clone();
1052        let local_var_value = match local_var_apikey.prefix {
1053            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1054            None => local_var_key,
1055        };
1056        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1057    };
1058
1059    let local_var_req = local_var_req_builder.build()?;
1060    let local_var_resp = local_var_client.execute(local_var_req).await?;
1061
1062    if "GET" != "GET" && "GET" != "HEAD" {
1063      let headers = local_var_resp.headers();
1064      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1065          Some(v) => v.to_str().unwrap().parse().unwrap(),
1066          None => configuration::DEFAULT_RATELIMIT,
1067      };
1068      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1069          Some(v) => v.to_str().unwrap().parse().unwrap(),
1070          None => 0,
1071      };
1072    }
1073
1074    let local_var_status = local_var_resp.status();
1075    let local_var_content = local_var_resp.text().await?;
1076
1077    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1078        serde_json::from_str(&local_var_content).map_err(Error::from)
1079    } else {
1080        let local_var_entity: Option<ListNetworkProtectEndpointsError> = serde_json::from_str(&local_var_content).ok();
1081        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1082        Err(Error::ResponseError(local_var_error))
1083    }
1084}
1085
1086/// Lists the customer's networks in ascending ID order. The response is cursor-paginated and includes the effective page limit.
1087pub async fn list_network_protect_networks(configuration: &mut configuration::Configuration, params: ListNetworkProtectNetworksParams) -> Result<crate::models::NetworkProtectNetworksResponse, Error<ListNetworkProtectNetworksError>> {
1088    let local_var_configuration = configuration;
1089
1090    // unbox the parameters
1091    let limit = params.limit;
1092    let cursor = params.cursor;
1093
1094
1095    let local_var_client = &local_var_configuration.client;
1096
1097    let local_var_uri_str = format!("{}/network-protect/v1/networks", local_var_configuration.base_path);
1098    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1099
1100    if let Some(ref local_var_str) = limit {
1101        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1102    }
1103    if let Some(ref local_var_str) = cursor {
1104        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1105    }
1106    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1107        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1108    }
1109    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1110        let local_var_key = local_var_apikey.key.clone();
1111        let local_var_value = match local_var_apikey.prefix {
1112            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1113            None => local_var_key,
1114        };
1115        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1116    };
1117
1118    let local_var_req = local_var_req_builder.build()?;
1119    let local_var_resp = local_var_client.execute(local_var_req).await?;
1120
1121    if "GET" != "GET" && "GET" != "HEAD" {
1122      let headers = local_var_resp.headers();
1123      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1124          Some(v) => v.to_str().unwrap().parse().unwrap(),
1125          None => configuration::DEFAULT_RATELIMIT,
1126      };
1127      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1128          Some(v) => v.to_str().unwrap().parse().unwrap(),
1129          None => 0,
1130      };
1131    }
1132
1133    let local_var_status = local_var_resp.status();
1134    let local_var_content = local_var_resp.text().await?;
1135
1136    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1137        serde_json::from_str(&local_var_content).map_err(Error::from)
1138    } else {
1139        let local_var_entity: Option<ListNetworkProtectNetworksError> = serde_json::from_str(&local_var_content).ok();
1140        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1141        Err(Error::ResponseError(local_var_error))
1142    }
1143}
1144
1145/// Lists prefix lists in ascending ID order. Positive limits above 1000 are accepted and clamped to 1000. Invalid limits return a `400 Bad Request` error.
1146pub async fn list_network_protect_prefix_lists(configuration: &mut configuration::Configuration, params: ListNetworkProtectPrefixListsParams) -> Result<crate::models::NetworkProtectPrefixListsResponse, Error<ListNetworkProtectPrefixListsError>> {
1147    let local_var_configuration = configuration;
1148
1149    // unbox the parameters
1150    let limit = params.limit;
1151    let cursor = params.cursor;
1152
1153
1154    let local_var_client = &local_var_configuration.client;
1155
1156    let local_var_uri_str = format!("{}/network-protect/v1/prefix-lists", local_var_configuration.base_path);
1157    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1158
1159    if let Some(ref local_var_str) = limit {
1160        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1161    }
1162    if let Some(ref local_var_str) = cursor {
1163        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1164    }
1165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1166        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1167    }
1168    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1169        let local_var_key = local_var_apikey.key.clone();
1170        let local_var_value = match local_var_apikey.prefix {
1171            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1172            None => local_var_key,
1173        };
1174        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1175    };
1176
1177    let local_var_req = local_var_req_builder.build()?;
1178    let local_var_resp = local_var_client.execute(local_var_req).await?;
1179
1180    if "GET" != "GET" && "GET" != "HEAD" {
1181      let headers = local_var_resp.headers();
1182      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1183          Some(v) => v.to_str().unwrap().parse().unwrap(),
1184          None => configuration::DEFAULT_RATELIMIT,
1185      };
1186      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1187          Some(v) => v.to_str().unwrap().parse().unwrap(),
1188          None => 0,
1189      };
1190    }
1191
1192    let local_var_status = local_var_resp.status();
1193    let local_var_content = local_var_resp.text().await?;
1194
1195    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1196        serde_json::from_str(&local_var_content).map_err(Error::from)
1197    } else {
1198        let local_var_entity: Option<ListNetworkProtectPrefixListsError> = serde_json::from_str(&local_var_content).ok();
1199        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1200        Err(Error::ResponseError(local_var_error))
1201    }
1202}
1203
1204/// Lists rule sets in ascending ID order. Positive limits above 1000 are accepted and clamped to 1000; invalid limits return a `400 Bad Request` error.
1205pub async fn list_network_protect_rule_sets(configuration: &mut configuration::Configuration, params: ListNetworkProtectRuleSetsParams) -> Result<crate::models::NetworkProtectRuleSetsResponse, Error<ListNetworkProtectRuleSetsError>> {
1206    let local_var_configuration = configuration;
1207
1208    // unbox the parameters
1209    let limit = params.limit;
1210    let cursor = params.cursor;
1211
1212
1213    let local_var_client = &local_var_configuration.client;
1214
1215    let local_var_uri_str = format!("{}/network-protect/v1/rule-sets", local_var_configuration.base_path);
1216    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1217
1218    if let Some(ref local_var_str) = limit {
1219        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
1220    }
1221    if let Some(ref local_var_str) = cursor {
1222        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1223    }
1224    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1225        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1226    }
1227    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1228        let local_var_key = local_var_apikey.key.clone();
1229        let local_var_value = match local_var_apikey.prefix {
1230            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1231            None => local_var_key,
1232        };
1233        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1234    };
1235
1236    let local_var_req = local_var_req_builder.build()?;
1237    let local_var_resp = local_var_client.execute(local_var_req).await?;
1238
1239    if "GET" != "GET" && "GET" != "HEAD" {
1240      let headers = local_var_resp.headers();
1241      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1242          Some(v) => v.to_str().unwrap().parse().unwrap(),
1243          None => configuration::DEFAULT_RATELIMIT,
1244      };
1245      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1246          Some(v) => v.to_str().unwrap().parse().unwrap(),
1247          None => 0,
1248      };
1249    }
1250
1251    let local_var_status = local_var_resp.status();
1252    let local_var_content = local_var_resp.text().await?;
1253
1254    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1255        serde_json::from_str(&local_var_content).map_err(Error::from)
1256    } else {
1257        let local_var_entity: Option<ListNetworkProtectRuleSetsError> = serde_json::from_str(&local_var_content).ok();
1258        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1259        Err(Error::ResponseError(local_var_error))
1260    }
1261}
1262
1263/// Updates an endpoint. Omitted fields remain unchanged. The IP address cannot be changed; create a new endpoint if the destination changes.
1264pub async fn update_network_protect_endpoint(configuration: &mut configuration::Configuration, params: UpdateNetworkProtectEndpointParams) -> Result<crate::models::NetworkProtectEndpointResponse, Error<UpdateNetworkProtectEndpointError>> {
1265    let local_var_configuration = configuration;
1266
1267    // unbox the parameters
1268    let endpoint_id = params.endpoint_id;
1269    let network_protect_endpoint_update = params.network_protect_endpoint_update;
1270
1271
1272    let local_var_client = &local_var_configuration.client;
1273
1274    let local_var_uri_str = format!("{}/network-protect/v1/endpoints/{endpoint_id}", local_var_configuration.base_path, endpoint_id=crate::apis::urlencode(endpoint_id));
1275    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1276
1277    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1278        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1279    }
1280    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1281        let local_var_key = local_var_apikey.key.clone();
1282        let local_var_value = match local_var_apikey.prefix {
1283            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1284            None => local_var_key,
1285        };
1286        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1287    };
1288    local_var_req_builder = local_var_req_builder.json(&network_protect_endpoint_update);
1289
1290    let local_var_req = local_var_req_builder.build()?;
1291    let local_var_resp = local_var_client.execute(local_var_req).await?;
1292
1293    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1294      let headers = local_var_resp.headers();
1295      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1296          Some(v) => v.to_str().unwrap().parse().unwrap(),
1297          None => configuration::DEFAULT_RATELIMIT,
1298      };
1299      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1300          Some(v) => v.to_str().unwrap().parse().unwrap(),
1301          None => 0,
1302      };
1303    }
1304
1305    let local_var_status = local_var_resp.status();
1306    let local_var_content = local_var_resp.text().await?;
1307
1308    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1309        serde_json::from_str(&local_var_content).map_err(Error::from)
1310    } else {
1311        let local_var_entity: Option<UpdateNetworkProtectEndpointError> = serde_json::from_str(&local_var_content).ok();
1312        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1313        Err(Error::ResponseError(local_var_error))
1314    }
1315}
1316
1317/// Updates a network. Omitted fields remain unchanged. The prefix cannot be changed. Sending `endpoint_policies` replaces the complete policy list; an empty array removes every policy. Advertisement is desired state. Enabling it requires an approved LOA, a valid ROA, and a ready default-region delivery policy. A readiness failure returns a `409 Conflict` error.
1318pub async fn update_network_protect_network(configuration: &mut configuration::Configuration, params: UpdateNetworkProtectNetworkParams) -> Result<crate::models::NetworkProtectNetworkResponse, Error<UpdateNetworkProtectNetworkError>> {
1319    let local_var_configuration = configuration;
1320
1321    // unbox the parameters
1322    let network_id = params.network_id;
1323    let network_protect_network_update = params.network_protect_network_update;
1324
1325
1326    let local_var_client = &local_var_configuration.client;
1327
1328    let local_var_uri_str = format!("{}/network-protect/v1/networks/{network_id}", local_var_configuration.base_path, network_id=crate::apis::urlencode(network_id));
1329    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1330
1331    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1332        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1333    }
1334    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1335        let local_var_key = local_var_apikey.key.clone();
1336        let local_var_value = match local_var_apikey.prefix {
1337            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1338            None => local_var_key,
1339        };
1340        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1341    };
1342    local_var_req_builder = local_var_req_builder.json(&network_protect_network_update);
1343
1344    let local_var_req = local_var_req_builder.build()?;
1345    let local_var_resp = local_var_client.execute(local_var_req).await?;
1346
1347    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1348      let headers = local_var_resp.headers();
1349      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1350          Some(v) => v.to_str().unwrap().parse().unwrap(),
1351          None => configuration::DEFAULT_RATELIMIT,
1352      };
1353      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1354          Some(v) => v.to_str().unwrap().parse().unwrap(),
1355          None => 0,
1356      };
1357    }
1358
1359    let local_var_status = local_var_resp.status();
1360    let local_var_content = local_var_resp.text().await?;
1361
1362    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1363        serde_json::from_str(&local_var_content).map_err(Error::from)
1364    } else {
1365        let local_var_entity: Option<UpdateNetworkProtectNetworkError> = serde_json::from_str(&local_var_content).ok();
1366        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1367        Err(Error::ResponseError(local_var_error))
1368    }
1369}
1370
1371/// Updates a prefix list. The family cannot be changed. Sending addresses replaces the complete list; an empty array clears it when no active source-list restriction applies. Addresses are canonicalized, deduplicated, and sorted by the backend.
1372pub async fn update_network_protect_prefix_list(configuration: &mut configuration::Configuration, params: UpdateNetworkProtectPrefixListParams) -> Result<crate::models::NetworkProtectPrefixListResponse, Error<UpdateNetworkProtectPrefixListError>> {
1373    let local_var_configuration = configuration;
1374
1375    // unbox the parameters
1376    let prefix_list_id = params.prefix_list_id;
1377    let network_protect_prefix_list_update = params.network_protect_prefix_list_update;
1378
1379
1380    let local_var_client = &local_var_configuration.client;
1381
1382    let local_var_uri_str = format!("{}/network-protect/v1/prefix-lists/{prefix_list_id}", local_var_configuration.base_path, prefix_list_id=crate::apis::urlencode(prefix_list_id));
1383    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1384
1385    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1386        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1387    }
1388    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1389        let local_var_key = local_var_apikey.key.clone();
1390        let local_var_value = match local_var_apikey.prefix {
1391            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1392            None => local_var_key,
1393        };
1394        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1395    };
1396    local_var_req_builder = local_var_req_builder.json(&network_protect_prefix_list_update);
1397
1398    let local_var_req = local_var_req_builder.build()?;
1399    let local_var_resp = local_var_client.execute(local_var_req).await?;
1400
1401    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1402      let headers = local_var_resp.headers();
1403      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1404          Some(v) => v.to_str().unwrap().parse().unwrap(),
1405          None => configuration::DEFAULT_RATELIMIT,
1406      };
1407      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1408          Some(v) => v.to_str().unwrap().parse().unwrap(),
1409          None => 0,
1410      };
1411    }
1412
1413    let local_var_status = local_var_resp.status();
1414    let local_var_content = local_var_resp.text().await?;
1415
1416    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1417        serde_json::from_str(&local_var_content).map_err(Error::from)
1418    } else {
1419        let local_var_entity: Option<UpdateNetworkProtectPrefixListError> = serde_json::from_str(&local_var_content).ok();
1420        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1421        Err(Error::ResponseError(local_var_error))
1422    }
1423}
1424
1425/// Updates a rule set. Omitted fields remain unchanged. Sending rules replaces the complete ordered list; an empty array removes every rule. Custom attachment and detachment remain restricted in this release.
1426pub async fn update_network_protect_rule_set(configuration: &mut configuration::Configuration, params: UpdateNetworkProtectRuleSetParams) -> Result<crate::models::NetworkProtectRuleSetResponse, Error<UpdateNetworkProtectRuleSetError>> {
1427    let local_var_configuration = configuration;
1428
1429    // unbox the parameters
1430    let rule_set_id = params.rule_set_id;
1431    let network_protect_rule_set_update = params.network_protect_rule_set_update;
1432
1433
1434    let local_var_client = &local_var_configuration.client;
1435
1436    let local_var_uri_str = format!("{}/network-protect/v1/rule-sets/{rule_set_id}", local_var_configuration.base_path, rule_set_id=crate::apis::urlencode(rule_set_id));
1437    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1438
1439    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1440        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1441    }
1442    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1443        let local_var_key = local_var_apikey.key.clone();
1444        let local_var_value = match local_var_apikey.prefix {
1445            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1446            None => local_var_key,
1447        };
1448        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1449    };
1450    local_var_req_builder = local_var_req_builder.json(&network_protect_rule_set_update);
1451
1452    let local_var_req = local_var_req_builder.build()?;
1453    let local_var_resp = local_var_client.execute(local_var_req).await?;
1454
1455    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1456      let headers = local_var_resp.headers();
1457      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1458          Some(v) => v.to_str().unwrap().parse().unwrap(),
1459          None => configuration::DEFAULT_RATELIMIT,
1460      };
1461      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1462          Some(v) => v.to_str().unwrap().parse().unwrap(),
1463          None => 0,
1464      };
1465    }
1466
1467    let local_var_status = local_var_resp.status();
1468    let local_var_content = local_var_resp.text().await?;
1469
1470    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1471        serde_json::from_str(&local_var_content).map_err(Error::from)
1472    } else {
1473        let local_var_entity: Option<UpdateNetworkProtectRuleSetError> = serde_json::from_str(&local_var_content).ok();
1474        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1475        Err(Error::ResponseError(local_var_error))
1476    }
1477}
1478