datasets
Creates, updates, deletes, gets or lists a datasets resource.
Overview
| Name | datasets |
| Type | Resource |
| Id | aws.cognito_sync.datasets |
Fields
The following fields are returned by SELECT queries:
- describe_dataset
- list_datasets
| Name | Datatype | Description |
|---|---|---|
creation_date | string (date-time) | Date on which the dataset was created. |
data_storage | integer (int64) | Total size in bytes of the records in this dataset. |
dataset_name | string | A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '' (underscore), '-' (dash), and '.' (dot). (pattern: <code>[a-zA-Z0-9.:-]+</code>) |
identity_id | string | A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region. (pattern: <code>[\w-]+:[0-9a-f-]+</code>) |
last_modified_by | string | The device that made the last change to this dataset. |
last_modified_date | string (date-time) | Date when the dataset was last modified. |
num_records | integer (int64) | Number of records in this dataset. |
| Name | Datatype | Description |
|---|---|---|
count | integer | Number of datasets returned. |
datasets | array | A set of datasets. |
next_token | string | A pagination token for obtaining the next page of results. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_dataset | select | identity_pool_id, identity_id, dataset_name, region | 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. | |
list_datasets | select | identity_pool_id, identity_id, region | nextToken, maxResults | 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. |
delete_dataset | delete | identity_pool_id, identity_id, dataset_name, region | 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. | |
subscribe_to_dataset | exec | identity_pool_id, identity_id, dataset_name, device_id, region | 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. | |
unsubscribe_from_dataset | exec | identity_pool_id, identity_id, dataset_name, device_id, region | 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. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
dataset_name | string | The name of the dataset from which to unsubcribe. |
device_id | string | The unique ID generated for this device by Cognito. |
identity_id | string | Unique ID for this identity. |
identity_pool_id | string | 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. |
region | string | AWS region (default: us-east-1) |
maxResults | integer | The maximum number of results to be returned. |
nextToken | string | A pagination token for obtaining the next page of results. |
SELECT examples
- describe_dataset
- list_datasets
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.
SELECT
creation_date,
data_storage,
dataset_name,
identity_id,
last_modified_by,
last_modified_date,
num_records
FROM aws.cognito_sync.datasets
WHERE identity_pool_id = '{{ identity_pool_id }}' -- required
AND identity_id = '{{ identity_id }}' -- required
AND dataset_name = '{{ dataset_name }}' -- required
AND region = '{{ region }}' -- required
;
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.
SELECT
count,
datasets,
next_token
FROM aws.cognito_sync.datasets
WHERE identity_pool_id = '{{ identity_pool_id }}' -- required
AND identity_id = '{{ identity_id }}' -- required
AND region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;
DELETE examples
- delete_dataset
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.
DELETE FROM aws.cognito_sync.datasets
WHERE identity_pool_id = '{{ identity_pool_id }}' --required
AND identity_id = '{{ identity_id }}' --required
AND dataset_name = '{{ dataset_name }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- subscribe_to_dataset
- unsubscribe_from_dataset
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.
EXEC aws.cognito_sync.datasets.subscribe_to_dataset
@identity_pool_id='{{ identity_pool_id }}' --required,
@identity_id='{{ identity_id }}' --required,
@dataset_name='{{ dataset_name }}' --required,
@device_id='{{ device_id }}' --required,
@region='{{ region }}' --required
;
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.
EXEC aws.cognito_sync.datasets.unsubscribe_from_dataset
@identity_pool_id='{{ identity_pool_id }}' --required,
@identity_id='{{ identity_id }}' --required,
@dataset_name='{{ dataset_name }}' --required,
@device_id='{{ device_id }}' --required,
@region='{{ region }}' --required
;