setIdentityPoolRoles method

Future<void> setIdentityPoolRoles({
  1. required String identityPoolId,
  2. required Map<String, String> roles,
  3. Map<String, RoleMapping>? roleMappings,
})

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.

May throw ConcurrentModificationException. May throw InternalErrorException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw ResourceConflictException. May throw ResourceNotFoundException. May throw TooManyRequestsException.

Parameter identityPoolId : An identity pool ID in the format REGION:GUID.

Parameter roles : 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.

Parameter roleMappings : 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.

Implementation

Future<void> setIdentityPoolRoles({
  required String identityPoolId,
  required Map<String, String> roles,
  Map<String, RoleMapping>? roleMappings,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityService.SetIdentityPoolRoles'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IdentityPoolId': identityPoolId,
      'Roles': roles,
      if (roleMappings != null) 'RoleMappings': roleMappings,
    },
  );
}