aws-sdk-appmonetization 1.0.0

AWS SDK for AWS App Monetization
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// Output for ArchiveMetric. Echoes the archived metric's identifiers.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ArchiveMetricOutput {
    /// The ID of the app the archived metric belonged to.
    pub app_id: ::std::string::String,
    /// The ID of the archived metric.
    pub metric_id: ::std::string::String,
    _request_id: Option<String>,
}
impl ArchiveMetricOutput {
    /// The ID of the app the archived metric belonged to.
    pub fn app_id(&self) -> &str {
        use std::ops::Deref;
        self.app_id.deref()
    }
    /// The ID of the archived metric.
    pub fn metric_id(&self) -> &str {
        use std::ops::Deref;
        self.metric_id.deref()
    }
}
impl ::aws_types::request_id::RequestId for ArchiveMetricOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ArchiveMetricOutput {
    /// Creates a new builder-style object to manufacture [`ArchiveMetricOutput`](crate::operation::archive_metric::ArchiveMetricOutput).
    pub fn builder() -> crate::operation::archive_metric::builders::ArchiveMetricOutputBuilder {
        crate::operation::archive_metric::builders::ArchiveMetricOutputBuilder::default()
    }
}

/// A builder for [`ArchiveMetricOutput`](crate::operation::archive_metric::ArchiveMetricOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ArchiveMetricOutputBuilder {
    pub(crate) app_id: ::std::option::Option<::std::string::String>,
    pub(crate) metric_id: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ArchiveMetricOutputBuilder {
    /// The ID of the app the archived metric belonged to.
    /// This field is required.
    pub fn app_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.app_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The ID of the app the archived metric belonged to.
    pub fn set_app_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.app_id = input;
        self
    }
    /// The ID of the app the archived metric belonged to.
    pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.app_id
    }
    /// The ID of the archived metric.
    /// This field is required.
    pub fn metric_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.metric_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The ID of the archived metric.
    pub fn set_metric_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.metric_id = input;
        self
    }
    /// The ID of the archived metric.
    pub fn get_metric_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.metric_id
    }
    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 [`ArchiveMetricOutput`](crate::operation::archive_metric::ArchiveMetricOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`app_id`](crate::operation::archive_metric::builders::ArchiveMetricOutputBuilder::app_id)
    /// - [`metric_id`](crate::operation::archive_metric::builders::ArchiveMetricOutputBuilder::metric_id)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::archive_metric::ArchiveMetricOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::archive_metric::ArchiveMetricOutput {
            app_id: self.app_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "app_id",
                    "app_id was not specified but it is required when building ArchiveMetricOutput",
                )
            })?,
            metric_id: self.metric_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "metric_id",
                    "metric_id was not specified but it is required when building ArchiveMetricOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}