Skip to main content

fastly_api/apis/
apisecurity_operations_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 [`api_security_bulk_add_tags_to_operations`]
15#[derive(Clone, Debug, Default)]
16pub struct ApiSecurityBulkAddTagsToOperationsParams {
17    /// The unique identifier of the service.
18    pub service_id: String,
19    pub operation_bulk_add_tags: Option<crate::models::OperationBulkAddTags>
20}
21
22/// struct for passing parameters to the method [`api_security_bulk_create_operations`]
23#[derive(Clone, Debug, Default)]
24pub struct ApiSecurityBulkCreateOperationsParams {
25    /// The unique identifier of the service.
26    pub service_id: String,
27    pub operation_bulk_create: Option<crate::models::OperationBulkCreate>
28}
29
30/// struct for passing parameters to the method [`api_security_bulk_delete_operations`]
31#[derive(Clone, Debug, Default)]
32pub struct ApiSecurityBulkDeleteOperationsParams {
33    /// The unique identifier of the service.
34    pub service_id: String,
35    pub operation_bulk_delete: Option<crate::models::OperationBulkDelete>
36}
37
38/// struct for passing parameters to the method [`api_security_create_operation`]
39#[derive(Clone, Debug, Default)]
40pub struct ApiSecurityCreateOperationParams {
41    /// The unique identifier of the service.
42    pub service_id: String,
43    pub operation_create: Option<crate::models::OperationCreate>
44}
45
46/// struct for passing parameters to the method [`api_security_create_operation_tag`]
47#[derive(Clone, Debug, Default)]
48pub struct ApiSecurityCreateOperationTagParams {
49    /// The unique identifier of the service.
50    pub service_id: String,
51    pub tag_create: Option<crate::models::TagCreate>
52}
53
54/// struct for passing parameters to the method [`api_security_delete_operation`]
55#[derive(Clone, Debug, Default)]
56pub struct ApiSecurityDeleteOperationParams {
57    /// The unique identifier of the service.
58    pub service_id: String,
59    /// The unique identifier of the operation.
60    pub operation_id: String
61}
62
63/// struct for passing parameters to the method [`api_security_delete_operation_tag`]
64#[derive(Clone, Debug, Default)]
65pub struct ApiSecurityDeleteOperationTagParams {
66    /// The unique identifier of the service.
67    pub service_id: String,
68    /// The unique identifier of the operation tag.
69    pub tag_id: String
70}
71
72/// struct for passing parameters to the method [`api_security_get_operation`]
73#[derive(Clone, Debug, Default)]
74pub struct ApiSecurityGetOperationParams {
75    /// The unique identifier of the service.
76    pub service_id: String,
77    /// The unique identifier of the operation.
78    pub operation_id: String
79}
80
81/// struct for passing parameters to the method [`api_security_get_operation_tag`]
82#[derive(Clone, Debug, Default)]
83pub struct ApiSecurityGetOperationTagParams {
84    /// The unique identifier of the service.
85    pub service_id: String,
86    /// The unique identifier of the operation tag.
87    pub tag_id: String
88}
89
90/// struct for passing parameters to the method [`api_security_list_discovered_operations`]
91#[derive(Clone, Debug, Default)]
92pub struct ApiSecurityListDiscoveredOperationsParams {
93    /// The unique identifier of the service.
94    pub service_id: String,
95    /// Filter operations by HTTP method.
96    pub method: Option<Vec<String>>,
97    /// Filter operations by fully-qualified domain name (exact match).
98    pub domain: Option<Vec<String>>,
99    /// Filter operations by path (exact match).
100    pub path: Option<String>,
101    /// The maximum number of operations to return per page.
102    pub limit: Option<i32>,
103    /// The page number to return.
104    pub page: Option<i32>
105}
106
107/// struct for passing parameters to the method [`api_security_list_operation_tags`]
108#[derive(Clone, Debug, Default)]
109pub struct ApiSecurityListOperationTagsParams {
110    /// The unique identifier of the service.
111    pub service_id: String,
112    /// The maximum number of operations to return per page.
113    pub limit: Option<i32>,
114    /// The page number to return.
115    pub page: Option<i32>
116}
117
118/// struct for passing parameters to the method [`api_security_list_operations`]
119#[derive(Clone, Debug, Default)]
120pub struct ApiSecurityListOperationsParams {
121    /// The unique identifier of the service.
122    pub service_id: String,
123    /// Filter operations by operation tag ID. Only operations associated with this operation tag will be returned.
124    pub tag_id: Option<String>,
125    /// Filter operations by status. Defaults to SAVED if omitted.
126    pub status: Option<String>,
127    /// Filter operations by HTTP method.
128    pub method: Option<Vec<String>>,
129    /// Filter operations by fully-qualified domain name (exact match).
130    pub domain: Option<Vec<String>>,
131    /// Filter operations by path (exact match).
132    pub path: Option<String>,
133    /// The maximum number of operations to return per page.
134    pub limit: Option<i32>,
135    /// The page number to return.
136    pub page: Option<i32>
137}
138
139/// struct for passing parameters to the method [`api_security_update_operation`]
140#[derive(Clone, Debug, Default)]
141pub struct ApiSecurityUpdateOperationParams {
142    /// The unique identifier of the service.
143    pub service_id: String,
144    /// The unique identifier of the operation.
145    pub operation_id: String,
146    pub operation_update: Option<crate::models::OperationUpdate>
147}
148
149/// struct for passing parameters to the method [`api_security_update_operation_tag`]
150#[derive(Clone, Debug, Default)]
151pub struct ApiSecurityUpdateOperationTagParams {
152    /// The unique identifier of the service.
153    pub service_id: String,
154    /// The unique identifier of the operation tag.
155    pub tag_id: String,
156    pub body: Option<crate::models::TagBase>
157}
158
159
160/// struct for typed errors of method [`api_security_bulk_add_tags_to_operations`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum ApiSecurityBulkAddTagsToOperationsError {
164    Status400(serde_json::Value),
165    Status401(serde_json::Value),
166    Status403(serde_json::Value),
167    Status404(serde_json::Value),
168    Status429(serde_json::Value),
169    UnknownValue(serde_json::Value),
170}
171
172/// struct for typed errors of method [`api_security_bulk_create_operations`]
173#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ApiSecurityBulkCreateOperationsError {
176    Status400(serde_json::Value),
177    Status401(serde_json::Value),
178    Status403(serde_json::Value),
179    Status404(serde_json::Value),
180    Status429(serde_json::Value),
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`api_security_bulk_delete_operations`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum ApiSecurityBulkDeleteOperationsError {
188    Status400(serde_json::Value),
189    Status401(serde_json::Value),
190    Status403(serde_json::Value),
191    Status404(serde_json::Value),
192    Status429(serde_json::Value),
193    UnknownValue(serde_json::Value),
194}
195
196/// struct for typed errors of method [`api_security_create_operation`]
197#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum ApiSecurityCreateOperationError {
200    Status400(serde_json::Value),
201    Status401(serde_json::Value),
202    Status403(serde_json::Value),
203    Status404(serde_json::Value),
204    Status429(serde_json::Value),
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`api_security_create_operation_tag`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum ApiSecurityCreateOperationTagError {
212    Status400(serde_json::Value),
213    Status401(serde_json::Value),
214    Status403(serde_json::Value),
215    Status429(serde_json::Value),
216    UnknownValue(serde_json::Value),
217}
218
219/// struct for typed errors of method [`api_security_delete_operation`]
220#[derive(Debug, Clone, Serialize, Deserialize)]
221#[serde(untagged)]
222pub enum ApiSecurityDeleteOperationError {
223    Status400(serde_json::Value),
224    Status401(serde_json::Value),
225    Status403(serde_json::Value),
226    Status404(serde_json::Value),
227    Status429(serde_json::Value),
228    UnknownValue(serde_json::Value),
229}
230
231/// struct for typed errors of method [`api_security_delete_operation_tag`]
232#[derive(Debug, Clone, Serialize, Deserialize)]
233#[serde(untagged)]
234pub enum ApiSecurityDeleteOperationTagError {
235    Status400(serde_json::Value),
236    Status401(serde_json::Value),
237    Status403(serde_json::Value),
238    Status404(serde_json::Value),
239    Status429(serde_json::Value),
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`api_security_get_operation`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum ApiSecurityGetOperationError {
247    Status400(serde_json::Value),
248    Status401(serde_json::Value),
249    Status403(serde_json::Value),
250    Status404(serde_json::Value),
251    Status429(serde_json::Value),
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`api_security_get_operation_tag`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum ApiSecurityGetOperationTagError {
259    Status400(serde_json::Value),
260    Status401(serde_json::Value),
261    Status403(serde_json::Value),
262    Status404(serde_json::Value),
263    Status429(serde_json::Value),
264    UnknownValue(serde_json::Value),
265}
266
267/// struct for typed errors of method [`api_security_list_discovered_operations`]
268#[derive(Debug, Clone, Serialize, Deserialize)]
269#[serde(untagged)]
270pub enum ApiSecurityListDiscoveredOperationsError {
271    Status400(serde_json::Value),
272    Status401(serde_json::Value),
273    Status403(serde_json::Value),
274    Status404(serde_json::Value),
275    Status429(serde_json::Value),
276    UnknownValue(serde_json::Value),
277}
278
279/// struct for typed errors of method [`api_security_list_operation_tags`]
280#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum ApiSecurityListOperationTagsError {
283    Status400(serde_json::Value),
284    Status401(serde_json::Value),
285    Status403(serde_json::Value),
286    Status429(serde_json::Value),
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`api_security_list_operations`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum ApiSecurityListOperationsError {
294    Status400(serde_json::Value),
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 [`api_security_update_operation`]
303#[derive(Debug, Clone, Serialize, Deserialize)]
304#[serde(untagged)]
305pub enum ApiSecurityUpdateOperationError {
306    Status400(serde_json::Value),
307    Status401(serde_json::Value),
308    Status403(serde_json::Value),
309    Status404(serde_json::Value),
310    Status429(serde_json::Value),
311    UnknownValue(serde_json::Value),
312}
313
314/// struct for typed errors of method [`api_security_update_operation_tag`]
315#[derive(Debug, Clone, Serialize, Deserialize)]
316#[serde(untagged)]
317pub enum ApiSecurityUpdateOperationTagError {
318    Status400(serde_json::Value),
319    Status401(serde_json::Value),
320    Status403(serde_json::Value),
321    Status404(serde_json::Value),
322    Status429(serde_json::Value),
323    UnknownValue(serde_json::Value),
324}
325
326
327/// Add tags to multiple operations in a single request.
328pub async fn api_security_bulk_add_tags_to_operations(configuration: &mut configuration::Configuration, params: ApiSecurityBulkAddTagsToOperationsParams) -> Result<crate::models::InlineResponse2071, Error<ApiSecurityBulkAddTagsToOperationsError>> {
329    let local_var_configuration = configuration;
330
331    // unbox the parameters
332    let service_id = params.service_id;
333    let operation_bulk_add_tags = params.operation_bulk_add_tags;
334
335
336    let local_var_client = &local_var_configuration.client;
337
338    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations-bulk-tags", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
339    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
340
341    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
342        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
343    }
344    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
345        let local_var_key = local_var_apikey.key.clone();
346        let local_var_value = match local_var_apikey.prefix {
347            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
348            None => local_var_key,
349        };
350        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
351    };
352    local_var_req_builder = local_var_req_builder.json(&operation_bulk_add_tags);
353
354    let local_var_req = local_var_req_builder.build()?;
355    let local_var_resp = local_var_client.execute(local_var_req).await?;
356
357    if "POST" != "GET" && "POST" != "HEAD" {
358      let headers = local_var_resp.headers();
359      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
360          Some(v) => v.to_str().unwrap().parse().unwrap(),
361          None => configuration::DEFAULT_RATELIMIT,
362      };
363      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
364          Some(v) => v.to_str().unwrap().parse().unwrap(),
365          None => 0,
366      };
367    }
368
369    let local_var_status = local_var_resp.status();
370    let local_var_content = local_var_resp.text().await?;
371
372    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
373        serde_json::from_str(&local_var_content).map_err(Error::from)
374    } else {
375        let local_var_entity: Option<ApiSecurityBulkAddTagsToOperationsError> = serde_json::from_str(&local_var_content).ok();
376        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
377        Err(Error::ResponseError(local_var_error))
378    }
379}
380
381/// Create multiple operations associated with a specific service in a single request.
382pub async fn api_security_bulk_create_operations(configuration: &mut configuration::Configuration, params: ApiSecurityBulkCreateOperationsParams) -> Result<crate::models::InlineResponse207, Error<ApiSecurityBulkCreateOperationsError>> {
383    let local_var_configuration = configuration;
384
385    // unbox the parameters
386    let service_id = params.service_id;
387    let operation_bulk_create = params.operation_bulk_create;
388
389
390    let local_var_client = &local_var_configuration.client;
391
392    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations-bulk", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
393    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
394
395    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
396        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
397    }
398    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
399        let local_var_key = local_var_apikey.key.clone();
400        let local_var_value = match local_var_apikey.prefix {
401            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
402            None => local_var_key,
403        };
404        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
405    };
406    local_var_req_builder = local_var_req_builder.json(&operation_bulk_create);
407
408    let local_var_req = local_var_req_builder.build()?;
409    let local_var_resp = local_var_client.execute(local_var_req).await?;
410
411    if "POST" != "GET" && "POST" != "HEAD" {
412      let headers = local_var_resp.headers();
413      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
414          Some(v) => v.to_str().unwrap().parse().unwrap(),
415          None => configuration::DEFAULT_RATELIMIT,
416      };
417      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
418          Some(v) => v.to_str().unwrap().parse().unwrap(),
419          None => 0,
420      };
421    }
422
423    let local_var_status = local_var_resp.status();
424    let local_var_content = local_var_resp.text().await?;
425
426    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
427        serde_json::from_str(&local_var_content).map_err(Error::from)
428    } else {
429        let local_var_entity: Option<ApiSecurityBulkCreateOperationsError> = serde_json::from_str(&local_var_content).ok();
430        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
431        Err(Error::ResponseError(local_var_error))
432    }
433}
434
435/// Delete multiple operations in a single request.
436pub async fn api_security_bulk_delete_operations(configuration: &mut configuration::Configuration, params: ApiSecurityBulkDeleteOperationsParams) -> Result<crate::models::InlineResponse2071, Error<ApiSecurityBulkDeleteOperationsError>> {
437    let local_var_configuration = configuration;
438
439    // unbox the parameters
440    let service_id = params.service_id;
441    let operation_bulk_delete = params.operation_bulk_delete;
442
443
444    let local_var_client = &local_var_configuration.client;
445
446    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations-bulk", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
447    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
448
449    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
450        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
451    }
452    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
453        let local_var_key = local_var_apikey.key.clone();
454        let local_var_value = match local_var_apikey.prefix {
455            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
456            None => local_var_key,
457        };
458        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
459    };
460    local_var_req_builder = local_var_req_builder.json(&operation_bulk_delete);
461
462    let local_var_req = local_var_req_builder.build()?;
463    let local_var_resp = local_var_client.execute(local_var_req).await?;
464
465    if "DELETE" != "GET" && "DELETE" != "HEAD" {
466      let headers = local_var_resp.headers();
467      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
468          Some(v) => v.to_str().unwrap().parse().unwrap(),
469          None => configuration::DEFAULT_RATELIMIT,
470      };
471      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
472          Some(v) => v.to_str().unwrap().parse().unwrap(),
473          None => 0,
474      };
475    }
476
477    let local_var_status = local_var_resp.status();
478    let local_var_content = local_var_resp.text().await?;
479
480    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
481        serde_json::from_str(&local_var_content).map_err(Error::from)
482    } else {
483        let local_var_entity: Option<ApiSecurityBulkDeleteOperationsError> = serde_json::from_str(&local_var_content).ok();
484        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
485        Err(Error::ResponseError(local_var_error))
486    }
487}
488
489/// Create a new operation associated with a specific service.
490pub async fn api_security_create_operation(configuration: &mut configuration::Configuration, params: ApiSecurityCreateOperationParams) -> Result<crate::models::OperationGet, Error<ApiSecurityCreateOperationError>> {
491    let local_var_configuration = configuration;
492
493    // unbox the parameters
494    let service_id = params.service_id;
495    let operation_create = params.operation_create;
496
497
498    let local_var_client = &local_var_configuration.client;
499
500    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
501    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
502
503    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
504        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
505    }
506    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
507        let local_var_key = local_var_apikey.key.clone();
508        let local_var_value = match local_var_apikey.prefix {
509            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
510            None => local_var_key,
511        };
512        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
513    };
514    local_var_req_builder = local_var_req_builder.json(&operation_create);
515
516    let local_var_req = local_var_req_builder.build()?;
517    let local_var_resp = local_var_client.execute(local_var_req).await?;
518
519    if "POST" != "GET" && "POST" != "HEAD" {
520      let headers = local_var_resp.headers();
521      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
522          Some(v) => v.to_str().unwrap().parse().unwrap(),
523          None => configuration::DEFAULT_RATELIMIT,
524      };
525      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
526          Some(v) => v.to_str().unwrap().parse().unwrap(),
527          None => 0,
528      };
529    }
530
531    let local_var_status = local_var_resp.status();
532    let local_var_content = local_var_resp.text().await?;
533
534    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
535        serde_json::from_str(&local_var_content).map_err(Error::from)
536    } else {
537        let local_var_entity: Option<ApiSecurityCreateOperationError> = serde_json::from_str(&local_var_content).ok();
538        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
539        Err(Error::ResponseError(local_var_error))
540    }
541}
542
543/// Create a new operation tag associated with a specific service.
544pub async fn api_security_create_operation_tag(configuration: &mut configuration::Configuration, params: ApiSecurityCreateOperationTagParams) -> Result<crate::models::TagGet, Error<ApiSecurityCreateOperationTagError>> {
545    let local_var_configuration = configuration;
546
547    // unbox the parameters
548    let service_id = params.service_id;
549    let tag_create = params.tag_create;
550
551
552    let local_var_client = &local_var_configuration.client;
553
554    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/tags", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
555    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
556
557    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
558        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559    }
560    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
561        let local_var_key = local_var_apikey.key.clone();
562        let local_var_value = match local_var_apikey.prefix {
563            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
564            None => local_var_key,
565        };
566        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
567    };
568    local_var_req_builder = local_var_req_builder.json(&tag_create);
569
570    let local_var_req = local_var_req_builder.build()?;
571    let local_var_resp = local_var_client.execute(local_var_req).await?;
572
573    if "POST" != "GET" && "POST" != "HEAD" {
574      let headers = local_var_resp.headers();
575      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
576          Some(v) => v.to_str().unwrap().parse().unwrap(),
577          None => configuration::DEFAULT_RATELIMIT,
578      };
579      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
580          Some(v) => v.to_str().unwrap().parse().unwrap(),
581          None => 0,
582      };
583    }
584
585    let local_var_status = local_var_resp.status();
586    let local_var_content = local_var_resp.text().await?;
587
588    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
589        serde_json::from_str(&local_var_content).map_err(Error::from)
590    } else {
591        let local_var_entity: Option<ApiSecurityCreateOperationTagError> = serde_json::from_str(&local_var_content).ok();
592        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
593        Err(Error::ResponseError(local_var_error))
594    }
595}
596
597/// Delete an existing operation associated with a specific service.
598pub async fn api_security_delete_operation(configuration: &mut configuration::Configuration, params: ApiSecurityDeleteOperationParams) -> Result<(), Error<ApiSecurityDeleteOperationError>> {
599    let local_var_configuration = configuration;
600
601    // unbox the parameters
602    let service_id = params.service_id;
603    let operation_id = params.operation_id;
604
605
606    let local_var_client = &local_var_configuration.client;
607
608    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations/{operation_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), operation_id=crate::apis::urlencode(operation_id));
609    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
610
611    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
612        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
613    }
614    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
615        let local_var_key = local_var_apikey.key.clone();
616        let local_var_value = match local_var_apikey.prefix {
617            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
618            None => local_var_key,
619        };
620        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
621    };
622
623    let local_var_req = local_var_req_builder.build()?;
624    let local_var_resp = local_var_client.execute(local_var_req).await?;
625
626    if "DELETE" != "GET" && "DELETE" != "HEAD" {
627      let headers = local_var_resp.headers();
628      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
629          Some(v) => v.to_str().unwrap().parse().unwrap(),
630          None => configuration::DEFAULT_RATELIMIT,
631      };
632      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
633          Some(v) => v.to_str().unwrap().parse().unwrap(),
634          None => 0,
635      };
636    }
637
638    let local_var_status = local_var_resp.status();
639    let local_var_content = local_var_resp.text().await?;
640
641    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
642        Ok(())
643    } else {
644        let local_var_entity: Option<ApiSecurityDeleteOperationError> = serde_json::from_str(&local_var_content).ok();
645        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
646        Err(Error::ResponseError(local_var_error))
647    }
648}
649
650/// Delete an existing operation tag.
651pub async fn api_security_delete_operation_tag(configuration: &mut configuration::Configuration, params: ApiSecurityDeleteOperationTagParams) -> Result<(), Error<ApiSecurityDeleteOperationTagError>> {
652    let local_var_configuration = configuration;
653
654    // unbox the parameters
655    let service_id = params.service_id;
656    let tag_id = params.tag_id;
657
658
659    let local_var_client = &local_var_configuration.client;
660
661    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/tags/{tag_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), tag_id=crate::apis::urlencode(tag_id));
662    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
663
664    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
665        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
666    }
667    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
668        let local_var_key = local_var_apikey.key.clone();
669        let local_var_value = match local_var_apikey.prefix {
670            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
671            None => local_var_key,
672        };
673        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
674    };
675
676    let local_var_req = local_var_req_builder.build()?;
677    let local_var_resp = local_var_client.execute(local_var_req).await?;
678
679    if "DELETE" != "GET" && "DELETE" != "HEAD" {
680      let headers = local_var_resp.headers();
681      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
682          Some(v) => v.to_str().unwrap().parse().unwrap(),
683          None => configuration::DEFAULT_RATELIMIT,
684      };
685      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
686          Some(v) => v.to_str().unwrap().parse().unwrap(),
687          None => 0,
688      };
689    }
690
691    let local_var_status = local_var_resp.status();
692    let local_var_content = local_var_resp.text().await?;
693
694    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
695        Ok(())
696    } else {
697        let local_var_entity: Option<ApiSecurityDeleteOperationTagError> = serde_json::from_str(&local_var_content).ok();
698        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
699        Err(Error::ResponseError(local_var_error))
700    }
701}
702
703/// Get a specific operation associated with a service.
704pub async fn api_security_get_operation(configuration: &mut configuration::Configuration, params: ApiSecurityGetOperationParams) -> Result<crate::models::OperationGet, Error<ApiSecurityGetOperationError>> {
705    let local_var_configuration = configuration;
706
707    // unbox the parameters
708    let service_id = params.service_id;
709    let operation_id = params.operation_id;
710
711
712    let local_var_client = &local_var_configuration.client;
713
714    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations/{operation_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), operation_id=crate::apis::urlencode(operation_id));
715    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
716
717    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
718        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
719    }
720    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
721        let local_var_key = local_var_apikey.key.clone();
722        let local_var_value = match local_var_apikey.prefix {
723            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
724            None => local_var_key,
725        };
726        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
727    };
728
729    let local_var_req = local_var_req_builder.build()?;
730    let local_var_resp = local_var_client.execute(local_var_req).await?;
731
732    if "GET" != "GET" && "GET" != "HEAD" {
733      let headers = local_var_resp.headers();
734      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
735          Some(v) => v.to_str().unwrap().parse().unwrap(),
736          None => configuration::DEFAULT_RATELIMIT,
737      };
738      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
739          Some(v) => v.to_str().unwrap().parse().unwrap(),
740          None => 0,
741      };
742    }
743
744    let local_var_status = local_var_resp.status();
745    let local_var_content = local_var_resp.text().await?;
746
747    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
748        serde_json::from_str(&local_var_content).map_err(Error::from)
749    } else {
750        let local_var_entity: Option<ApiSecurityGetOperationError> = serde_json::from_str(&local_var_content).ok();
751        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
752        Err(Error::ResponseError(local_var_error))
753    }
754}
755
756/// Get a specific operation tag by its unique identifier.
757pub async fn api_security_get_operation_tag(configuration: &mut configuration::Configuration, params: ApiSecurityGetOperationTagParams) -> Result<crate::models::TagGet, Error<ApiSecurityGetOperationTagError>> {
758    let local_var_configuration = configuration;
759
760    // unbox the parameters
761    let service_id = params.service_id;
762    let tag_id = params.tag_id;
763
764
765    let local_var_client = &local_var_configuration.client;
766
767    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/tags/{tag_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), tag_id=crate::apis::urlencode(tag_id));
768    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
769
770    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
771        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
772    }
773    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
774        let local_var_key = local_var_apikey.key.clone();
775        let local_var_value = match local_var_apikey.prefix {
776            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
777            None => local_var_key,
778        };
779        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
780    };
781
782    let local_var_req = local_var_req_builder.build()?;
783    let local_var_resp = local_var_client.execute(local_var_req).await?;
784
785    if "GET" != "GET" && "GET" != "HEAD" {
786      let headers = local_var_resp.headers();
787      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
788          Some(v) => v.to_str().unwrap().parse().unwrap(),
789          None => configuration::DEFAULT_RATELIMIT,
790      };
791      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
792          Some(v) => v.to_str().unwrap().parse().unwrap(),
793          None => 0,
794      };
795    }
796
797    let local_var_status = local_var_resp.status();
798    let local_var_content = local_var_resp.text().await?;
799
800    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
801        serde_json::from_str(&local_var_content).map_err(Error::from)
802    } else {
803        let local_var_entity: Option<ApiSecurityGetOperationTagError> = serde_json::from_str(&local_var_content).ok();
804        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
805        Err(Error::ResponseError(local_var_error))
806    }
807}
808
809/// List all discovered operations associated with a specific service. Optionally filter operations by status.
810pub async fn api_security_list_discovered_operations(configuration: &mut configuration::Configuration, params: ApiSecurityListDiscoveredOperationsParams) -> Result<crate::models::InlineResponse2001, Error<ApiSecurityListDiscoveredOperationsError>> {
811    let local_var_configuration = configuration;
812
813    // unbox the parameters
814    let service_id = params.service_id;
815    let method = params.method;
816    let domain = params.domain;
817    let path = params.path;
818    let limit = params.limit;
819    let page = params.page;
820
821
822    let local_var_client = &local_var_configuration.client;
823
824    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/discovered-operations", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
825    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
826
827    if let Some(ref local_var_str) = method {
828        local_var_req_builder = match "multi" {
829            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("method".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
830            _ => local_var_req_builder.query(&[("method", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
831        };
832    }
833    if let Some(ref local_var_str) = domain {
834        local_var_req_builder = match "multi" {
835            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("domain".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
836            _ => local_var_req_builder.query(&[("domain", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
837        };
838    }
839    if let Some(ref local_var_str) = path {
840        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
841    }
842    if let Some(ref local_var_str) = limit {
843        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
844    }
845    if let Some(ref local_var_str) = page {
846        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
847    }
848    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
849        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
850    }
851    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
852        let local_var_key = local_var_apikey.key.clone();
853        let local_var_value = match local_var_apikey.prefix {
854            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
855            None => local_var_key,
856        };
857        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
858    };
859
860    let local_var_req = local_var_req_builder.build()?;
861    let local_var_resp = local_var_client.execute(local_var_req).await?;
862
863    if "GET" != "GET" && "GET" != "HEAD" {
864      let headers = local_var_resp.headers();
865      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
866          Some(v) => v.to_str().unwrap().parse().unwrap(),
867          None => configuration::DEFAULT_RATELIMIT,
868      };
869      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
870          Some(v) => v.to_str().unwrap().parse().unwrap(),
871          None => 0,
872      };
873    }
874
875    let local_var_status = local_var_resp.status();
876    let local_var_content = local_var_resp.text().await?;
877
878    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
879        serde_json::from_str(&local_var_content).map_err(Error::from)
880    } else {
881        let local_var_entity: Option<ApiSecurityListDiscoveredOperationsError> = serde_json::from_str(&local_var_content).ok();
882        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
883        Err(Error::ResponseError(local_var_error))
884    }
885}
886
887/// List all operation tags associated with a specific service.
888pub async fn api_security_list_operation_tags(configuration: &mut configuration::Configuration, params: ApiSecurityListOperationTagsParams) -> Result<crate::models::InlineResponse2003, Error<ApiSecurityListOperationTagsError>> {
889    let local_var_configuration = configuration;
890
891    // unbox the parameters
892    let service_id = params.service_id;
893    let limit = params.limit;
894    let page = params.page;
895
896
897    let local_var_client = &local_var_configuration.client;
898
899    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/tags", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
900    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
901
902    if let Some(ref local_var_str) = limit {
903        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
904    }
905    if let Some(ref local_var_str) = page {
906        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
907    }
908    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
909        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
910    }
911    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
912        let local_var_key = local_var_apikey.key.clone();
913        let local_var_value = match local_var_apikey.prefix {
914            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
915            None => local_var_key,
916        };
917        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
918    };
919
920    let local_var_req = local_var_req_builder.build()?;
921    let local_var_resp = local_var_client.execute(local_var_req).await?;
922
923    if "GET" != "GET" && "GET" != "HEAD" {
924      let headers = local_var_resp.headers();
925      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
926          Some(v) => v.to_str().unwrap().parse().unwrap(),
927          None => configuration::DEFAULT_RATELIMIT,
928      };
929      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
930          Some(v) => v.to_str().unwrap().parse().unwrap(),
931          None => 0,
932      };
933    }
934
935    let local_var_status = local_var_resp.status();
936    let local_var_content = local_var_resp.text().await?;
937
938    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
939        serde_json::from_str(&local_var_content).map_err(Error::from)
940    } else {
941        let local_var_entity: Option<ApiSecurityListOperationTagsError> = serde_json::from_str(&local_var_content).ok();
942        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
943        Err(Error::ResponseError(local_var_error))
944    }
945}
946
947/// List all operations associated with a specific service. Optionally filter operations by tag ID.
948pub async fn api_security_list_operations(configuration: &mut configuration::Configuration, params: ApiSecurityListOperationsParams) -> Result<crate::models::InlineResponse2002, Error<ApiSecurityListOperationsError>> {
949    let local_var_configuration = configuration;
950
951    // unbox the parameters
952    let service_id = params.service_id;
953    let tag_id = params.tag_id;
954    let status = params.status;
955    let method = params.method;
956    let domain = params.domain;
957    let path = params.path;
958    let limit = params.limit;
959    let page = params.page;
960
961
962    let local_var_client = &local_var_configuration.client;
963
964    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id));
965    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
966
967    if let Some(ref local_var_str) = tag_id {
968        local_var_req_builder = local_var_req_builder.query(&[("tag_id", &local_var_str.to_string())]);
969    }
970    if let Some(ref local_var_str) = status {
971        local_var_req_builder = local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
972    }
973    if let Some(ref local_var_str) = method {
974        local_var_req_builder = match "multi" {
975            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("method".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
976            _ => local_var_req_builder.query(&[("method", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
977        };
978    }
979    if let Some(ref local_var_str) = domain {
980        local_var_req_builder = match "multi" {
981            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("domain".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
982            _ => local_var_req_builder.query(&[("domain", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
983        };
984    }
985    if let Some(ref local_var_str) = path {
986        local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
987    }
988    if let Some(ref local_var_str) = limit {
989        local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
990    }
991    if let Some(ref local_var_str) = page {
992        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
993    }
994    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
995        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
996    }
997    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
998        let local_var_key = local_var_apikey.key.clone();
999        let local_var_value = match local_var_apikey.prefix {
1000            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1001            None => local_var_key,
1002        };
1003        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1004    };
1005
1006    let local_var_req = local_var_req_builder.build()?;
1007    let local_var_resp = local_var_client.execute(local_var_req).await?;
1008
1009    if "GET" != "GET" && "GET" != "HEAD" {
1010      let headers = local_var_resp.headers();
1011      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1012          Some(v) => v.to_str().unwrap().parse().unwrap(),
1013          None => configuration::DEFAULT_RATELIMIT,
1014      };
1015      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1016          Some(v) => v.to_str().unwrap().parse().unwrap(),
1017          None => 0,
1018      };
1019    }
1020
1021    let local_var_status = local_var_resp.status();
1022    let local_var_content = local_var_resp.text().await?;
1023
1024    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1025        serde_json::from_str(&local_var_content).map_err(Error::from)
1026    } else {
1027        let local_var_entity: Option<ApiSecurityListOperationsError> = serde_json::from_str(&local_var_content).ok();
1028        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1029        Err(Error::ResponseError(local_var_error))
1030    }
1031}
1032
1033/// Partially update an existing operation associated with a specific service.
1034pub async fn api_security_update_operation(configuration: &mut configuration::Configuration, params: ApiSecurityUpdateOperationParams) -> Result<crate::models::OperationGet, Error<ApiSecurityUpdateOperationError>> {
1035    let local_var_configuration = configuration;
1036
1037    // unbox the parameters
1038    let service_id = params.service_id;
1039    let operation_id = params.operation_id;
1040    let operation_update = params.operation_update;
1041
1042
1043    let local_var_client = &local_var_configuration.client;
1044
1045    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/operations/{operation_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), operation_id=crate::apis::urlencode(operation_id));
1046    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1047
1048    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1049        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1050    }
1051    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1052        let local_var_key = local_var_apikey.key.clone();
1053        let local_var_value = match local_var_apikey.prefix {
1054            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1055            None => local_var_key,
1056        };
1057        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1058    };
1059    local_var_req_builder = local_var_req_builder.json(&operation_update);
1060
1061    let local_var_req = local_var_req_builder.build()?;
1062    let local_var_resp = local_var_client.execute(local_var_req).await?;
1063
1064    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1065      let headers = local_var_resp.headers();
1066      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1067          Some(v) => v.to_str().unwrap().parse().unwrap(),
1068          None => configuration::DEFAULT_RATELIMIT,
1069      };
1070      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1071          Some(v) => v.to_str().unwrap().parse().unwrap(),
1072          None => 0,
1073      };
1074    }
1075
1076    let local_var_status = local_var_resp.status();
1077    let local_var_content = local_var_resp.text().await?;
1078
1079    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1080        serde_json::from_str(&local_var_content).map_err(Error::from)
1081    } else {
1082        let local_var_entity: Option<ApiSecurityUpdateOperationError> = serde_json::from_str(&local_var_content).ok();
1083        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1084        Err(Error::ResponseError(local_var_error))
1085    }
1086}
1087
1088/// Partially update an existing operation tag.
1089pub async fn api_security_update_operation_tag(configuration: &mut configuration::Configuration, params: ApiSecurityUpdateOperationTagParams) -> Result<crate::models::TagGet, Error<ApiSecurityUpdateOperationTagError>> {
1090    let local_var_configuration = configuration;
1091
1092    // unbox the parameters
1093    let service_id = params.service_id;
1094    let tag_id = params.tag_id;
1095    let body = params.body;
1096
1097
1098    let local_var_client = &local_var_configuration.client;
1099
1100    let local_var_uri_str = format!("{}/api-security/v1/services/{service_id}/tags/{tag_id}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), tag_id=crate::apis::urlencode(tag_id));
1101    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1102
1103    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1104        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1105    }
1106    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1107        let local_var_key = local_var_apikey.key.clone();
1108        let local_var_value = match local_var_apikey.prefix {
1109            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
1110            None => local_var_key,
1111        };
1112        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
1113    };
1114    local_var_req_builder = local_var_req_builder.json(&body);
1115
1116    let local_var_req = local_var_req_builder.build()?;
1117    let local_var_resp = local_var_client.execute(local_var_req).await?;
1118
1119    if "PATCH" != "GET" && "PATCH" != "HEAD" {
1120      let headers = local_var_resp.headers();
1121      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
1122          Some(v) => v.to_str().unwrap().parse().unwrap(),
1123          None => configuration::DEFAULT_RATELIMIT,
1124      };
1125      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
1126          Some(v) => v.to_str().unwrap().parse().unwrap(),
1127          None => 0,
1128      };
1129    }
1130
1131    let local_var_status = local_var_resp.status();
1132    let local_var_content = local_var_resp.text().await?;
1133
1134    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1135        serde_json::from_str(&local_var_content).map_err(Error::from)
1136    } else {
1137        let local_var_entity: Option<ApiSecurityUpdateOperationTagError> = serde_json::from_str(&local_var_content).ok();
1138        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1139        Err(Error::ResponseError(local_var_error))
1140    }
1141}
1142