aws_sdk_cognitoidentityprovider/operation/create_group/_create_group_input.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 CreateGroupInput {
6 /// <p>A name for the group. This name must be unique in your user pool.</p>
7 pub group_name: ::std::option::Option<::std::string::String>,
8 /// <p>The ID of the user pool where you want to create a user group.</p>
9 pub user_pool_id: ::std::option::Option<::std::string::String>,
10 /// <p>A description of the group that you're creating.</p>
11 pub description: ::std::option::Option<::std::string::String>,
12 /// <p>The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a <code>cognito:preferred_role</code> claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a <code>cognito:groups</code> claim that list all the groups that a user is a member of.</p>
13 pub role_arn: ::std::option::Option<::std::string::String>,
14 /// <p>A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims.</p>
15 /// <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim isn't set in users' tokens.</p>
16 /// <p>The default <code>Precedence</code> value is null. The maximum <code>Precedence</code> value is <code>2^31-1</code>.</p>
17 pub precedence: ::std::option::Option<i32>,
18}
19impl CreateGroupInput {
20 /// <p>A name for the group. This name must be unique in your user pool.</p>
21 pub fn group_name(&self) -> ::std::option::Option<&str> {
22 self.group_name.as_deref()
23 }
24 /// <p>The ID of the user pool where you want to create a user group.</p>
25 pub fn user_pool_id(&self) -> ::std::option::Option<&str> {
26 self.user_pool_id.as_deref()
27 }
28 /// <p>A description of the group that you're creating.</p>
29 pub fn description(&self) -> ::std::option::Option<&str> {
30 self.description.as_deref()
31 }
32 /// <p>The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a <code>cognito:preferred_role</code> claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a <code>cognito:groups</code> claim that list all the groups that a user is a member of.</p>
33 pub fn role_arn(&self) -> ::std::option::Option<&str> {
34 self.role_arn.as_deref()
35 }
36 /// <p>A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims.</p>
37 /// <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim isn't set in users' tokens.</p>
38 /// <p>The default <code>Precedence</code> value is null. The maximum <code>Precedence</code> value is <code>2^31-1</code>.</p>
39 pub fn precedence(&self) -> ::std::option::Option<i32> {
40 self.precedence
41 }
42}
43impl CreateGroupInput {
44 /// Creates a new builder-style object to manufacture [`CreateGroupInput`](crate::operation::create_group::CreateGroupInput).
45 pub fn builder() -> crate::operation::create_group::builders::CreateGroupInputBuilder {
46 crate::operation::create_group::builders::CreateGroupInputBuilder::default()
47 }
48}
49
50/// A builder for [`CreateGroupInput`](crate::operation::create_group::CreateGroupInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct CreateGroupInputBuilder {
54 pub(crate) group_name: ::std::option::Option<::std::string::String>,
55 pub(crate) user_pool_id: ::std::option::Option<::std::string::String>,
56 pub(crate) description: ::std::option::Option<::std::string::String>,
57 pub(crate) role_arn: ::std::option::Option<::std::string::String>,
58 pub(crate) precedence: ::std::option::Option<i32>,
59}
60impl CreateGroupInputBuilder {
61 /// <p>A name for the group. This name must be unique in your user pool.</p>
62 /// This field is required.
63 pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64 self.group_name = ::std::option::Option::Some(input.into());
65 self
66 }
67 /// <p>A name for the group. This name must be unique in your user pool.</p>
68 pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69 self.group_name = input;
70 self
71 }
72 /// <p>A name for the group. This name must be unique in your user pool.</p>
73 pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
74 &self.group_name
75 }
76 /// <p>The ID of the user pool where you want to create a user group.</p>
77 /// This field is required.
78 pub fn user_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79 self.user_pool_id = ::std::option::Option::Some(input.into());
80 self
81 }
82 /// <p>The ID of the user pool where you want to create a user group.</p>
83 pub fn set_user_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84 self.user_pool_id = input;
85 self
86 }
87 /// <p>The ID of the user pool where you want to create a user group.</p>
88 pub fn get_user_pool_id(&self) -> &::std::option::Option<::std::string::String> {
89 &self.user_pool_id
90 }
91 /// <p>A description of the group that you're creating.</p>
92 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93 self.description = ::std::option::Option::Some(input.into());
94 self
95 }
96 /// <p>A description of the group that you're creating.</p>
97 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98 self.description = input;
99 self
100 }
101 /// <p>A description of the group that you're creating.</p>
102 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
103 &self.description
104 }
105 /// <p>The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a <code>cognito:preferred_role</code> claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a <code>cognito:groups</code> claim that list all the groups that a user is a member of.</p>
106 pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107 self.role_arn = ::std::option::Option::Some(input.into());
108 self
109 }
110 /// <p>The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a <code>cognito:preferred_role</code> claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a <code>cognito:groups</code> claim that list all the groups that a user is a member of.</p>
111 pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112 self.role_arn = input;
113 self
114 }
115 /// <p>The Amazon Resource Name (ARN) for the IAM role that you want to associate with the group. A group role primarily declares a preferred role for the credentials that you get from an identity pool. Amazon Cognito ID tokens have a <code>cognito:preferred_role</code> claim that presents the highest-precedence group that a user belongs to. Both ID and access tokens also contain a <code>cognito:groups</code> claim that list all the groups that a user is a member of.</p>
116 pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
117 &self.role_arn
118 }
119 /// <p>A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims.</p>
120 /// <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim isn't set in users' tokens.</p>
121 /// <p>The default <code>Precedence</code> value is null. The maximum <code>Precedence</code> value is <code>2^31-1</code>.</p>
122 pub fn precedence(mut self, input: i32) -> Self {
123 self.precedence = ::std::option::Option::Some(input);
124 self
125 }
126 /// <p>A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims.</p>
127 /// <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim isn't set in users' tokens.</p>
128 /// <p>The default <code>Precedence</code> value is null. The maximum <code>Precedence</code> value is <code>2^31-1</code>.</p>
129 pub fn set_precedence(mut self, input: ::std::option::Option<i32>) -> Self {
130 self.precedence = input;
131 self
132 }
133 /// <p>A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. Zero is the highest precedence value. Groups with lower <code>Precedence</code> values take precedence over groups with higher or null <code>Precedence</code> values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the <code>cognito:roles</code> and <code>cognito:preferred_role</code> claims.</p>
134 /// <p>Two groups can have the same <code>Precedence</code> value. If this happens, neither group takes precedence over the other. If two groups with the same <code>Precedence</code> have the same role ARN, that role is used in the <code>cognito:preferred_role</code> claim in tokens for users in each group. If the two groups have different role ARNs, the <code>cognito:preferred_role</code> claim isn't set in users' tokens.</p>
135 /// <p>The default <code>Precedence</code> value is null. The maximum <code>Precedence</code> value is <code>2^31-1</code>.</p>
136 pub fn get_precedence(&self) -> &::std::option::Option<i32> {
137 &self.precedence
138 }
139 /// Consumes the builder and constructs a [`CreateGroupInput`](crate::operation::create_group::CreateGroupInput).
140 pub fn build(self) -> ::std::result::Result<crate::operation::create_group::CreateGroupInput, ::aws_smithy_types::error::operation::BuildError> {
141 ::std::result::Result::Ok(crate::operation::create_group::CreateGroupInput {
142 group_name: self.group_name,
143 user_pool_id: self.user_pool_id,
144 description: self.description,
145 role_arn: self.role_arn,
146 precedence: self.precedence,
147 })
148 }
149}