setCognitoEvents method

Future<void> setCognitoEvents({
  1. required Map<String, String> events,
  2. required String identityPoolId,
})

Sets the AWS Lambda function for a given event type for an identity pool. This request only updates the key/value pair specified. Other key/values pairs are not updated. To remove a key value pair, pass a empty value for the particular key.

This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.

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

Parameter events : The events to configure

Parameter identityPoolId : The Cognito Identity Pool to use when configuring Cognito Events

Implementation

Future<void> setCognitoEvents({
  required Map<String, String> events,
  required String identityPoolId,
}) async {
  ArgumentError.checkNotNull(events, 'events');
  ArgumentError.checkNotNull(identityPoolId, 'identityPoolId');
  _s.validateStringLength(
    'identityPoolId',
    identityPoolId,
    1,
    55,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'Events': events,
  };
  await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/identitypools/${Uri.encodeComponent(identityPoolId)}/events',
    exceptionFnMap: _exceptionFns,
  );
}