update_records
¶
update_records(
identity_pool_id: IdentityPoolId,
identity_id: IdentityId,
dataset_name: DatasetName,
sync_session_token: SyncSessionToken,
*,
config_overrides: Optional[CognitoSyncClientConfig] = None,
device_id: Optional[DeviceId] = None,
record_patches: Optional[RecordPatchList] = None,
client_context: Optional[ClientContext] = None,
) -> UpdateRecordsResponse
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.
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.
-
dataset_name(DatasetName) –A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot).
-
device_id(Optional[DeviceId], default:None) –The unique ID generated for this device by Cognito.
-
record_patches(Optional[RecordPatchList], default:None) –A list of patch operations.
-
sync_session_token(SyncSessionToken) –The SyncSessionToken returned by a previous call to ListRecords for this dataset and identity.
-
client_context(Optional[ClientContext], default:None) –Intended to supply a device ID that will populate the lastModifiedBy field referenced in other methods. The ClientContext field is not yet implemented.
Raises:
-
InternalErrorException–Indicates an internal service error.
-
InvalidLambdaFunctionOutputException–The AWS Lambda function returned invalid output or an exception.
-
InvalidParameterException–Thrown when a request parameter does not comply with the associated constraints.
-
LambdaThrottledException–AWS Lambda throttled your account, please contact AWS Support
-
LimitExceededException–Thrown when the limit on the number of objects or operations has been exceeded.
-
NotAuthorizedException–Thrown when a user is not authorized to access the requested resource.
-
ResourceConflictException–Thrown if an update can't be applied because the resource was changed by another call and this would result in a conflict.
-
ResourceNotFoundException–Thrown if the resource doesn't exist.
-
TooManyRequestsException–Thrown if the request is throttled.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cognito_sync/_services/cognito_sync.py
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | |