aws-sdk-iotsecuretunneling 0.26.0

AWS SDK for AWS IoT Secure Tunneling
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::rotate_tunnel_access_token::_rotate_tunnel_access_token_output::RotateTunnelAccessTokenOutputBuilder;

pub use crate::operation::rotate_tunnel_access_token::_rotate_tunnel_access_token_input::RotateTunnelAccessTokenInputBuilder;

/// Fluent builder constructing a request to `RotateTunnelAccessToken`.
///
/// <p>Revokes the current client access token (CAT) and returns new CAT for clients to use when reconnecting to secure tunneling to access the same tunnel.</p>
/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">RotateTunnelAccessToken</a> action.</p> <note>
/// <p>Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration is 12 hours and the tunnel has already been open for 4 hours. When you rotate the access tokens, the new tokens that are generated can only be used for the remaining 8 hours.</p>
/// </note>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct RotateTunnelAccessTokenFluentBuilder {
    handle: std::sync::Arc<crate::client::Handle>,
    inner:
        crate::operation::rotate_tunnel_access_token::builders::RotateTunnelAccessTokenInputBuilder,
}
impl RotateTunnelAccessTokenFluentBuilder {
    /// Creates a new `RotateTunnelAccessToken`.
    pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: Default::default(),
        }
    }

    /// Consume this builder, creating a customizable operation that can be modified before being
    /// sent. The operation's inner [http::Request] can be modified as well.
    pub async fn customize(
        self,
    ) -> std::result::Result<
        crate::client::customize::CustomizableOperation<
            crate::operation::rotate_tunnel_access_token::RotateTunnelAccessToken,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::result::SdkError<
            crate::operation::rotate_tunnel_access_token::RotateTunnelAccessTokenError,
        >,
    > {
        let handle = self.handle.clone();
        let operation = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        Ok(crate::client::customize::CustomizableOperation { handle, operation })
    }

    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> std::result::Result<
        crate::operation::rotate_tunnel_access_token::RotateTunnelAccessTokenOutput,
        aws_smithy_http::result::SdkError<
            crate::operation::rotate_tunnel_access_token::RotateTunnelAccessTokenError,
        >,
    > {
        let op = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&self.handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        self.handle.client.call(op).await
    }
    /// <p>The tunnel for which you want to rotate the access tokens.</p>
    pub fn tunnel_id(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.tunnel_id(input.into());
        self
    }
    /// <p>The tunnel for which you want to rotate the access tokens.</p>
    pub fn set_tunnel_id(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_tunnel_id(input);
        self
    }
    /// <p>The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.</p>
    pub fn client_mode(mut self, input: crate::types::ClientMode) -> Self {
        self.inner = self.inner.client_mode(input);
        self
    }
    /// <p>The mode of the client that will use the client token, which can be either the source or destination, or both source and destination.</p>
    pub fn set_client_mode(mut self, input: std::option::Option<crate::types::ClientMode>) -> Self {
        self.inner = self.inner.set_client_mode(input);
        self
    }
    /// <p>The destination configuration.</p>
    pub fn destination_config(mut self, input: crate::types::DestinationConfig) -> Self {
        self.inner = self.inner.destination_config(input);
        self
    }
    /// <p>The destination configuration.</p>
    pub fn set_destination_config(
        mut self,
        input: std::option::Option<crate::types::DestinationConfig>,
    ) -> Self {
        self.inner = self.inner.set_destination_config(input);
        self
    }
}