// 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 GetResourcePolicyOutput {
    /// <p>Details of the resource policy. This is formatted as a JSON string.</p>
    pub policy: ::std::string::String,
    _request_id: Option<String>,
}
impl GetResourcePolicyOutput {
    /// <p>Details of the resource policy. This is formatted as a JSON string.</p>
    pub fn policy(&self) -> &str {
        use std::ops::Deref;
        self.policy.deref()
    }
}
impl ::aws_types::request_id::RequestId for GetResourcePolicyOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetResourcePolicyOutput {
    /// Creates a new builder-style object to manufacture [`GetResourcePolicyOutput`](crate::operation::get_resource_policy::GetResourcePolicyOutput).
    pub fn builder() -> crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder {
        crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::default()
    }
}

/// A builder for [`GetResourcePolicyOutput`](crate::operation::get_resource_policy::GetResourcePolicyOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetResourcePolicyOutputBuilder {
    pub(crate) policy: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl GetResourcePolicyOutputBuilder {
    /// <p>Details of the resource policy. This is formatted as a JSON string.</p>
    /// This field is required.
    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Details of the resource policy. This is formatted as a JSON string.</p>
    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy = input;
        self
    }
    /// <p>Details of the resource policy. This is formatted as a JSON string.</p>
    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy
    }
    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 [`GetResourcePolicyOutput`](crate::operation::get_resource_policy::GetResourcePolicyOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`policy`](crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::policy)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::get_resource_policy::GetResourcePolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::get_resource_policy::GetResourcePolicyOutput {
            policy: self.policy.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "policy",
                    "policy was not specified but it is required when building GetResourcePolicyOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}
