/
cognito_sync.jl
774 lines (707 loc) · 26.6 KB
/
cognito_sync.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: cognito_sync
using AWS.Compat
using AWS.UUIDs
"""
bulk_publish(identity_pool_id)
bulk_publish(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `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.
"""
function bulk_publish(IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config())
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/bulkpublish";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function bulk_publish(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/bulkpublish",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
delete_dataset(dataset_name, identity_id, identity_pool_id)
delete_dataset(dataset_name, identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9,
'_' (underscore), '-' (dash), and '.' (dot).
- `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.
- `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.
"""
function delete_dataset(
DatasetName,
IdentityId,
IdentityPoolId;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"DELETE",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function delete_dataset(
DatasetName,
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"DELETE",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_dataset(dataset_name, identity_id, identity_pool_id)
describe_dataset(dataset_name, identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9,
'_' (underscore), '-' (dash), and '.' (dot).
- `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.
- `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.
"""
function describe_dataset(
DatasetName,
IdentityId,
IdentityPoolId;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_dataset(
DatasetName,
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_identity_pool_usage(identity_pool_id)
describe_identity_pool_usage(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `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.
"""
function describe_identity_pool_usage(
IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_identity_pool_usage(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_identity_usage(identity_id, identity_pool_id)
describe_identity_usage(identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `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.
- `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.
"""
function describe_identity_usage(
IdentityId, IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_identity_usage(
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
get_bulk_publish_details(identity_pool_id)
get_bulk_publish_details(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `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.
"""
function get_bulk_publish_details(
IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/getBulkPublishDetails";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function get_bulk_publish_details(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/getBulkPublishDetails",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
get_cognito_events(identity_pool_id)
get_cognito_events(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `identity_pool_id`: The Cognito Identity Pool ID for the request
"""
function get_cognito_events(
IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/events";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function get_cognito_events(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/events",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
get_identity_pool_configuration(identity_pool_id)
get_identity_pool_configuration(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `identity_pool_id`: 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.
"""
function get_identity_pool_configuration(
IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/configuration";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function get_identity_pool_configuration(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/configuration",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_datasets(identity_id, identity_pool_id)
list_datasets(identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `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.
- `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.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be returned.
- `"nextToken"`: A pagination token for obtaining the next page of results.
"""
function list_datasets(
IdentityId, IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function list_datasets(
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_identity_pool_usage()
list_identity_pool_usage(params::Dict{String,<:Any})
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.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to be returned.
- `"nextToken"`: A pagination token for obtaining the next page of results.
"""
function list_identity_pool_usage(; aws_config::AbstractAWSConfig=global_aws_config())
return cognito_sync(
"GET", "/identitypools"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
)
end
function list_identity_pool_usage(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"GET",
"/identitypools",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_records(dataset_name, identity_id, identity_pool_id)
list_records(dataset_name, identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9,
'_' (underscore), '-' (dash), and '.' (dot).
- `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.
- `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.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"lastSyncCount"`: The last server sync count for this record.
- `"maxResults"`: The maximum number of results to be returned.
- `"nextToken"`: A pagination token for obtaining the next page of results.
- `"syncSessionToken"`: A token containing a session ID, identity ID, and expiration.
"""
function list_records(
DatasetName,
IdentityId,
IdentityPoolId;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/records";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function list_records(
DatasetName,
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"GET",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/records",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
register_device(identity_id, identity_pool_id, platform, token)
register_device(identity_id, identity_pool_id, platform, token, params::Dict{String,<:Any})
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.
# Arguments
- `identity_id`: The unique ID for this identity.
- `identity_pool_id`: 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.
- `platform`: The SNS platform type (e.g. GCM, SDM, APNS, APNS_SANDBOX).
- `token`: The push token.
"""
function register_device(
IdentityId,
IdentityPoolId,
Platform,
Token;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identity/$(IdentityId)/device",
Dict{String,Any}("Platform" => Platform, "Token" => Token);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function register_device(
IdentityId,
IdentityPoolId,
Platform,
Token,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identity/$(IdentityId)/device",
Dict{String,Any}(
mergewith(
_merge, Dict{String,Any}("Platform" => Platform, "Token" => Token), params
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
set_cognito_events(events, identity_pool_id)
set_cognito_events(events, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `events`: The events to configure
- `identity_pool_id`: The Cognito Identity Pool to use when configuring Cognito Events
"""
function set_cognito_events(
Events, IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/events",
Dict{String,Any}("Events" => Events);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function set_cognito_events(
Events,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/events",
Dict{String,Any}(mergewith(_merge, Dict{String,Any}("Events" => Events), params));
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
set_identity_pool_configuration(identity_pool_id)
set_identity_pool_configuration(identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `identity_pool_id`: 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.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"CognitoStreams"`: Options to apply to this identity pool for Amazon Cognito streams.
- `"PushSync"`: Options to apply to this identity pool for push synchronization.
"""
function set_identity_pool_configuration(
IdentityPoolId; aws_config::AbstractAWSConfig=global_aws_config()
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/configuration";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function set_identity_pool_configuration(
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/configuration",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
subscribe_to_dataset(dataset_name, device_id, identity_id, identity_pool_id)
subscribe_to_dataset(dataset_name, device_id, identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: The name of the dataset to subcribe to.
- `device_id`: The unique ID generated for this device by Cognito.
- `identity_id`: Unique ID for this identity.
- `identity_pool_id`: 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.
"""
function subscribe_to_dataset(
DatasetName,
DeviceId,
IdentityId,
IdentityPoolId;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/subscriptions/$(DeviceId)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function subscribe_to_dataset(
DatasetName,
DeviceId,
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/subscriptions/$(DeviceId)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
unsubscribe_from_dataset(dataset_name, device_id, identity_id, identity_pool_id)
unsubscribe_from_dataset(dataset_name, device_id, identity_id, identity_pool_id, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: The name of the dataset from which to unsubcribe.
- `device_id`: The unique ID generated for this device by Cognito.
- `identity_id`: Unique ID for this identity.
- `identity_pool_id`: 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.
"""
function unsubscribe_from_dataset(
DatasetName,
DeviceId,
IdentityId,
IdentityPoolId;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"DELETE",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/subscriptions/$(DeviceId)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function unsubscribe_from_dataset(
DatasetName,
DeviceId,
IdentityId,
IdentityPoolId,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"DELETE",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)/subscriptions/$(DeviceId)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
update_records(dataset_name, identity_id, identity_pool_id, sync_session_token)
update_records(dataset_name, identity_id, identity_pool_id, sync_session_token, params::Dict{String,<:Any})
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.
# Arguments
- `dataset_name`: A string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9,
'_' (underscore), '-' (dash), and '.' (dot).
- `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.
- `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.
- `sync_session_token`: The SyncSessionToken returned by a previous call to ListRecords for
this dataset and identity.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"DeviceId"`: The unique ID generated for this device by Cognito.
- `"RecordPatches"`: A list of patch operations.
- `"x-amz-Client-Context"`: Intended to supply a device ID that will populate the
lastModifiedBy field referenced in other methods. The ClientContext field is not yet
implemented.
"""
function update_records(
DatasetName,
IdentityId,
IdentityPoolId,
SyncSessionToken;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)",
Dict{String,Any}("SyncSessionToken" => SyncSessionToken);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function update_records(
DatasetName,
IdentityId,
IdentityPoolId,
SyncSessionToken,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return cognito_sync(
"POST",
"/identitypools/$(IdentityPoolId)/identities/$(IdentityId)/datasets/$(DatasetName)",
Dict{String,Any}(
mergewith(
_merge, Dict{String,Any}("SyncSessionToken" => SyncSessionToken), params
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end