harbor_api/apis/
retention_api.rs

1/*
2 * Harbor API
3 *
4 * These APIs provide services for manipulating Harbor project.
5 *
6 * The version of the OpenAPI document: 2.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`create_retention`]
18#[derive(Clone, Debug)]
19pub struct CreateRetentionParams {
20    /// Create Retention Policy successfully.
21    pub policy: models::RetentionPolicy,
22    /// An unique ID for the request
23    pub x_request_id: Option<String>
24}
25
26/// struct for passing parameters to the method [`delete_retention`]
27#[derive(Clone, Debug)]
28pub struct DeleteRetentionParams {
29    /// Retention ID.
30    pub id: i64,
31    /// An unique ID for the request
32    pub x_request_id: Option<String>
33}
34
35/// struct for passing parameters to the method [`get_rentenition_metadata`]
36#[derive(Clone, Debug)]
37pub struct GetRentenitionMetadataParams {
38    /// An unique ID for the request
39    pub x_request_id: Option<String>
40}
41
42/// struct for passing parameters to the method [`get_retention`]
43#[derive(Clone, Debug)]
44pub struct GetRetentionParams {
45    /// Retention ID.
46    pub id: i64,
47    /// An unique ID for the request
48    pub x_request_id: Option<String>
49}
50
51/// struct for passing parameters to the method [`get_retention_task_log`]
52#[derive(Clone, Debug)]
53pub struct GetRetentionTaskLogParams {
54    /// Retention ID.
55    pub id: i64,
56    /// Retention execution ID.
57    pub eid: i64,
58    /// Retention execution ID.
59    pub tid: i64,
60    /// An unique ID for the request
61    pub x_request_id: Option<String>
62}
63
64/// struct for passing parameters to the method [`list_retention_executions`]
65#[derive(Clone, Debug)]
66pub struct ListRetentionExecutionsParams {
67    /// Retention ID.
68    pub id: i64,
69    /// An unique ID for the request
70    pub x_request_id: Option<String>,
71    /// The page number.
72    pub page: Option<i64>,
73    /// The size of per page.
74    pub page_size: Option<i64>
75}
76
77/// struct for passing parameters to the method [`list_retention_tasks`]
78#[derive(Clone, Debug)]
79pub struct ListRetentionTasksParams {
80    /// Retention ID.
81    pub id: i64,
82    /// Retention execution ID.
83    pub eid: i64,
84    /// An unique ID for the request
85    pub x_request_id: Option<String>,
86    /// The page number.
87    pub page: Option<i64>,
88    /// The size of per page.
89    pub page_size: Option<i64>
90}
91
92/// struct for passing parameters to the method [`operate_retention_execution`]
93#[derive(Clone, Debug)]
94pub struct OperateRetentionExecutionParams {
95    /// Retention ID.
96    pub id: i64,
97    /// Retention execution ID.
98    pub eid: i64,
99    /// The action, only support \"stop\" now.
100    pub body: models::OperateRetentionExecutionRequest,
101    /// An unique ID for the request
102    pub x_request_id: Option<String>
103}
104
105/// struct for passing parameters to the method [`trigger_retention_execution`]
106#[derive(Clone, Debug)]
107pub struct TriggerRetentionExecutionParams {
108    /// Retention ID.
109    pub id: i64,
110    pub body: models::TriggerRetentionExecutionRequest,
111    /// An unique ID for the request
112    pub x_request_id: Option<String>
113}
114
115/// struct for passing parameters to the method [`update_retention`]
116#[derive(Clone, Debug)]
117pub struct UpdateRetentionParams {
118    /// Retention ID.
119    pub id: i64,
120    pub policy: models::RetentionPolicy,
121    /// An unique ID for the request
122    pub x_request_id: Option<String>
123}
124
125
126/// struct for typed errors of method [`create_retention`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum CreateRetentionError {
130    Status400(models::Errors),
131    Status401(models::Errors),
132    Status403(models::Errors),
133    Status500(models::Errors),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`delete_retention`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum DeleteRetentionError {
141    Status401(models::Errors),
142    Status403(models::Errors),
143    Status500(models::Errors),
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`get_rentenition_metadata`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum GetRentenitionMetadataError {
151    UnknownValue(serde_json::Value),
152}
153
154/// struct for typed errors of method [`get_retention`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum GetRetentionError {
158    Status401(models::Errors),
159    Status403(models::Errors),
160    Status500(models::Errors),
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`get_retention_task_log`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum GetRetentionTaskLogError {
168    Status401(models::Errors),
169    Status403(models::Errors),
170    Status500(models::Errors),
171    UnknownValue(serde_json::Value),
172}
173
174/// struct for typed errors of method [`list_retention_executions`]
175#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum ListRetentionExecutionsError {
178    Status401(models::Errors),
179    Status403(models::Errors),
180    Status500(models::Errors),
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`list_retention_tasks`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum ListRetentionTasksError {
188    Status401(models::Errors),
189    Status403(models::Errors),
190    Status500(models::Errors),
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`operate_retention_execution`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum OperateRetentionExecutionError {
198    Status401(models::Errors),
199    Status403(models::Errors),
200    Status500(models::Errors),
201    UnknownValue(serde_json::Value),
202}
203
204/// struct for typed errors of method [`trigger_retention_execution`]
205#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum TriggerRetentionExecutionError {
208    Status401(models::Errors),
209    Status403(models::Errors),
210    Status500(models::Errors),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`update_retention`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum UpdateRetentionError {
218    Status401(models::Errors),
219    Status403(models::Errors),
220    Status500(models::Errors),
221    UnknownValue(serde_json::Value),
222}
223
224
225/// Create Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when no retention policy binded to project yet.
226pub async fn create_retention(configuration: &configuration::Configuration, params: CreateRetentionParams) -> Result<(), Error<CreateRetentionError>> {
227
228    let uri_str = format!("{}/retentions", configuration.base_path);
229    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
230
231    if let Some(ref user_agent) = configuration.user_agent {
232        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
233    }
234    if let Some(param_value) = params.x_request_id {
235        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
236    }
237    if let Some(ref auth_conf) = configuration.basic_auth {
238        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
239    };
240    req_builder = req_builder.json(&params.policy);
241
242    let req = req_builder.build()?;
243    let resp = configuration.client.execute(req).await?;
244
245    let status = resp.status();
246
247    if !status.is_client_error() && !status.is_server_error() {
248        Ok(())
249    } else {
250        let content = resp.text().await?;
251        let entity: Option<CreateRetentionError> = serde_json::from_str(&content).ok();
252        Err(Error::ResponseError(ResponseContent { status, content, entity }))
253    }
254}
255
256/// Delete Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.
257pub async fn delete_retention(configuration: &configuration::Configuration, params: DeleteRetentionParams) -> Result<(), Error<DeleteRetentionError>> {
258
259    let uri_str = format!("{}/retentions/{id}", configuration.base_path, id=params.id);
260    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
261
262    if let Some(ref user_agent) = configuration.user_agent {
263        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
264    }
265    if let Some(param_value) = params.x_request_id {
266        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
267    }
268    if let Some(ref auth_conf) = configuration.basic_auth {
269        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
270    };
271
272    let req = req_builder.build()?;
273    let resp = configuration.client.execute(req).await?;
274
275    let status = resp.status();
276
277    if !status.is_client_error() && !status.is_server_error() {
278        Ok(())
279    } else {
280        let content = resp.text().await?;
281        let entity: Option<DeleteRetentionError> = serde_json::from_str(&content).ok();
282        Err(Error::ResponseError(ResponseContent { status, content, entity }))
283    }
284}
285
286/// Get Retention Metadatas.
287pub async fn get_rentenition_metadata(configuration: &configuration::Configuration, params: GetRentenitionMetadataParams) -> Result<models::RetentionMetadata, Error<GetRentenitionMetadataError>> {
288
289    let uri_str = format!("{}/retentions/metadatas", configuration.base_path);
290    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
291
292    if let Some(ref user_agent) = configuration.user_agent {
293        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
294    }
295    if let Some(param_value) = params.x_request_id {
296        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
297    }
298    if let Some(ref auth_conf) = configuration.basic_auth {
299        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
300    };
301
302    let req = req_builder.build()?;
303    let resp = configuration.client.execute(req).await?;
304
305    let status = resp.status();
306    let content_type = resp
307        .headers()
308        .get("content-type")
309        .and_then(|v| v.to_str().ok())
310        .unwrap_or("application/octet-stream");
311    let content_type = super::ContentType::from(content_type);
312
313    if !status.is_client_error() && !status.is_server_error() {
314        let content = resp.text().await?;
315        match content_type {
316            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
317            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RetentionMetadata`"))),
318            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RetentionMetadata`")))),
319        }
320    } else {
321        let content = resp.text().await?;
322        let entity: Option<GetRentenitionMetadataError> = serde_json::from_str(&content).ok();
323        Err(Error::ResponseError(ResponseContent { status, content, entity }))
324    }
325}
326
327/// Get Retention Policy.
328pub async fn get_retention(configuration: &configuration::Configuration, params: GetRetentionParams) -> Result<models::RetentionPolicy, Error<GetRetentionError>> {
329
330    let uri_str = format!("{}/retentions/{id}", configuration.base_path, id=params.id);
331    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
332
333    if let Some(ref user_agent) = configuration.user_agent {
334        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
335    }
336    if let Some(param_value) = params.x_request_id {
337        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
338    }
339    if let Some(ref auth_conf) = configuration.basic_auth {
340        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
341    };
342
343    let req = req_builder.build()?;
344    let resp = configuration.client.execute(req).await?;
345
346    let status = resp.status();
347    let content_type = resp
348        .headers()
349        .get("content-type")
350        .and_then(|v| v.to_str().ok())
351        .unwrap_or("application/octet-stream");
352    let content_type = super::ContentType::from(content_type);
353
354    if !status.is_client_error() && !status.is_server_error() {
355        let content = resp.text().await?;
356        match content_type {
357            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
358            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RetentionPolicy`"))),
359            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RetentionPolicy`")))),
360        }
361    } else {
362        let content = resp.text().await?;
363        let entity: Option<GetRetentionError> = serde_json::from_str(&content).ok();
364        Err(Error::ResponseError(ResponseContent { status, content, entity }))
365    }
366}
367
368/// Get Retention job task log, tags ratain or deletion detail will be shown in a table.
369pub async fn get_retention_task_log(configuration: &configuration::Configuration, params: GetRetentionTaskLogParams) -> Result<String, Error<GetRetentionTaskLogError>> {
370
371    let uri_str = format!("{}/retentions/{id}/executions/{eid}/tasks/{tid}", configuration.base_path, id=params.id, eid=params.eid, tid=params.tid);
372    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
373
374    if let Some(ref user_agent) = configuration.user_agent {
375        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
376    }
377    if let Some(param_value) = params.x_request_id {
378        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
379    }
380    if let Some(ref auth_conf) = configuration.basic_auth {
381        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
382    };
383
384    let req = req_builder.build()?;
385    let resp = configuration.client.execute(req).await?;
386
387    let status = resp.status();
388    let content_type = resp
389        .headers()
390        .get("content-type")
391        .and_then(|v| v.to_str().ok())
392        .unwrap_or("application/octet-stream");
393    let content_type = super::ContentType::from(content_type);
394
395    if !status.is_client_error() && !status.is_server_error() {
396        let content = resp.text().await?;
397        match content_type {
398            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
399            ContentType::Text => return Ok(content),
400            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
401        }
402    } else {
403        let content = resp.text().await?;
404        let entity: Option<GetRetentionTaskLogError> = serde_json::from_str(&content).ok();
405        Err(Error::ResponseError(ResponseContent { status, content, entity }))
406    }
407}
408
409/// Get Retention executions, execution status may be delayed before job service schedule it up.
410pub async fn list_retention_executions(configuration: &configuration::Configuration, params: ListRetentionExecutionsParams) -> Result<Vec<models::RetentionExecution>, Error<ListRetentionExecutionsError>> {
411
412    let uri_str = format!("{}/retentions/{id}/executions", configuration.base_path, id=params.id);
413    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
414
415    if let Some(ref param_value) = params.page {
416        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
417    }
418    if let Some(ref param_value) = params.page_size {
419        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
420    }
421    if let Some(ref user_agent) = configuration.user_agent {
422        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
423    }
424    if let Some(param_value) = params.x_request_id {
425        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
426    }
427    if let Some(ref auth_conf) = configuration.basic_auth {
428        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
429    };
430
431    let req = req_builder.build()?;
432    let resp = configuration.client.execute(req).await?;
433
434    let status = resp.status();
435    let content_type = resp
436        .headers()
437        .get("content-type")
438        .and_then(|v| v.to_str().ok())
439        .unwrap_or("application/octet-stream");
440    let content_type = super::ContentType::from(content_type);
441
442    if !status.is_client_error() && !status.is_server_error() {
443        let content = resp.text().await?;
444        match content_type {
445            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
446            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::RetentionExecution&gt;`"))),
447            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::RetentionExecution&gt;`")))),
448        }
449    } else {
450        let content = resp.text().await?;
451        let entity: Option<ListRetentionExecutionsError> = serde_json::from_str(&content).ok();
452        Err(Error::ResponseError(ResponseContent { status, content, entity }))
453    }
454}
455
456/// Get Retention tasks, each repository as a task.
457pub async fn list_retention_tasks(configuration: &configuration::Configuration, params: ListRetentionTasksParams) -> Result<Vec<models::RetentionExecutionTask>, Error<ListRetentionTasksError>> {
458
459    let uri_str = format!("{}/retentions/{id}/executions/{eid}/tasks", configuration.base_path, id=params.id, eid=params.eid);
460    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
461
462    if let Some(ref param_value) = params.page {
463        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
464    }
465    if let Some(ref param_value) = params.page_size {
466        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
467    }
468    if let Some(ref user_agent) = configuration.user_agent {
469        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
470    }
471    if let Some(param_value) = params.x_request_id {
472        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
473    }
474    if let Some(ref auth_conf) = configuration.basic_auth {
475        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
476    };
477
478    let req = req_builder.build()?;
479    let resp = configuration.client.execute(req).await?;
480
481    let status = resp.status();
482    let content_type = resp
483        .headers()
484        .get("content-type")
485        .and_then(|v| v.to_str().ok())
486        .unwrap_or("application/octet-stream");
487    let content_type = super::ContentType::from(content_type);
488
489    if !status.is_client_error() && !status.is_server_error() {
490        let content = resp.text().await?;
491        match content_type {
492            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
493            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::RetentionExecutionTask&gt;`"))),
494            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::RetentionExecutionTask&gt;`")))),
495        }
496    } else {
497        let content = resp.text().await?;
498        let entity: Option<ListRetentionTasksError> = serde_json::from_str(&content).ok();
499        Err(Error::ResponseError(ResponseContent { status, content, entity }))
500    }
501}
502
503/// Stop a Retention execution, only support \"stop\" action now.
504pub async fn operate_retention_execution(configuration: &configuration::Configuration, params: OperateRetentionExecutionParams) -> Result<(), Error<OperateRetentionExecutionError>> {
505
506    let uri_str = format!("{}/retentions/{id}/executions/{eid}", configuration.base_path, id=params.id, eid=params.eid);
507    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
508
509    if let Some(ref user_agent) = configuration.user_agent {
510        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
511    }
512    if let Some(param_value) = params.x_request_id {
513        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
514    }
515    if let Some(ref auth_conf) = configuration.basic_auth {
516        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
517    };
518    req_builder = req_builder.json(&params.body);
519
520    let req = req_builder.build()?;
521    let resp = configuration.client.execute(req).await?;
522
523    let status = resp.status();
524
525    if !status.is_client_error() && !status.is_server_error() {
526        Ok(())
527    } else {
528        let content = resp.text().await?;
529        let entity: Option<OperateRetentionExecutionError> = serde_json::from_str(&content).ok();
530        Err(Error::ResponseError(ResponseContent { status, content, entity }))
531    }
532}
533
534/// Trigger a Retention Execution, if dry_run is True, nothing would be deleted actually.
535pub async fn trigger_retention_execution(configuration: &configuration::Configuration, params: TriggerRetentionExecutionParams) -> Result<(), Error<TriggerRetentionExecutionError>> {
536
537    let uri_str = format!("{}/retentions/{id}/executions", configuration.base_path, id=params.id);
538    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
539
540    if let Some(ref user_agent) = configuration.user_agent {
541        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
542    }
543    if let Some(param_value) = params.x_request_id {
544        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
545    }
546    if let Some(ref auth_conf) = configuration.basic_auth {
547        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
548    };
549    req_builder = req_builder.json(&params.body);
550
551    let req = req_builder.build()?;
552    let resp = configuration.client.execute(req).await?;
553
554    let status = resp.status();
555
556    if !status.is_client_error() && !status.is_server_error() {
557        Ok(())
558    } else {
559        let content = resp.text().await?;
560        let entity: Option<TriggerRetentionExecutionError> = serde_json::from_str(&content).ok();
561        Err(Error::ResponseError(ResponseContent { status, content, entity }))
562    }
563}
564
565/// Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.
566pub async fn update_retention(configuration: &configuration::Configuration, params: UpdateRetentionParams) -> Result<(), Error<UpdateRetentionError>> {
567
568    let uri_str = format!("{}/retentions/{id}", configuration.base_path, id=params.id);
569    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
570
571    if let Some(ref user_agent) = configuration.user_agent {
572        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
573    }
574    if let Some(param_value) = params.x_request_id {
575        req_builder = req_builder.header("X-Request-Id", param_value.to_string());
576    }
577    if let Some(ref auth_conf) = configuration.basic_auth {
578        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
579    };
580    req_builder = req_builder.json(&params.policy);
581
582    let req = req_builder.build()?;
583    let resp = configuration.client.execute(req).await?;
584
585    let status = resp.status();
586
587    if !status.is_client_error() && !status.is_server_error() {
588        Ok(())
589    } else {
590        let content = resp.text().await?;
591        let entity: Option<UpdateRetentionError> = serde_json::from_str(&content).ok();
592        Err(Error::ResponseError(ResponseContent { status, content, entity }))
593    }
594}
595