aws-sdk-applicationautoscaling 1.115.0

AWS SDK for Application Auto Scaling
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct PutScalingPolicyOutput {
    /// <p>The Amazon Resource Name (ARN) of the resulting scaling policy.</p>
    pub policy_arn: ::std::string::String,
    /// <p>The CloudWatch alarms created for the target tracking scaling policy.</p>
    pub alarms: ::std::option::Option<::std::vec::Vec<crate::types::Alarm>>,
    _request_id: Option<String>,
}
impl PutScalingPolicyOutput {
    /// <p>The Amazon Resource Name (ARN) of the resulting scaling policy.</p>
    pub fn policy_arn(&self) -> &str {
        use std::ops::Deref;
        self.policy_arn.deref()
    }
    /// <p>The CloudWatch alarms created for the target tracking scaling policy.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.alarms.is_none()`.
    pub fn alarms(&self) -> &[crate::types::Alarm] {
        self.alarms.as_deref().unwrap_or_default()
    }
}
impl ::aws_types::request_id::RequestId for PutScalingPolicyOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl PutScalingPolicyOutput {
    /// Creates a new builder-style object to manufacture [`PutScalingPolicyOutput`](crate::operation::put_scaling_policy::PutScalingPolicyOutput).
    pub fn builder() -> crate::operation::put_scaling_policy::builders::PutScalingPolicyOutputBuilder {
        crate::operation::put_scaling_policy::builders::PutScalingPolicyOutputBuilder::default()
    }
}

/// A builder for [`PutScalingPolicyOutput`](crate::operation::put_scaling_policy::PutScalingPolicyOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PutScalingPolicyOutputBuilder {
    pub(crate) policy_arn: ::std::option::Option<::std::string::String>,
    pub(crate) alarms: ::std::option::Option<::std::vec::Vec<crate::types::Alarm>>,
    _request_id: Option<String>,
}
impl PutScalingPolicyOutputBuilder {
    /// <p>The Amazon Resource Name (ARN) of the resulting scaling policy.</p>
    /// This field is required.
    pub fn policy_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the resulting scaling policy.</p>
    pub fn set_policy_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_arn = input;
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the resulting scaling policy.</p>
    pub fn get_policy_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_arn
    }
    /// Appends an item to `alarms`.
    ///
    /// To override the contents of this collection use [`set_alarms`](Self::set_alarms).
    ///
    /// <p>The CloudWatch alarms created for the target tracking scaling policy.</p>
    pub fn alarms(mut self, input: crate::types::Alarm) -> Self {
        let mut v = self.alarms.unwrap_or_default();
        v.push(input);
        self.alarms = ::std::option::Option::Some(v);
        self
    }
    /// <p>The CloudWatch alarms created for the target tracking scaling policy.</p>
    pub fn set_alarms(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Alarm>>) -> Self {
        self.alarms = input;
        self
    }
    /// <p>The CloudWatch alarms created for the target tracking scaling policy.</p>
    pub fn get_alarms(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Alarm>> {
        &self.alarms
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`PutScalingPolicyOutput`](crate::operation::put_scaling_policy::PutScalingPolicyOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`policy_arn`](crate::operation::put_scaling_policy::builders::PutScalingPolicyOutputBuilder::policy_arn)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::put_scaling_policy::PutScalingPolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::put_scaling_policy::PutScalingPolicyOutput {
            policy_arn: self.policy_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "policy_arn",
                    "policy_arn was not specified but it is required when building PutScalingPolicyOutput",
                )
            })?,
            alarms: self.alarms,
            _request_id: self._request_id,
        })
    }
}