aws_sdk_entityresolution/operation/get_policy/
_get_policy_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetPolicyOutput {
6    /// <p>The Entity Resolution resource ARN.</p>
7    pub arn: ::std::string::String,
8    /// <p>A unique identifier for the current revision of the policy.</p>
9    pub token: ::std::string::String,
10    /// <p>The resource-based policy.</p>
11    pub policy: ::std::option::Option<::std::string::String>,
12    _request_id: Option<String>,
13}
14impl GetPolicyOutput {
15    /// <p>The Entity Resolution resource ARN.</p>
16    pub fn arn(&self) -> &str {
17        use std::ops::Deref;
18        self.arn.deref()
19    }
20    /// <p>A unique identifier for the current revision of the policy.</p>
21    pub fn token(&self) -> &str {
22        use std::ops::Deref;
23        self.token.deref()
24    }
25    /// <p>The resource-based policy.</p>
26    pub fn policy(&self) -> ::std::option::Option<&str> {
27        self.policy.as_deref()
28    }
29}
30impl ::aws_types::request_id::RequestId for GetPolicyOutput {
31    fn request_id(&self) -> Option<&str> {
32        self._request_id.as_deref()
33    }
34}
35impl GetPolicyOutput {
36    /// Creates a new builder-style object to manufacture [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
37    pub fn builder() -> crate::operation::get_policy::builders::GetPolicyOutputBuilder {
38        crate::operation::get_policy::builders::GetPolicyOutputBuilder::default()
39    }
40}
41
42/// A builder for [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct GetPolicyOutputBuilder {
46    pub(crate) arn: ::std::option::Option<::std::string::String>,
47    pub(crate) token: ::std::option::Option<::std::string::String>,
48    pub(crate) policy: ::std::option::Option<::std::string::String>,
49    _request_id: Option<String>,
50}
51impl GetPolicyOutputBuilder {
52    /// <p>The Entity Resolution resource ARN.</p>
53    /// This field is required.
54    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.arn = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>The Entity Resolution resource ARN.</p>
59    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.arn = input;
61        self
62    }
63    /// <p>The Entity Resolution resource ARN.</p>
64    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
65        &self.arn
66    }
67    /// <p>A unique identifier for the current revision of the policy.</p>
68    /// This field is required.
69    pub fn token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.token = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>A unique identifier for the current revision of the policy.</p>
74    pub fn set_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.token = input;
76        self
77    }
78    /// <p>A unique identifier for the current revision of the policy.</p>
79    pub fn get_token(&self) -> &::std::option::Option<::std::string::String> {
80        &self.token
81    }
82    /// <p>The resource-based policy.</p>
83    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.policy = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The resource-based policy.</p>
88    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.policy = input;
90        self
91    }
92    /// <p>The resource-based policy.</p>
93    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
94        &self.policy
95    }
96    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
97        self._request_id = Some(request_id.into());
98        self
99    }
100
101    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
102        self._request_id = request_id;
103        self
104    }
105    /// Consumes the builder and constructs a [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
106    /// This method will fail if any of the following fields are not set:
107    /// - [`arn`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::arn)
108    /// - [`token`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::token)
109    pub fn build(self) -> ::std::result::Result<crate::operation::get_policy::GetPolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
110        ::std::result::Result::Ok(crate::operation::get_policy::GetPolicyOutput {
111            arn: self.arn.ok_or_else(|| {
112                ::aws_smithy_types::error::operation::BuildError::missing_field(
113                    "arn",
114                    "arn was not specified but it is required when building GetPolicyOutput",
115                )
116            })?,
117            token: self.token.ok_or_else(|| {
118                ::aws_smithy_types::error::operation::BuildError::missing_field(
119                    "token",
120                    "token was not specified but it is required when building GetPolicyOutput",
121                )
122            })?,
123            policy: self.policy,
124            _request_id: self._request_id,
125        })
126    }
127}