aws_sdk_cognitoidentity/operation/unlink_identity/
_unlink_identity_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Input to the UnlinkIdentity action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UnlinkIdentityInput {
7    /// <p>A unique identifier in the format REGION:GUID.</p>
8    pub identity_id: ::std::option::Option<::std::string::String>,
9    /// <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
10    pub logins: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
11    /// <p>Provider names to unlink from this identity.</p>
12    pub logins_to_remove: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13}
14impl UnlinkIdentityInput {
15    /// <p>A unique identifier in the format REGION:GUID.</p>
16    pub fn identity_id(&self) -> ::std::option::Option<&str> {
17        self.identity_id.as_deref()
18    }
19    /// <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
20    pub fn logins(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
21        self.logins.as_ref()
22    }
23    /// <p>Provider names to unlink from this identity.</p>
24    ///
25    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.logins_to_remove.is_none()`.
26    pub fn logins_to_remove(&self) -> &[::std::string::String] {
27        self.logins_to_remove.as_deref().unwrap_or_default()
28    }
29}
30impl UnlinkIdentityInput {
31    /// Creates a new builder-style object to manufacture [`UnlinkIdentityInput`](crate::operation::unlink_identity::UnlinkIdentityInput).
32    pub fn builder() -> crate::operation::unlink_identity::builders::UnlinkIdentityInputBuilder {
33        crate::operation::unlink_identity::builders::UnlinkIdentityInputBuilder::default()
34    }
35}
36
37/// A builder for [`UnlinkIdentityInput`](crate::operation::unlink_identity::UnlinkIdentityInput).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct UnlinkIdentityInputBuilder {
41    pub(crate) identity_id: ::std::option::Option<::std::string::String>,
42    pub(crate) logins: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
43    pub(crate) logins_to_remove: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
44}
45impl UnlinkIdentityInputBuilder {
46    /// <p>A unique identifier in the format REGION:GUID.</p>
47    /// This field is required.
48    pub fn identity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49        self.identity_id = ::std::option::Option::Some(input.into());
50        self
51    }
52    /// <p>A unique identifier in the format REGION:GUID.</p>
53    pub fn set_identity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54        self.identity_id = input;
55        self
56    }
57    /// <p>A unique identifier in the format REGION:GUID.</p>
58    pub fn get_identity_id(&self) -> &::std::option::Option<::std::string::String> {
59        &self.identity_id
60    }
61    /// Adds a key-value pair to `logins`.
62    ///
63    /// To override the contents of this collection use [`set_logins`](Self::set_logins).
64    ///
65    /// <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
66    pub fn logins(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
67        let mut hash_map = self.logins.unwrap_or_default();
68        hash_map.insert(k.into(), v.into());
69        self.logins = ::std::option::Option::Some(hash_map);
70        self
71    }
72    /// <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
73    pub fn set_logins(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
74        self.logins = input;
75        self
76    }
77    /// <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
78    pub fn get_logins(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
79        &self.logins
80    }
81    /// Appends an item to `logins_to_remove`.
82    ///
83    /// To override the contents of this collection use [`set_logins_to_remove`](Self::set_logins_to_remove).
84    ///
85    /// <p>Provider names to unlink from this identity.</p>
86    pub fn logins_to_remove(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        let mut v = self.logins_to_remove.unwrap_or_default();
88        v.push(input.into());
89        self.logins_to_remove = ::std::option::Option::Some(v);
90        self
91    }
92    /// <p>Provider names to unlink from this identity.</p>
93    pub fn set_logins_to_remove(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
94        self.logins_to_remove = input;
95        self
96    }
97    /// <p>Provider names to unlink from this identity.</p>
98    pub fn get_logins_to_remove(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
99        &self.logins_to_remove
100    }
101    /// Consumes the builder and constructs a [`UnlinkIdentityInput`](crate::operation::unlink_identity::UnlinkIdentityInput).
102    pub fn build(
103        self,
104    ) -> ::std::result::Result<crate::operation::unlink_identity::UnlinkIdentityInput, ::aws_smithy_types::error::operation::BuildError> {
105        ::std::result::Result::Ok(crate::operation::unlink_identity::UnlinkIdentityInput {
106            identity_id: self.identity_id,
107            logins: self.logins,
108            logins_to_remove: self.logins_to_remove,
109        })
110    }
111}