Class: AWS.CognitoSync

Inherits:
AWS.Service show all
Identifier:
cognitosync
API Version:
2014-06-30
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Amazon Cognito Sync provides an AWS service and client library that enable cross-device syncing of application-related user data. High-level client libraries are available for both iOS and Android. You can use these libraries to persist data locally so that it's available even if the device is offline. Developer credentials don't need to be stored on the mobile device to access the service. You can use Amazon Cognito to obtain a normalized user ID and credentials. User data is persisted in a dataset that can store up to 1 MB of key-value pairs, and you can have up to 20 datasets per user identity.

With Amazon Cognito Sync, the data stored for each identity is accessible only to credentials assigned to that identity. In order to use the Cognito Sync service, you need to make API calls using credentials retrieved with Amazon Cognito Identity service.

If you want to use Cognito Sync in an Android or iOS application, you will probably want to make API calls via the AWS Mobile SDK. To learn more, see the Developer Guide for Android and the Developer Guide for iOS.

Sending a Request Using CognitoSync

var cognitosync = new AWS.CognitoSync();
cognitosync.bulkPublish(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CognitoSync object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var cognitosync = new AWS.CognitoSync({apiVersion: '2014-06-30'});

You can also set the API version globally in AWS.config.apiVersions using the cognitosync service identifier:

AWS.config.apiVersions = {
  cognitosync: '2014-06-30',
  // other service API versions
};

var cognitosync = new AWS.CognitoSync();

Version:

  • 2014-06-30

Constructor Summary

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.CognitoSync(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a CognitoSync object

var cognitosync = new AWS.CognitoSync({apiVersion: '2014-06-30'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.CognitoSync.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.CognitoSync.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.CognitoSync.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

bulkPublish(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the bulkPublish operation

var params = {
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.bulkPublish(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolId — (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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteDataset(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the deleteDataset operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.deleteDataset(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.
    • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Dataset — (map) A collection of data for an identity pool. An identity pool can have multiple datasets. A dataset is per identity and can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
        • IdentityId — (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.
        • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        • CreationDate — (Date) Date on which the dataset was created.
        • LastModifiedDate — (Date) Date when the dataset was last modified.
        • LastModifiedBy — (String) The device that made the last change to this dataset.
        • DataStorage — (Integer) Total size in bytes of the records in this dataset.
        • NumRecords — (Integer) Number of records in this dataset.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeDataset(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the describeDataset operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.describeDataset(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.
    • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Dataset — (map) Meta data for a collection of data for an identity. An identity can have multiple datasets. A dataset can be general or associated with a particular entity in an application (like a saved game). Datasets are automatically created if they don't exist. Data is synced by dataset, and a dataset can hold up to 1MB of key-value pairs.
        • IdentityId — (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.
        • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        • CreationDate — (Date) Date on which the dataset was created.
        • LastModifiedDate — (Date) Date when the dataset was last modified.
        • LastModifiedBy — (String) The device that made the last change to this dataset.
        • DataStorage — (Integer) Total size in bytes of the records in this dataset.
        • NumRecords — (Integer) Number of records in this dataset.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeIdentityPoolUsage(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the describeIdentityPoolUsage operation

var params = {
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.describeIdentityPoolUsage(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolUsage — (map) Information about the usage of the identity pool.
        • IdentityPoolId — (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.
        • SyncSessionsCount — (Integer) Number of sync sessions for the identity pool.
        • DataStorage — (Integer) Data storage information for the identity pool.
        • LastModifiedDate — (Date) Date on which the identity pool was last modified.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeIdentityUsage(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the describeIdentityUsage operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.describeIdentityUsage(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityUsage — (map) Usage information for the identity.
        • IdentityId — (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.
        • IdentityPoolId — (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.
        • LastModifiedDate — (Date) Date on which the identity was last modified.
        • DatasetCount — (Integer) Number of datasets for the identity.
        • DataStorage — (Integer) Total data storage for this identity.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getBulkPublishDetails(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getBulkPublishDetails operation

var params = {
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.getBulkPublishDetails(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolId — (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.
      • BulkPublishStartTime — (Date) The date/time at which the last bulk publish was initiated.
      • BulkPublishCompleteTime — (Date) If BulkPublishStatus is SUCCEEDED, the time the last bulk publish operation completed.
      • BulkPublishStatus — (String) Status of the last bulk publish operation, valid values are:

        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.

        Possible values include:
        • "NOT_STARTED"
        • "IN_PROGRESS"
        • "FAILED"
        • "SUCCEEDED"
      • FailureMessage — (String) If BulkPublishStatus is FAILED this field will contain the error message that caused the bulk publish to fail.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getCognitoEvents(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getCognitoEvents operation

var params = {
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.getCognitoEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (String)

      The Cognito Identity Pool ID for the request

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Events — (map<String>)

        The Cognito Events returned from the GetCognitoEvents request

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getIdentityPoolConfiguration(params = {}, callback) ⇒ AWS.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.

Service Reference:

Examples:

Calling the getIdentityPoolConfiguration operation

var params = {
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.getIdentityPoolConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (String)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolId — (String)

        A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.

      • PushSync — (map)

        Options to apply to this identity pool for push synchronization.

        • ApplicationArns — (Array<String>)

          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 — (map) 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.

          Possible values include:
          • "ENABLED"
          • "DISABLED"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listDatasets(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the listDatasets operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitosync.listDatasets(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.
    • NextToken — (String) A pagination token for obtaining the next page of results.
    • MaxResults — (Integer) The maximum number of results to be returned.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Datasets — (Array<map>) A set of datasets.
        • IdentityId — (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.
        • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
        • CreationDate — (Date) Date on which the dataset was created.
        • LastModifiedDate — (Date) Date when the dataset was last modified.
        • LastModifiedBy — (String) The device that made the last change to this dataset.
        • DataStorage — (Integer) Total size in bytes of the records in this dataset.
        • NumRecords — (Integer) Number of records in this dataset.
      • Count — (Integer) Number of datasets returned.
      • NextToken — (String) A pagination token for obtaining the next page of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listIdentityPoolUsage(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the listIdentityPoolUsage operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
cognitosync.listIdentityPoolUsage(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String) A pagination token for obtaining the next page of results.
    • MaxResults — (Integer) The maximum number of results to be returned.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolUsages — (Array<map>) Usage information for the identity pools.
        • IdentityPoolId — (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.
        • SyncSessionsCount — (Integer) Number of sync sessions for the identity pool.
        • DataStorage — (Integer) Data storage information for the identity pool.
        • LastModifiedDate — (Date) Date on which the identity pool was last modified.
      • MaxResults — (Integer) The maximum number of results to be returned.
      • Count — (Integer) Total number of identities for the identity pool.
      • NextToken — (String) A pagination token for obtaining the next page of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listRecords(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the listRecords operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  LastSyncCount: 'NUMBER_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  SyncSessionToken: 'STRING_VALUE'
};
cognitosync.listRecords(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.
    • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
    • LastSyncCount — (Integer) The last server sync count for this record.
    • NextToken — (String) A pagination token for obtaining the next page of results.
    • MaxResults — (Integer) The maximum number of results to be returned.
    • SyncSessionToken — (String) A token containing a session ID, identity ID, and expiration.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Records — (Array<map>) A list of all records.
        • Key — (String) The key for the record.
        • Value — (String) The value for the record.
        • SyncCount — (Integer) The server sync count for this record.
        • LastModifiedDate — (Date) The date on which the record was last modified.
        • LastModifiedBy — (String) The user/device that made the last change to this record.
        • DeviceLastModifiedDate — (Date) The last modified date of the client device.
      • NextToken — (String) A pagination token for obtaining the next page of results.
      • Count — (Integer) Total number of records.
      • DatasetSyncCount — (Integer) Server sync count for this dataset.
      • LastModifiedBy — (String) The user/device that made the last change to this record.
      • MergedDatasetNames — (Array<String>) Names of merged datasets.
      • DatasetExists — (Boolean) Indicates whether the dataset exists.
      • DatasetDeletedAfterRequestedSyncCount — (Boolean) A boolean value specifying whether to delete the dataset locally.
      • SyncSessionToken — (String) A token containing a session ID, identity ID, and expiration.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

registerDevice(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the registerDevice operation

var params = {
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  Platform: APNS | APNS_SANDBOX | GCM | ADM, /* required */
  Token: 'STRING_VALUE' /* required */
};
cognitosync.registerDevice(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (String)

      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.

    • IdentityId — (String)

      The unique ID for this identity.

    • Platform — (String)

      The SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).

      Possible values include:
      • "APNS"
      • "APNS_SANDBOX"
      • "GCM"
      • "ADM"
    • Token — (String)

      The push token.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • DeviceId — (String)

        The unique ID generated for this device by Cognito.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setCognitoEvents(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the setCognitoEvents operation

var params = {
  Events: { /* required */
    '<CognitoEventType>': 'STRING_VALUE',
    /* '<CognitoEventType>': ... */
  },
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.setCognitoEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (String)

      The Cognito Identity Pool to use when configuring Cognito Events

    • Events — (map<String>)

      The events to configure

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

setIdentityPoolConfiguration(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the setIdentityPoolConfiguration operation

var params = {
  IdentityPoolId: 'STRING_VALUE', /* required */
  CognitoStreams: {
    RoleArn: 'STRING_VALUE',
    StreamName: 'STRING_VALUE',
    StreamingStatus: ENABLED | DISABLED
  },
  PushSync: {
    ApplicationArns: [
      'STRING_VALUE',
      /* more items */
    ],
    RoleArn: 'STRING_VALUE'
  }
};
cognitosync.setIdentityPoolConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (String)

      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.

    • PushSync — (map)

      Options to apply to this identity pool for push synchronization.

      • ApplicationArns — (Array<String>)

        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 — (map) 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.

        Possible values include:
        • "ENABLED"
        • "DISABLED"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • IdentityPoolId — (String)

        A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito.

      • PushSync — (map)

        Options to apply to this identity pool for push synchronization.

        • ApplicationArns — (Array<String>)

          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 — (map) 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.

          Possible values include:
          • "ENABLED"
          • "DISABLED"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

subscribeToDataset(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the subscribeToDataset operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  DeviceId: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.subscribeToDataset(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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 the identity belongs.

    • IdentityId — (String)

      Unique ID for this identity.

    • DatasetName — (String)

      The name of the dataset to subcribe to.

    • DeviceId — (String)

      The unique ID generated for this device by Cognito.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

unsubscribeFromDataset(params = {}, callback) ⇒ AWS.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.

Service Reference:

Examples:

Calling the unsubscribeFromDataset operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  DeviceId: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE' /* required */
};
cognitosync.unsubscribeFromDataset(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.

    • IdentityId — (String)

      Unique ID for this identity.

    • DatasetName — (String)

      The name of the dataset from which to unsubcribe.

    • DeviceId — (String)

      The unique ID generated for this device by Cognito.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateRecords(params = {}, callback) ⇒ AWS.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.

Service Reference:

Examples:

Calling the updateRecords operation

var params = {
  DatasetName: 'STRING_VALUE', /* required */
  IdentityId: 'STRING_VALUE', /* required */
  IdentityPoolId: 'STRING_VALUE', /* required */
  SyncSessionToken: 'STRING_VALUE', /* required */
  ClientContext: 'STRING_VALUE',
  DeviceId: 'STRING_VALUE',
  RecordPatches: [
    {
      Key: 'STRING_VALUE', /* required */
      Op: replace | remove, /* required */
      SyncCount: 'NUMBER_VALUE', /* required */
      DeviceLastModifiedDate: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
      Value: 'STRING_VALUE'
    },
    /* more items */
  ]
};
cognitosync.updateRecords(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • IdentityPoolId — (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.
    • IdentityId — (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.
    • DatasetName — (String) A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
    • DeviceId — (String)

      The unique ID generated for this device by Cognito.

    • RecordPatches — (Array<map>) A list of patch operations.
      • Oprequired — (String) An operation, either replace or remove. Possible values include:
        • "replace"
        • "remove"
      • Keyrequired — (String) The key associated with the record patch.
      • Value — (String) The value associated with the record patch.
      • SyncCountrequired — (Integer) Last known server sync count for this record. Set to 0 if unknown.
      • DeviceLastModifiedDate — (Date) The last modified date of the client device.
    • SyncSessionToken — (String) The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
    • ClientContext — (String) Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Records — (Array<map>) A list of records that have been updated.
        • Key — (String) The key for the record.
        • Value — (String) The value for the record.
        • SyncCount — (Integer) The server sync count for this record.
        • LastModifiedDate — (Date) The date on which the record was last modified.
        • LastModifiedBy — (String) The user/device that made the last change to this record.
        • DeviceLastModifiedDate — (Date) The last modified date of the client device.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.