cortexa-aws-cloudtrail-data 0.1.0

AWS CLOUDTRAIL-DATA service client and resource abstractions for cortexa-rust-aws.
Documentation
//! codegen-checksum: 750e944b0acb3b3d
//! Auto-generated executable typed client for AWS cloudtrail-data.
//! Do not edit manually.

#![allow(
    dead_code,
    clippy::too_many_lines,
    clippy::unused_async,
    clippy::implicit_clone
)]

use cortexa_aws_core::client::AwsClient;
use cortexa_aws_core::transport::{DefaultRuntime, Runtime};
use cortexa_aws_errors::AwsError;

use super::types::*;

/// Auto-generated typed client covering all Smithy 2.0 operations for AWS `cloudtrail-data`.
#[derive(Debug)]
#[repr(transparent)]
pub struct GeneratedClient<R: Runtime = DefaultRuntime> {
    client: AwsClient<R>,
}

impl<R: Runtime> Clone for GeneratedClient<R> {
    fn clone(&self) -> Self {
        Self {
            client: self.client.clone(),
        }
    }
}

impl<R: Runtime> GeneratedClient<R> {
    /// Creates a new [`GeneratedClient`] wrapping `client`.
    #[must_use]
    pub const fn new(client: AwsClient<R>) -> Self {
        Self { client }
    }

    /// Returns a reference to the underlying [`AwsClient`].
    #[must_use]
    pub const fn inner(&self) -> &AwsClient<R> {
        &self.client
    }

    /// Invokes AWS `PutAuditEvents` operation.
    pub async fn put_audit_events(
        &self,
        input: &PutAuditEventsRequest,
    ) -> Result<PutAuditEventsResponse, AwsError> {
        let path = "/PutAuditEvents".to_owned();
        let mut query_owned: Vec<(&'static str, String)> = Vec::new();
        if let Some(v) = input.channel_arn.as_ref() {
            query_owned.push(("channelArn", v.to_string()));
        }
        if let Some(v) = input.external_id.as_ref() {
            query_owned.push(("externalId", v.to_string()));
        }
        let query_refs: Vec<(&str, &str)> =
            query_owned.iter().map(|(k, v)| (*k, v.as_str())).collect();
        cortexa_aws_protocols::invoke::invoke_rest_json(
            &self.client,
            "cloudtrail-data",
            "cloudtrail-data",
            None,
            cortexa_aws_core::transport::HttpMethod::Post,
            &path,
            &query_refs,
            "PutAuditEvents",
            Some(input),
        )
        .await
    }
}