aws-sdk-oam 1.41.0

AWS SDK for CloudWatch Observability Access Manager
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_link::_create_link_output::CreateLinkOutputBuilder;

pub use crate::operation::create_link::_create_link_input::CreateLinkInputBuilder;

impl crate::operation::create_link::builders::CreateLinkInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::create_link::CreateLinkOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_link::CreateLinkError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.create_link();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `CreateLink`.
///
/// <p>Creates a link between a source account and a sink that you have created in a monitoring account. After the link is created, data is sent from the source account to the monitoring account. When you create a link, you can optionally specify filters that specify which metric namespaces and which log groups are shared from the source account to the monitoring account.</p>
/// <p>Before you create a link, you must create a sink in the monitoring account and create a sink policy in that account. The sink policy must permit the source account to link to it. You can grant permission to source accounts by granting permission to an entire organization or to individual accounts.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a> and <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_PutSinkPolicy.html">PutSinkPolicy</a>.</p>
/// <p>Each monitoring account can be linked to as many as 100,000 source accounts.</p>
/// <p>Each source account can be linked to as many as five monitoring accounts.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateLinkFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::create_link::builders::CreateLinkInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::create_link::CreateLinkOutput,
        crate::operation::create_link::CreateLinkError,
    > for CreateLinkFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::create_link::CreateLinkOutput,
            crate::operation::create_link::CreateLinkError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl CreateLinkFluentBuilder {
    /// Creates a new `CreateLinkFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the CreateLink as a reference.
    pub fn as_input(&self) -> &crate::operation::create_link::builders::CreateLinkInputBuilder {
        &self.inner
    }
    /// 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::create_link::CreateLinkOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_link::CreateLinkError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::create_link::CreateLink::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::create_link::CreateLink::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::create_link::CreateLinkOutput,
        crate::operation::create_link::CreateLinkError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>Specify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.</p>
    /// <p>You can use a custom label or use the following variables:</p>
    /// <ul>
    /// <li>
    /// <p><code>$AccountName</code> is the name of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmail</code> is the globally unique email address of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmailNoDomain</code> is the email address of the account without the domain name</p></li>
    /// </ul>
    pub fn label_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.label_template(input.into());
        self
    }
    /// <p>Specify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.</p>
    /// <p>You can use a custom label or use the following variables:</p>
    /// <ul>
    /// <li>
    /// <p><code>$AccountName</code> is the name of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmail</code> is the globally unique email address of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmailNoDomain</code> is the email address of the account without the domain name</p></li>
    /// </ul>
    pub fn set_label_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_label_template(input);
        self
    }
    /// <p>Specify a friendly human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.</p>
    /// <p>You can use a custom label or use the following variables:</p>
    /// <ul>
    /// <li>
    /// <p><code>$AccountName</code> is the name of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmail</code> is the globally unique email address of the account</p></li>
    /// <li>
    /// <p><code>$AccountEmailNoDomain</code> is the email address of the account without the domain name</p></li>
    /// </ul>
    pub fn get_label_template(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_label_template()
    }
    ///
    /// Appends an item to `ResourceTypes`.
    ///
    /// To override the contents of this collection use [`set_resource_types`](Self::set_resource_types).
    ///
    /// <p>An array of strings that define which types of data that the source account shares with the monitoring account.</p>
    pub fn resource_types(mut self, input: crate::types::ResourceType) -> Self {
        self.inner = self.inner.resource_types(input);
        self
    }
    /// <p>An array of strings that define which types of data that the source account shares with the monitoring account.</p>
    pub fn set_resource_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceType>>) -> Self {
        self.inner = self.inner.set_resource_types(input);
        self
    }
    /// <p>An array of strings that define which types of data that the source account shares with the monitoring account.</p>
    pub fn get_resource_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceType>> {
        self.inner.get_resource_types()
    }
    /// <p>The ARN of the sink to use to create this link. You can use <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_ListSinks.html">ListSinks</a> to find the ARNs of sinks.</p>
    /// <p>For more information about sinks, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a>.</p>
    pub fn sink_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.sink_identifier(input.into());
        self
    }
    /// <p>The ARN of the sink to use to create this link. You can use <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_ListSinks.html">ListSinks</a> to find the ARNs of sinks.</p>
    /// <p>For more information about sinks, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a>.</p>
    pub fn set_sink_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_sink_identifier(input);
        self
    }
    /// <p>The ARN of the sink to use to create this link. You can use <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_ListSinks.html">ListSinks</a> to find the ARNs of sinks.</p>
    /// <p>For more information about sinks, see <a href="https://docs.aws.amazon.com/OAM/latest/APIReference/API_CreateSink.html">CreateSink</a>.</p>
    pub fn get_sink_identifier(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_sink_identifier()
    }
    ///
    /// Adds a key-value pair to `Tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>Assigns one or more tags (key-value pairs) to the link.</p>
    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
    /// <p>For more information about using tags to control access, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html">Controlling access to Amazon Web Services resources using tags</a>.</p>
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.tags(k.into(), v.into());
        self
    }
    /// <p>Assigns one or more tags (key-value pairs) to the link.</p>
    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
    /// <p>For more information about using tags to control access, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html">Controlling access to Amazon Web Services resources using tags</a>.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.inner = self.inner.set_tags(input);
        self
    }
    /// <p>Assigns one or more tags (key-value pairs) to the link.</p>
    /// <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p>
    /// <p>For more information about using tags to control access, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html">Controlling access to Amazon Web Services resources using tags</a>.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.inner.get_tags()
    }
    /// <p>Use this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.</p>
    pub fn link_configuration(mut self, input: crate::types::LinkConfiguration) -> Self {
        self.inner = self.inner.link_configuration(input);
        self
    }
    /// <p>Use this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.</p>
    pub fn set_link_configuration(mut self, input: ::std::option::Option<crate::types::LinkConfiguration>) -> Self {
        self.inner = self.inner.set_link_configuration(input);
        self
    }
    /// <p>Use this structure to optionally create filters that specify that only some metric namespaces or log groups are to be shared from the source account to the monitoring account.</p>
    pub fn get_link_configuration(&self) -> &::std::option::Option<crate::types::LinkConfiguration> {
        self.inner.get_link_configuration()
    }
}