Skip to content

subscribe_to_dataset async

subscribe_to_dataset(
    identity_pool_id: IdentityPoolId,
    identity_id: IdentityId,
    dataset_name: DatasetName,
    device_id: DeviceId,
    *,
    config_overrides: Optional[AsyncCognitoSyncClientConfig] = None,
) -> SubscribeToDatasetResponse

Subscribes to receive notifications when a dataset is modified by another device.

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

SubscribeToDataset The following examples have been edited for readability. POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 8b9932b7-201d-4418-a960-0a470e11de9f X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.SubscribeToDataset HOST: cognito-sync.us-east-1.amazonaws.com X-AMZ-DATE: 20141004T195350Z X-AMZ-SECURITY-TOKEN: AUTHORIZATION: AWS4-HMAC-SHA256 Credential=, SignedHeaders=content-type;content-length;host;x-amz-date;x-amz-target, Signature= { "Operation": "com.amazonaws.cognito.sync.model#SubscribeToDataset", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "ID_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "Rufus", "DeviceId": "5cd28fbe-dd83-47ab-9f83-19093a5fb014" } } 1.1 200 OK x-amzn-requestid: 8b9932b7-201d-4418-a960-0a470e11de9f date: Sat, 04 Oct 2014 19:53:50 GMT content-type: application/json content-length: 99 { "Output": { "__type": "com.amazonaws.cognito.sync.model#SubscribeToDatasetResponse" }, "Version": "1.0" }

Parameters:

  • identity_pool_id (IdentityPoolId) –

    A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.

  • identity_id (IdentityId) –

    Unique ID for this identity.

  • dataset_name (DatasetName) –

    The name of the dataset to subcribe to.

  • device_id (DeviceId) –

    The unique ID generated for this device by Cognito.

Raises:

Source code in docs_src/capo_cognito_sync/_services/async_cognito_sync.py
async def subscribe_to_dataset(
    self,
    identity_pool_id: "capo_cognito_sync.types.identity_pool_id.IdentityPoolId",
    identity_id: "capo_cognito_sync.types.identity_id.IdentityId",
    dataset_name: "capo_cognito_sync.types.dataset_name.DatasetName",
    device_id: "capo_cognito_sync.types.device_id.DeviceId",
    *,
    config_overrides: Optional[AsyncCognitoSyncClientConfig] = None,
) -> "capo_cognito_sync.types.subscribe_to_dataset_response.SubscribeToDatasetResponse":
    """<p>Subscribes to receive notifications when a dataset is modified by another device.</p><p>This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.</p> <examples> <example> <name>SubscribeToDataset</name> <description>The following examples have been edited for readability.</description> <request> POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 8b9932b7-201d-4418-a960-0a470e11de9f X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.SubscribeToDataset HOST: cognito-sync.us-east-1.amazonaws.com X-AMZ-DATE: 20141004T195350Z X-AMZ-SECURITY-TOKEN: <securitytoken> AUTHORIZATION: AWS4-HMAC-SHA256 Credential=<credential>, SignedHeaders=content-type;content-length;host;x-amz-date;x-amz-target, Signature=<signature> { "Operation": "com.amazonaws.cognito.sync.model#SubscribeToDataset", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "ID_POOL_ID", "IdentityId": "IDENTITY_ID", "DatasetName": "Rufus", "DeviceId": "5cd28fbe-dd83-47ab-9f83-19093a5fb014" } } </request> <response> 1.1 200 OK x-amzn-requestid: 8b9932b7-201d-4418-a960-0a470e11de9f date: Sat, 04 Oct 2014 19:53:50 GMT content-type: application/json content-length: 99 { "Output": { "__type": "com.amazonaws.cognito.sync.model#SubscribeToDatasetResponse" }, "Version": "1.0" } </response> </example> </examples>

    Args:
        identity_pool_id: <p>A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which the identity belongs.</p>
        identity_id: <p>Unique ID for this identity.</p>
        dataset_name: <p>The name of the dataset to subcribe to.</p>
        device_id: <p>The unique ID generated for this device by Cognito.</p>

    Raises:
        capo_cognito_sync.errors.internal_error_exception.InternalErrorException: Indicates an internal service error.
        capo_cognito_sync.errors.invalid_configuration_exception.InvalidConfigurationException
        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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cognito_sync.types.subscribe_to_dataset_request.SubscribeToDatasetRequest]",
    ) -> AsyncOperationResponse[
        "capo_cognito_sync.types.subscribe_to_dataset_response.SubscribeToDatasetResponse"
    ]:
        import capo_cognito_sync._operations.aws_cognito_sync_service.subscribe_to_dataset

        (
            output,
            http_response,
        ) = await capo_cognito_sync._operations.aws_cognito_sync_service.subscribe_to_dataset.async_subscribe_to_dataset(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SubscribeToDataset")
    )
    input_: capo_cognito_sync.types.subscribe_to_dataset_request.SubscribeToDatasetRequest = {
        "identity_pool_id": identity_pool_id,
        "identity_id": identity_id,
        "dataset_name": dataset_name,
        "device_id": device_id,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output