Sets the roles for an identity pool. These roles are used when making calls to GetCredentialsForIdentity action.
You must use Amazon Web Services developer credentials to call this operation.
Parameters:
-
identity_pool_id
(IdentityPoolId)
–
An identity pool ID in the format REGION:GUID.
-
roles
(RolesMap)
–
The map of roles associated with this pool. For a given role, the key will be either "authenticated" or "unauthenticated" and the value will be the Role ARN.
-
role_mappings
(Optional[RoleMappingMap], default:
None
)
–
How users for a specific identity provider are to mapped to roles. This is a string to RoleMapping object map. The string identifies the identity provider, for example, graph.facebook.com or cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id.
Up to 25 rules can be specified per identity provider.
Raises:
Source code in docs_src/capo_cognito_identity/_services/cognito_identity.py
| def set_identity_pool_roles(
self,
identity_pool_id: "capo_cognito_identity.types.identity_pool_id.IdentityPoolId",
roles: "capo_cognito_identity.types.roles_map.RolesMap",
*,
config_overrides: Optional[CognitoIdentityClientConfig] = None,
role_mappings: Optional[
"capo_cognito_identity.types.role_mapping_map.RoleMappingMap"
] = None,
) -> None:
"""<p>Sets the roles for an identity pool. These roles are used when making calls to <a>GetCredentialsForIdentity</a> action.</p> <p>You must use Amazon Web Services developer credentials to call this operation.</p>
Args:
identity_pool_id: <p>An identity pool ID in the format REGION:GUID.</p>
roles: <p>The map of roles associated with this pool. For a given role, the key will be either "authenticated" or "unauthenticated" and the value will be the Role ARN.</p>
role_mappings: <p>How users for a specific identity provider are to mapped to roles. This is a string to <a>RoleMapping</a> object map. The string identifies the identity provider, for example, <code>graph.facebook.com</code> or <code>cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id</code>.</p> <p>Up to 25 rules can be specified per identity provider.</p>
Raises:
capo_cognito_identity.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Thrown if there are parallel requests to modify a resource.</p>
capo_cognito_identity.errors.internal_error_exception.InternalErrorException: <p>Thrown when the service encounters an error during processing the request.</p>
capo_cognito_identity.errors.invalid_parameter_exception.InvalidParameterException: <p>Thrown for missing or bad input parameter(s).</p>
capo_cognito_identity.errors.not_authorized_exception.NotAuthorizedException: <p>Thrown when a user is not authorized to access the requested resource.</p>
capo_cognito_identity.errors.resource_conflict_exception.ResourceConflictException: <p>Thrown when a user tries to use a login which is already linked to another account.</p>
capo_cognito_identity.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when the requested resource (for example, a dataset or record) does not exist.</p>
capo_cognito_identity.errors.too_many_requests_exception.TooManyRequestsException: <p>Thrown when a request is throttled.</p>
capo_cognito_identity.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cognito_identity.types.set_identity_pool_roles_input.SetIdentityPoolRolesInput]",
) -> OperationResponse[None]:
import capo_cognito_identity._operations.aws_cognito_identity_service.set_identity_pool_roles
output, http_response = (
capo_cognito_identity._operations.aws_cognito_identity_service.set_identity_pool_roles.set_identity_pool_roles(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SetIdentityPoolRoles")
)
input_: capo_cognito_identity.types.set_identity_pool_roles_input.SetIdentityPoolRolesInput = {
"identity_pool_id": identity_pool_id,
"roles": roles,
}
if role_mappings is not None:
input_["role_mappings"] = role_mappings
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|