Skip to content

set_cognito_events

set_cognito_events(
    identity_pool_id: IdentityPoolId,
    events: Events,
    *,
    config_overrides: Optional[CognitoSyncClientConfig] = None,
) -> None

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.

Parameters:

  • identity_pool_id (IdentityPoolId) –

    The Cognito Identity Pool to use when configuring Cognito Events

  • events (Events) –

    The events to configure

Raises:

Source code in docs_src/capo_cognito_sync/_services/cognito_sync.py
def set_cognito_events(
    self,
    identity_pool_id: "capo_cognito_sync.types.identity_pool_id.IdentityPoolId",
    events: "capo_cognito_sync.types.events.Events",
    *,
    config_overrides: Optional[CognitoSyncClientConfig] = None,
) -> None:
    """<p>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.</p><p>This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.</p>

    Args:
        identity_pool_id: <p>The Cognito Identity Pool to use when configuring Cognito Events</p>
        events: <p>The events to configure</p>

    Raises:
        capo_cognito_sync.errors.internal_error_exception.InternalErrorException: Indicates an internal service error.
        capo_cognito_sync.errors.invalid_parameter_exception.InvalidParameterException: Thrown when a request parameter does not comply with the associated constraints.
        capo_cognito_sync.errors.not_authorized_exception.NotAuthorizedException: Thrown when a user is not authorized to access the requested resource.
        capo_cognito_sync.errors.resource_not_found_exception.ResourceNotFoundException: Thrown if the resource doesn't exist.
        capo_cognito_sync.errors.too_many_requests_exception.TooManyRequestsException: Thrown if the request is throttled.
        capo_cognito_sync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cognito_sync.types.set_cognito_events_request.SetCognitoEventsRequest]",
    ) -> OperationResponse[None]:
        import capo_cognito_sync._operations.aws_cognito_sync_service.set_cognito_events

        output, http_response = (
            capo_cognito_sync._operations.aws_cognito_sync_service.set_cognito_events.set_cognito_events(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SetCognitoEvents")
    )
    input_: capo_cognito_sync.types.set_cognito_events_request.SetCognitoEventsRequest = {
        "identity_pool_id": identity_pool_id,
        "events": events,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output