aws_sdk_sts/operation/get_caller_identity/
_get_caller_identity_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the response to a successful <code>GetCallerIdentity</code> request, including information about the entity making the request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetCallerIdentityOutput {
7    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
8    pub user_id: ::std::option::Option<::std::string::String>,
9    /// <p>The Amazon Web Services account ID number of the account that owns or contains the calling entity.</p>
10    pub account: ::std::option::Option<::std::string::String>,
11    /// <p>The Amazon Web Services ARN associated with the calling entity.</p>
12    pub arn: ::std::option::Option<::std::string::String>,
13    _request_id: Option<String>,
14}
15impl GetCallerIdentityOutput {
16    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
17    pub fn user_id(&self) -> ::std::option::Option<&str> {
18        self.user_id.as_deref()
19    }
20    /// <p>The Amazon Web Services account ID number of the account that owns or contains the calling entity.</p>
21    pub fn account(&self) -> ::std::option::Option<&str> {
22        self.account.as_deref()
23    }
24    /// <p>The Amazon Web Services ARN associated with the calling entity.</p>
25    pub fn arn(&self) -> ::std::option::Option<&str> {
26        self.arn.as_deref()
27    }
28}
29impl ::aws_types::request_id::RequestId for GetCallerIdentityOutput {
30    fn request_id(&self) -> Option<&str> {
31        self._request_id.as_deref()
32    }
33}
34impl GetCallerIdentityOutput {
35    /// Creates a new builder-style object to manufacture [`GetCallerIdentityOutput`](crate::operation::get_caller_identity::GetCallerIdentityOutput).
36    pub fn builder() -> crate::operation::get_caller_identity::builders::GetCallerIdentityOutputBuilder {
37        crate::operation::get_caller_identity::builders::GetCallerIdentityOutputBuilder::default()
38    }
39}
40
41/// A builder for [`GetCallerIdentityOutput`](crate::operation::get_caller_identity::GetCallerIdentityOutput).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct GetCallerIdentityOutputBuilder {
45    pub(crate) user_id: ::std::option::Option<::std::string::String>,
46    pub(crate) account: ::std::option::Option<::std::string::String>,
47    pub(crate) arn: ::std::option::Option<::std::string::String>,
48    _request_id: Option<String>,
49}
50impl GetCallerIdentityOutputBuilder {
51    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
52    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53        self.user_id = ::std::option::Option::Some(input.into());
54        self
55    }
56    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
57    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58        self.user_id = input;
59        self
60    }
61    /// <p>The unique identifier of the calling entity. The exact value depends on the type of entity that is making the call. The values returned are those listed in the <b>aws:userid</b> column in the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable">Principal table</a> found on the <b>Policy Variables</b> reference page in the <i>IAM User Guide</i>.</p>
62    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
63        &self.user_id
64    }
65    /// <p>The Amazon Web Services account ID number of the account that owns or contains the calling entity.</p>
66    pub fn account(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.account = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>The Amazon Web Services account ID number of the account that owns or contains the calling entity.</p>
71    pub fn set_account(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.account = input;
73        self
74    }
75    /// <p>The Amazon Web Services account ID number of the account that owns or contains the calling entity.</p>
76    pub fn get_account(&self) -> &::std::option::Option<::std::string::String> {
77        &self.account
78    }
79    /// <p>The Amazon Web Services ARN associated with the calling entity.</p>
80    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.arn = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// <p>The Amazon Web Services ARN associated with the calling entity.</p>
85    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.arn = input;
87        self
88    }
89    /// <p>The Amazon Web Services ARN associated with the calling entity.</p>
90    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
91        &self.arn
92    }
93    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
94        self._request_id = Some(request_id.into());
95        self
96    }
97
98    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
99        self._request_id = request_id;
100        self
101    }
102    /// Consumes the builder and constructs a [`GetCallerIdentityOutput`](crate::operation::get_caller_identity::GetCallerIdentityOutput).
103    pub fn build(self) -> crate::operation::get_caller_identity::GetCallerIdentityOutput {
104        crate::operation::get_caller_identity::GetCallerIdentityOutput {
105            user_id: self.user_id,
106            account: self.account,
107            arn: self.arn,
108            _request_id: self._request_id,
109        }
110    }
111}