Table of Contents
A low-level client representing Amazon Cognito Sync:
import boto3
client = boto3.client('cognito-sync')
These are the available methods:
Initiates a bulk publish of all existing datasets for an Identity Pool to the configured stream. Customers are limited to one successful bulk publish per 24 hours. Bulk publish is an asynchronous request, customers can see the status of the request via the GetBulkPublishDetails operation.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.bulk_publish(
IdentityPoolId='string'
)
{
'IdentityPoolId': 'string'
}
Response Structure
Check if an operation can be paginated.
Deletes the specific dataset. The dataset will be deleted permanently, and the action can't be undone. Datasets that this dataset was merged with will no longer report the merge. Any subsequent operation on this dataset will result in a ResourceNotFoundException.
This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.
See also: AWS API Documentation
Request Syntax
response = client.delete_dataset(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string'
)
dict
Response Syntax
{
'Dataset': {
'IdentityId': 'string',
'DatasetName': 'string',
'CreationDate': datetime(2015, 1, 1),
'LastModifiedDate': datetime(2015, 1, 1),
'LastModifiedBy': 'string',
'DataStorage': 123,
'NumRecords': 123
}
}
Response Structure
Gets meta data about a dataset by identity and dataset name. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.
This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.
See also: AWS API Documentation
Request Syntax
response = client.describe_dataset(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string'
)
dict
Response Syntax
{
'Dataset': {
'IdentityId': 'string',
'DatasetName': 'string',
'CreationDate': datetime(2015, 1, 1),
'LastModifiedDate': datetime(2015, 1, 1),
'LastModifiedBy': 'string',
'DataStorage': 123,
'NumRecords': 123
}
}
Response Structure
Gets usage details (for example, data storage) about a particular identity pool.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.describe_identity_pool_usage(
IdentityPoolId='string'
)
{
'IdentityPoolUsage': {
'IdentityPoolId': 'string',
'SyncSessionsCount': 123,
'DataStorage': 123,
'LastModifiedDate': datetime(2015, 1, 1)
}
}
Response Structure
Gets usage information for an identity, including number of datasets and data usage.
This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.
See also: AWS API Documentation
Request Syntax
response = client.describe_identity_usage(
IdentityPoolId='string',
IdentityId='string'
)
dict
Response Syntax
{
'IdentityUsage': {
'IdentityId': 'string',
'IdentityPoolId': 'string',
'LastModifiedDate': datetime(2015, 1, 1),
'DatasetCount': 123,
'DataStorage': 123
}
}
Response Structure
Generate a presigned url given a client, its method, and arguments
The presigned url
Get the status of the last BulkPublish operation for an identity pool.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.get_bulk_publish_details(
IdentityPoolId='string'
)
{
'IdentityPoolId': 'string',
'BulkPublishStartTime': datetime(2015, 1, 1),
'BulkPublishCompleteTime': datetime(2015, 1, 1),
'BulkPublishStatus': 'NOT_STARTED'|'IN_PROGRESS'|'FAILED'|'SUCCEEDED',
'FailureMessage': 'string'
}
Response Structure
NOT_STARTED - No bulk publish has been requested for this identity pool
IN_PROGRESS - Data is being published to the configured stream
SUCCEEDED - All data for the identity pool has been published to the configured stream
FAILED - Some portion of the data has failed to publish, check FailureMessage for the cause.
Gets the events and the corresponding Lambda functions associated with an identity pool.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.get_cognito_events(
IdentityPoolId='string'
)
[REQUIRED]
The Cognito Identity Pool ID for the request
{
'Events': {
'string': 'string'
}
}
Response Structure
The response from the GetCognitoEvents request
The Cognito Events returned from the GetCognitoEvents request
Gets the configuration settings of an identity pool.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.get_identity_pool_configuration(
IdentityPoolId='string'
)
[REQUIRED]
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool for which to return a configuration.
{
'IdentityPoolId': 'string',
'PushSync': {
'ApplicationArns': [
'string',
],
'RoleArn': 'string'
},
'CognitoStreams': {
'StreamName': 'string',
'RoleArn': 'string',
'StreamingStatus': 'ENABLED'|'DISABLED'
}
}
Response Structure
The output for the GetIdentityPoolConfiguration operation.
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
Options to apply to this identity pool for push synchronization.
List of SNS platform application ARNs that could be used by clients.
A role configured to allow Cognito to call SNS on behalf of the developer.
ENABLED - Streaming of updates to identity pool is enabled.
DISABLED - Streaming of updates to identity pool is disabled. Bulk publish will also fail if StreamingStatus is DISABLED.
Create a paginator for an operation.
Returns an object that can wait for some condition.
Lists datasets for an identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.
ListDatasets can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use the Cognito Identity credentials to make this API call.
See also: AWS API Documentation
Request Syntax
response = client.list_datasets(
IdentityPoolId='string',
IdentityId='string',
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'Datasets': [
{
'IdentityId': 'string',
'DatasetName': 'string',
'CreationDate': datetime(2015, 1, 1),
'LastModifiedDate': datetime(2015, 1, 1),
'LastModifiedBy': 'string',
'DataStorage': 123,
'NumRecords': 123
},
],
'Count': 123,
'NextToken': 'string'
}
Response Structure
Gets a list of identity pools registered with Cognito.
ListIdentityPoolUsage can only be called with developer credentials. You cannot make this API call with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.list_identity_pool_usage(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'IdentityPoolUsages': [
{
'IdentityPoolId': 'string',
'SyncSessionsCount': 123,
'DataStorage': 123,
'LastModifiedDate': datetime(2015, 1, 1)
},
],
'MaxResults': 123,
'Count': 123,
'NextToken': 'string'
}
Response Structure
Gets paginated records, optionally changed after a particular sync count for a dataset and identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.
ListRecords can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.
See also: AWS API Documentation
Request Syntax
response = client.list_records(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string',
LastSyncCount=123,
NextToken='string',
MaxResults=123,
SyncSessionToken='string'
)
dict
Response Syntax
{
'Records': [
{
'Key': 'string',
'Value': 'string',
'SyncCount': 123,
'LastModifiedDate': datetime(2015, 1, 1),
'LastModifiedBy': 'string',
'DeviceLastModifiedDate': datetime(2015, 1, 1)
},
],
'NextToken': 'string',
'Count': 123,
'DatasetSyncCount': 123,
'LastModifiedBy': 'string',
'MergedDatasetNames': [
'string',
],
'DatasetExists': True|False,
'DatasetDeletedAfterRequestedSyncCount': True|False,
'SyncSessionToken': 'string'
}
Response Structure
Registers a device to receive push sync notifications.
This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.
See also: AWS API Documentation
Request Syntax
response = client.register_device(
IdentityPoolId='string',
IdentityId='string',
Platform='APNS'|'APNS_SANDBOX'|'GCM'|'ADM',
Token='string'
)
[REQUIRED]
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. Here, the ID of the pool that the identity belongs to.
[REQUIRED]
The unique ID for this identity.
[REQUIRED]
The SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).
[REQUIRED]
The push token.
dict
Response Syntax
{
'DeviceId': 'string'
}
Response Structure
(dict) --
Response to a RegisterDevice request.
DeviceId (string) --
The unique ID generated for this device by Cognito.
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.
See also: AWS API Documentation
Request Syntax
response = client.set_cognito_events(
IdentityPoolId='string',
Events={
'string': 'string'
}
)
[REQUIRED]
The Cognito Identity Pool to use when configuring Cognito Events
[REQUIRED]
The events to configure
None
Sets the necessary configuration for push sync.
This API can only be called with developer credentials. You cannot call this API with the temporary user credentials provided by Cognito Identity.
See also: AWS API Documentation
Request Syntax
response = client.set_identity_pool_configuration(
IdentityPoolId='string',
PushSync={
'ApplicationArns': [
'string',
],
'RoleArn': 'string'
},
CognitoStreams={
'StreamName': 'string',
'RoleArn': 'string',
'StreamingStatus': 'ENABLED'|'DISABLED'
}
)
[REQUIRED]
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool to modify.
Options to apply to this identity pool for push synchronization.
List of SNS platform application ARNs that could be used by clients.
A role configured to allow Cognito to call SNS on behalf of the developer.
Options to apply to this identity pool for Amazon Cognito streams.
ENABLED - Streaming of updates to identity pool is enabled.
DISABLED - Streaming of updates to identity pool is disabled. Bulk publish will also fail if StreamingStatus is DISABLED.
dict
Response Syntax
{
'IdentityPoolId': 'string',
'PushSync': {
'ApplicationArns': [
'string',
],
'RoleArn': 'string'
},
'CognitoStreams': {
'StreamName': 'string',
'RoleArn': 'string',
'StreamingStatus': 'ENABLED'|'DISABLED'
}
}
Response Structure
(dict) --
The output for the SetIdentityPoolConfiguration operation
IdentityPoolId (string) --
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.
PushSync (dict) --
Options to apply to this identity pool for push synchronization.
ApplicationArns (list) --
List of SNS platform application ARNs that could be used by clients.
RoleArn (string) --
A role configured to allow Cognito to call SNS on behalf of the developer.
CognitoStreams (dict) -- Options to apply to this identity pool for Amazon Cognito streams.
StreamName (string) -- The name of the Cognito stream to receive updates. This stream must be in the developers account and in the same region as the identity pool.
RoleArn (string) -- The ARN of the role Amazon Cognito can assume in order to publish to the stream. This role must grant access to Amazon Cognito (cognito-sync) to invoke PutRecord on your Cognito stream.
StreamingStatus (string) -- Status of the Cognito streams. Valid values are:
ENABLED - Streaming of updates to identity pool is enabled.
DISABLED - Streaming of updates to identity pool is disabled. Bulk publish will also fail if StreamingStatus is DISABLED.
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.
See also: AWS API Documentation
Request Syntax
response = client.subscribe_to_dataset(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string',
DeviceId='string'
)
[REQUIRED]
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.
[REQUIRED]
Unique ID for this identity.
[REQUIRED]
The name of the dataset to subcribe to.
[REQUIRED]
The unique ID generated for this device by Cognito.
dict
Response Syntax
{}
Response Structure
(dict) --
Response to a SubscribeToDataset request.
Unsubscribes from receiving 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.
See also: AWS API Documentation
Request Syntax
response = client.unsubscribe_from_dataset(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string',
DeviceId='string'
)
[REQUIRED]
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 this identity belongs.
[REQUIRED]
Unique ID for this identity.
[REQUIRED]
The name of the dataset from which to unsubcribe.
[REQUIRED]
The unique ID generated for this device by Cognito.
dict
Response Syntax
{}
Response Structure
(dict) --
Response to an UnsubscribeFromDataset request.
Posts updates to records and adds and deletes records for a dataset and user.
The sync count in the record patch is your last known sync count for that record. The server will reject an UpdateRecords request with a ResourceConflictException if you try to patch a record with a new value but a stale sync count.
For example, if the sync count on the server is 5 for a key called highScore and you try and submit a new highScore with sync count of 4, the request will be rejected. To obtain the current sync count for a record, call ListRecords. On a successful update of the record, the response returns the new sync count for that record. You should present that sync count the next time you try to update that same record. When the record does not exist, specify the sync count as 0.
This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.
See also: AWS API Documentation
Request Syntax
response = client.update_records(
IdentityPoolId='string',
IdentityId='string',
DatasetName='string',
DeviceId='string',
RecordPatches=[
{
'Op': 'replace'|'remove',
'Key': 'string',
'Value': 'string',
'SyncCount': 123,
'DeviceLastModifiedDate': datetime(2015, 1, 1)
},
],
SyncSessionToken='string',
ClientContext='string'
)
A list of patch operations.
dict
Response Syntax
{
'Records': [
{
'Key': 'string',
'Value': 'string',
'SyncCount': 123,
'LastModifiedDate': datetime(2015, 1, 1),
'LastModifiedBy': 'string',
'DeviceLastModifiedDate': datetime(2015, 1, 1)
},
]
}
Response Structure