aws-sdk-networkmonitor 1.88.0

AWS SDK for Amazon CloudWatch Network Monitor
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_monitor::_create_monitor_input::CreateMonitorInputBuilder;

pub use crate::operation::create_monitor::_create_monitor_output::CreateMonitorOutputBuilder;

impl crate::operation::create_monitor::builders::CreateMonitorInputBuilder {
    /// 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_monitor::CreateMonitorOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_monitor::CreateMonitorError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.create_monitor();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `CreateMonitor`.
///
/// <p>Creates a monitor between a source subnet and destination IP address. Within a monitor you'll create one or more probes that monitor network traffic between your source Amazon Web Services VPC subnets and your destination IP addresses. Each probe then aggregates and sends metrics to Amazon CloudWatch.</p>
/// <p>You can also create a monitor with probes using this command. For each probe, you define the following:</p>
/// <ul>
/// <li>
/// <p><code>source</code>—The subnet IDs where the probes will be created.</p></li>
/// <li>
/// <p><code>destination</code>— The target destination IP address for the probe.</p></li>
/// <li>
/// <p><code>destinationPort</code>—Required only if the protocol is <code>TCP</code>.</p></li>
/// <li>
/// <p><code>protocol</code>—The communication protocol between the source and destination. This will be either <code>TCP</code> or <code>ICMP</code>.</p></li>
/// <li>
/// <p><code>packetSize</code>—The size of the packets. This must be a number between <code>56</code> and <code>8500</code>.</p></li>
/// <li>
/// <p>(Optional) <code>tags</code> —Key-value pairs created and assigned to the probe.</p></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateMonitorFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::create_monitor::builders::CreateMonitorInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::create_monitor::CreateMonitorOutput,
        crate::operation::create_monitor::CreateMonitorError,
    > for CreateMonitorFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::create_monitor::CreateMonitorOutput,
            crate::operation::create_monitor::CreateMonitorError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl CreateMonitorFluentBuilder {
    /// Creates a new `CreateMonitorFluentBuilder`.
    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 CreateMonitor as a reference.
    pub fn as_input(&self) -> &crate::operation::create_monitor::builders::CreateMonitorInputBuilder {
        &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_monitor::CreateMonitorOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_monitor::CreateMonitorError,
            ::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_monitor::CreateMonitor::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::create_monitor::CreateMonitor::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_monitor::CreateMonitorOutput,
        crate::operation::create_monitor::CreateMonitorError,
        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>The name identifying the monitor. It can contain only letters, underscores (_), or dashes (-), and can be up to 200 characters.</p>
    pub fn monitor_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.monitor_name(input.into());
        self
    }
    /// <p>The name identifying the monitor. It can contain only letters, underscores (_), or dashes (-), and can be up to 200 characters.</p>
    pub fn set_monitor_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_monitor_name(input);
        self
    }
    /// <p>The name identifying the monitor. It can contain only letters, underscores (_), or dashes (-), and can be up to 200 characters.</p>
    pub fn get_monitor_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_monitor_name()
    }
    ///
    /// Appends an item to `probes`.
    ///
    /// To override the contents of this collection use [`set_probes`](Self::set_probes).
    ///
    /// <p>Displays a list of all of the probes created for a monitor.</p>
    pub fn probes(mut self, input: crate::types::CreateMonitorProbeInput) -> Self {
        self.inner = self.inner.probes(input);
        self
    }
    /// <p>Displays a list of all of the probes created for a monitor.</p>
    pub fn set_probes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CreateMonitorProbeInput>>) -> Self {
        self.inner = self.inner.set_probes(input);
        self
    }
    /// <p>Displays a list of all of the probes created for a monitor.</p>
    pub fn get_probes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CreateMonitorProbeInput>> {
        self.inner.get_probes()
    }
    /// <p>The time, in seconds, that metrics are aggregated and sent to Amazon CloudWatch. Valid values are either <code>30</code> or <code>60</code>. <code>60</code> is the default if no period is chosen.</p>
    pub fn aggregation_period(mut self, input: i64) -> Self {
        self.inner = self.inner.aggregation_period(input);
        self
    }
    /// <p>The time, in seconds, that metrics are aggregated and sent to Amazon CloudWatch. Valid values are either <code>30</code> or <code>60</code>. <code>60</code> is the default if no period is chosen.</p>
    pub fn set_aggregation_period(mut self, input: ::std::option::Option<i64>) -> Self {
        self.inner = self.inner.set_aggregation_period(input);
        self
    }
    /// <p>The time, in seconds, that metrics are aggregated and sent to Amazon CloudWatch. Valid values are either <code>30</code> or <code>60</code>. <code>60</code> is the default if no period is chosen.</p>
    pub fn get_aggregation_period(&self) -> &::std::option::Option<i64> {
        self.inner.get_aggregation_period()
    }
    /// <p>Unique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.</p>
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.client_token(input.into());
        self
    }
    /// <p>Unique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.</p>
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_client_token(input);
        self
    }
    /// <p>Unique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.</p>
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_client_token()
    }
    ///
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>The list of key-value pairs created and assigned to the monitor.</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>The list of key-value pairs created and assigned to the monitor.</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>The list of key-value pairs created and assigned to the monitor.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.inner.get_tags()
    }
}