Skip to main content

cortexa_aws_cloudtrail_data/generated/
client.rs

1//! codegen-checksum: 750e944b0acb3b3d
2//! Auto-generated executable typed client for AWS cloudtrail-data.
3//! Do not edit manually.
4
5#![allow(
6    dead_code,
7    clippy::too_many_lines,
8    clippy::unused_async,
9    clippy::implicit_clone
10)]
11
12use cortexa_aws_core::client::AwsClient;
13use cortexa_aws_core::transport::{DefaultRuntime, Runtime};
14use cortexa_aws_errors::AwsError;
15
16use super::types::*;
17
18/// Auto-generated typed client covering all Smithy 2.0 operations for AWS `cloudtrail-data`.
19#[derive(Debug)]
20#[repr(transparent)]
21pub struct GeneratedClient<R: Runtime = DefaultRuntime> {
22    client: AwsClient<R>,
23}
24
25impl<R: Runtime> Clone for GeneratedClient<R> {
26    fn clone(&self) -> Self {
27        Self {
28            client: self.client.clone(),
29        }
30    }
31}
32
33impl<R: Runtime> GeneratedClient<R> {
34    /// Creates a new [`GeneratedClient`] wrapping `client`.
35    #[must_use]
36    pub const fn new(client: AwsClient<R>) -> Self {
37        Self { client }
38    }
39
40    /// Returns a reference to the underlying [`AwsClient`].
41    #[must_use]
42    pub const fn inner(&self) -> &AwsClient<R> {
43        &self.client
44    }
45
46    /// Invokes AWS `PutAuditEvents` operation.
47    pub async fn put_audit_events(
48        &self,
49        input: &PutAuditEventsRequest,
50    ) -> Result<PutAuditEventsResponse, AwsError> {
51        let path = "/PutAuditEvents".to_owned();
52        let mut query_owned: Vec<(&'static str, String)> = Vec::new();
53        if let Some(v) = input.channel_arn.as_ref() {
54            query_owned.push(("channelArn", v.to_string()));
55        }
56        if let Some(v) = input.external_id.as_ref() {
57            query_owned.push(("externalId", v.to_string()));
58        }
59        let query_refs: Vec<(&str, &str)> =
60            query_owned.iter().map(|(k, v)| (*k, v.as_str())).collect();
61        cortexa_aws_protocols::invoke::invoke_rest_json(
62            &self.client,
63            "cloudtrail-data",
64            "cloudtrail-data",
65            None,
66            cortexa_aws_core::transport::HttpMethod::Post,
67            &path,
68            &query_refs,
69            "PutAuditEvents",
70            Some(input),
71        )
72        .await
73    }
74}