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.
ListDatasets The following examples have been edited for readability. POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 15225768-209f-4078-aaed-7494ace9f2db X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListDatasets HOST: cognito-sync.us-east-1.amazonaws.com:443 X-AMZ-DATE: 20141111T215640Z AUTHORIZATION: AWS4-HMAC-SHA256 Credential=, SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature= { "Operation": "com.amazonaws.cognito.sync.model#ListDatasets", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "MaxResults": "3" } } 1.1 200 OK x-amzn-requestid: 15225768-209f-4078-aaed-7494ace9f2db, 15225768-209f-4078-aaed-7494ace9f2db content-type: application/json content-length: 355 date: Tue, 11 Nov 2014 21:56:40 GMT { "Output": { "__type": "com.amazonaws.cognito.sync.model#ListDatasetsResponse", "Count": 1, "Datasets": [ { "CreationDate": 1.412974057151E9, "DataStorage": 16, "DatasetName": "my_list", "IdentityId": "IDENTITY_ID", "LastModifiedBy": "123456789012", "LastModifiedDate": 1.412974057244E9, "NumRecords": 1 }], "NextToken": null }, "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. GUID generation is unique within a region.
-
identity_id
(IdentityId)
–
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.
-
next_token
(Optional[String], default:
None
)
–
A pagination token for obtaining the next page of results.
-
max_results
(Optional[IntegerString], default:
None
)
–
The maximum number of results to be returned.
Raises:
Source code in docs_src/capo_cognito_sync/_services/cognito_sync.py
| def list_datasets(
self,
identity_pool_id: "capo_cognito_sync.types.identity_pool_id.IdentityPoolId",
identity_id: "capo_cognito_sync.types.identity_id.IdentityId",
*,
config_overrides: Optional[CognitoSyncClientConfig] = None,
next_token: Optional["capo_cognito_sync.types.string.String"] = None,
max_results: Optional[
"capo_cognito_sync.types.integer_string.IntegerString"
] = None,
) -> "capo_cognito_sync.types.list_datasets_response.ListDatasetsResponse":
"""<p>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.</p> <p>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.</p> <examples> <example> <name>ListDatasets</name> <description>The following examples have been edited for readability.</description> <request> POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 15225768-209f-4078-aaed-7494ace9f2db X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListDatasets HOST: cognito-sync.us-east-1.amazonaws.com:443 X-AMZ-DATE: 20141111T215640Z AUTHORIZATION: AWS4-HMAC-SHA256 Credential=<credential>, SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<signature> { "Operation": "com.amazonaws.cognito.sync.model#ListDatasets", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "MaxResults": "3" } } </request> <response> 1.1 200 OK x-amzn-requestid: 15225768-209f-4078-aaed-7494ace9f2db, 15225768-209f-4078-aaed-7494ace9f2db content-type: application/json content-length: 355 date: Tue, 11 Nov 2014 21:56:40 GMT { "Output": { "__type": "com.amazonaws.cognito.sync.model#ListDatasetsResponse", "Count": 1, "Datasets": [ { "CreationDate": 1.412974057151E9, "DataStorage": 16, "DatasetName": "my_list", "IdentityId": "IDENTITY_ID", "LastModifiedBy": "123456789012", "LastModifiedDate": 1.412974057244E9, "NumRecords": 1 }], "NextToken": null }, "Version": "1.0" } </response> </example> </examples>
Args:
identity_pool_id: 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.
identity_id: 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.
next_token: A pagination token for obtaining the next page of results.
max_results: The maximum number of results to be returned.
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.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.list_datasets_request.ListDatasetsRequest]",
) -> OperationResponse[
"capo_cognito_sync.types.list_datasets_response.ListDatasetsResponse"
]:
import capo_cognito_sync._operations.aws_cognito_sync_service.list_datasets
output, http_response = (
capo_cognito_sync._operations.aws_cognito_sync_service.list_datasets.list_datasets(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListDatasets")
)
input_: capo_cognito_sync.types.list_datasets_request.ListDatasetsRequest = {
"identity_pool_id": identity_pool_id,
"identity_id": identity_id,
}
if next_token is not None:
input_["next_token"] = next_token
if max_results is not None:
input_["max_results"] = max_results
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|