15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_CLIENT_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_CLIENT_H
18#include "google/cloud/storage/hmac_key_metadata.h"
19#include "google/cloud/storage/internal/logging_client.h"
20#include "google/cloud/storage/internal/parameter_pack_validation.h"
21#include "google/cloud/storage/internal/policy_document_request.h"
22#include "google/cloud/storage/internal/request_project_id.h"
23#include "google/cloud/storage/internal/retry_client.h"
24#include "google/cloud/storage/internal/signed_url_requests.h"
25#include "google/cloud/storage/internal/tuple_filter.h"
26#include "google/cloud/storage/list_buckets_reader.h"
27#include "google/cloud/storage/list_hmac_keys_reader.h"
28#include "google/cloud/storage/list_objects_and_prefixes_reader.h"
29#include "google/cloud/storage/list_objects_reader.h"
30#include "google/cloud/storage/notification_event_type.h"
31#include "google/cloud/storage/notification_payload_format.h"
32#include "google/cloud/storage/oauth2/google_credentials.h"
33#include "google/cloud/storage/object_rewriter.h"
34#include "google/cloud/storage/object_stream.h"
35#include "google/cloud/storage/retry_policy.h"
36#include "google/cloud/storage/upload_options.h"
37#include "google/cloud/storage/version.h"
38#include "google/cloud/internal/group_options.h"
39#include "google/cloud/internal/throw_delegate.h"
40#include "google/cloud/options.h"
41#include "google/cloud/status.h"
42#include "google/cloud/status_or.h"
43#include "absl/meta/type_traits.h"
44#include "absl/strings/string_view.h"
52GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
54class NonResumableParallelUploadState;
55class ResumableParallelUploadState;
56struct ClientImplDetails;
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
286 return a.raw_client_ == b.raw_client_;
292
293
294
295
296
297
298
299
300
301
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318 template <
typename... Options>
320 Options&&... options) {
322 SpanOptions(std::forward<Options>(options)...));
323 internal::ListBucketsRequest request(project_id);
324 request.set_multiple_options(std::forward<Options>(options)...);
325 auto& client = raw_client_;
326 return google::
cloud::internal::MakePaginationRange<ListBucketsReader>(
328 [client](internal::ListBucketsRequest
const& r) {
329 return client->ListBuckets(r);
331 [](internal::ListBucketsResponse r) {
return std::move(r.items); });
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354 template <
typename... Options>
355 ListBucketsReader
ListBuckets(Options&&... options) {
356 auto opts = SpanOptions(std::forward<Options>(options)...);
357 auto project_id = storage_internal::RequestProjectId(
358 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
360 return google::
cloud::internal::MakeErrorPaginationRange<
361 ListBucketsReader>(std::move(project_id).status());
363 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
364 return ListBucketsForProject(*std::move(project_id),
365 std::forward<Options>(options)...);
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 template <
typename... Options>
399 Options&&... options) {
400 auto opts = SpanOptions(std::forward<Options>(options)...);
401 auto project_id = storage_internal::RequestProjectId(
402 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
403 if (!project_id)
return std::move(project_id).status();
404 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
406 internal::CreateBucketRequest request(*std::move(project_id),
407 std::move(metadata));
408 request.set_multiple_options(std::forward<Options>(options)...);
409 return raw_client_->CreateBucket(request);
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 template <
typename... Options>
441 std::string project_id,
443 Options&&... options) {
445 SpanOptions(std::forward<Options>(options)...));
447 internal::CreateBucketRequest request(std::move(project_id),
448 std::move(metadata));
449 request.set_multiple_options(std::forward<Options>(options)...);
450 return raw_client_->CreateBucket(request);
454
455
456
457
458
459
460
461
462
463
464
465
466
467 template <
typename... Options>
469 Options&&... options) {
471 SpanOptions(std::forward<Options>(options)...));
472 internal::GetBucketMetadataRequest request(bucket_name);
473 request.set_multiple_options(std::forward<Options>(options)...);
474 return raw_client_->GetBucketMetadata(request);
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492 template <
typename... Options>
495 SpanOptions(std::forward<Options>(options)...));
496 internal::DeleteBucketRequest request(bucket_name);
497 request.set_multiple_options(std::forward<Options>(options)...);
498 return raw_client_->DeleteBucket(request)
.status();
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 template <
typename... Options>
537 Options&&... options) {
539 SpanOptions(std::forward<Options>(options)...));
541 internal::UpdateBucketRequest request(std::move(metadata));
542 request.set_multiple_options(std::forward<Options>(options)...);
543 return raw_client_->UpdateBucket(request);
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 template <
typename... Options>
588 Options&&... options) {
590 SpanOptions(std::forward<Options>(options)...));
591 internal::PatchBucketRequest request(std::move(bucket_name), original,
593 request.set_multiple_options(std::forward<Options>(options)...);
594 return raw_client_->PatchBucket(request);
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 template <
typename... Options>
633 Options&&... options) {
635 SpanOptions(std::forward<Options>(options)...));
636 internal::PatchBucketRequest request(std::move(bucket_name), builder);
637 request.set_multiple_options(std::forward<Options>(options)...);
638 return raw_client_->PatchBucket(request);
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 template <
typename... Options>
676 std::string
const& bucket_name, Options&&... options) {
678 SpanOptions(std::forward<Options>(options)...));
679 internal::GetBucketIamPolicyRequest request(bucket_name);
680 request.set_multiple_options(std::forward<Options>(options)...);
681 return raw_client_->GetNativeBucketIamPolicy(request);
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 template <
typename... Options>
733 Options&&... options) {
735 SpanOptions(std::forward<Options>(options)...));
736 internal::SetNativeBucketIamPolicyRequest request(bucket_name, iam_policy);
737 request.set_multiple_options(std::forward<Options>(options)...);
738 return raw_client_->SetNativeBucketIamPolicy(request);
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 template <
typename... Options>
770 std::string bucket_name, std::vector<std::string> permissions,
771 Options&&... options) {
773 SpanOptions(std::forward<Options>(options)...));
774 internal::TestBucketIamPermissionsRequest request(std::move(bucket_name),
775 std::move(permissions));
776 request.set_multiple_options(std::forward<Options>(options)...);
777 auto result = raw_client_->TestBucketIamPermissions(request);
781 return std::move(result
.value().permissions);
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830 template <
typename... Options>
832 std::string
const& bucket_name, std::uint64_t metageneration,
833 Options&&... options) {
835 SpanOptions(std::forward<Options>(options)...));
836 internal::LockBucketRetentionPolicyRequest request(bucket_name,
838 request.set_multiple_options(std::forward<Options>(options)...);
839 return raw_client_->LockBucketRetentionPolicy(request);
844
845
846
847
848
849
850
851
852
853
854
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880 template <
typename... Options>
882 std::string
const& object_name,
883 absl::string_view contents,
884 Options&&... options) {
886 SpanOptions(std::forward<Options>(options)...));
887 internal::InsertObjectMediaRequest request(bucket_name, object_name,
889 request.set_multiple_options(std::forward<Options>(options)...);
890 return raw_client_->InsertObjectMedia(request);
894 template <
typename... Options>
896 std::string
const& object_name,
897 std::string
const& contents,
898 Options&&... options) {
899 return InsertObject(bucket_name, object_name, absl::string_view(contents),
900 std::forward<Options>(options)...);
904 template <
typename... Options>
906 std::string
const& object_name,
907 char const* contents,
908 Options&&... options) {
910 contents ==
nullptr ? absl::string_view{} : absl::string_view{contents};
911 return InsertObject(bucket_name, object_name, c,
912 std::forward<Options>(options)...);
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955 template <
typename... Options>
957 std::string source_object_name,
958 std::string destination_bucket_name,
959 std::string destination_object_name,
960 Options&&... options) {
962 SpanOptions(std::forward<Options>(options)...));
963 internal::CopyObjectRequest request(
964 std::move(source_bucket_name), std::move(source_object_name),
965 std::move(destination_bucket_name), std::move(destination_object_name));
966 request.set_multiple_options(std::forward<Options>(options)...);
967 return raw_client_->CopyObject(request);
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986 template <
typename... Options>
988 std::string
const& object_name,
989 Options&&... options) {
991 SpanOptions(std::forward<Options>(options)...));
992 internal::GetObjectMetadataRequest request(bucket_name, object_name);
993 request.set_multiple_options(std::forward<Options>(options)...);
994 return raw_client_->GetObjectMetadata(request);
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012 template <
typename... Options>
1013 ListObjectsReader
ListObjects(std::string
const& bucket_name,
1014 Options&&... options) {
1016 SpanOptions(std::forward<Options>(options)...));
1017 internal::ListObjectsRequest request(bucket_name);
1018 request.set_multiple_options(std::forward<Options>(options)...);
1019 auto& client = raw_client_;
1020 return google::
cloud::internal::MakePaginationRange<ListObjectsReader>(
1022 [client](internal::ListObjectsRequest
const& r) {
1023 return client->ListObjects(r);
1025 [](internal::ListObjectsResponse r) {
return std::move(r.items); });
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044 template <
typename... Options>
1046 std::string
const& bucket_name, Options&&... options) {
1048 SpanOptions(std::forward<Options>(options)...));
1049 internal::ListObjectsRequest request(bucket_name);
1050 request.set_multiple_options(std::forward<Options>(options)...);
1051 return google::
cloud::internal::MakePaginationRange<
1052 ListObjectsAndPrefixesReader>(
1054 [client = raw_client_](internal::ListObjectsRequest
const& r) {
1055 return client->ListObjects(r);
1057 [](internal::ListObjectsResponse r) {
1058 std::vector<ObjectOrPrefix> result;
1059 result.reserve(r.items.size() + r.prefixes.size());
1060 for (
auto& item : r.items) {
1061 result.emplace_back(std::move(item));
1063 for (
auto& prefix : r.prefixes) {
1064 result.emplace_back(std::move(prefix));
1066 internal::SortObjectsAndPrefixes(result);
1072
1073
1074
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 template <
typename... Options>
1108 std::string
const& object_name,
1109 Options&&... options) {
1111 :
public absl::disjunction<std::is_same<
ReadRange, Options>...> {};
1112 struct HasReadFromOffset
1113 :
public absl::disjunction<std::is_same<
ReadFromOffset, Options>...> {};
1115 :
public absl::disjunction<std::is_same<
ReadLast, Options>...> {};
1117 struct HasIncompatibleRangeOptions
1118 :
public std::integral_constant<
bool, HasReadLast::value &&
1119 (HasReadFromOffset::value ||
1120 HasReadRange::value)> {};
1122 static_assert(!HasIncompatibleRangeOptions::value,
1123 "Cannot set ReadLast option with either ReadFromOffset or "
1127 SpanOptions(std::forward<Options>(options)...));
1128 internal::ReadObjectRangeRequest request(bucket_name, object_name);
1129 request.set_multiple_options(std::forward<Options>(options)...);
1130 return ReadObjectImpl(request);
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194 template <
typename... Options>
1196 std::string
const& object_name,
1197 Options&&... options) {
1199 SpanOptions(std::forward<Options>(options)...));
1200 internal::ResumableUploadRequest request(bucket_name, object_name);
1201 request.set_multiple_options(std::forward<Options>(options)...);
1202 return WriteObjectImpl(request);
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235 template <
typename... Options>
1237 std::string
const& bucket_name,
1238 std::string
const& object_name,
1239 Options&&... options) {
1244 using HasUseResumableUpload =
1246 return UploadFileImpl(file_name, bucket_name, object_name,
1247 HasUseResumableUpload{},
1248 std::forward<Options>(options)...);
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263 template <
typename... Options>
1265 Options&&... options) {
1267 SpanOptions(std::forward<Options>(options)...));
1268 internal::DeleteResumableUploadRequest request(upload_session_url);
1269 request.set_multiple_options(std::forward<Options>(options)...);
1270 return raw_client_->DeleteResumableUpload(request)
.status();
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292 template <
typename... Options>
1294 std::string
const& object_name,
1295 std::string
const& file_name, Options&&... options) {
1297 SpanOptions(std::forward<Options>(options)...));
1298 internal::ReadObjectRangeRequest request(bucket_name, object_name);
1299 request.set_multiple_options(std::forward<Options>(options)...);
1300 return DownloadFileImpl(request, file_name);
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321 template <
typename... Options>
1323 std::string
const& object_name, Options&&... options) {
1325 SpanOptions(std::forward<Options>(options)...));
1326 internal::DeleteObjectRequest request(bucket_name, object_name);
1327 request.set_multiple_options(std::forward<Options>(options)...);
1328 return raw_client_->DeleteObject(request)
.status();
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353 template <
typename... Options>
1355 std::string object_name,
1357 Options&&... options) {
1359 SpanOptions(std::forward<Options>(options)...));
1360 internal::UpdateObjectRequest request(
1361 std::move(bucket_name), std::move(object_name), std::move(metadata));
1362 request.set_multiple_options(std::forward<Options>(options)...);
1363 return raw_client_->UpdateObject(request);
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392 template <
typename... Options>
1394 std::string object_name,
1397 Options&&... options) {
1399 SpanOptions(std::forward<Options>(options)...));
1400 internal::PatchObjectRequest request(
1401 std::move(bucket_name), std::move(object_name), original, updated);
1402 request.set_multiple_options(std::forward<Options>(options)...);
1403 return raw_client_->PatchObject(request);
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430 template <
typename... Options>
1432 std::string bucket_name, std::string object_name,
1435 SpanOptions(std::forward<Options>(options)...));
1436 internal::PatchObjectRequest request(std::move(bucket_name),
1437 std::move(object_name), builder);
1438 request.set_multiple_options(std::forward<Options>(options)...);
1439 return raw_client_->PatchObject(request);
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465 template <
typename... Options>
1468 std::string destination_object_name, Options&&... options) {
1470 SpanOptions(std::forward<Options>(options)...));
1471 internal::ComposeObjectRequest request(std::move(bucket_name),
1472 std::move(source_objects),
1473 std::move(destination_object_name));
1474 request.set_multiple_options(std::forward<Options>(options)...);
1475 return raw_client_->ComposeObject(request);
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516 template <
typename... Options>
1518 std::string source_object_name,
1519 std::string destination_bucket_name,
1520 std::string destination_object_name,
1521 Options&&... options) {
1522 return ResumeRewriteObject(
1523 std::move(source_bucket_name), std::move(source_object_name),
1524 std::move(destination_bucket_name), std::move(destination_object_name),
1525 std::string{}, std::forward<Options>(options)...);
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568 template <
typename... Options>
1570 std::string source_object_name,
1571 std::string destination_bucket_name,
1572 std::string destination_object_name,
1573 std::string rewrite_token,
1574 Options&&... options) {
1576 SpanOptions(std::forward<Options>(options)...));
1577 internal::RewriteObjectRequest request(
1578 std::move(source_bucket_name), std::move(source_object_name),
1579 std::move(destination_bucket_name), std::move(destination_object_name),
1580 std::move(rewrite_token));
1581 request.set_multiple_options(std::forward<Options>(options)...);
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628 template <
typename... Options>
1630 std::string source_bucket_name, std::string source_object_name,
1631 std::string destination_bucket_name, std::string destination_object_name,
1632 Options&&... options) {
1633 return ResumeRewriteObject(std::move(source_bucket_name),
1634 std::move(source_object_name),
1635 std::move(destination_bucket_name),
1636 std::move(destination_object_name),
1637 std::string{}, std::forward<Options>(options)...)
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686 template <
typename... Options>
1688 std::string
const& bucket_name, Options&&... options) {
1690 SpanOptions(std::forward<Options>(options)...));
1691 internal::ListBucketAclRequest request(bucket_name);
1692 request.set_multiple_options(std::forward<Options>(options)...);
1693 auto items = raw_client_->ListBucketAcl(request);
1697 return std::move(items
.value().items);
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721 template <
typename... Options>
1723 std::string
const& entity,
1724 std::string
const& role,
1725 Options&&... options) {
1727 SpanOptions(std::forward<Options>(options)...));
1728 internal::CreateBucketAclRequest request(bucket_name, entity, role);
1729 request.set_multiple_options(std::forward<Options>(options)...);
1730 return raw_client_->CreateBucketAcl(request);
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751 template <
typename... Options>
1753 std::string
const& entity, Options&&... options) {
1755 SpanOptions(std::forward<Options>(options)...));
1756 internal::DeleteBucketAclRequest request(bucket_name, entity);
1757 request.set_multiple_options(std::forward<Options>(options)...);
1758 return raw_client_->DeleteBucketAcl(request)
.status();
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778 template <
typename... Options>
1780 std::string
const& entity,
1781 Options&&... options) {
1783 SpanOptions(std::forward<Options>(options)...));
1784 internal::GetBucketAclRequest request(bucket_name, entity);
1785 request.set_multiple_options(std::forward<Options>(options)...);
1786 return raw_client_->GetBucketAcl(request);
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819 template <
typename... Options>
1822 Options&&... options) {
1824 SpanOptions(std::forward<Options>(options)...));
1825 internal::UpdateBucketAclRequest request(bucket_name, acl
.entity(),
1827 request.set_multiple_options(std::forward<Options>(options)...);
1828 return raw_client_->UpdateBucketAcl(request);
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866 template <
typename... Options>
1868 std::string
const& bucket_name, std::string
const& entity,
1872 SpanOptions(std::forward<Options>(options)...));
1873 internal::PatchBucketAclRequest request(bucket_name, entity, original_acl,
1875 request.set_multiple_options(std::forward<Options>(options)...);
1876 return raw_client_->PatchBucketAcl(request);
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912 template <
typename... Options>
1914 std::string
const& bucket_name, std::string
const& entity,
1917 SpanOptions(std::forward<Options>(options)...));
1918 internal::PatchBucketAclRequest request(bucket_name, entity, builder);
1919 request.set_multiple_options(std::forward<Options>(options)...);
1920 return raw_client_->PatchBucketAcl(request);
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962 template <
typename... Options>
1964 std::string
const& bucket_name, std::string
const& object_name,
1965 Options&&... options) {
1967 SpanOptions(std::forward<Options>(options)...));
1968 internal::ListObjectAclRequest request(bucket_name, object_name);
1969 request.set_multiple_options(std::forward<Options>(options)...);
1970 auto result = raw_client_->ListObjectAcl(request);
1974 return std::move(result
.value().items);
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999 template <
typename... Options>
2001 std::string
const& object_name,
2002 std::string
const& entity,
2003 std::string
const& role,
2004 Options&&... options) {
2006 SpanOptions(std::forward<Options>(options)...));
2007 internal::CreateObjectAclRequest request(bucket_name, object_name, entity,
2009 request.set_multiple_options(std::forward<Options>(options)...);
2010 return raw_client_->CreateObjectAcl(request);
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033 template <
typename... Options>
2035 std::string
const& object_name,
2036 std::string
const& entity, Options&&... options) {
2038 SpanOptions(std::forward<Options>(options)...));
2039 internal::DeleteObjectAclRequest request(bucket_name, object_name, entity);
2040 request.set_multiple_options(std::forward<Options>(options)...);
2041 return raw_client_->DeleteObjectAcl(request)
.status();
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062 template <
typename... Options>
2064 std::string
const& object_name,
2065 std::string
const& entity,
2066 Options&&... options) {
2068 SpanOptions(std::forward<Options>(options)...));
2069 internal::GetObjectAclRequest request(bucket_name, object_name, entity);
2070 request.set_multiple_options(std::forward<Options>(options)...);
2071 return raw_client_->GetObjectAcl(request);
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103 template <
typename... Options>
2105 std::string
const& object_name,
2107 Options&&... options) {
2109 SpanOptions(std::forward<Options>(options)...));
2110 internal::UpdateObjectAclRequest request(bucket_name, object_name,
2112 request.set_multiple_options(std::forward<Options>(options)...);
2113 return raw_client_->UpdateObjectAcl(request);
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152 template <
typename... Options>
2154 std::string
const& bucket_name, std::string
const& object_name,
2158 SpanOptions(std::forward<Options>(options)...));
2159 internal::PatchObjectAclRequest request(bucket_name, object_name, entity,
2160 original_acl, new_acl);
2161 request.set_multiple_options(std::forward<Options>(options)...);
2162 return raw_client_->PatchObjectAcl(request);
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199 template <
typename... Options>
2201 std::string
const& bucket_name, std::string
const& object_name,
2203 Options&&... options) {
2205 SpanOptions(std::forward<Options>(options)...));
2206 internal::PatchObjectAclRequest request(bucket_name, object_name, entity,
2208 request.set_multiple_options(std::forward<Options>(options)...);
2209 return raw_client_->PatchObjectAcl(request);
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250 template <
typename... Options>
2252 std::string
const& bucket_name, Options&&... options) {
2254 SpanOptions(std::forward<Options>(options)...));
2255 internal::ListDefaultObjectAclRequest request(bucket_name);
2256 request.set_multiple_options(std::forward<Options>(options)...);
2257 auto response = raw_client_->ListDefaultObjectAcl(request);
2261 return std::move(response
.value().items);
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290 template <
typename... Options>
2292 std::string
const& bucket_name, std::string
const& entity,
2293 std::string
const& role, Options&&... options) {
2295 SpanOptions(std::forward<Options>(options)...));
2296 internal::CreateDefaultObjectAclRequest request(bucket_name, entity, role);
2297 request.set_multiple_options(std::forward<Options>(options)...);
2298 return raw_client_->CreateDefaultObjectAcl(request);
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324 template <
typename... Options>
2326 std::string
const& entity,
2327 Options&&... options) {
2329 SpanOptions(std::forward<Options>(options)...));
2330 internal::DeleteDefaultObjectAclRequest request(bucket_name, entity);
2331 request.set_multiple_options(std::forward<Options>(options)...);
2332 return raw_client_->DeleteDefaultObjectAcl(request)
.status();
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357 template <
typename... Options>
2359 std::string
const& bucket_name, std::string
const& entity,
2360 Options&&... options) {
2362 SpanOptions(std::forward<Options>(options)...));
2363 internal::GetDefaultObjectAclRequest request(bucket_name, entity);
2364 request.set_multiple_options(std::forward<Options>(options)...);
2365 return raw_client_->GetDefaultObjectAcl(request);
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401 template <
typename... Options>
2404 Options&&... options) {
2406 SpanOptions(std::forward<Options>(options)...));
2407 internal::UpdateDefaultObjectAclRequest request(bucket_name, acl
.entity(),
2409 request.set_multiple_options(std::forward<Options>(options)...);
2410 return raw_client_->UpdateDefaultObjectAcl(request);
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451 template <
typename... Options>
2453 std::string
const& bucket_name, std::string
const& entity,
2457 SpanOptions(std::forward<Options>(options)...));
2458 internal::PatchDefaultObjectAclRequest request(bucket_name, entity,
2459 original_acl, new_acl);
2460 request.set_multiple_options(std::forward<Options>(options)...);
2461 return raw_client_->PatchDefaultObjectAcl(request);
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500 template <
typename... Options>
2502 std::string
const& bucket_name, std::string
const& entity,
2505 SpanOptions(std::forward<Options>(options)...));
2506 internal::PatchDefaultObjectAclRequest request(bucket_name, entity,
2508 request.set_multiple_options(std::forward<Options>(options)...);
2509 return raw_client_->PatchDefaultObjectAcl(request);
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547 template <
typename... Options>
2549 std::string
const& project_id, Options&&... options) {
2551 SpanOptions(std::forward<Options>(options)...));
2552 internal::GetProjectServiceAccountRequest request(project_id);
2553 request.set_multiple_options(std::forward<Options>(options)...);
2554 return raw_client_->GetServiceAccount(request);
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585 template <
typename... Options>
2587 auto opts = SpanOptions(std::forward<Options>(options)...);
2588 auto project_id = storage_internal::RequestProjectId(
2589 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2590 if (!project_id)
return std::move(project_id).status();
2591 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2592 internal::GetProjectServiceAccountRequest request(*std::move(project_id));
2593 request.set_multiple_options(std::forward<Options>(options)...);
2594 return raw_client_->GetServiceAccount(request);
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626 template <
typename... Options>
2627 ListHmacKeysReader
ListHmacKeys(Options&&... options) {
2628 auto opts = SpanOptions(std::forward<Options>(options)...);
2629 auto project_id = storage_internal::RequestProjectId(
2630 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2632 return google::
cloud::internal::MakeErrorPaginationRange<
2633 ListHmacKeysReader>(std::move(project_id).status());
2635 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2637 internal::ListHmacKeysRequest request(*std::move(project_id));
2638 request.set_multiple_options(std::forward<Options>(options)...);
2639 return google::
cloud::internal::MakePaginationRange<ListHmacKeysReader>(
2641 [stub = raw_client_](internal::ListHmacKeysRequest
const& r) {
2642 return stub->ListHmacKeys(r);
2644 [](internal::ListHmacKeysResponse r) {
return std::move(r.items); });
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677 template <
typename... Options>
2679 std::string service_account, Options&&... options) {
2680 auto opts = SpanOptions(std::forward<Options>(options)...);
2681 auto project_id = storage_internal::RequestProjectId(
2682 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2683 if (!project_id)
return std::move(project_id).status();
2684 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2686 internal::CreateHmacKeyRequest request(*std::move(project_id),
2687 std::move(service_account));
2688 request.set_multiple_options(std::forward<Options>(options)...);
2689 auto result = raw_client_->CreateHmacKey(request);
2690 if (!result)
return std::move(result)
.status();
2691 return std::make_pair(std::move(result
->metadata),
2692 std::move(result
->secret));
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720 template <
typename... Options>
2722 auto opts = SpanOptions(std::forward<Options>(options)...);
2723 auto project_id = storage_internal::RequestProjectId(
2724 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2725 if (!project_id)
return std::move(project_id).status();
2726 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2728 internal::DeleteHmacKeyRequest request(*std::move(project_id),
2729 std::move(access_id));
2730 request.set_multiple_options(std::forward<Options>(options)...);
2731 return raw_client_->DeleteHmacKey(request)
.status();
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758 template <
typename... Options>
2760 Options&&... options) {
2761 auto opts = SpanOptions(std::forward<Options>(options)...);
2762 auto project_id = storage_internal::RequestProjectId(
2763 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2764 if (!project_id)
return std::move(project_id).status();
2765 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2767 internal::GetHmacKeyRequest request(*std::move(project_id),
2768 std::move(access_id));
2769 request.set_multiple_options(std::forward<Options>(options)...);
2770 return raw_client_->GetHmacKey(request);
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801 template <
typename... Options>
2804 Options&&... options) {
2805 auto opts = SpanOptions(std::forward<Options>(options)...);
2806 auto project_id = storage_internal::RequestProjectId(
2807 GCP_ERROR_INFO(), opts, std::forward<Options>(options)...);
2808 if (!project_id)
return std::move(project_id).status();
2809 google::
cloud::internal::OptionsSpan
const span(std::move(opts));
2811 internal::UpdateHmacKeyRequest request(
2812 *std::move(project_id), std::move(access_id), std::move(resource));
2813 request.set_multiple_options(std::forward<Options>(options)...);
2814 return raw_client_->UpdateHmacKey(request);
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872 template <
typename... Options>
2874 std::string bucket_name,
2875 std::string object_name,
2876 Options&&... options) {
2878 SpanOptions(std::forward<Options>(options)...));
2879 internal::V2SignUrlRequest request(std::move(verb), std::move(bucket_name),
2880 std::move(object_name));
2881 request.set_multiple_options(std::forward<Options>(options)...);
2882 return SignUrlV2(request);
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937 template <
typename... Options>
2939 std::string bucket_name,
2940 std::string object_name,
2941 Options&&... options) {
2943 SpanOptions(std::forward<Options>(options)...));
2944 internal::V4SignUrlRequest request(std::move(verb), std::move(bucket_name),
2945 std::move(object_name));
2946 request.set_multiple_options(std::forward<Options>(options)...);
2947 return SignUrlV4(std::move(request));
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983 template <
typename... Options>
2987 SpanOptions(std::forward<Options>(options)...));
2988 internal::PolicyDocumentRequest request(std::move(document));
2989 request.set_multiple_options(std::forward<Options>(options)...);
2990 return SignPolicyDocument(request);
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026 template <
typename... Options>
3030 SpanOptions(std::forward<Options>(options)...));
3031 internal::PolicyDocumentV4Request request(std::move(document));
3032 request.set_multiple_options(std::forward<Options>(options)...);
3033 return SignPolicyDocumentV4(std::move(request));
3037
3038
3039
3040
3041
3042
3043
3044
3045
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063 template <
typename... Options>
3065 std::string
const& bucket_name, Options&&... options) {
3067 SpanOptions(std::forward<Options>(options)...));
3068 internal::ListNotificationsRequest request(bucket_name);
3069 request.set_multiple_options(std::forward<Options>(options)...);
3070 auto result = raw_client_->ListNotifications(request);
3074 return std::move(result
.value().items);
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106 template <
typename... Options>
3108 std::string
const& bucket_name, std::string
const& topic_name,
3111 SpanOptions(std::forward<Options>(options)...));
3112 return CreateNotification(bucket_name, topic_name,
3114 std::forward<Options>(options)...);
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150 template <
typename... Options>
3152 std::string
const& bucket_name, std::string
const& topic_name,
3154 Options&&... options) {
3156 SpanOptions(std::forward<Options>(options)...));
3158 internal::CreateNotificationRequest request(bucket_name, metadata);
3159 request.set_multiple_options(std::forward<Options>(options)...);
3160 return raw_client_->CreateNotification(request);
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188 template <
typename... Options>
3190 std::string
const& bucket_name, std::string
const& notification_id,
3191 Options&&... options) {
3193 SpanOptions(std::forward<Options>(options)...));
3194 internal::GetNotificationRequest request(bucket_name, notification_id);
3195 request.set_multiple_options(std::forward<Options>(options)...);
3196 return raw_client_->GetNotification(request);
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226 template <
typename... Options>
3228 std::string
const& notification_id,
3229 Options&&... options) {
3231 SpanOptions(std::forward<Options>(options)...));
3232 internal::DeleteNotificationRequest request(bucket_name, notification_id);
3233 request.set_multiple_options(std::forward<Options>(options)...);
3234 return std::move(raw_client_->DeleteNotification(request))
.status();
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250 template <
typename... Policies>
3252 :
Client(InternalOnly{}, internal::ApplyPolicies(
3253 internal::MakeOptions(std::move(options)),
3254 std::forward<Policies>(policies)...)) {}
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267 template <
typename... Policies>
3269 Policies&&... policies)
3271 internal::ApplyPolicies(
3272 internal::DefaultOptions(std::move(credentials),
{}),
3273 std::forward<Policies>(policies)...)) {}
3276
3277
3278
3279
3286 template <
typename... Policies>
3287#if !defined(_MSC_VER) || _MSC_VER >= 1920
3288 GOOGLE_CLOUD_CPP_DEPRECATED(
3289 "applications should not need this."
3290 " Please use the constructors from ClientOptions instead."
3291 " For mocking, please use testing::ClientFromMock() instead."
3292 " Please file a bug at https://github.com/googleapis/google-cloud-cpp"
3293 " if you have a use-case not covered by these.")
3296 explicit Client(std::shared_ptr<internal::RawClient> client,
3297 Policies&&... policies)
3298 :
Client(InternalOnlyNoDecorations{},
3299 CreateDefaultInternalClient(
3300 internal::ApplyPolicies(
3301 internal::DefaultOptions(
3303 std::forward<Policies>(policies)...),
3313 GOOGLE_CLOUD_CPP_DEPRECATED(
3314 "applications should not need this."
3315 " Please file a bug at https://github.com/googleapis/google-cloud-cpp"
3318 :
Client(InternalOnlyNoDecorations{}, std::move(client)) {}
3322 GOOGLE_CLOUD_CPP_DEPRECATED(
3323 "applications should not need this."
3324 " Please file a bug at https://github.com/googleapis/google-cloud-cpp"
3326 std::shared_ptr<internal::RawClient>
raw_client()
const {
3331 friend class internal::NonResumableParallelUploadState;
3332 friend class internal::ResumableParallelUploadState;
3333 friend internal::ClientImplDetails;
3335 struct InternalOnly {};
3336 struct InternalOnlyNoDecorations {};
3338 Client(InternalOnly,
Options const& opts)
3339 : raw_client_(CreateDefaultInternalClient(opts)) {}
3340 Client(InternalOnlyNoDecorations, std::shared_ptr<internal::RawClient> c)
3341 : raw_client_(std::move(c)) {}
3343 static std::shared_ptr<internal::RawClient> CreateDefaultInternalClient(
3344 Options const& opts, std::shared_ptr<internal::RawClient> client);
3345 static std::shared_ptr<internal::RawClient> CreateDefaultInternalClient(
3349 internal::ReadObjectRangeRequest
const& request);
3352 internal::ResumableUploadRequest
const& request);
3354 template <
typename... RequestOptions>
3357 raw_client_->options(), std::forward<RequestOptions>(o)...);
3362 template <
typename... Options>
3363 StatusOr<
ObjectMetadata> UploadFileImpl(std::string
const& file_name,
3364 std::string
const& bucket_name,
3365 std::string
const& object_name,
3367 Options&&... options) {
3369 SpanOptions(std::forward<Options>(options)...));
3370 internal::ResumableUploadRequest request(bucket_name, object_name);
3371 request.set_multiple_options(std::forward<Options>(options)...);
3372 return UploadFileResumable(file_name, std::move(request));
3378 template <
typename... Options>
3379 StatusOr<
ObjectMetadata> UploadFileImpl(std::string
const& file_name,
3380 std::string
const& bucket_name,
3381 std::string
const& object_name,
3383 Options&&... options) {
3385 SpanOptions(std::forward<Options>(options)...));
3386 std::size_t file_size = 0;
3387 if (UseSimpleUpload(file_name, file_size)) {
3388 internal::InsertObjectMediaRequest request(bucket_name, object_name,
3390 request.set_multiple_options(std::forward<Options>(options)...);
3391 return UploadFileSimple(file_name, file_size, request);
3393 internal::ResumableUploadRequest request(bucket_name, object_name);
3394 request.set_multiple_options(std::forward<Options>(options)...);
3395 return UploadFileResumable(file_name, std::move(request));
3398 static bool UseSimpleUpload(std::string
const& file_name, std::size_t& size);
3401 std::string
const& file_name, std::size_t file_size,
3402 internal::InsertObjectMediaRequest request);
3405 std::string
const& file_name, internal::ResumableUploadRequest request);
3408 std::istream& source,
3409 internal::ResumableUploadRequest
const& request)
const;
3411 Status DownloadFileImpl(internal::ReadObjectRangeRequest
const& request,
3412 std::string
const& file_name);
3415 std::string SigningEmail(
SigningAccount const& signing_account)
const;
3419 struct SignBlobResponseRaw {
3421 std::vector<std::uint8_t> signed_blob;
3425 StatusOr<SignBlobResponseRaw> SignBlobImpl(
3426 SigningAccount const& signing_account, std::string
const& string_to_sign);
3428 StatusOr<std::string> SignUrlV2(internal::V2SignUrlRequest
const& request);
3429 StatusOr<std::string> SignUrlV4(internal::V4SignUrlRequest request);
3432 internal::PolicyDocumentRequest
const& request);
3434 internal::PolicyDocumentV4Request request);
3436 std::shared_ptr<internal::RawClient> raw_client_;
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3458struct ClientImplDetails {
3459 static std::shared_ptr<RawClient> GetRawClient(
Client& c) {
3460 return c.raw_client_;
3464 Client& client, std::istream& source,
3465 internal::ResumableUploadRequest
const& request) {
3466 return client.UploadStreamResumable(source, request);
3469 template <
typename... Policies>
3470 static Client CreateClient(std::shared_ptr<internal::RawClient> c,
3473 internal::ApplyPolicies(c->options(), std::forward<Policies>(p)...);
3475 Client::CreateDefaultInternalClient(opts, std::move(c)));
3478 static Client CreateWithoutDecorations(
3479 std::shared_ptr<internal::RawClient> c) {
3480 return Client(
Client::InternalOnlyNoDecorations{}, std::move(c));
3485struct DeleteApplyHelper {
3486 template <
typename... Options>
3487 Status operator()(Options... options)
const {
3488 return client.DeleteObject(bucket_name, object_name,
Generation(generation),
3489 std::move(options)...);
3493 std::string bucket_name;
3494 std::string object_name;
3495 std::int64_t generation;
3499struct InsertObjectApplyHelper {
3500 template <
typename... Options>
3502 return client.InsertObject(bucket_name, object_name, std::move(contents),
3503 std::move(options)...);
3507 std::string
const& bucket_name;
3508 std::string
const& object_name;
3509 std::string contents;
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525template <
typename... Options>
3527 std::string
const& bucket_name,
3528 std::string
const& prefix,
3529 Options&&... options) {
3531 internal::InsertObjectApplyHelper{client, bucket_name, prefix,
""},
3534 internal::StaticTupleFilter<
3537 std::forward_as_tuple(std::forward<Options>(options)...))));
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552template <
typename... Options>
3554 std::string
const& prefix, Options&&... options) {
3555 using internal::NotAmong;
3556 using internal::StaticTupleFilter;
3558 auto all_options = std::tie(options...);
3562 decltype(StaticTupleFilter<
3564 all_options))>::value == 0,
3565 "This functions accepts only options of type QuotaUser, UserIp, "
3566 "UserProject or Versions.");
3570 std::forward<Options>(options)...)) {
3571 if (!object)
return std::move(object).status();
3573 internal::DeleteApplyHelper{client, object->bucket(), object->name(),
3574 object->generation()},
3575 StaticTupleFilter<NotAmong<
Versions>::TPred>(all_options));
3578 status = std::move(del);
3586struct ComposeApplyHelper {
3587 template <
typename... Options>
3589 return client.ComposeObject(
3590 std::move(bucket_name), std::move(source_objects),
3591 std::move(destination_object_name), std::move(options)...);
3595 std::string bucket_name;
3597 std::string destination_object_name;
3601class ScopedDeleter {
3605 explicit ScopedDeleter(std::function<
Status(std::string, std::int64_t)> df);
3606 ScopedDeleter(ScopedDeleter
const&) =
delete;
3607 ScopedDeleter& operator=(ScopedDeleter
const&) =
delete;
3614 void Add(std::string object_name, std::int64_t generation);
3619 void Enable(
bool enable) { enabled_ = enable; }
3622 bool enabled_ =
true;
3623 std::function<
Status(std::string, std::int64_t)> delete_fun_;
3624 std::vector<std::pair<std::string, std::int64_t>> object_list_;
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672template <
typename... Options>
3674 Client& client, std::string
const& bucket_name,
3676 std::string destination_object_name,
bool ignore_cleanup_failures,
3677 Options&&... options) {
3678 using internal::Among;
3679 using internal::NotAmong;
3680 using internal::StaticTupleFilter;
3681 std::size_t
const max_num_objects = 32;
3683 if (source_objects.empty()) {
3685 "ComposeMany requires at least one source object.");
3688 auto all_options = std::make_tuple(options...);
3693 decltype(StaticTupleFilter<
3699 "This functions accepts only options of type DestinationPredefinedAcl, "
3700 "EncryptionKey, IfGenerationMatch, IfMetagenerationMatch, KmsKeyName, "
3701 "QuotaUser, UserIp, UserProject or WithObjectMetadata.");
3703 internal::ScopedDeleter deleter(
3704 [&](std::string
const& object_name, std::int64_t generation) {
3706 internal::DeleteApplyHelper{client, bucket_name, object_name,
3712 auto lock = internal::LockPrefix(client, bucket_name, prefix,
"",
3713 std::make_tuple(options...));
3716 lock.status().code(),
3717 "Failed to lock prefix for ComposeMany: " + lock.status().message());
3721 std::size_t num_tmp_objects = 0;
3722 auto tmpobject_name_gen = [&num_tmp_objects, &prefix] {
3723 return prefix +
".compose-tmp-" + std::to_string(num_tmp_objects++);
3726 auto to_source_objects = [](std::vector<
ObjectMetadata> objects) {
3728 std::transform(objects.begin(), objects.end(), sources.begin(),
3739 internal::ComposeApplyHelper{client, bucket_name,
3740 std::move(compose_range),
3741 std::move(destination_object_name)},
3745 internal::ComposeApplyHelper{client, bucket_name,
3746 std::move(compose_range),
3747 tmpobject_name_gen()},
3756 for (
auto range_begin = source_objects.begin();
3757 range_begin != source_objects.end();) {
3758 std::size_t range_size = std::min<std::size_t>(
3759 std::distance(range_begin, source_objects.end()), max_num_objects);
3760 auto range_end = std::next(range_begin, range_size);
3762 std::move(range_begin, range_end, compose_range.begin());
3764 bool const is_final_composition =
3765 source_objects.size() <= max_num_objects;
3766 auto object = composer(std::move(compose_range), is_final_composition);
3768 return std::move(object).status();
3770 objects.push_back(*std::move(object));
3771 if (!is_final_composition) {
3772 deleter.Add(objects.back());
3774 range_begin = range_end;
3781 StatusOr<std::vector<
ObjectMetadata>> objects = reduce(source_objects);
3785 if (objects
->size() == 1) {
3786 if (!ignore_cleanup_failures) {
3787 auto delete_status = deleter.ExecuteDelete();
3788 if (!delete_status
.ok()) {
3789 return delete_status;
3792 result = std::move((
*objects)[0]);
3795 source_objects = to_source_objects(
*std::move(objects));
3796 }
while (source_objects.size() > 1);
3800GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Status const & status() const &
Status(StatusCode code, std::string message, ErrorInfo info={})
Prepares a patch for a BucketAccessControl resource.
Definition: bucket_access_control.h:188
Wraps the bucketAccessControl resource in Google Cloud Storage.
Definition: bucket_access_control.h:39
std::string const & entity() const
Definition: bucket_access_control.h:75
std::string const & role() const
Definition: bucket_access_control.h:85
Describes the configuration for a storage::Client object.
Definition: client_options.h:107
std::shared_ptr< oauth2::Credentials > credentials() const
Definition: client_options.h:150
The Google Cloud Storage (GCS) Client.
Definition: client.h:263
StatusOr< NativeIamPolicy > SetNativeBucketIamPolicy(std::string const &bucket_name, NativeIamPolicy const &iam_policy, Options &&... options)
Sets the native IAM Policy for a Bucket.
Definition: client.h:731
StatusOr< ServiceAccount > GetServiceAccount(Options &&... options)
Gets the GCS service account for the default project.
Definition: client.h:2586
StatusOr< ObjectMetadata > UpdateObject(std::string bucket_name, std::string object_name, ObjectMetadata metadata, Options &&... options)
Updates the metadata in a Google Cloud Storage Object.
Definition: client.h:1354
StatusOr< std::vector< ObjectAccessControl > > ListDefaultObjectAcl(std::string const &bucket_name, Options &&... options)
Retrieves the default object ACL for a bucket as a vector of ObjectAccessControl items.
Definition: client.h:2251
StatusOr< ObjectMetadata > RewriteObjectBlocking(std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options)
Rewrites the object, blocking until the rewrite completes, and returns the resulting ObjectMetadata.
Definition: client.h:1629
StatusOr< BucketMetadata > CreateBucket(std::string bucket_name, BucketMetadata metadata, Options &&... options)
Creates a new Google Cloud Storage bucket using the default project.
Definition: client.h:397
StatusOr< std::vector< ObjectAccessControl > > ListObjectAcl(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Retrieves the list of ObjectAccessControl items for an object.
Definition: client.h:1963
StatusOr< BucketAccessControl > GetBucketAcl(std::string const &bucket_name, std::string const &entity, Options &&... options)
Gets the value of an existing bucket ACL.
Definition: client.h:1779
Client(std::shared_ptr< oauth2::Credentials > credentials, Policies &&... policies)
Creates the default client type given the credentials and policies.
Definition: client.h:3268
ListObjectsAndPrefixesReader ListObjectsAndPrefixes(std::string const &bucket_name, Options &&... options)
Lists the objects and prefixes in a bucket.
Definition: client.h:1045
friend bool operator!=(Client const &a, Client const &b)
Definition: client.h:288
StatusOr< ObjectAccessControl > UpdateObjectAcl(std::string const &bucket_name, std::string const &object_name, ObjectAccessControl const &acl, Options &&... options)
Updates the value of an existing object ACL.
Definition: client.h:2104
Status DownloadToFile(std::string const &bucket_name, std::string const &object_name, std::string const &file_name, Options &&... options)
Downloads a Cloud Storage object to a file.
Definition: client.h:1293
StatusOr< ObjectMetadata > InsertObject(std::string const &bucket_name, std::string const &object_name, char const *contents, Options &&... options)
Creates an object given its name and contents.
Definition: client.h:905
Client(ClientOptions options, Policies &&... policies)
Creates the default client type given the options.
Definition: client.h:3251
std::shared_ptr< internal::RawClient > raw_client() const
Access the underlying RawClient.
Definition: client.h:3326
StatusOr< std::string > CreateV2SignedUrl(std::string verb, std::string bucket_name, std::string object_name, Options &&... options)
Create a V2 signed URL for the given parameters.
Definition: client.h:2873
Client(Options opts={})
Build a new client.
StatusOr< ObjectAccessControl > UpdateDefaultObjectAcl(std::string const &bucket_name, ObjectAccessControl const &acl, Options &&... options)
Updates the value of an existing default object ACL.
Definition: client.h:2402
StatusOr< ObjectMetadata > InsertObject(std::string const &bucket_name, std::string const &object_name, std::string const &contents, Options &&... options)
Creates an object given its name and contents.
Definition: client.h:895
ListBucketsReader ListBucketsForProject(std::string const &project_id, Options &&... options)
Fetches the list of buckets for a given project.
Definition: client.h:319
static StatusOr< Client > CreateDefaultClient()
Create a Client using ClientOptions::CreateDefaultClientOptions().
StatusOr< BucketMetadata > GetBucketMetadata(std::string const &bucket_name, Options &&... options)
Fetches the bucket metadata.
Definition: client.h:468
StatusOr< std::vector< std::string > > TestBucketIamPermissions(std::string bucket_name, std::vector< std::string > permissions, Options &&... options)
Tests the IAM permissions of the caller against a Bucket.
Definition: client.h:769
StatusOr< BucketMetadata > PatchBucket(std::string bucket_name, BucketMetadataPatchBuilder const &builder, Options &&... options)
Patches the metadata in a Google Cloud Storage Bucket given a desired set changes.
Definition: client.h:631
StatusOr< BucketAccessControl > PatchBucketAcl(std::string const &bucket_name, std::string const &entity, BucketAccessControlPatchBuilder const &builder, Options &&... options)
Patches the value of an existing bucket ACL.
Definition: client.h:1913
StatusOr< std::string > CreateV4SignedUrl(std::string verb, std::string bucket_name, std::string object_name, Options &&... options)
Create a V4 signed URL for the given parameters.
Definition: client.h:2938
StatusOr< ObjectAccessControl > PatchObjectAcl(std::string const &bucket_name, std::string const &object_name, std::string const &entity, ObjectAccessControlPatchBuilder const &builder, Options &&... options)
Patches the value of an existing object ACL.
Definition: client.h:2200
StatusOr< ObjectAccessControl > PatchObjectAcl(std::string const &bucket_name, std::string const &object_name, std::string const &entity, ObjectAccessControl const &original_acl, ObjectAccessControl const &new_acl, Options &&... options)
Patches the value of an existing object ACL.
Definition: client.h:2153
StatusOr< ObjectAccessControl > PatchDefaultObjectAcl(std::string const &bucket_name, std::string const &entity, ObjectAccessControlPatchBuilder const &builder, Options &&... options)
Patches the value of an existing default object ACL.
Definition: client.h:2501
StatusOr< ObjectMetadata > PatchObject(std::string bucket_name, std::string object_name, ObjectMetadata const &original, ObjectMetadata const &updated, Options &&... options)
Patches the metadata in a Google Cloud Storage Object.
Definition: client.h:1393
Status DeleteObject(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Deletes an object.
Definition: client.h:1322
StatusOr< BucketMetadata > UpdateBucket(std::string bucket_name, BucketMetadata metadata, Options &&... options)
Updates the metadata in a Google Cloud Storage Bucket.
Definition: client.h:535
StatusOr< std::pair< HmacKeyMetadata, std::string > > CreateHmacKey(std::string service_account, Options &&... options)
Create a new HMAC key.
Definition: client.h:2678
StatusOr< std::vector< NotificationMetadata > > ListNotifications(std::string const &bucket_name, Options &&... options)
Retrieves the list of Notifications for a Bucket.
Definition: client.h:3064
StatusOr< ObjectMetadata > UploadFile(std::string const &file_name, std::string const &bucket_name, std::string const &object_name, Options &&... options)
Uploads a file to an object.
Definition: client.h:1236
StatusOr< NotificationMetadata > CreateNotification(std::string const &bucket_name, std::string const &topic_name, std::string const &payload_format, NotificationMetadata metadata, Options &&... options)
Creates a new notification config for a Bucket.
Definition: client.h:3151
StatusOr< ObjectAccessControl > GetObjectAcl(std::string const &bucket_name, std::string const &object_name, std::string const &entity, Options &&... options)
Gets the value of an existing object ACL.
Definition: client.h:2063
StatusOr< ObjectAccessControl > PatchDefaultObjectAcl(std::string const &bucket_name, std::string const &entity, ObjectAccessControl const &original_acl, ObjectAccessControl const &new_acl, Options &&... options)
Patches the value of an existing default object ACL.
Definition: client.h:2452
StatusOr< BucketAccessControl > CreateBucketAcl(std::string const &bucket_name, std::string const &entity, std::string const &role, Options &&... options)
Creates a new entry in a bucket ACL.
Definition: client.h:1722
Client(std::shared_ptr< internal::RawClient > client, NoDecorations)
Builds a client with a specific RawClient, without decorations.
Definition: client.h:3317
ObjectRewriter RewriteObject(std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options)
Creates an ObjectRewriter to copy the source object.
Definition: client.h:1517
StatusOr< NotificationMetadata > GetNotification(std::string const &bucket_name, std::string const ¬ification_id, Options &&... options)
Gets the details about a notification config in a given Bucket.
Definition: client.h:3189
ObjectRewriter ResumeRewriteObject(std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, std::string rewrite_token, Options &&... options)
Creates an ObjectRewriter to resume a previously created rewrite.
Definition: client.h:1569
Status DeleteBucketAcl(std::string const &bucket_name, std::string const &entity, Options &&... options)
Deletes an entry from a bucket ACL.
Definition: client.h:1752
ObjectWriteStream WriteObject(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Writes contents into an object.
Definition: client.h:1195
ObjectReadStream ReadObject(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Reads the contents of an object.
Definition: client.h:1107
StatusOr< ObjectMetadata > ComposeObject(std::string bucket_name, std::vector< ComposeSourceObject > source_objects, std::string destination_object_name, Options &&... options)
Composes existing objects into a new object in the same bucket.
Definition: client.h:1466
StatusOr< ObjectAccessControl > GetDefaultObjectAcl(std::string const &bucket_name, std::string const &entity, Options &&... options)
Gets the value of a default object ACL in a bucket.
Definition: client.h:2358
Client(std::shared_ptr< internal::RawClient > client, Policies &&... policies)
Builds a client and maybe override the retry, idempotency, and/or backoff policies.
Definition: client.h:3296
StatusOr< NativeIamPolicy > GetNativeBucketIamPolicy(std::string const &bucket_name, Options &&... options)
Fetches the native IAM policy for a Bucket.
Definition: client.h:675
StatusOr< std::vector< BucketAccessControl > > ListBucketAcl(std::string const &bucket_name, Options &&... options)
Retrieves the list of BucketAccessControl items for a bucket.
Definition: client.h:1687
StatusOr< ObjectMetadata > PatchObject(std::string bucket_name, std::string object_name, ObjectMetadataPatchBuilder const &builder, Options &&... options)
Patches the metadata in a Google Cloud Storage Object.
Definition: client.h:1431
Status DeleteNotification(std::string const &bucket_name, std::string const ¬ification_id, Options &&... options)
Delete an existing notification config in a given Bucket.
Definition: client.h:3227
StatusOr< HmacKeyMetadata > GetHmacKey(std::string access_id, Options &&... options)
Get an existing HMAC key in a given project.
Definition: client.h:2759
friend bool operator==(Client const &a, Client const &b)
Definition: client.h:285
StatusOr< ObjectMetadata > CopyObject(std::string source_bucket_name, std::string source_object_name, std::string destination_bucket_name, std::string destination_object_name, Options &&... options)
Copies an existing object.
Definition: client.h:956
StatusOr< ObjectAccessControl > CreateDefaultObjectAcl(std::string const &bucket_name, std::string const &entity, std::string const &role, Options &&... options)
Creates a new entry in the default object ACL for a bucket.
Definition: client.h:2291
Status DeleteBucket(std::string const &bucket_name, Options &&... options)
Deletes a Google Cloud Storage Bucket.
Definition: client.h:493
ListBucketsReader ListBuckets(Options &&... options)
Fetches the list of buckets for the default project.
Definition: client.h:355
StatusOr< BucketMetadata > CreateBucketForProject(std::string bucket_name, std::string project_id, BucketMetadata metadata, Options &&... options)
Creates a new Google Cloud Storage Bucket in a given project.
Definition: client.h:440
StatusOr< NotificationMetadata > CreateNotification(std::string const &bucket_name, std::string const &topic_name, NotificationMetadata metadata, Options &&... options)
Creates a new notification config for a Bucket.
Definition: client.h:3107
StatusOr< ObjectAccessControl > CreateObjectAcl(std::string const &bucket_name, std::string const &object_name, std::string const &entity, std::string const &role, Options &&... options)
Creates a new entry in the object ACL.
Definition: client.h:2000
StatusOr< BucketAccessControl > PatchBucketAcl(std::string const &bucket_name, std::string const &entity, BucketAccessControl const &original_acl, BucketAccessControl const &new_acl, Options &&... options)
Patches the value of an existing bucket ACL.
Definition: client.h:1867
ListObjectsReader ListObjects(std::string const &bucket_name, Options &&... options)
Lists the objects in a bucket.
Definition: client.h:1013
Status DeleteDefaultObjectAcl(std::string const &bucket_name, std::string const &entity, Options &&... options)
Deletes an entry from the default object ACL in a bucket.
Definition: client.h:2325
StatusOr< BucketMetadata > PatchBucket(std::string bucket_name, BucketMetadata const &original, BucketMetadata const &updated, Options &&... options)
Computes the difference between two BucketMetadata objects and patches a bucket based on that differe...
Definition: client.h:585
StatusOr< ObjectMetadata > InsertObject(std::string const &bucket_name, std::string const &object_name, absl::string_view contents, Options &&... options)
Creates an object given its name and contents.
Definition: client.h:881
StatusOr< ObjectMetadata > GetObjectMetadata(std::string const &bucket_name, std::string const &object_name, Options &&... options)
Fetches the object metadata.
Definition: client.h:987
Status DeleteResumableUpload(std::string const &upload_session_url, Options &&... options)
Cancel a resumable upload.
Definition: client.h:1264
StatusOr< PolicyDocumentV4Result > GenerateSignedPostPolicyV4(PolicyDocumentV4 document, Options &&... options)
Create a signed V4 policy document.
Definition: client.h:3027
StatusOr< ServiceAccount > GetServiceAccountForProject(std::string const &project_id, Options &&... options)
Gets the GCS service account for a given project.
Definition: client.h:2548
StatusOr< BucketAccessControl > UpdateBucketAcl(std::string const &bucket_name, BucketAccessControl const &acl, Options &&... options)
Updates the value of an existing bucket ACL.
Definition: client.h:1820
StatusOr< PolicyDocumentResult > CreateSignedPolicyDocument(PolicyDocument document, Options &&... options)
Create a signed policy document.
Definition: client.h:2984
StatusOr< BucketMetadata > LockBucketRetentionPolicy(std::string const &bucket_name, std::uint64_t metageneration, Options &&... options)
Locks the retention policy for a bucket.
Definition: client.h:831
Status DeleteHmacKey(std::string access_id, Options &&... options)
Delete a HMAC key in a given project.
Definition: client.h:2721
Status DeleteObjectAcl(std::string const &bucket_name, std::string const &object_name, std::string const &entity, Options &&... options)
Deletes one access control entry in one object.
Definition: client.h:2034
StatusOr< HmacKeyMetadata > UpdateHmacKey(std::string access_id, HmacKeyMetadata resource, Options &&... options)
Update an existing HMAC key in a given project.
Definition: client.h:2802
ListHmacKeysReader ListHmacKeys(Options &&... options)
List the available HMAC keys.
Definition: client.h:2627
Represent the result of a GetIamPolicy or SetIamPolicy request.
Definition: iam_policy.h:150
Prepares a patch for an ObjectAccessControl resource.
Definition: object_access_control.h:200
Wraps the objectAccessControl resource in Google Cloud Storage.
Definition: object_access_control.h:39
std::string const & entity() const
Definition: object_access_control.h:77
std::string const & role() const
Definition: object_access_control.h:87
Defines a std::basic_istream<char> to read from a GCS Object.
Definition: object_read_stream.h:33
Complete long running object rewrite operations.
Definition: object_rewriter.h:49
ObjectRewriter(std::shared_ptr< internal::RawClient > client, internal::RewriteObjectRequest request)
Defines a std::basic_ostream<char> to write to a GCS object.
Definition: object_write_stream.h:131
Represents the metadata for a Google Cloud Storage service account.
Definition: service_account.h:30
Interface for OAuth 2.0 credentials used to access Google Cloud services.
Definition: credentials.h:47
Authentication components for Google Cloud Storage.
Definition: anonymous_credentials.h:26
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
Status DeleteByPrefix(Client &client, std::string const &bucket_name, std::string const &prefix, Options &&... options)
Delete objects whose names match a given prefix.
Definition: client.h:3553
std::string CreateRandomPrefixName(std::string const &prefix="")
Create a random prefix for object names.
StatusOr< ObjectMetadata > ComposeMany(Client &client, std::string const &bucket_name, std::vector< ComposeSourceObject > source_objects, std::string const &prefix, std::string destination_object_name, bool ignore_cleanup_failures, Options &&... options)
Compose existing objects into a new object in the same bucket.
Definition: client.h:3673
Define a tag to disable automatic decorations of the RawClient.
Definition: client.h:3308
Defines one of the source objects for a compose operation.
Definition: object_metadata.h:44
Set the ACL to a predefined value when copying Objects.
Definition: well_known_parameters.h:357
An optional parameter to set the Customer-Supplied Encryption key.
Definition: well_known_headers.h:183
Set the version of an object to operate on.
Definition: well_known_parameters.h:145
A pre-condition: the request succeeds only if the object generation matches.
Definition: well_known_parameters.h:157
Configure the Customer-Managed Encryption Key (CMEK) for an upload.
Definition: well_known_parameters.h:274
Define a policy document result.
Definition: policy_document.h:176
Define a policy document result V4.
Definition: policy_document.h:192
Define a policy document V4.
Definition: policy_document.h:147
Define a policy document.
Definition: policy_document.h:130
Set the ACL to predefined values when creating Buckets or Objects.
Definition: well_known_parameters.h:320
Restrict list operations to entries starting with this value.
Definition: well_known_parameters.h:436
Controls what metadata fields are included in the response.
Definition: well_known_parameters.h:507
static Projection NoAcl()
Definition: well_known_parameters.h:511
Sets the user for this operation for quota enforcement purposes.
Definition: well_known_parameters.h:524
Download all the data from the GCS object starting at the given offset.
Definition: download_options.h:54
Read last N bytes from the GCS object.
Definition: download_options.h:65
Request only a portion of the GCS object in a ReadObject operation.
Definition: download_options.h:38
Specify the service account used to sign a blob.
Definition: signed_url_options.h:186
Request a resumable upload, restoring a previous session if necessary.
Definition: upload_options.h:38
Sets the user IP on an operation for quota enforcement purposes.
Definition: user_ip_option.h:43
Set the project used for billing in "requester pays" Buckets.
Definition: well_known_parameters.h:573
Control if all versions of an object should be included when listing objects.
Definition: well_known_parameters.h:587