aws-sdk-mpa 1.19.0

AWS SDK for AWS Multi-party Approval
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)]
pub struct GetResourcePolicyOutput {
    /// <p>Amazon Resource Name (ARN) for the resource.</p>
    pub resource_arn: ::std::string::String,
    /// <p>The type of policy</p>
    pub policy_type: crate::types::PolicyType,
    /// <p>Amazon Resource Name (ARN) for the policy version.</p>
    pub policy_version_arn: ::std::option::Option<::std::string::String>,
    /// <p>Name of the policy.</p>
    pub policy_name: ::std::string::String,
    /// <p>Document that contains the contents for the policy.</p>
    pub policy_document: ::std::string::String,
    _request_id: Option<String>,
}
impl GetResourcePolicyOutput {
    /// <p>Amazon Resource Name (ARN) for the resource.</p>
    pub fn resource_arn(&self) -> &str {
        use std::ops::Deref;
        self.resource_arn.deref()
    }
    /// <p>The type of policy</p>
    pub fn policy_type(&self) -> &crate::types::PolicyType {
        &self.policy_type
    }
    /// <p>Amazon Resource Name (ARN) for the policy version.</p>
    pub fn policy_version_arn(&self) -> ::std::option::Option<&str> {
        self.policy_version_arn.as_deref()
    }
    /// <p>Name of the policy.</p>
    pub fn policy_name(&self) -> &str {
        use std::ops::Deref;
        self.policy_name.deref()
    }
    /// <p>Document that contains the contents for the policy.</p>
    pub fn policy_document(&self) -> &str {
        use std::ops::Deref;
        self.policy_document.deref()
    }
}
impl ::std::fmt::Debug for GetResourcePolicyOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("GetResourcePolicyOutput");
        formatter.field("resource_arn", &self.resource_arn);
        formatter.field("policy_type", &self.policy_type);
        formatter.field("policy_version_arn", &self.policy_version_arn);
        formatter.field("policy_name", &self.policy_name);
        formatter.field("policy_document", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
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)]
#[non_exhaustive]
pub struct GetResourcePolicyOutputBuilder {
    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
    pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
    pub(crate) policy_version_arn: ::std::option::Option<::std::string::String>,
    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl GetResourcePolicyOutputBuilder {
    /// <p>Amazon Resource Name (ARN) for the resource.</p>
    /// This field is required.
    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.resource_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Amazon Resource Name (ARN) for the resource.</p>
    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.resource_arn = input;
        self
    }
    /// <p>Amazon Resource Name (ARN) for the resource.</p>
    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.resource_arn
    }
    /// <p>The type of policy</p>
    /// This field is required.
    pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
        self.policy_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of policy</p>
    pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
        self.policy_type = input;
        self
    }
    /// <p>The type of policy</p>
    pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
        &self.policy_type
    }
    /// <p>Amazon Resource Name (ARN) for the policy version.</p>
    pub fn policy_version_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_version_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Amazon Resource Name (ARN) for the policy version.</p>
    pub fn set_policy_version_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_version_arn = input;
        self
    }
    /// <p>Amazon Resource Name (ARN) for the policy version.</p>
    pub fn get_policy_version_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_version_arn
    }
    /// <p>Name of the policy.</p>
    /// This field is required.
    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Name of the policy.</p>
    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_name = input;
        self
    }
    /// <p>Name of the policy.</p>
    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_name
    }
    /// <p>Document that contains the contents for the policy.</p>
    /// This field is required.
    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_document = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Document that contains the contents for the policy.</p>
    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_document = input;
        self
    }
    /// <p>Document that contains the contents for the policy.</p>
    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_document
    }
    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:
    /// - [`resource_arn`](crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::resource_arn)
    /// - [`policy_type`](crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::policy_type)
    /// - [`policy_name`](crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::policy_name)
    /// - [`policy_document`](crate::operation::get_resource_policy::builders::GetResourcePolicyOutputBuilder::policy_document)
    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 {
            resource_arn: self.resource_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "resource_arn",
                    "resource_arn was not specified but it is required when building GetResourcePolicyOutput",
                )
            })?,
            policy_type: self.policy_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "policy_type",
                    "policy_type was not specified but it is required when building GetResourcePolicyOutput",
                )
            })?,
            policy_version_arn: self.policy_version_arn,
            policy_name: self.policy_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "policy_name",
                    "policy_name was not specified but it is required when building GetResourcePolicyOutput",
                )
            })?,
            policy_document: self.policy_document.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "policy_document",
                    "policy_document was not specified but it is required when building GetResourcePolicyOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}
impl ::std::fmt::Debug for GetResourcePolicyOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("GetResourcePolicyOutputBuilder");
        formatter.field("resource_arn", &self.resource_arn);
        formatter.field("policy_type", &self.policy_type);
        formatter.field("policy_version_arn", &self.policy_version_arn);
        formatter.field("policy_name", &self.policy_name);
        formatter.field("policy_document", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}