azure-storage-blobs
blob_rest_client.hpp
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
4 #pragma once
5 
6 #include <cstring>
7 #include <limits>
8 #include <map>
9 #include <set>
10 #include <stdexcept>
11 #include <string>
12 #include <type_traits>
13 #include <vector>
14 
15 #include <azure/core/context.hpp>
16 #include <azure/core/datetime.hpp>
17 #include <azure/core/etag.hpp>
18 #include <azure/core/http/http.hpp>
19 #include <azure/core/internal/http/pipeline.hpp>
20 #include <azure/core/internal/strings.hpp>
21 #include <azure/core/nullable.hpp>
22 #include <azure/core/response.hpp>
23 #include <azure/storage/common/crypt.hpp>
24 #include <azure/storage/common/internal/xml_wrapper.hpp>
25 #include <azure/storage/common/storage_common.hpp>
26 #include <azure/storage/common/storage_exception.hpp>
27 
29 
30 namespace Azure { namespace Storage { namespace Blobs {
31 
32  namespace _detail {
33  constexpr static const char* ApiVersion = "2020-02-10";
34  } // namespace _detail
35 
36  namespace Models {
37 
41  class AccountKind final {
42  public:
43  AccountKind() = default;
44  explicit AccountKind(std::string value) : m_value(std::move(value)) {}
45  bool operator==(const AccountKind& other) const { return m_value == other.m_value; }
46  bool operator!=(const AccountKind& other) const { return !(*this == other); }
47  const std::string& ToString() const { return m_value; }
68 
69  private:
70  std::string m_value;
71  }; // extensible enum AccountKind
72 
76  struct BlobBlock final
77  {
81  std::string Name;
85  int64_t Size = 0;
86  }; // struct BlobBlock
87 
91  class CopyStatus final {
92  public:
93  CopyStatus() = default;
94  explicit CopyStatus(std::string value) : m_value(std::move(value)) {}
95  bool operator==(const CopyStatus& other) const { return m_value == other.m_value; }
96  bool operator!=(const CopyStatus& other) const { return !(*this == other); }
97  const std::string& ToString() const { return m_value; }
106 
107  private:
108  std::string m_value;
109  }; // extensible enum CopyStatus
110 
114  class GeoReplicationStatus final {
115  public:
116  GeoReplicationStatus() = default;
117  explicit GeoReplicationStatus(std::string value) : m_value(std::move(value)) {}
118  bool operator==(const GeoReplicationStatus& other) const { return m_value == other.m_value; }
119  bool operator!=(const GeoReplicationStatus& other) const { return !(*this == other); }
120  const std::string& ToString() const { return m_value; }
133 
134  private:
135  std::string m_value;
136  }; // extensible enum GeoReplicationStatus
137 
141  class LeaseDurationType final {
142  public:
143  LeaseDurationType() = default;
144  explicit LeaseDurationType(std::string value) : m_value(std::move(value)) {}
145  bool operator==(const LeaseDurationType& other) const { return m_value == other.m_value; }
146  bool operator!=(const LeaseDurationType& other) const { return !(*this == other); }
147  const std::string& ToString() const { return m_value; }
156 
157  private:
158  std::string m_value;
159  }; // extensible enum LeaseDurationType
160 
164  class LeaseState final {
165  public:
166  LeaseState() = default;
167  explicit LeaseState(std::string value) : m_value(std::move(value)) {}
168  bool operator==(const LeaseState& other) const { return m_value == other.m_value; }
169  bool operator!=(const LeaseState& other) const { return !(*this == other); }
170  const std::string& ToString() const { return m_value; }
192 
193  private:
194  std::string m_value;
195  }; // extensible enum LeaseState
196 
200  class LeaseStatus final {
201  public:
202  LeaseStatus() = default;
203  explicit LeaseStatus(std::string value) : m_value(std::move(value)) {}
204  bool operator==(const LeaseStatus& other) const { return m_value == other.m_value; }
205  bool operator!=(const LeaseStatus& other) const { return !(*this == other); }
206  const std::string& ToString() const { return m_value; }
215 
216  private:
217  std::string m_value;
218  }; // extensible enum LeaseStatus
219 
224  public:
225  ObjectReplicationStatus() = default;
226  explicit ObjectReplicationStatus(std::string value) : m_value(std::move(value)) {}
227  bool operator==(const ObjectReplicationStatus& other) const
228  {
229  return m_value == other.m_value;
230  }
231  bool operator!=(const ObjectReplicationStatus& other) const { return !(*this == other); }
232  const std::string& ToString() const { return m_value; }
241 
242  private:
243  std::string m_value;
244  }; // extensible enum ObjectReplicationStatus
245 
250  class PublicAccessType final {
251  public:
252  PublicAccessType() = default;
253  explicit PublicAccessType(std::string value) : m_value(std::move(value)) {}
254  bool operator==(const PublicAccessType& other) const { return m_value == other.m_value; }
255  bool operator!=(const PublicAccessType& other) const { return !(*this == other); }
256  const std::string& ToString() const { return m_value; }
273 
274  private:
275  std::string m_value;
276  }; // extensible enum PublicAccessType
277 
281  struct RetentionPolicy final
282  {
286  bool IsEnabled = false;
291  Azure::Nullable<int32_t> Days;
292  }; // struct RetentionPolicy
293 
297  struct SignedIdentifier final
298  {
302  std::string Id;
306  Azure::DateTime StartsOn;
310  Azure::DateTime ExpiresOn;
314  std::string Permissions;
315  }; // struct SignedIdentifier
316 
320  class SkuName final {
321  public:
322  SkuName() = default;
323  explicit SkuName(std::string value) : m_value(std::move(value)) {}
324  bool operator==(const SkuName& other) const { return m_value == other.m_value; }
325  bool operator!=(const SkuName& other) const { return !(*this == other); }
326  const std::string& ToString() const { return m_value; }
359 
360  private:
361  std::string m_value;
362  }; // extensible enum SkuName
363 
368  struct TaggedBlobItem final
369  {
373  std::string BlobName;
377  std::string BlobContainerName;
378  }; // struct TaggedBlobItem
379 
383  struct AnalyticsLogging final
384  {
388  std::string Version;
392  bool Delete = false;
396  bool Read = false;
400  bool Write = false;
405  }; // struct AnalyticsLogging
406 
411  {
415  Azure::ETag ETag;
421  Azure::DateTime LastModified;
425  Storage::Metadata Metadata;
433  bool HasImmutabilityPolicy = false;
437  bool HasLegalHold = false;
442  Azure::Nullable<LeaseDurationType> LeaseDuration;
463  Azure::Nullable<int32_t> RemainingRetentionDays;
468  Azure::Nullable<Azure::DateTime> DeletedOn;
469  }; // struct BlobContainerItemDetails
470 
474  struct CorsRule final
475  {
480  std::string AllowedOrigins;
485  std::string AllowedMethods;
489  std::string AllowedHeaders;
493  std::string ExposedHeaders;
497  int32_t MaxAgeInSeconds = 0;
498  }; // struct CorsRule
499 
503  struct GeoReplication final
504  {
514  Azure::Nullable<Azure::DateTime> LastSyncedOn;
515  }; // struct GeoReplication
516 
520  struct Metrics final
521  {
525  std::string Version;
529  bool IsEnabled = false;
537  Azure::Nullable<bool> IncludeApis;
538  }; // struct Metrics
539 
544  {
548  std::string RuleId;
553  }; // struct ObjectReplicationRule
554 
558  struct StaticWebsite final
559  {
563  bool IsEnabled = false;
567  Azure::Nullable<std::string> IndexDocument;
571  Azure::Nullable<std::string> DefaultIndexDocumentPath;
575  Azure::Nullable<std::string> ErrorDocument404Path;
576  }; // struct StaticWebsite
577 
581  class AccessTier final {
582  public:
583  AccessTier() = default;
584  explicit AccessTier(std::string value) : m_value(std::move(value)) {}
585  bool operator==(const AccessTier& other) const { return m_value == other.m_value; }
586  bool operator!=(const AccessTier& other) const { return !(*this == other); }
587  const std::string& ToString() const { return m_value; }
657 
658  private:
659  std::string m_value;
660  }; // extensible enum AccessTier
661 
666  class ArchiveStatus final {
667  public:
668  ArchiveStatus() = default;
669  explicit ArchiveStatus(std::string value) : m_value(std::move(value)) {}
670  bool operator==(const ArchiveStatus& other) const { return m_value == other.m_value; }
671  bool operator!=(const ArchiveStatus& other) const { return !(*this == other); }
672  const std::string& ToString() const { return m_value; }
681 
682  private:
683  std::string m_value;
684  }; // extensible enum ArchiveStatus
685 
690  struct BlobContainerItem final
691  {
695  std::string Name;
699  bool IsDeleted = false;
703  Azure::Nullable<std::string> VersionId;
708  }; // struct BlobContainerItem
709 
713  struct BlobHttpHeaders final
714  {
718  std::string ContentType;
722  std::string ContentEncoding;
726  std::string ContentLanguage;
730  Storage::ContentHash ContentHash;
734  std::string CacheControl;
739  std::string ContentDisposition;
740  }; // struct BlobHttpHeaders
741 
745  class BlobType final {
746  public:
747  BlobType() = default;
748  explicit BlobType(std::string value) : m_value(std::move(value)) {}
749  bool operator==(const BlobType& other) const { return m_value == other.m_value; }
750  bool operator!=(const BlobType& other) const { return !(*this == other); }
751  const std::string& ToString() const { return m_value; }
764 
765  private:
766  std::string m_value;
767  }; // extensible enum BlobType
768 
776  {
780  std::string PolicyId;
784  std::vector<ObjectReplicationRule> Rules;
785  }; // struct ObjectReplicationPolicy
786 
790  class RehydratePriority final {
791  public:
792  RehydratePriority() = default;
793  explicit RehydratePriority(std::string value) : m_value(std::move(value)) {}
794  bool operator==(const RehydratePriority& other) const { return m_value == other.m_value; }
795  bool operator!=(const RehydratePriority& other) const { return !(*this == other); }
796  const std::string& ToString() const { return m_value; }
805 
806  private:
807  std::string m_value;
808  }; // extensible enum RehydratePriority
809 
813  struct BlobItemDetails final
814  {
822  Storage::Metadata Metadata;
826  Azure::DateTime CreatedOn;
830  Azure::Nullable<Azure::DateTime> ExpiresOn;
834  Azure::Nullable<Azure::DateTime> LastAccessedOn;
840  Azure::DateTime LastModified;
844  Azure::ETag ETag;
848  Azure::Nullable<Models::AccessTier> AccessTier;
852  Azure::Nullable<bool> IsAccessTierInferred;
865  Azure::Nullable<LeaseDurationType> LeaseDuration;
871  bool IsServerEncrypted = false;
875  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
879  Azure::Nullable<std::string> EncryptionScope;
884  Azure::Nullable<int64_t> SequenceNumber;
888  Azure::Nullable<bool> IsSealed;
892  std::vector<ObjectReplicationPolicy> ObjectReplicationSourceProperties;
893  }; // struct BlobItemDetails
894 
898  struct DownloadBlobDetails final
899  {
903  Azure::ETag ETag;
909  Azure::DateTime LastModified;
913  Azure::DateTime CreatedOn;
917  Azure::Nullable<Azure::DateTime> ExpiresOn;
921  Azure::Nullable<Azure::DateTime> LastAccessedOn;
929  Storage::Metadata Metadata;
934  Azure::Nullable<int64_t> SequenceNumber;
939  Azure::Nullable<int32_t> CommittedBlockCount;
943  Azure::Nullable<bool> IsSealed;
948  Azure::Nullable<LeaseDurationType> LeaseDuration;
952  Azure::Nullable<Models::LeaseState> LeaseState;
956  Azure::Nullable<Models::LeaseStatus> LeaseStatus;
962  bool IsServerEncrypted = false;
966  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
970  Azure::Nullable<std::string> EncryptionScope;
974  Azure::Nullable<std::string> ObjectReplicationDestinationPolicyId;
978  std::vector<ObjectReplicationPolicy> ObjectReplicationSourceProperties;
982  Azure::Nullable<int32_t> TagCount;
988  Azure::Nullable<std::string> CopyId;
995  Azure::Nullable<std::string> CopySource;
1002  Azure::Nullable<Models::CopyStatus> CopyStatus;
1007  Azure::Nullable<std::string> CopyStatusDescription;
1012  Azure::Nullable<std::string> CopyProgress;
1017  Azure::Nullable<Azure::DateTime> CopyCompletedOn;
1022  Azure::Nullable<std::string> VersionId;
1027  Azure::Nullable<bool> IsCurrentVersion;
1028  }; // struct DownloadBlobDetails
1029 
1033  struct BlobItem final
1034  {
1035  std::string Name;
1039  int64_t BlobSize = 0;
1047  bool IsDeleted = false;
1051  std::string Snapshot;
1056  Azure::Nullable<std::string> VersionId;
1061  Azure::Nullable<bool> IsCurrentVersion;
1066  }; // struct BlobItem
1067 
1072  {
1073  }; // struct AbortBlobCopyFromUriResult
1074 
1078  struct AccountInfo final
1079  {
1094  }; // struct AccountInfo
1095 
1100  {
1104  Azure::ETag ETag;
1110  Azure::DateTime LastModified;
1114  Azure::Nullable<ContentHash> TransactionalContentHash;
1118  int64_t AppendOffset = 0;
1123  int32_t CommittedBlockCount = 0;
1129  bool IsServerEncrypted = false;
1133  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1137  Azure::Nullable<std::string> EncryptionScope;
1138  }; // struct AppendBlockFromUriResult
1139 
1143  struct AppendBlockResult final
1144  {
1148  Azure::ETag ETag;
1154  Azure::DateTime LastModified;
1158  Azure::Nullable<ContentHash> TransactionalContentHash;
1162  int64_t AppendOffset = 0;
1167  int32_t CommittedBlockCount = 0;
1173  bool IsServerEncrypted = false;
1177  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1181  Azure::Nullable<std::string> EncryptionScope;
1182  }; // struct AppendBlockResult
1183 
1188  {
1196  std::vector<SignedIdentifier> SignedIdentifiers;
1197  }; // struct BlobContainerAccessPolicy
1198 
1203  {
1207  Azure::ETag ETag;
1213  Azure::DateTime LastModified;
1217  Storage::Metadata Metadata;
1229  bool HasLegalHold = false;
1234  Azure::Nullable<LeaseDurationType> LeaseDuration;
1251  }; // struct BlobContainerProperties
1252 
1256  struct BlobProperties final
1257  {
1261  Azure::ETag ETag;
1267  Azure::DateTime LastModified;
1271  Azure::DateTime CreatedOn;
1275  Azure::Nullable<Azure::DateTime> ExpiresOn;
1279  Azure::Nullable<Azure::DateTime> LastAccessedOn;
1283  Storage::Metadata Metadata;
1292  Azure::Nullable<LeaseDurationType> LeaseDuration;
1296  Azure::Nullable<Models::LeaseState> LeaseState;
1300  Azure::Nullable<Models::LeaseStatus> LeaseStatus;
1304  int64_t BlobSize = 0;
1313  Azure::Nullable<int64_t> SequenceNumber;
1318  Azure::Nullable<int32_t> CommittedBlockCount;
1322  Azure::Nullable<bool> IsSealed;
1328  bool IsServerEncrypted = false;
1332  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1336  Azure::Nullable<std::string> EncryptionScope;
1340  Azure::Nullable<Models::AccessTier> AccessTier;
1344  Azure::Nullable<bool> IsAccessTierInferred;
1348  Azure::Nullable<Models::ArchiveStatus> ArchiveStatus;
1352  Azure::Nullable<Models::RehydratePriority> RehydratePriority;
1356  Azure::Nullable<Azure::DateTime> AccessTierChangedOn;
1362  Azure::Nullable<std::string> CopyId;
1369  Azure::Nullable<std::string> CopySource;
1376  Azure::Nullable<Models::CopyStatus> CopyStatus;
1381  Azure::Nullable<std::string> CopyStatusDescription;
1385  Azure::Nullable<bool> IsIncrementalCopy;
1389  Azure::Nullable<std::string> IncrementalCopyDestinationSnapshot;
1394  Azure::Nullable<std::string> CopyProgress;
1399  Azure::Nullable<Azure::DateTime> CopyCompletedOn;
1403  Azure::Nullable<std::string> ObjectReplicationDestinationPolicyId;
1407  std::vector<ObjectReplicationPolicy> ObjectReplicationSourceProperties;
1411  Azure::Nullable<int32_t> TagCount;
1416  Azure::Nullable<std::string> VersionId;
1421  Azure::Nullable<bool> IsCurrentVersion;
1422  }; // struct BlobProperties
1423 
1428  {
1444  std::vector<CorsRule> Cors;
1449  Azure::Nullable<std::string> DefaultServiceVersion;
1458  }; // struct BlobServiceProperties
1459 
1463  class BlockListType final {
1464  public:
1465  BlockListType() = default;
1466  explicit BlockListType(std::string value) : m_value(std::move(value)) {}
1467  bool operator==(const BlockListType& other) const { return m_value == other.m_value; }
1468  bool operator!=(const BlockListType& other) const { return !(*this == other); }
1469  const std::string& ToString() const { return m_value; }
1482 
1483  private:
1484  std::string m_value;
1485  }; // extensible enum BlockListType
1486 
1490  class BlockType final {
1491  public:
1492  BlockType() = default;
1493  explicit BlockType(std::string value) : m_value(std::move(value)) {}
1494  bool operator==(const BlockType& other) const { return m_value == other.m_value; }
1495  bool operator!=(const BlockType& other) const { return !(*this == other); }
1496  const std::string& ToString() const { return m_value; }
1510 
1511  private:
1512  std::string m_value;
1513  }; // extensible enum BlockType
1514 
1518  struct ClearPagesResult final
1519  {
1523  Azure::ETag ETag;
1529  Azure::DateTime LastModified;
1534  int64_t SequenceNumber = 0;
1535  }; // struct ClearPagesResult
1536 
1541  {
1545  Azure::ETag ETag;
1551  Azure::DateTime LastModified;
1556  Azure::Nullable<std::string> VersionId;
1562  bool IsServerEncrypted = false;
1566  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1570  Azure::Nullable<std::string> EncryptionScope;
1574  Azure::Nullable<ContentHash> TransactionalContentHash;
1575  }; // struct CommitBlockListResult
1576 
1581  {
1585  bool Created = true;
1589  Azure::ETag ETag;
1595  Azure::DateTime LastModified;
1600  Azure::Nullable<std::string> VersionId;
1606  bool IsServerEncrypted = false;
1610  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1614  Azure::Nullable<std::string> EncryptionScope;
1615  }; // struct CreateAppendBlobResult
1616 
1621  {
1625  bool Created = true;
1629  Azure::ETag ETag;
1635  Azure::DateTime LastModified;
1636  }; // struct CreateBlobContainerResult
1637 
1642  {
1643  std::string Snapshot;
1647  Azure::ETag ETag;
1653  Azure::DateTime LastModified;
1658  Azure::Nullable<std::string> VersionId;
1664  bool IsServerEncrypted = false;
1668  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1672  Azure::Nullable<std::string> EncryptionScope;
1673  }; // struct CreateBlobSnapshotResult
1674 
1679  {
1683  bool Created = true;
1687  Azure::ETag ETag;
1693  Azure::DateTime LastModified;
1698  Azure::Nullable<std::string> VersionId;
1704  bool IsServerEncrypted = false;
1708  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
1712  Azure::Nullable<std::string> EncryptionScope;
1717  Azure::Nullable<int64_t> SequenceNumber;
1718  }; // struct CreatePageBlobResult
1719 
1724  {
1728  bool Deleted = true;
1729  }; // struct DeleteBlobContainerResult
1730 
1734  struct DeleteBlobResult final
1735  {
1739  bool Deleted = true;
1740  }; // struct DeleteBlobResult
1741 
1747  public:
1748  DeleteSnapshotsOption() = default;
1749  explicit DeleteSnapshotsOption(std::string value) : m_value(std::move(value)) {}
1750  bool operator==(const DeleteSnapshotsOption& other) const { return m_value == other.m_value; }
1751  bool operator!=(const DeleteSnapshotsOption& other) const { return !(*this == other); }
1752  const std::string& ToString() const { return m_value; }
1761 
1762  private:
1763  std::string m_value;
1764  }; // extensible enum DeleteSnapshotsOption
1765 
1769  struct DownloadBlobResult final
1770  {
1774  std::unique_ptr<Azure::Core::IO::BodyStream> BodyStream;
1778  Azure::Core::Http::HttpRange ContentRange;
1782  int64_t BlobSize = 0;
1790  Azure::Nullable<ContentHash> TransactionalContentHash;
1795  }; // struct DownloadBlobResult
1796 
1801  public:
1802  EncryptionAlgorithmType() = default;
1803  explicit EncryptionAlgorithmType(std::string value) : m_value(std::move(value)) {}
1804  bool operator==(const EncryptionAlgorithmType& other) const
1805  {
1806  return m_value == other.m_value;
1807  }
1808  bool operator!=(const EncryptionAlgorithmType& other) const { return !(*this == other); }
1809  const std::string& ToString() const { return m_value; }
1814 
1815  private:
1816  std::string m_value;
1817  }; // extensible enum EncryptionAlgorithmType
1818 
1822  struct GetBlockListResult final
1823  {
1827  Azure::ETag ETag;
1833  Azure::DateTime LastModified;
1837  int64_t BlobSize = 0;
1841  std::vector<BlobBlock> CommittedBlocks;
1845  std::vector<BlobBlock> UncommittedBlocks;
1846  }; // struct GetBlockListResult
1847 
1848  enum class ListBlobContainersIncludeFlags
1849  {
1853  None = 0,
1857  Metadata = 1,
1861  Deleted = 2,
1862  }; // bitwise enum ListBlobContainersIncludeFlags
1863 
1864  inline ListBlobContainersIncludeFlags operator|(
1865  ListBlobContainersIncludeFlags lhs,
1866  ListBlobContainersIncludeFlags rhs)
1867  {
1868  using type = std::underlying_type_t<ListBlobContainersIncludeFlags>;
1869  return static_cast<ListBlobContainersIncludeFlags>(
1870  static_cast<type>(lhs) | static_cast<type>(rhs));
1871  }
1872 
1873  inline ListBlobContainersIncludeFlags& operator|=(
1874  ListBlobContainersIncludeFlags& lhs,
1875  ListBlobContainersIncludeFlags rhs)
1876  {
1877  lhs = lhs | rhs;
1878  return lhs;
1879  }
1880 
1881  inline ListBlobContainersIncludeFlags operator&(
1882  ListBlobContainersIncludeFlags lhs,
1883  ListBlobContainersIncludeFlags rhs)
1884  {
1885  using type = std::underlying_type_t<ListBlobContainersIncludeFlags>;
1886  return static_cast<ListBlobContainersIncludeFlags>(
1887  static_cast<type>(lhs) & static_cast<type>(rhs));
1888  }
1889 
1890  inline ListBlobContainersIncludeFlags& operator&=(
1891  ListBlobContainersIncludeFlags& lhs,
1892  ListBlobContainersIncludeFlags rhs)
1893  {
1894  lhs = lhs & rhs;
1895  return lhs;
1896  }
1897 
1898  enum class ListBlobsIncludeFlags
1899  {
1903  None = 0,
1907  Copy = 1,
1911  Deleted = 2,
1915  Metadata = 4,
1919  Snapshots = 8,
1923  Versions = 16,
1927  UncomittedBlobs = 32,
1928  }; // bitwise enum ListBlobsIncludeFlags
1929 
1930  inline ListBlobsIncludeFlags operator|(ListBlobsIncludeFlags lhs, ListBlobsIncludeFlags rhs)
1931  {
1932  using type = std::underlying_type_t<ListBlobsIncludeFlags>;
1933  return static_cast<ListBlobsIncludeFlags>(static_cast<type>(lhs) | static_cast<type>(rhs));
1934  }
1935 
1936  inline ListBlobsIncludeFlags& operator|=(ListBlobsIncludeFlags& lhs, ListBlobsIncludeFlags rhs)
1937  {
1938  lhs = lhs | rhs;
1939  return lhs;
1940  }
1941 
1942  inline ListBlobsIncludeFlags operator&(ListBlobsIncludeFlags lhs, ListBlobsIncludeFlags rhs)
1943  {
1944  using type = std::underlying_type_t<ListBlobsIncludeFlags>;
1945  return static_cast<ListBlobsIncludeFlags>(static_cast<type>(lhs) & static_cast<type>(rhs));
1946  }
1947 
1948  inline ListBlobsIncludeFlags& operator&=(ListBlobsIncludeFlags& lhs, ListBlobsIncludeFlags rhs)
1949  {
1950  lhs = lhs & rhs;
1951  return lhs;
1952  }
1953 
1958  {
1962  Azure::ETag ETag;
1968  Azure::DateTime LastModified;
1973  int64_t SequenceNumber = 0;
1974  }; // struct ResizePageBlobResult
1975 
1980  public:
1981  ScheduleBlobExpiryOriginType() = default;
1982  explicit ScheduleBlobExpiryOriginType(std::string value) : m_value(std::move(value)) {}
1983  bool operator==(const ScheduleBlobExpiryOriginType& other) const
1984  {
1985  return m_value == other.m_value;
1986  }
1987  bool operator!=(const ScheduleBlobExpiryOriginType& other) const { return !(*this == other); }
1988  const std::string& ToString() const { return m_value; }
2005 
2006  private:
2007  std::string m_value;
2008  }; // extensible enum ScheduleBlobExpiryOriginType
2009 
2014  {
2018  Azure::ETag ETag;
2024  Azure::DateTime LastModified;
2028  bool IsSealed = true;
2029  }; // struct SealAppendBlobResult
2030 
2034  struct ServiceStatistics final
2035  {
2040  }; // struct ServiceStatistics
2041 
2046  {
2047  }; // struct SetBlobAccessTierResult
2048 
2053  {
2057  Azure::ETag ETag;
2063  Azure::DateTime LastModified;
2064  }; // struct SetBlobContainerAccessPolicyResult
2065 
2070  {
2074  Azure::ETag ETag;
2080  Azure::DateTime LastModified;
2081  }; // struct SetBlobContainerMetadataResult
2082 
2087  struct SetBlobExpiryResult final
2088  {
2089  }; // struct SetBlobExpiryResult
2090 
2095  {
2099  Azure::ETag ETag;
2105  Azure::DateTime LastModified;
2110  Azure::Nullable<int64_t> SequenceNumber;
2111  }; // struct SetBlobHttpHeadersResult
2112 
2117  {
2121  Azure::ETag ETag;
2127  Azure::DateTime LastModified;
2132  Azure::Nullable<int64_t> SequenceNumber;
2133  }; // struct SetBlobMetadataResult
2134 
2138  struct SetBlobTagsResult final
2139  {
2140  }; // struct SetBlobTagsResult
2141 
2146  {
2147  }; // struct SetServicePropertiesResult
2148 
2153  {
2157  Azure::Nullable<ContentHash> TransactionalContentHash;
2163  bool IsServerEncrypted = false;
2167  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
2171  Azure::Nullable<std::string> EncryptionScope;
2172  }; // struct StageBlockFromUriResult
2173 
2177  struct StageBlockResult final
2178  {
2182  Azure::Nullable<ContentHash> TransactionalContentHash;
2188  bool IsServerEncrypted = false;
2192  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
2196  Azure::Nullable<std::string> EncryptionScope;
2197  }; // struct StageBlockResult
2198 
2202  struct UndeleteBlobResult final
2203  {
2204  }; // struct UndeleteBlobResult
2205 
2210  {
2214  Azure::ETag ETag;
2220  Azure::DateTime LastModified;
2225  Azure::Nullable<std::string> VersionId;
2231  bool IsServerEncrypted = false;
2235  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
2239  Azure::Nullable<std::string> EncryptionScope;
2243  Azure::Nullable<ContentHash> TransactionalContentHash;
2244  }; // struct UploadBlockBlobResult
2245 
2250  {
2254  Azure::ETag ETag;
2260  Azure::DateTime LastModified;
2264  Azure::Nullable<ContentHash> TransactionalContentHash;
2269  int64_t SequenceNumber = 0;
2275  bool IsServerEncrypted = false;
2279  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
2283  Azure::Nullable<std::string> EncryptionScope;
2284  }; // struct UploadPagesFromUriResult
2285 
2289  struct UploadPagesResult final
2290  {
2294  Azure::ETag ETag;
2300  Azure::DateTime LastModified;
2304  Azure::Nullable<ContentHash> TransactionalContentHash;
2309  int64_t SequenceNumber = 0;
2315  bool IsServerEncrypted = false;
2319  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
2323  Azure::Nullable<std::string> EncryptionScope;
2324  }; // struct UploadPagesResult
2325 
2329  struct UserDelegationKey final
2330  {
2334  std::string SignedObjectId;
2338  std::string SignedTenantId;
2342  Azure::DateTime SignedStartsOn;
2346  Azure::DateTime SignedExpiresOn;
2350  std::string SignedService;
2354  std::string SignedVersion;
2358  std::string Value;
2359  }; // struct UserDelegationKey
2360 
2361  namespace _detail {
2362  struct AcquireBlobContainerLeaseResult final
2363  {
2367  Azure::ETag ETag;
2373  Azure::DateTime LastModified;
2377  std::string LeaseId;
2378  }; // struct AcquireBlobContainerLeaseResult
2379  } // namespace _detail
2380 
2381  namespace _detail {
2382  struct AcquireBlobLeaseResult final
2383  {
2387  Azure::ETag ETag;
2393  Azure::DateTime LastModified;
2397  std::string LeaseId;
2398  }; // struct AcquireBlobLeaseResult
2399  } // namespace _detail
2400 
2401  namespace _detail {
2402  struct BreakBlobContainerLeaseResult final
2403  {
2407  Azure::ETag ETag;
2413  Azure::DateTime LastModified;
2417  int32_t LeaseTime = 0;
2418  }; // struct BreakBlobContainerLeaseResult
2419  } // namespace _detail
2420 
2421  namespace _detail {
2422  struct BreakBlobLeaseResult final
2423  {
2427  Azure::ETag ETag;
2433  Azure::DateTime LastModified;
2437  int32_t LeaseTime = 0;
2438  }; // struct BreakBlobLeaseResult
2439  } // namespace _detail
2440 
2441  namespace _detail {
2442  struct ChangeBlobContainerLeaseResult final
2443  {
2447  Azure::ETag ETag;
2453  Azure::DateTime LastModified;
2457  std::string LeaseId;
2458  }; // struct ChangeBlobContainerLeaseResult
2459  } // namespace _detail
2460 
2461  namespace _detail {
2462  struct ChangeBlobLeaseResult final
2463  {
2467  Azure::ETag ETag;
2473  Azure::DateTime LastModified;
2477  std::string LeaseId;
2478  }; // struct ChangeBlobLeaseResult
2479  } // namespace _detail
2480 
2481  namespace _detail {
2482  struct FindBlobsByTagsResult final
2483  {
2484  std::string ServiceEndpoint;
2485  Azure::Nullable<std::string> ContinuationToken;
2486  std::vector<TaggedBlobItem> Items;
2487  }; // struct FindBlobsByTagsResult
2488  } // namespace _detail
2489 
2490  namespace _detail {
2491  struct GetBlobTagsResult final
2492  {
2493  std::map<std::string, std::string> Tags;
2494  }; // struct GetBlobTagsResult
2495  } // namespace _detail
2496 
2497  namespace _detail {
2498  struct GetPageRangesResult final
2499  {
2503  Azure::ETag ETag;
2509  Azure::DateTime LastModified;
2513  int64_t BlobSize = 0;
2514  std::vector<Azure::Core::Http::HttpRange> PageRanges;
2515  std::vector<Azure::Core::Http::HttpRange> ClearRanges;
2516  }; // struct GetPageRangesResult
2517  } // namespace _detail
2518 
2519  namespace _detail {
2520  struct ListBlobContainersResult final
2521  {
2522  std::string ServiceEndpoint;
2523  std::string Prefix;
2524  Azure::Nullable<std::string> ContinuationToken;
2525  std::vector<BlobContainerItem> Items;
2526  }; // struct ListBlobContainersResult
2527  } // namespace _detail
2528 
2529  namespace _detail {
2530  struct ListBlobsByHierarchyResult final
2531  {
2532  std::string ServiceEndpoint;
2533  std::string BlobContainerName;
2534  std::string Prefix;
2535  std::string Delimiter;
2536  Azure::Nullable<std::string> ContinuationToken;
2537  std::vector<BlobItem> Items;
2538  std::vector<std::string> BlobPrefixes;
2539  }; // struct ListBlobsByHierarchyResult
2540  } // namespace _detail
2541 
2542  namespace _detail {
2543  struct ListBlobsResult final
2544  {
2545  std::string ServiceEndpoint;
2546  std::string BlobContainerName;
2547  std::string Prefix;
2548  Azure::Nullable<std::string> ContinuationToken;
2549  std::vector<BlobItem> Items;
2550  }; // struct ListBlobsResult
2551  } // namespace _detail
2552 
2553  namespace _detail {
2554  struct ReleaseBlobContainerLeaseResult final
2555  {
2559  Azure::ETag ETag;
2565  Azure::DateTime LastModified;
2566  }; // struct ReleaseBlobContainerLeaseResult
2567  } // namespace _detail
2568 
2569  namespace _detail {
2570  struct ReleaseBlobLeaseResult final
2571  {
2575  Azure::ETag ETag;
2581  Azure::DateTime LastModified;
2586  Azure::Nullable<int64_t> SequenceNumber;
2587  }; // struct ReleaseBlobLeaseResult
2588  } // namespace _detail
2589 
2590  namespace _detail {
2591  struct RenewBlobContainerLeaseResult final
2592  {
2596  Azure::ETag ETag;
2602  Azure::DateTime LastModified;
2606  std::string LeaseId;
2607  }; // struct RenewBlobContainerLeaseResult
2608  } // namespace _detail
2609 
2610  namespace _detail {
2611  struct RenewBlobLeaseResult final
2612  {
2616  Azure::ETag ETag;
2622  Azure::DateTime LastModified;
2626  std::string LeaseId;
2627  }; // struct RenewBlobLeaseResult
2628  } // namespace _detail
2629 
2630  namespace _detail {
2631  struct StartBlobCopyFromUriResult final
2632  {
2636  Azure::ETag ETag;
2642  Azure::DateTime LastModified;
2648  std::string CopyId;
2655  Models::CopyStatus CopyStatus;
2660  Azure::Nullable<std::string> VersionId;
2661  }; // struct StartBlobCopyFromUriResult
2662  } // namespace _detail
2663 
2664  namespace _detail {
2665  struct StartBlobCopyIncrementalResult final
2666  {
2670  Azure::ETag ETag;
2676  Azure::DateTime LastModified;
2682  std::string CopyId;
2689  Models::CopyStatus CopyStatus;
2694  Azure::Nullable<std::string> VersionId;
2695  }; // struct StartBlobCopyIncrementalResult
2696  } // namespace _detail
2697 
2698  namespace _detail {
2699  struct SubmitBlobBatchResult final
2700  {
2701  std::string ContentType;
2702  }; // struct SubmitBlobBatchResult
2703  } // namespace _detail
2704 
2705  namespace _detail {
2706  struct UndeleteBlobContainerResult final
2707  {
2708  }; // struct UndeleteBlobContainerResult
2709  } // namespace _detail
2710 
2711  } // namespace Models
2712 
2713  namespace _detail {
2714 
2715  using namespace Models;
2716 
2717  inline std::string ListBlobContainersIncludeFlagsToString(
2718  const ListBlobContainersIncludeFlags& val)
2719  {
2720  ListBlobContainersIncludeFlags value_list[] = {
2721  ListBlobContainersIncludeFlags::Metadata,
2722  ListBlobContainersIncludeFlags::Deleted,
2723  };
2724  const char* string_list[] = {
2725  "metadata",
2726  "deleted",
2727  };
2728  std::string ret;
2729  for (size_t i = 0; i < sizeof(value_list) / sizeof(ListBlobContainersIncludeFlags); ++i)
2730  {
2731  if ((val & value_list[i]) == value_list[i])
2732  {
2733  if (!ret.empty())
2734  {
2735  ret += ",";
2736  }
2737  ret += string_list[i];
2738  }
2739  }
2740  return ret;
2741  }
2742 
2743  inline std::string ListBlobsIncludeFlagsToString(const ListBlobsIncludeFlags& val)
2744  {
2745  ListBlobsIncludeFlags value_list[] = {
2746  ListBlobsIncludeFlags::Copy,
2747  ListBlobsIncludeFlags::Deleted,
2748  ListBlobsIncludeFlags::Metadata,
2749  ListBlobsIncludeFlags::Snapshots,
2750  ListBlobsIncludeFlags::Versions,
2751  ListBlobsIncludeFlags::UncomittedBlobs,
2752  };
2753  const char* string_list[] = {
2754  "copy",
2755  "deleted",
2756  "metadata",
2757  "snapshots",
2758  "versions",
2759  "uncommittedblobs",
2760  };
2761  std::string ret;
2762  for (size_t i = 0; i < sizeof(value_list) / sizeof(ListBlobsIncludeFlags); ++i)
2763  {
2764  if ((val & value_list[i]) == value_list[i])
2765  {
2766  if (!ret.empty())
2767  {
2768  ret += ",";
2769  }
2770  ret += string_list[i];
2771  }
2772  }
2773  return ret;
2774  }
2775 
2776  class BlobRestClient final {
2777  public:
2778  class Service final {
2779  public:
2780  struct ListBlobContainersOptions final
2781  {
2782  Azure::Nullable<int32_t> Timeout;
2783  Azure::Nullable<std::string> Prefix;
2784  Azure::Nullable<std::string> ContinuationToken;
2785  Azure::Nullable<int32_t> MaxResults;
2786  ListBlobContainersIncludeFlags Include = ListBlobContainersIncludeFlags::None;
2787  }; // struct ListBlobContainersOptions
2788 
2789  static Azure::Response<Models::_detail::ListBlobContainersResult> ListBlobContainers(
2790  Azure::Core::Http::_internal::HttpPipeline& pipeline,
2791  const Azure::Core::Url& url,
2792  const ListBlobContainersOptions& options,
2793  const Azure::Core::Context& context)
2794  {
2795  (void)options;
2796  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
2797  request.SetHeader("x-ms-version", "2020-02-10");
2798  if (options.Timeout.HasValue())
2799  {
2800  request.GetUrl().AppendQueryParameter(
2801  "timeout", std::to_string(options.Timeout.Value()));
2802  }
2803  request.GetUrl().AppendQueryParameter("comp", "list");
2804  if (options.Prefix.HasValue())
2805  {
2806  request.GetUrl().AppendQueryParameter(
2807  "prefix", _internal::UrlEncodeQueryParameter(options.Prefix.Value()));
2808  }
2809  if (options.ContinuationToken.HasValue())
2810  {
2811  request.GetUrl().AppendQueryParameter(
2812  "marker", _internal::UrlEncodeQueryParameter(options.ContinuationToken.Value()));
2813  }
2814  if (options.MaxResults.HasValue())
2815  {
2816  request.GetUrl().AppendQueryParameter(
2817  "maxresults", std::to_string(options.MaxResults.Value()));
2818  }
2819  std::string list_blob_containers_include_flags
2820  = ListBlobContainersIncludeFlagsToString(options.Include);
2821  if (!list_blob_containers_include_flags.empty())
2822  {
2823  request.GetUrl().AppendQueryParameter(
2824  "include", _internal::UrlEncodeQueryParameter(list_blob_containers_include_flags));
2825  }
2826  auto pHttpResponse = pipeline.Send(request, context);
2827  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
2828  Models::_detail::ListBlobContainersResult response;
2829  auto http_status_code
2830  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
2831  httpResponse.GetStatusCode());
2832  if (!(http_status_code == 200))
2833  {
2834  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
2835  }
2836  {
2837  const auto& httpResponseBody = httpResponse.GetBody();
2838  _internal::XmlReader reader(
2839  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
2840  response = ListBlobContainersResultInternalFromXml(reader);
2841  }
2842  return Azure::Response<Models::_detail::ListBlobContainersResult>(
2843  std::move(response), std::move(pHttpResponse));
2844  }
2845 
2846  struct GetUserDelegationKeyOptions final
2847  {
2848  Azure::Nullable<int32_t> Timeout;
2849  Azure::DateTime StartsOn;
2850  Azure::DateTime ExpiresOn;
2851  }; // struct GetUserDelegationKeyOptions
2852 
2853  static Azure::Response<UserDelegationKey> GetUserDelegationKey(
2854  Azure::Core::Http::_internal::HttpPipeline& pipeline,
2855  const Azure::Core::Url& url,
2856  const GetUserDelegationKeyOptions& options,
2857  const Azure::Core::Context& context)
2858  {
2859  (void)options;
2860  std::string xml_body;
2861  {
2862  _internal::XmlWriter writer;
2863  GetUserDelegationKeyOptionsToXml(writer, options);
2864  xml_body = writer.GetDocument();
2865  writer.Write(_internal::XmlNode{_internal::XmlNodeType::End});
2866  }
2867  Azure::Core::IO::MemoryBodyStream xml_body_stream(
2868  reinterpret_cast<const uint8_t*>(xml_body.data()), xml_body.length());
2869  auto request = Azure::Core::Http::Request(
2870  Azure::Core::Http::HttpMethod::Post, url, &xml_body_stream);
2871  request.SetHeader("Content-Length", std::to_string(xml_body_stream.Length()));
2872  request.GetUrl().AppendQueryParameter("restype", "service");
2873  request.GetUrl().AppendQueryParameter("comp", "userdelegationkey");
2874  request.SetHeader("x-ms-version", "2020-02-10");
2875  if (options.Timeout.HasValue())
2876  {
2877  request.GetUrl().AppendQueryParameter(
2878  "timeout", std::to_string(options.Timeout.Value()));
2879  }
2880  auto pHttpResponse = pipeline.Send(request, context);
2881  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
2882  UserDelegationKey response;
2883  auto http_status_code
2884  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
2885  httpResponse.GetStatusCode());
2886  if (!(http_status_code == 200))
2887  {
2888  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
2889  }
2890  {
2891  const auto& httpResponseBody = httpResponse.GetBody();
2892  _internal::XmlReader reader(
2893  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
2894  response = UserDelegationKeyFromXml(reader);
2895  }
2896  return Azure::Response<UserDelegationKey>(std::move(response), std::move(pHttpResponse));
2897  }
2898 
2899  struct GetServicePropertiesOptions final
2900  {
2901  Azure::Nullable<int32_t> Timeout;
2902  }; // struct GetServicePropertiesOptions
2903 
2904  static Azure::Response<BlobServiceProperties> GetProperties(
2905  Azure::Core::Http::_internal::HttpPipeline& pipeline,
2906  const Azure::Core::Url& url,
2907  const GetServicePropertiesOptions& options,
2908  const Azure::Core::Context& context)
2909  {
2910  (void)options;
2911  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
2912  request.GetUrl().AppendQueryParameter("restype", "service");
2913  request.GetUrl().AppendQueryParameter("comp", "properties");
2914  request.SetHeader("x-ms-version", "2020-02-10");
2915  if (options.Timeout.HasValue())
2916  {
2917  request.GetUrl().AppendQueryParameter(
2918  "timeout", std::to_string(options.Timeout.Value()));
2919  }
2920  auto pHttpResponse = pipeline.Send(request, context);
2921  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
2922  BlobServiceProperties response;
2923  auto http_status_code
2924  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
2925  httpResponse.GetStatusCode());
2926  if (!(http_status_code == 200))
2927  {
2928  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
2929  }
2930  {
2931  const auto& httpResponseBody = httpResponse.GetBody();
2932  _internal::XmlReader reader(
2933  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
2934  response = BlobServicePropertiesFromXml(reader);
2935  }
2936  return Azure::Response<BlobServiceProperties>(
2937  std::move(response), std::move(pHttpResponse));
2938  }
2939 
2940  struct SetServicePropertiesOptions final
2941  {
2942  Azure::Nullable<int32_t> Timeout;
2943  BlobServiceProperties Properties;
2944  }; // struct SetServicePropertiesOptions
2945 
2946  static Azure::Response<SetServicePropertiesResult> SetProperties(
2947  Azure::Core::Http::_internal::HttpPipeline& pipeline,
2948  const Azure::Core::Url& url,
2949  const SetServicePropertiesOptions& options,
2950  const Azure::Core::Context& context)
2951  {
2952  (void)options;
2953  std::string xml_body;
2954  {
2955  _internal::XmlWriter writer;
2956  SetServicePropertiesOptionsToXml(writer, options);
2957  xml_body = writer.GetDocument();
2958  writer.Write(_internal::XmlNode{_internal::XmlNodeType::End});
2959  }
2960  Azure::Core::IO::MemoryBodyStream xml_body_stream(
2961  reinterpret_cast<const uint8_t*>(xml_body.data()), xml_body.length());
2962  auto request = Azure::Core::Http::Request(
2963  Azure::Core::Http::HttpMethod::Put, url, &xml_body_stream);
2964  request.SetHeader("Content-Length", std::to_string(xml_body_stream.Length()));
2965  request.GetUrl().AppendQueryParameter("restype", "service");
2966  request.GetUrl().AppendQueryParameter("comp", "properties");
2967  request.SetHeader("x-ms-version", "2020-02-10");
2968  if (options.Timeout.HasValue())
2969  {
2970  request.GetUrl().AppendQueryParameter(
2971  "timeout", std::to_string(options.Timeout.Value()));
2972  }
2973  auto pHttpResponse = pipeline.Send(request, context);
2974  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
2975  SetServicePropertiesResult response;
2976  auto http_status_code
2977  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
2978  httpResponse.GetStatusCode());
2979  if (!(http_status_code == 202))
2980  {
2981  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
2982  }
2983  return Azure::Response<SetServicePropertiesResult>(
2984  std::move(response), std::move(pHttpResponse));
2985  }
2986 
2987  struct GetAccountInfoOptions final
2988  {
2989  Azure::Nullable<int32_t> Timeout;
2990  }; // struct GetAccountInfoOptions
2991 
2992  static Azure::Response<AccountInfo> GetAccountInfo(
2993  Azure::Core::Http::_internal::HttpPipeline& pipeline,
2994  const Azure::Core::Url& url,
2995  const GetAccountInfoOptions& options,
2996  const Azure::Core::Context& context)
2997  {
2998  (void)options;
2999  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Head, url);
3000  request.GetUrl().AppendQueryParameter("restype", "account");
3001  request.GetUrl().AppendQueryParameter("comp", "properties");
3002  request.SetHeader("x-ms-version", "2020-02-10");
3003  if (options.Timeout.HasValue())
3004  {
3005  request.GetUrl().AppendQueryParameter(
3006  "timeout", std::to_string(options.Timeout.Value()));
3007  }
3008  auto pHttpResponse = pipeline.Send(request, context);
3009  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
3010  AccountInfo response;
3011  auto http_status_code
3012  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
3013  httpResponse.GetStatusCode());
3014  if (!(http_status_code == 200))
3015  {
3016  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
3017  }
3018  response.SkuName = SkuName(httpResponse.GetHeaders().at("x-ms-sku-name"));
3019  response.AccountKind = AccountKind(httpResponse.GetHeaders().at("x-ms-account-kind"));
3020  response.IsHierarchicalNamespaceEnabled
3021  = httpResponse.GetHeaders().at("x-ms-is-hns-enabled") == "true";
3022  return Azure::Response<AccountInfo>(std::move(response), std::move(pHttpResponse));
3023  }
3024 
3025  struct GetServiceStatisticsOptions final
3026  {
3027  Azure::Nullable<int32_t> Timeout;
3028  }; // struct GetServiceStatisticsOptions
3029 
3030  static Azure::Response<ServiceStatistics> GetStatistics(
3031  Azure::Core::Http::_internal::HttpPipeline& pipeline,
3032  const Azure::Core::Url& url,
3033  const GetServiceStatisticsOptions& options,
3034  const Azure::Core::Context& context)
3035  {
3036  (void)options;
3037  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
3038  request.GetUrl().AppendQueryParameter("restype", "service");
3039  request.GetUrl().AppendQueryParameter("comp", "stats");
3040  request.SetHeader("x-ms-version", "2020-02-10");
3041  if (options.Timeout.HasValue())
3042  {
3043  request.GetUrl().AppendQueryParameter(
3044  "timeout", std::to_string(options.Timeout.Value()));
3045  }
3046  auto pHttpResponse = pipeline.Send(request, context);
3047  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
3048  ServiceStatistics response;
3049  auto http_status_code
3050  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
3051  httpResponse.GetStatusCode());
3052  if (!(http_status_code == 200))
3053  {
3054  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
3055  }
3056  {
3057  const auto& httpResponseBody = httpResponse.GetBody();
3058  _internal::XmlReader reader(
3059  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
3060  response = ServiceStatisticsFromXml(reader);
3061  }
3062  return Azure::Response<ServiceStatistics>(std::move(response), std::move(pHttpResponse));
3063  }
3064 
3065  struct FindBlobsByTagsOptions final
3066  {
3067  Azure::Nullable<int32_t> Timeout;
3068  std::string Where;
3069  Azure::Nullable<std::string> ContinuationToken;
3070  Azure::Nullable<int32_t> MaxResults;
3071  }; // struct FindBlobsByTagsOptions
3072 
3073  static Azure::Response<Models::_detail::FindBlobsByTagsResult> FindBlobsByTags(
3074  Azure::Core::Http::_internal::HttpPipeline& pipeline,
3075  const Azure::Core::Url& url,
3076  const FindBlobsByTagsOptions& options,
3077  const Azure::Core::Context& context)
3078  {
3079  (void)options;
3080  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
3081  request.SetHeader("x-ms-version", "2020-02-10");
3082  if (options.Timeout.HasValue())
3083  {
3084  request.GetUrl().AppendQueryParameter(
3085  "timeout", std::to_string(options.Timeout.Value()));
3086  }
3087  request.GetUrl().AppendQueryParameter("comp", "blobs");
3088  request.GetUrl().AppendQueryParameter(
3089  "where", _internal::UrlEncodeQueryParameter(options.Where));
3090  if (options.ContinuationToken.HasValue())
3091  {
3092  request.GetUrl().AppendQueryParameter(
3093  "marker", _internal::UrlEncodeQueryParameter(options.ContinuationToken.Value()));
3094  }
3095  if (options.MaxResults.HasValue())
3096  {
3097  request.GetUrl().AppendQueryParameter(
3098  "maxresults", std::to_string(options.MaxResults.Value()));
3099  }
3100  auto pHttpResponse = pipeline.Send(request, context);
3101  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
3102  Models::_detail::FindBlobsByTagsResult response;
3103  auto http_status_code
3104  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
3105  httpResponse.GetStatusCode());
3106  if (!(http_status_code == 200))
3107  {
3108  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
3109  }
3110  {
3111  const auto& httpResponseBody = httpResponse.GetBody();
3112  _internal::XmlReader reader(
3113  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
3114  response = FindBlobsByTagsResultInternalFromXml(reader);
3115  }
3116  return Azure::Response<Models::_detail::FindBlobsByTagsResult>(
3117  std::move(response), std::move(pHttpResponse));
3118  }
3119 
3120  private:
3121  static BlobServiceProperties BlobServicePropertiesFromXml(_internal::XmlReader& reader)
3122  {
3123  BlobServiceProperties ret;
3124  enum class XmlTagName
3125  {
3126  k_StorageServiceProperties,
3127  k_Logging,
3128  k_HourMetrics,
3129  k_MinuteMetrics,
3130  k_Cors,
3131  k_CorsRule,
3132  k_DefaultServiceVersion,
3133  k_DeleteRetentionPolicy,
3134  k_StaticWebsite,
3135  k_Unknown,
3136  };
3137  std::vector<XmlTagName> path;
3138  while (true)
3139  {
3140  auto node = reader.Read();
3141  if (node.Type == _internal::XmlNodeType::End)
3142  {
3143  break;
3144  }
3145  else if (node.Type == _internal::XmlNodeType::EndTag)
3146  {
3147  if (path.size() > 0)
3148  {
3149  path.pop_back();
3150  }
3151  else
3152  {
3153  break;
3154  }
3155  }
3156  else if (node.Type == _internal::XmlNodeType::StartTag)
3157  {
3158  if (std::strcmp(node.Name, "StorageServiceProperties") == 0)
3159  {
3160  path.emplace_back(XmlTagName::k_StorageServiceProperties);
3161  }
3162  else if (std::strcmp(node.Name, "Logging") == 0)
3163  {
3164  path.emplace_back(XmlTagName::k_Logging);
3165  }
3166  else if (std::strcmp(node.Name, "HourMetrics") == 0)
3167  {
3168  path.emplace_back(XmlTagName::k_HourMetrics);
3169  }
3170  else if (std::strcmp(node.Name, "MinuteMetrics") == 0)
3171  {
3172  path.emplace_back(XmlTagName::k_MinuteMetrics);
3173  }
3174  else if (std::strcmp(node.Name, "Cors") == 0)
3175  {
3176  path.emplace_back(XmlTagName::k_Cors);
3177  }
3178  else if (std::strcmp(node.Name, "CorsRule") == 0)
3179  {
3180  path.emplace_back(XmlTagName::k_CorsRule);
3181  }
3182  else if (std::strcmp(node.Name, "DefaultServiceVersion") == 0)
3183  {
3184  path.emplace_back(XmlTagName::k_DefaultServiceVersion);
3185  }
3186  else if (std::strcmp(node.Name, "DeleteRetentionPolicy") == 0)
3187  {
3188  path.emplace_back(XmlTagName::k_DeleteRetentionPolicy);
3189  }
3190  else if (std::strcmp(node.Name, "StaticWebsite") == 0)
3191  {
3192  path.emplace_back(XmlTagName::k_StaticWebsite);
3193  }
3194  else
3195  {
3196  path.emplace_back(XmlTagName::k_Unknown);
3197  }
3198  if (path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3199  && path[1] == XmlTagName::k_Logging)
3200  {
3201  ret.Logging = AnalyticsLoggingFromXml(reader);
3202  path.pop_back();
3203  }
3204  else if (
3205  path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3206  && path[1] == XmlTagName::k_HourMetrics)
3207  {
3208  ret.HourMetrics = MetricsFromXml(reader);
3209  path.pop_back();
3210  }
3211  else if (
3212  path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3213  && path[1] == XmlTagName::k_MinuteMetrics)
3214  {
3215  ret.MinuteMetrics = MetricsFromXml(reader);
3216  path.pop_back();
3217  }
3218  else if (
3219  path.size() == 3 && path[0] == XmlTagName::k_StorageServiceProperties
3220  && path[1] == XmlTagName::k_Cors && path[2] == XmlTagName::k_CorsRule)
3221  {
3222  ret.Cors.emplace_back(CorsRuleFromXml(reader));
3223  path.pop_back();
3224  }
3225  else if (
3226  path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3227  && path[1] == XmlTagName::k_DeleteRetentionPolicy)
3228  {
3229  ret.DeleteRetentionPolicy = RetentionPolicyFromXml(reader);
3230  path.pop_back();
3231  }
3232  else if (
3233  path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3234  && path[1] == XmlTagName::k_StaticWebsite)
3235  {
3236  ret.StaticWebsite = StaticWebsiteFromXml(reader);
3237  path.pop_back();
3238  }
3239  }
3240  else if (node.Type == _internal::XmlNodeType::Text)
3241  {
3242  if (path.size() == 2 && path[0] == XmlTagName::k_StorageServiceProperties
3243  && path[1] == XmlTagName::k_DefaultServiceVersion)
3244  {
3245  ret.DefaultServiceVersion = node.Value;
3246  }
3247  }
3248  }
3249  return ret;
3250  }
3251 
3252  static Models::_detail::FindBlobsByTagsResult FindBlobsByTagsResultInternalFromXml(
3253  _internal::XmlReader& reader)
3254  {
3255  Models::_detail::FindBlobsByTagsResult ret;
3256  enum class XmlTagName
3257  {
3258  k_EnumerationResults,
3259  k_NextMarker,
3260  k_Blobs,
3261  k_Blob,
3262  k_Unknown,
3263  };
3264  std::vector<XmlTagName> path;
3265  while (true)
3266  {
3267  auto node = reader.Read();
3268  if (node.Type == _internal::XmlNodeType::End)
3269  {
3270  break;
3271  }
3272  else if (node.Type == _internal::XmlNodeType::EndTag)
3273  {
3274  if (path.size() > 0)
3275  {
3276  path.pop_back();
3277  }
3278  else
3279  {
3280  break;
3281  }
3282  }
3283  else if (node.Type == _internal::XmlNodeType::StartTag)
3284  {
3285  if (std::strcmp(node.Name, "EnumerationResults") == 0)
3286  {
3287  path.emplace_back(XmlTagName::k_EnumerationResults);
3288  }
3289  else if (std::strcmp(node.Name, "NextMarker") == 0)
3290  {
3291  path.emplace_back(XmlTagName::k_NextMarker);
3292  }
3293  else if (std::strcmp(node.Name, "Blobs") == 0)
3294  {
3295  path.emplace_back(XmlTagName::k_Blobs);
3296  }
3297  else if (std::strcmp(node.Name, "Blob") == 0)
3298  {
3299  path.emplace_back(XmlTagName::k_Blob);
3300  }
3301  else
3302  {
3303  path.emplace_back(XmlTagName::k_Unknown);
3304  }
3305  if (path.size() == 3 && path[0] == XmlTagName::k_EnumerationResults
3306  && path[1] == XmlTagName::k_Blobs && path[2] == XmlTagName::k_Blob)
3307  {
3308  ret.Items.emplace_back(TaggedBlobItemFromXml(reader));
3309  path.pop_back();
3310  }
3311  }
3312  else if (node.Type == _internal::XmlNodeType::Text)
3313  {
3314  if (path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
3315  && path[1] == XmlTagName::k_NextMarker)
3316  {
3317  ret.ContinuationToken = node.Value;
3318  }
3319  }
3320  else if (node.Type == _internal::XmlNodeType::Attribute)
3321  {
3322  if (path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
3323  && std::strcmp(node.Name, "ServiceEndpoint") == 0)
3324  {
3325  ret.ServiceEndpoint = node.Value;
3326  }
3327  }
3328  }
3329  return ret;
3330  }
3331 
3332  static Models::_detail::ListBlobContainersResult ListBlobContainersResultInternalFromXml(
3333  _internal::XmlReader& reader)
3334  {
3335  Models::_detail::ListBlobContainersResult ret;
3336  enum class XmlTagName
3337  {
3338  k_EnumerationResults,
3339  k_Prefix,
3340  k_NextMarker,
3341  k_Containers,
3342  k_Container,
3343  k_Unknown,
3344  };
3345  std::vector<XmlTagName> path;
3346  while (true)
3347  {
3348  auto node = reader.Read();
3349  if (node.Type == _internal::XmlNodeType::End)
3350  {
3351  break;
3352  }
3353  else if (node.Type == _internal::XmlNodeType::EndTag)
3354  {
3355  if (path.size() > 0)
3356  {
3357  path.pop_back();
3358  }
3359  else
3360  {
3361  break;
3362  }
3363  }
3364  else if (node.Type == _internal::XmlNodeType::StartTag)
3365  {
3366  if (std::strcmp(node.Name, "EnumerationResults") == 0)
3367  {
3368  path.emplace_back(XmlTagName::k_EnumerationResults);
3369  }
3370  else if (std::strcmp(node.Name, "Prefix") == 0)
3371  {
3372  path.emplace_back(XmlTagName::k_Prefix);
3373  }
3374  else if (std::strcmp(node.Name, "NextMarker") == 0)
3375  {
3376  path.emplace_back(XmlTagName::k_NextMarker);
3377  }
3378  else if (std::strcmp(node.Name, "Containers") == 0)
3379  {
3380  path.emplace_back(XmlTagName::k_Containers);
3381  }
3382  else if (std::strcmp(node.Name, "Container") == 0)
3383  {
3384  path.emplace_back(XmlTagName::k_Container);
3385  }
3386  else
3387  {
3388  path.emplace_back(XmlTagName::k_Unknown);
3389  }
3390  if (path.size() == 3 && path[0] == XmlTagName::k_EnumerationResults
3391  && path[1] == XmlTagName::k_Containers && path[2] == XmlTagName::k_Container)
3392  {
3393  ret.Items.emplace_back(BlobContainerItemFromXml(reader));
3394  path.pop_back();
3395  }
3396  }
3397  else if (node.Type == _internal::XmlNodeType::Text)
3398  {
3399  if (path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
3400  && path[1] == XmlTagName::k_Prefix)
3401  {
3402  ret.Prefix = node.Value;
3403  }
3404  else if (
3405  path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
3406  && path[1] == XmlTagName::k_NextMarker)
3407  {
3408  ret.ContinuationToken = node.Value;
3409  }
3410  }
3411  else if (node.Type == _internal::XmlNodeType::Attribute)
3412  {
3413  if (path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
3414  && std::strcmp(node.Name, "ServiceEndpoint") == 0)
3415  {
3416  ret.ServiceEndpoint = node.Value;
3417  }
3418  }
3419  }
3420  return ret;
3421  }
3422 
3423  static ServiceStatistics ServiceStatisticsFromXml(_internal::XmlReader& reader)
3424  {
3425  ServiceStatistics ret;
3426  enum class XmlTagName
3427  {
3428  k_StorageServiceStats,
3429  k_GeoReplication,
3430  k_Unknown,
3431  };
3432  std::vector<XmlTagName> path;
3433  while (true)
3434  {
3435  auto node = reader.Read();
3436  if (node.Type == _internal::XmlNodeType::End)
3437  {
3438  break;
3439  }
3440  else if (node.Type == _internal::XmlNodeType::EndTag)
3441  {
3442  if (path.size() > 0)
3443  {
3444  path.pop_back();
3445  }
3446  else
3447  {
3448  break;
3449  }
3450  }
3451  else if (node.Type == _internal::XmlNodeType::StartTag)
3452  {
3453  if (std::strcmp(node.Name, "StorageServiceStats") == 0)
3454  {
3455  path.emplace_back(XmlTagName::k_StorageServiceStats);
3456  }
3457  else if (std::strcmp(node.Name, "GeoReplication") == 0)
3458  {
3459  path.emplace_back(XmlTagName::k_GeoReplication);
3460  }
3461  else
3462  {
3463  path.emplace_back(XmlTagName::k_Unknown);
3464  }
3465  if (path.size() == 2 && path[0] == XmlTagName::k_StorageServiceStats
3466  && path[1] == XmlTagName::k_GeoReplication)
3467  {
3468  ret.GeoReplication = GeoReplicationFromXml(reader);
3469  path.pop_back();
3470  }
3471  }
3472  else if (node.Type == _internal::XmlNodeType::Text)
3473  {
3474  }
3475  }
3476  return ret;
3477  }
3478 
3479  static UserDelegationKey UserDelegationKeyFromXml(_internal::XmlReader& reader)
3480  {
3481  UserDelegationKey ret;
3482  enum class XmlTagName
3483  {
3484  k_UserDelegationKey,
3485  k_SignedOid,
3486  k_SignedTid,
3487  k_SignedStart,
3488  k_SignedExpiry,
3489  k_SignedService,
3490  k_SignedVersion,
3491  k_Value,
3492  k_Unknown,
3493  };
3494  std::vector<XmlTagName> path;
3495  while (true)
3496  {
3497  auto node = reader.Read();
3498  if (node.Type == _internal::XmlNodeType::End)
3499  {
3500  break;
3501  }
3502  else if (node.Type == _internal::XmlNodeType::EndTag)
3503  {
3504  if (path.size() > 0)
3505  {
3506  path.pop_back();
3507  }
3508  else
3509  {
3510  break;
3511  }
3512  }
3513  else if (node.Type == _internal::XmlNodeType::StartTag)
3514  {
3515  if (std::strcmp(node.Name, "UserDelegationKey") == 0)
3516  {
3517  path.emplace_back(XmlTagName::k_UserDelegationKey);
3518  }
3519  else if (std::strcmp(node.Name, "SignedOid") == 0)
3520  {
3521  path.emplace_back(XmlTagName::k_SignedOid);
3522  }
3523  else if (std::strcmp(node.Name, "SignedTid") == 0)
3524  {
3525  path.emplace_back(XmlTagName::k_SignedTid);
3526  }
3527  else if (std::strcmp(node.Name, "SignedStart") == 0)
3528  {
3529  path.emplace_back(XmlTagName::k_SignedStart);
3530  }
3531  else if (std::strcmp(node.Name, "SignedExpiry") == 0)
3532  {
3533  path.emplace_back(XmlTagName::k_SignedExpiry);
3534  }
3535  else if (std::strcmp(node.Name, "SignedService") == 0)
3536  {
3537  path.emplace_back(XmlTagName::k_SignedService);
3538  }
3539  else if (std::strcmp(node.Name, "SignedVersion") == 0)
3540  {
3541  path.emplace_back(XmlTagName::k_SignedVersion);
3542  }
3543  else if (std::strcmp(node.Name, "Value") == 0)
3544  {
3545  path.emplace_back(XmlTagName::k_Value);
3546  }
3547  else
3548  {
3549  path.emplace_back(XmlTagName::k_Unknown);
3550  }
3551  }
3552  else if (node.Type == _internal::XmlNodeType::Text)
3553  {
3554  if (path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3555  && path[1] == XmlTagName::k_SignedOid)
3556  {
3557  ret.SignedObjectId = node.Value;
3558  }
3559  else if (
3560  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3561  && path[1] == XmlTagName::k_SignedTid)
3562  {
3563  ret.SignedTenantId = node.Value;
3564  }
3565  else if (
3566  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3567  && path[1] == XmlTagName::k_SignedStart)
3568  {
3569  ret.SignedStartsOn
3570  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc3339);
3571  }
3572  else if (
3573  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3574  && path[1] == XmlTagName::k_SignedExpiry)
3575  {
3576  ret.SignedExpiresOn
3577  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc3339);
3578  }
3579  else if (
3580  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3581  && path[1] == XmlTagName::k_SignedService)
3582  {
3583  ret.SignedService = node.Value;
3584  }
3585  else if (
3586  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3587  && path[1] == XmlTagName::k_SignedVersion)
3588  {
3589  ret.SignedVersion = node.Value;
3590  }
3591  else if (
3592  path.size() == 2 && path[0] == XmlTagName::k_UserDelegationKey
3593  && path[1] == XmlTagName::k_Value)
3594  {
3595  ret.Value = node.Value;
3596  }
3597  }
3598  }
3599  return ret;
3600  }
3601 
3602  static AnalyticsLogging AnalyticsLoggingFromXml(_internal::XmlReader& reader)
3603  {
3604  AnalyticsLogging ret;
3605  enum class XmlTagName
3606  {
3607  k_Version,
3608  k_Delete,
3609  k_Read,
3610  k_Write,
3611  k_RetentionPolicy,
3612  k_Unknown,
3613  };
3614  std::vector<XmlTagName> path;
3615  while (true)
3616  {
3617  auto node = reader.Read();
3618  if (node.Type == _internal::XmlNodeType::End)
3619  {
3620  break;
3621  }
3622  else if (node.Type == _internal::XmlNodeType::EndTag)
3623  {
3624  if (path.size() > 0)
3625  {
3626  path.pop_back();
3627  }
3628  else
3629  {
3630  break;
3631  }
3632  }
3633  else if (node.Type == _internal::XmlNodeType::StartTag)
3634  {
3635  if (std::strcmp(node.Name, "Version") == 0)
3636  {
3637  path.emplace_back(XmlTagName::k_Version);
3638  }
3639  else if (std::strcmp(node.Name, "Delete") == 0)
3640  {
3641  path.emplace_back(XmlTagName::k_Delete);
3642  }
3643  else if (std::strcmp(node.Name, "Read") == 0)
3644  {
3645  path.emplace_back(XmlTagName::k_Read);
3646  }
3647  else if (std::strcmp(node.Name, "Write") == 0)
3648  {
3649  path.emplace_back(XmlTagName::k_Write);
3650  }
3651  else if (std::strcmp(node.Name, "RetentionPolicy") == 0)
3652  {
3653  path.emplace_back(XmlTagName::k_RetentionPolicy);
3654  }
3655  else
3656  {
3657  path.emplace_back(XmlTagName::k_Unknown);
3658  }
3659  if (path.size() == 1 && path[0] == XmlTagName::k_RetentionPolicy)
3660  {
3661  ret.RetentionPolicy = RetentionPolicyFromXml(reader);
3662  path.pop_back();
3663  }
3664  }
3665  else if (node.Type == _internal::XmlNodeType::Text)
3666  {
3667  if (path.size() == 1 && path[0] == XmlTagName::k_Version)
3668  {
3669  ret.Version = node.Value;
3670  }
3671  else if (path.size() == 1 && path[0] == XmlTagName::k_Delete)
3672  {
3673  ret.Delete = std::strcmp(node.Value, "true") == 0;
3674  }
3675  else if (path.size() == 1 && path[0] == XmlTagName::k_Read)
3676  {
3677  ret.Read = std::strcmp(node.Value, "true") == 0;
3678  }
3679  else if (path.size() == 1 && path[0] == XmlTagName::k_Write)
3680  {
3681  ret.Write = std::strcmp(node.Value, "true") == 0;
3682  }
3683  }
3684  }
3685  return ret;
3686  }
3687 
3688  static BlobContainerItem BlobContainerItemFromXml(_internal::XmlReader& reader)
3689  {
3690  BlobContainerItem ret;
3691  enum class XmlTagName
3692  {
3693  k_Name,
3694  k_Properties,
3695  k_Etag,
3696  k_LastModified,
3697  k_PublicAccess,
3698  k_HasImmutabilityPolicy,
3699  k_HasLegalHold,
3700  k_LeaseStatus,
3701  k_LeaseState,
3702  k_LeaseDuration,
3703  k_DefaultEncryptionScope,
3704  k_DenyEncryptionScopeOverride,
3705  k_Metadata,
3706  k_Deleted,
3707  k_Version,
3708  k_DeletedTime,
3709  k_RemainingRetentionDays,
3710  k_Unknown,
3711  };
3712  std::vector<XmlTagName> path;
3713  while (true)
3714  {
3715  auto node = reader.Read();
3716  if (node.Type == _internal::XmlNodeType::End)
3717  {
3718  break;
3719  }
3720  else if (node.Type == _internal::XmlNodeType::EndTag)
3721  {
3722  if (path.size() > 0)
3723  {
3724  path.pop_back();
3725  }
3726  else
3727  {
3728  break;
3729  }
3730  }
3731  else if (node.Type == _internal::XmlNodeType::StartTag)
3732  {
3733  if (std::strcmp(node.Name, "Name") == 0)
3734  {
3735  path.emplace_back(XmlTagName::k_Name);
3736  }
3737  else if (std::strcmp(node.Name, "Properties") == 0)
3738  {
3739  path.emplace_back(XmlTagName::k_Properties);
3740  }
3741  else if (std::strcmp(node.Name, "Etag") == 0)
3742  {
3743  path.emplace_back(XmlTagName::k_Etag);
3744  }
3745  else if (std::strcmp(node.Name, "Last-Modified") == 0)
3746  {
3747  path.emplace_back(XmlTagName::k_LastModified);
3748  }
3749  else if (std::strcmp(node.Name, "PublicAccess") == 0)
3750  {
3751  path.emplace_back(XmlTagName::k_PublicAccess);
3752  }
3753  else if (std::strcmp(node.Name, "HasImmutabilityPolicy") == 0)
3754  {
3755  path.emplace_back(XmlTagName::k_HasImmutabilityPolicy);
3756  }
3757  else if (std::strcmp(node.Name, "HasLegalHold") == 0)
3758  {
3759  path.emplace_back(XmlTagName::k_HasLegalHold);
3760  }
3761  else if (std::strcmp(node.Name, "LeaseStatus") == 0)
3762  {
3763  path.emplace_back(XmlTagName::k_LeaseStatus);
3764  }
3765  else if (std::strcmp(node.Name, "LeaseState") == 0)
3766  {
3767  path.emplace_back(XmlTagName::k_LeaseState);
3768  }
3769  else if (std::strcmp(node.Name, "LeaseDuration") == 0)
3770  {
3771  path.emplace_back(XmlTagName::k_LeaseDuration);
3772  }
3773  else if (std::strcmp(node.Name, "DefaultEncryptionScope") == 0)
3774  {
3775  path.emplace_back(XmlTagName::k_DefaultEncryptionScope);
3776  }
3777  else if (std::strcmp(node.Name, "DenyEncryptionScopeOverride") == 0)
3778  {
3779  path.emplace_back(XmlTagName::k_DenyEncryptionScopeOverride);
3780  }
3781  else if (std::strcmp(node.Name, "Metadata") == 0)
3782  {
3783  path.emplace_back(XmlTagName::k_Metadata);
3784  }
3785  else if (std::strcmp(node.Name, "Deleted") == 0)
3786  {
3787  path.emplace_back(XmlTagName::k_Deleted);
3788  }
3789  else if (std::strcmp(node.Name, "Version") == 0)
3790  {
3791  path.emplace_back(XmlTagName::k_Version);
3792  }
3793  else if (std::strcmp(node.Name, "DeletedTime") == 0)
3794  {
3795  path.emplace_back(XmlTagName::k_DeletedTime);
3796  }
3797  else if (std::strcmp(node.Name, "RemainingRetentionDays") == 0)
3798  {
3799  path.emplace_back(XmlTagName::k_RemainingRetentionDays);
3800  }
3801  else
3802  {
3803  path.emplace_back(XmlTagName::k_Unknown);
3804  }
3805  if (path.size() == 1 && path[0] == XmlTagName::k_Metadata)
3806  {
3807  ret.Details.Metadata = MetadataFromXml(reader);
3808  path.pop_back();
3809  }
3810  }
3811  else if (node.Type == _internal::XmlNodeType::Text)
3812  {
3813  if (path.size() == 1 && path[0] == XmlTagName::k_Name)
3814  {
3815  ret.Name = node.Value;
3816  }
3817  else if (
3818  path.size() == 2 && path[0] == XmlTagName::k_Properties
3819  && path[1] == XmlTagName::k_Etag)
3820  {
3821  ret.Details.ETag = Azure::ETag(node.Value);
3822  }
3823  else if (
3824  path.size() == 2 && path[0] == XmlTagName::k_Properties
3825  && path[1] == XmlTagName::k_LastModified)
3826  {
3827  ret.Details.LastModified
3828  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
3829  }
3830  else if (
3831  path.size() == 2 && path[0] == XmlTagName::k_Properties
3832  && path[1] == XmlTagName::k_PublicAccess)
3833  {
3834  ret.Details.AccessType = PublicAccessType(node.Value);
3835  }
3836  else if (
3837  path.size() == 2 && path[0] == XmlTagName::k_Properties
3838  && path[1] == XmlTagName::k_HasImmutabilityPolicy)
3839  {
3840  ret.Details.HasImmutabilityPolicy = std::strcmp(node.Value, "true") == 0;
3841  }
3842  else if (
3843  path.size() == 2 && path[0] == XmlTagName::k_Properties
3844  && path[1] == XmlTagName::k_HasLegalHold)
3845  {
3846  ret.Details.HasLegalHold = std::strcmp(node.Value, "true") == 0;
3847  }
3848  else if (
3849  path.size() == 2 && path[0] == XmlTagName::k_Properties
3850  && path[1] == XmlTagName::k_LeaseStatus)
3851  {
3852  ret.Details.LeaseStatus = LeaseStatus(node.Value);
3853  }
3854  else if (
3855  path.size() == 2 && path[0] == XmlTagName::k_Properties
3856  && path[1] == XmlTagName::k_LeaseState)
3857  {
3858  ret.Details.LeaseState = LeaseState(node.Value);
3859  }
3860  else if (
3861  path.size() == 2 && path[0] == XmlTagName::k_Properties
3862  && path[1] == XmlTagName::k_LeaseDuration)
3863  {
3864  ret.Details.LeaseDuration = LeaseDurationType(node.Value);
3865  }
3866  else if (
3867  path.size() == 2 && path[0] == XmlTagName::k_Properties
3868  && path[1] == XmlTagName::k_DefaultEncryptionScope)
3869  {
3870  ret.Details.DefaultEncryptionScope = node.Value;
3871  }
3872  else if (
3873  path.size() == 2 && path[0] == XmlTagName::k_Properties
3874  && path[1] == XmlTagName::k_DenyEncryptionScopeOverride)
3875  {
3876  ret.Details.PreventEncryptionScopeOverride = std::strcmp(node.Value, "true") == 0;
3877  }
3878  else if (path.size() == 1 && path[0] == XmlTagName::k_Deleted)
3879  {
3880  ret.IsDeleted = std::strcmp(node.Value, "true") == 0;
3881  }
3882  else if (path.size() == 1 && path[0] == XmlTagName::k_Version)
3883  {
3884  ret.VersionId = node.Value;
3885  }
3886  else if (
3887  path.size() == 2 && path[0] == XmlTagName::k_Properties
3888  && path[1] == XmlTagName::k_DeletedTime)
3889  {
3890  ret.Details.DeletedOn
3891  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
3892  }
3893  else if (
3894  path.size() == 2 && path[0] == XmlTagName::k_Properties
3895  && path[1] == XmlTagName::k_RemainingRetentionDays)
3896  {
3897  ret.Details.RemainingRetentionDays = std::stoi(node.Value);
3898  }
3899  }
3900  }
3901  return ret;
3902  }
3903 
3904  static CorsRule CorsRuleFromXml(_internal::XmlReader& reader)
3905  {
3906  CorsRule ret;
3907  enum class XmlTagName
3908  {
3909  k_AllowedOrigins,
3910  k_AllowedMethods,
3911  k_MaxAgeInSeconds,
3912  k_ExposedHeaders,
3913  k_AllowedHeaders,
3914  k_Unknown,
3915  };
3916  std::vector<XmlTagName> path;
3917  while (true)
3918  {
3919  auto node = reader.Read();
3920  if (node.Type == _internal::XmlNodeType::End)
3921  {
3922  break;
3923  }
3924  else if (node.Type == _internal::XmlNodeType::EndTag)
3925  {
3926  if (path.size() > 0)
3927  {
3928  path.pop_back();
3929  }
3930  else
3931  {
3932  break;
3933  }
3934  }
3935  else if (node.Type == _internal::XmlNodeType::StartTag)
3936  {
3937  if (std::strcmp(node.Name, "AllowedOrigins") == 0)
3938  {
3939  path.emplace_back(XmlTagName::k_AllowedOrigins);
3940  }
3941  else if (std::strcmp(node.Name, "AllowedMethods") == 0)
3942  {
3943  path.emplace_back(XmlTagName::k_AllowedMethods);
3944  }
3945  else if (std::strcmp(node.Name, "MaxAgeInSeconds") == 0)
3946  {
3947  path.emplace_back(XmlTagName::k_MaxAgeInSeconds);
3948  }
3949  else if (std::strcmp(node.Name, "ExposedHeaders") == 0)
3950  {
3951  path.emplace_back(XmlTagName::k_ExposedHeaders);
3952  }
3953  else if (std::strcmp(node.Name, "AllowedHeaders") == 0)
3954  {
3955  path.emplace_back(XmlTagName::k_AllowedHeaders);
3956  }
3957  else
3958  {
3959  path.emplace_back(XmlTagName::k_Unknown);
3960  }
3961  }
3962  else if (node.Type == _internal::XmlNodeType::Text)
3963  {
3964  if (path.size() == 1 && path[0] == XmlTagName::k_AllowedOrigins)
3965  {
3966  ret.AllowedOrigins = node.Value;
3967  }
3968  else if (path.size() == 1 && path[0] == XmlTagName::k_AllowedMethods)
3969  {
3970  ret.AllowedMethods = node.Value;
3971  }
3972  else if (path.size() == 1 && path[0] == XmlTagName::k_MaxAgeInSeconds)
3973  {
3974  ret.MaxAgeInSeconds = std::stoi(node.Value);
3975  }
3976  else if (path.size() == 1 && path[0] == XmlTagName::k_ExposedHeaders)
3977  {
3978  ret.ExposedHeaders = node.Value;
3979  }
3980  else if (path.size() == 1 && path[0] == XmlTagName::k_AllowedHeaders)
3981  {
3982  ret.AllowedHeaders = node.Value;
3983  }
3984  }
3985  }
3986  return ret;
3987  }
3988 
3989  static GeoReplication GeoReplicationFromXml(_internal::XmlReader& reader)
3990  {
3991  GeoReplication ret;
3992  enum class XmlTagName
3993  {
3994  k_Status,
3995  k_LastSyncTime,
3996  k_Unknown,
3997  };
3998  std::vector<XmlTagName> path;
3999  while (true)
4000  {
4001  auto node = reader.Read();
4002  if (node.Type == _internal::XmlNodeType::End)
4003  {
4004  break;
4005  }
4006  else if (node.Type == _internal::XmlNodeType::EndTag)
4007  {
4008  if (path.size() > 0)
4009  {
4010  path.pop_back();
4011  }
4012  else
4013  {
4014  break;
4015  }
4016  }
4017  else if (node.Type == _internal::XmlNodeType::StartTag)
4018  {
4019  if (std::strcmp(node.Name, "Status") == 0)
4020  {
4021  path.emplace_back(XmlTagName::k_Status);
4022  }
4023  else if (std::strcmp(node.Name, "LastSyncTime") == 0)
4024  {
4025  path.emplace_back(XmlTagName::k_LastSyncTime);
4026  }
4027  else
4028  {
4029  path.emplace_back(XmlTagName::k_Unknown);
4030  }
4031  }
4032  else if (node.Type == _internal::XmlNodeType::Text)
4033  {
4034  if (path.size() == 1 && path[0] == XmlTagName::k_Status)
4035  {
4036  ret.Status = GeoReplicationStatus(node.Value);
4037  }
4038  else if (path.size() == 1 && path[0] == XmlTagName::k_LastSyncTime)
4039  {
4040  ret.LastSyncedOn
4041  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
4042  }
4043  }
4044  }
4045  return ret;
4046  }
4047 
4048  static Metrics MetricsFromXml(_internal::XmlReader& reader)
4049  {
4050  Metrics ret;
4051  enum class XmlTagName
4052  {
4053  k_Version,
4054  k_Enabled,
4055  k_IncludeAPIs,
4056  k_RetentionPolicy,
4057  k_Unknown,
4058  };
4059  std::vector<XmlTagName> path;
4060  while (true)
4061  {
4062  auto node = reader.Read();
4063  if (node.Type == _internal::XmlNodeType::End)
4064  {
4065  break;
4066  }
4067  else if (node.Type == _internal::XmlNodeType::EndTag)
4068  {
4069  if (path.size() > 0)
4070  {
4071  path.pop_back();
4072  }
4073  else
4074  {
4075  break;
4076  }
4077  }
4078  else if (node.Type == _internal::XmlNodeType::StartTag)
4079  {
4080  if (std::strcmp(node.Name, "Version") == 0)
4081  {
4082  path.emplace_back(XmlTagName::k_Version);
4083  }
4084  else if (std::strcmp(node.Name, "Enabled") == 0)
4085  {
4086  path.emplace_back(XmlTagName::k_Enabled);
4087  }
4088  else if (std::strcmp(node.Name, "IncludeAPIs") == 0)
4089  {
4090  path.emplace_back(XmlTagName::k_IncludeAPIs);
4091  }
4092  else if (std::strcmp(node.Name, "RetentionPolicy") == 0)
4093  {
4094  path.emplace_back(XmlTagName::k_RetentionPolicy);
4095  }
4096  else
4097  {
4098  path.emplace_back(XmlTagName::k_Unknown);
4099  }
4100  if (path.size() == 1 && path[0] == XmlTagName::k_RetentionPolicy)
4101  {
4102  ret.RetentionPolicy = RetentionPolicyFromXml(reader);
4103  path.pop_back();
4104  }
4105  }
4106  else if (node.Type == _internal::XmlNodeType::Text)
4107  {
4108  if (path.size() == 1 && path[0] == XmlTagName::k_Version)
4109  {
4110  ret.Version = node.Value;
4111  }
4112  else if (path.size() == 1 && path[0] == XmlTagName::k_Enabled)
4113  {
4114  ret.IsEnabled = std::strcmp(node.Value, "true") == 0;
4115  }
4116  else if (path.size() == 1 && path[0] == XmlTagName::k_IncludeAPIs)
4117  {
4118  ret.IncludeApis = std::strcmp(node.Value, "true") == 0;
4119  }
4120  }
4121  }
4122  return ret;
4123  }
4124 
4125  static RetentionPolicy RetentionPolicyFromXml(_internal::XmlReader& reader)
4126  {
4127  RetentionPolicy ret;
4128  enum class XmlTagName
4129  {
4130  k_Enabled,
4131  k_Days,
4132  k_Unknown,
4133  };
4134  std::vector<XmlTagName> path;
4135  while (true)
4136  {
4137  auto node = reader.Read();
4138  if (node.Type == _internal::XmlNodeType::End)
4139  {
4140  break;
4141  }
4142  else if (node.Type == _internal::XmlNodeType::EndTag)
4143  {
4144  if (path.size() > 0)
4145  {
4146  path.pop_back();
4147  }
4148  else
4149  {
4150  break;
4151  }
4152  }
4153  else if (node.Type == _internal::XmlNodeType::StartTag)
4154  {
4155  if (std::strcmp(node.Name, "Enabled") == 0)
4156  {
4157  path.emplace_back(XmlTagName::k_Enabled);
4158  }
4159  else if (std::strcmp(node.Name, "Days") == 0)
4160  {
4161  path.emplace_back(XmlTagName::k_Days);
4162  }
4163  else
4164  {
4165  path.emplace_back(XmlTagName::k_Unknown);
4166  }
4167  }
4168  else if (node.Type == _internal::XmlNodeType::Text)
4169  {
4170  if (path.size() == 1 && path[0] == XmlTagName::k_Enabled)
4171  {
4172  ret.IsEnabled = std::strcmp(node.Value, "true") == 0;
4173  }
4174  else if (path.size() == 1 && path[0] == XmlTagName::k_Days)
4175  {
4176  ret.Days = std::stoi(node.Value);
4177  }
4178  }
4179  }
4180  return ret;
4181  }
4182 
4183  static StaticWebsite StaticWebsiteFromXml(_internal::XmlReader& reader)
4184  {
4185  StaticWebsite ret;
4186  enum class XmlTagName
4187  {
4188  k_Enabled,
4189  k_IndexDocument,
4190  k_DefaultIndexDocumentPath,
4191  k_ErrorDocument404Path,
4192  k_Unknown,
4193  };
4194  std::vector<XmlTagName> path;
4195  while (true)
4196  {
4197  auto node = reader.Read();
4198  if (node.Type == _internal::XmlNodeType::End)
4199  {
4200  break;
4201  }
4202  else if (node.Type == _internal::XmlNodeType::EndTag)
4203  {
4204  if (path.size() > 0)
4205  {
4206  path.pop_back();
4207  }
4208  else
4209  {
4210  break;
4211  }
4212  }
4213  else if (node.Type == _internal::XmlNodeType::StartTag)
4214  {
4215  if (std::strcmp(node.Name, "Enabled") == 0)
4216  {
4217  path.emplace_back(XmlTagName::k_Enabled);
4218  }
4219  else if (std::strcmp(node.Name, "IndexDocument") == 0)
4220  {
4221  path.emplace_back(XmlTagName::k_IndexDocument);
4222  }
4223  else if (std::strcmp(node.Name, "DefaultIndexDocumentPath") == 0)
4224  {
4225  path.emplace_back(XmlTagName::k_DefaultIndexDocumentPath);
4226  }
4227  else if (std::strcmp(node.Name, "ErrorDocument404Path") == 0)
4228  {
4229  path.emplace_back(XmlTagName::k_ErrorDocument404Path);
4230  }
4231  else
4232  {
4233  path.emplace_back(XmlTagName::k_Unknown);
4234  }
4235  }
4236  else if (node.Type == _internal::XmlNodeType::Text)
4237  {
4238  if (path.size() == 1 && path[0] == XmlTagName::k_Enabled)
4239  {
4240  ret.IsEnabled = std::strcmp(node.Value, "true") == 0;
4241  }
4242  else if (path.size() == 1 && path[0] == XmlTagName::k_IndexDocument)
4243  {
4244  ret.IndexDocument = node.Value;
4245  }
4246  else if (path.size() == 1 && path[0] == XmlTagName::k_DefaultIndexDocumentPath)
4247  {
4248  ret.DefaultIndexDocumentPath = node.Value;
4249  }
4250  else if (path.size() == 1 && path[0] == XmlTagName::k_ErrorDocument404Path)
4251  {
4252  ret.ErrorDocument404Path = node.Value;
4253  }
4254  }
4255  }
4256  return ret;
4257  }
4258 
4259  static TaggedBlobItem TaggedBlobItemFromXml(_internal::XmlReader& reader)
4260  {
4261  TaggedBlobItem ret;
4262  enum class XmlTagName
4263  {
4264  k_Name,
4265  k_ContainerName,
4266  k_Unknown,
4267  };
4268  std::vector<XmlTagName> path;
4269  while (true)
4270  {
4271  auto node = reader.Read();
4272  if (node.Type == _internal::XmlNodeType::End)
4273  {
4274  break;
4275  }
4276  else if (node.Type == _internal::XmlNodeType::EndTag)
4277  {
4278  if (path.size() > 0)
4279  {
4280  path.pop_back();
4281  }
4282  else
4283  {
4284  break;
4285  }
4286  }
4287  else if (node.Type == _internal::XmlNodeType::StartTag)
4288  {
4289  if (std::strcmp(node.Name, "Name") == 0)
4290  {
4291  path.emplace_back(XmlTagName::k_Name);
4292  }
4293  else if (std::strcmp(node.Name, "ContainerName") == 0)
4294  {
4295  path.emplace_back(XmlTagName::k_ContainerName);
4296  }
4297  else
4298  {
4299  path.emplace_back(XmlTagName::k_Unknown);
4300  }
4301  }
4302  else if (node.Type == _internal::XmlNodeType::Text)
4303  {
4304  if (path.size() == 1 && path[0] == XmlTagName::k_Name)
4305  {
4306  ret.BlobName = node.Value;
4307  }
4308  else if (path.size() == 1 && path[0] == XmlTagName::k_ContainerName)
4309  {
4310  ret.BlobContainerName = node.Value;
4311  }
4312  }
4313  }
4314  return ret;
4315  }
4316 
4317  static Metadata MetadataFromXml(_internal::XmlReader& reader)
4318  {
4319  Metadata ret;
4320  int depth = 0;
4321  std::string key;
4322  while (true)
4323  {
4324  auto node = reader.Read();
4325  if (node.Type == _internal::XmlNodeType::End)
4326  {
4327  break;
4328  }
4329  else if (node.Type == _internal::XmlNodeType::StartTag)
4330  {
4331  if (depth++ == 0)
4332  {
4333  key = node.Name;
4334  }
4335  }
4336  else if (node.Type == _internal::XmlNodeType::EndTag)
4337  {
4338  if (depth-- == 0)
4339  {
4340  break;
4341  }
4342  }
4343  else if (depth == 1 && node.Type == _internal::XmlNodeType::Text)
4344  {
4345  ret.emplace(std::move(key), std::string(node.Value));
4346  }
4347  }
4348  return ret;
4349  }
4350 
4351  static void GetUserDelegationKeyOptionsToXml(
4352  _internal::XmlWriter& writer,
4353  const GetUserDelegationKeyOptions& options)
4354  {
4355  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "KeyInfo"});
4356  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Start"});
4357  writer.Write(_internal::XmlNode{
4358  _internal::XmlNodeType::Text,
4359  nullptr,
4360  options.StartsOn
4361  .ToString(
4362  Azure::DateTime::DateFormat::Rfc3339,
4363  Azure::DateTime::TimeFractionFormat::Truncate)
4364  .data()});
4365  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4366  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Expiry"});
4367  writer.Write(_internal::XmlNode{
4368  _internal::XmlNodeType::Text,
4369  nullptr,
4370  options.ExpiresOn
4371  .ToString(
4372  Azure::DateTime::DateFormat::Rfc3339,
4373  Azure::DateTime::TimeFractionFormat::Truncate)
4374  .data()});
4375  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4376  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4377  }
4378 
4379  static void SetServicePropertiesOptionsToXml(
4380  _internal::XmlWriter& writer,
4381  const SetServicePropertiesOptions& options)
4382  {
4383  writer.Write(
4384  _internal::XmlNode{_internal::XmlNodeType::StartTag, "StorageServiceProperties"});
4385  BlobServicePropertiesToXml(writer, options.Properties);
4386  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4387  }
4388 
4389  static void BlobServicePropertiesToXml(
4390  _internal::XmlWriter& writer,
4391  const BlobServiceProperties& options)
4392  {
4393  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Logging"});
4394  AnalyticsLoggingToXml(writer, options.Logging);
4395  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4396  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "HourMetrics"});
4397  MetricsToXml(writer, options.HourMetrics);
4398  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4399  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "MinuteMetrics"});
4400  MetricsToXml(writer, options.MinuteMetrics);
4401  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4402  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Cors"});
4403  for (const auto& i : options.Cors)
4404  {
4405  CorsRuleToXml(writer, i);
4406  }
4407  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4408  if (options.DefaultServiceVersion.HasValue())
4409  {
4410  writer.Write(
4411  _internal::XmlNode{_internal::XmlNodeType::StartTag, "DefaultServiceVersion"});
4412  writer.Write(_internal::XmlNode{
4413  _internal::XmlNodeType::Text,
4414  nullptr,
4415  options.DefaultServiceVersion.Value().data()});
4416  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4417  }
4418  writer.Write(
4419  _internal::XmlNode{_internal::XmlNodeType::StartTag, "DeleteRetentionPolicy"});
4420  RetentionPolicyToXml(writer, options.DeleteRetentionPolicy);
4421  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4422  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "StaticWebsite"});
4423  StaticWebsiteToXml(writer, options.StaticWebsite);
4424  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4425  }
4426 
4427  static void AnalyticsLoggingToXml(
4428  _internal::XmlWriter& writer,
4429  const AnalyticsLogging& options)
4430  {
4431  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Version"});
4432  writer.Write(
4433  _internal::XmlNode{_internal::XmlNodeType::Text, nullptr, options.Version.data()});
4434  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4435  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Delete"});
4436  writer.Write(_internal::XmlNode{
4437  _internal::XmlNodeType::Text, nullptr, options.Delete ? "true" : "false"});
4438  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4439  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Read"});
4440  writer.Write(_internal::XmlNode{
4441  _internal::XmlNodeType::Text, nullptr, options.Read ? "true" : "false"});
4442  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4443  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Write"});
4444  writer.Write(_internal::XmlNode{
4445  _internal::XmlNodeType::Text, nullptr, options.Write ? "true" : "false"});
4446  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4447  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "RetentionPolicy"});
4448  RetentionPolicyToXml(writer, options.RetentionPolicy);
4449  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4450  }
4451 
4452  static void CorsRuleToXml(_internal::XmlWriter& writer, const CorsRule& options)
4453  {
4454  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "CorsRule"});
4455  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "AllowedOrigins"});
4456  writer.Write(_internal::XmlNode{
4457  _internal::XmlNodeType::Text, nullptr, options.AllowedOrigins.data()});
4458  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4459  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "AllowedMethods"});
4460  writer.Write(_internal::XmlNode{
4461  _internal::XmlNodeType::Text, nullptr, options.AllowedMethods.data()});
4462  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4463  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "AllowedHeaders"});
4464  writer.Write(_internal::XmlNode{
4465  _internal::XmlNodeType::Text, nullptr, options.AllowedHeaders.data()});
4466  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4467  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "ExposedHeaders"});
4468  writer.Write(_internal::XmlNode{
4469  _internal::XmlNodeType::Text, nullptr, options.ExposedHeaders.data()});
4470  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4471  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "MaxAgeInSeconds"});
4472  writer.Write(_internal::XmlNode{
4473  _internal::XmlNodeType::Text,
4474  nullptr,
4475  std::to_string(options.MaxAgeInSeconds).data()});
4476  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4477  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4478  }
4479 
4480  static void MetricsToXml(_internal::XmlWriter& writer, const Metrics& options)
4481  {
4482  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Version"});
4483  writer.Write(
4484  _internal::XmlNode{_internal::XmlNodeType::Text, nullptr, options.Version.data()});
4485  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4486  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Enabled"});
4487  writer.Write(_internal::XmlNode{
4488  _internal::XmlNodeType::Text, nullptr, options.IsEnabled ? "true" : "false"});
4489  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4490  if (options.IncludeApis.HasValue())
4491  {
4492  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "IncludeAPIs"});
4493  writer.Write(_internal::XmlNode{
4494  _internal::XmlNodeType::Text,
4495  nullptr,
4496  options.IncludeApis.Value() ? "true" : "false"});
4497  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4498  }
4499  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "RetentionPolicy"});
4500  RetentionPolicyToXml(writer, options.RetentionPolicy);
4501  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4502  }
4503 
4504  static void RetentionPolicyToXml(
4505  _internal::XmlWriter& writer,
4506  const RetentionPolicy& options)
4507  {
4508  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Enabled"});
4509  writer.Write(_internal::XmlNode{
4510  _internal::XmlNodeType::Text, nullptr, options.IsEnabled ? "true" : "false"});
4511  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4512  if (options.Days.HasValue())
4513  {
4514  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Days"});
4515  writer.Write(_internal::XmlNode{
4516  _internal::XmlNodeType::Text,
4517  nullptr,
4518  std::to_string(options.Days.Value()).data()});
4519  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4520  }
4521  }
4522 
4523  static void StaticWebsiteToXml(_internal::XmlWriter& writer, const StaticWebsite& options)
4524  {
4525  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Enabled"});
4526  writer.Write(_internal::XmlNode{
4527  _internal::XmlNodeType::Text, nullptr, options.IsEnabled ? "true" : "false"});
4528  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4529  if (options.IndexDocument.HasValue())
4530  {
4531  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "IndexDocument"});
4532  writer.Write(_internal::XmlNode{
4533  _internal::XmlNodeType::Text, nullptr, options.IndexDocument.Value().data()});
4534  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4535  }
4536  if (options.DefaultIndexDocumentPath.HasValue())
4537  {
4538  writer.Write(
4539  _internal::XmlNode{_internal::XmlNodeType::StartTag, "DefaultIndexDocumentPath"});
4540  writer.Write(_internal::XmlNode{
4541  _internal::XmlNodeType::Text,
4542  nullptr,
4543  options.DefaultIndexDocumentPath.Value().data()});
4544  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4545  }
4546  if (options.ErrorDocument404Path.HasValue())
4547  {
4548  writer.Write(
4549  _internal::XmlNode{_internal::XmlNodeType::StartTag, "ErrorDocument404Path"});
4550  writer.Write(_internal::XmlNode{
4551  _internal::XmlNodeType::Text,
4552  nullptr,
4553  options.ErrorDocument404Path.Value().data()});
4554  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
4555  }
4556  }
4557 
4558  }; // class Service
4559 
4560  class BlobContainer final {
4561  public:
4562  struct CreateBlobContainerOptions final
4563  {
4564  Azure::Nullable<int32_t> Timeout;
4565  PublicAccessType AccessType = PublicAccessType::None;
4566  Storage::Metadata Metadata;
4567  Azure::Nullable<std::string> DefaultEncryptionScope;
4568  Azure::Nullable<bool> PreventEncryptionScopeOverride;
4569  }; // struct CreateBlobContainerOptions
4570 
4571  static Azure::Response<CreateBlobContainerResult> Create(
4572  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4573  const Azure::Core::Url& url,
4574  const CreateBlobContainerOptions& options,
4575  const Azure::Core::Context& context)
4576  {
4577  (void)options;
4578  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
4579  request.SetHeader("Content-Length", "0");
4580  request.GetUrl().AppendQueryParameter("restype", "container");
4581  request.SetHeader("x-ms-version", "2020-02-10");
4582  if (options.Timeout.HasValue())
4583  {
4584  request.GetUrl().AppendQueryParameter(
4585  "timeout", std::to_string(options.Timeout.Value()));
4586  }
4587  for (const auto& pair : options.Metadata)
4588  {
4589  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
4590  }
4591  if (!options.AccessType.ToString().empty())
4592  {
4593  request.SetHeader("x-ms-blob-public-access", options.AccessType.ToString());
4594  }
4595  if (options.DefaultEncryptionScope.HasValue())
4596  {
4597  request.SetHeader(
4598  "x-ms-default-encryption-scope", options.DefaultEncryptionScope.Value());
4599  }
4600  if (options.PreventEncryptionScopeOverride.HasValue())
4601  {
4602  request.SetHeader(
4603  "x-ms-deny-encryption-scope-override",
4604  options.PreventEncryptionScopeOverride.Value() ? "true" : "false");
4605  }
4606  auto pHttpResponse = pipeline.Send(request, context);
4607  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4608  CreateBlobContainerResult response;
4609  auto http_status_code
4610  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4611  httpResponse.GetStatusCode());
4612  if (!(http_status_code == 201))
4613  {
4614  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4615  }
4616  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
4617  response.LastModified = Azure::DateTime::Parse(
4618  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
4619  return Azure::Response<CreateBlobContainerResult>(
4620  std::move(response), std::move(pHttpResponse));
4621  }
4622 
4623  struct DeleteBlobContainerOptions final
4624  {
4625  Azure::Nullable<int32_t> Timeout;
4626  Azure::Nullable<std::string> LeaseId;
4627  Azure::Nullable<Azure::DateTime> IfModifiedSince;
4628  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
4629  }; // struct DeleteBlobContainerOptions
4630 
4631  static Azure::Response<DeleteBlobContainerResult> Delete(
4632  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4633  const Azure::Core::Url& url,
4634  const DeleteBlobContainerOptions& options,
4635  const Azure::Core::Context& context)
4636  {
4637  (void)options;
4638  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Delete, url);
4639  request.GetUrl().AppendQueryParameter("restype", "container");
4640  request.SetHeader("x-ms-version", "2020-02-10");
4641  if (options.Timeout.HasValue())
4642  {
4643  request.GetUrl().AppendQueryParameter(
4644  "timeout", std::to_string(options.Timeout.Value()));
4645  }
4646  if (options.LeaseId.HasValue())
4647  {
4648  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
4649  }
4650  if (options.IfModifiedSince.HasValue())
4651  {
4652  request.SetHeader(
4653  "If-Modified-Since",
4654  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
4655  }
4656  if (options.IfUnmodifiedSince.HasValue())
4657  {
4658  request.SetHeader(
4659  "If-Unmodified-Since",
4660  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
4661  }
4662  auto pHttpResponse = pipeline.Send(request, context);
4663  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4664  DeleteBlobContainerResult response;
4665  auto http_status_code
4666  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4667  httpResponse.GetStatusCode());
4668  if (!(http_status_code == 202))
4669  {
4670  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4671  }
4672  return Azure::Response<DeleteBlobContainerResult>(
4673  std::move(response), std::move(pHttpResponse));
4674  }
4675 
4676  struct UndeleteBlobContainerOptions final
4677  {
4678  Azure::Nullable<int32_t> Timeout;
4679  std::string DeletedBlobContainerName;
4680  std::string DeletedBlobContainerVersion;
4681  }; // struct UndeleteBlobContainerOptions
4682 
4683  static Azure::Response<Models::_detail::UndeleteBlobContainerResult> Undelete(
4684  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4685  const Azure::Core::Url& url,
4686  const UndeleteBlobContainerOptions& options,
4687  const Azure::Core::Context& context)
4688  {
4689  (void)options;
4690  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
4691  request.SetHeader("Content-Length", "0");
4692  request.GetUrl().AppendQueryParameter("restype", "container");
4693  request.GetUrl().AppendQueryParameter("comp", "undelete");
4694  request.SetHeader("x-ms-version", "2020-02-10");
4695  if (options.Timeout.HasValue())
4696  {
4697  request.GetUrl().AppendQueryParameter(
4698  "timeout", std::to_string(options.Timeout.Value()));
4699  }
4700  request.SetHeader("x-ms-deleted-container-name", options.DeletedBlobContainerName);
4701  request.SetHeader("x-ms-deleted-container-version", options.DeletedBlobContainerVersion);
4702  auto pHttpResponse = pipeline.Send(request, context);
4703  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4704  Models::_detail::UndeleteBlobContainerResult response;
4705  auto http_status_code
4706  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4707  httpResponse.GetStatusCode());
4708  if (!(http_status_code == 201))
4709  {
4710  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4711  }
4712  return Azure::Response<Models::_detail::UndeleteBlobContainerResult>(
4713  std::move(response), std::move(pHttpResponse));
4714  }
4715 
4716  struct GetBlobContainerPropertiesOptions final
4717  {
4718  Azure::Nullable<int32_t> Timeout;
4719  Azure::Nullable<std::string> LeaseId;
4720  }; // struct GetBlobContainerPropertiesOptions
4721 
4722  static Azure::Response<BlobContainerProperties> GetProperties(
4723  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4724  const Azure::Core::Url& url,
4725  const GetBlobContainerPropertiesOptions& options,
4726  const Azure::Core::Context& context)
4727  {
4728  (void)options;
4729  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Head, url);
4730  request.GetUrl().AppendQueryParameter("restype", "container");
4731  request.SetHeader("x-ms-version", "2020-02-10");
4732  if (options.Timeout.HasValue())
4733  {
4734  request.GetUrl().AppendQueryParameter(
4735  "timeout", std::to_string(options.Timeout.Value()));
4736  }
4737  if (options.LeaseId.HasValue())
4738  {
4739  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
4740  }
4741  auto pHttpResponse = pipeline.Send(request, context);
4742  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4743  BlobContainerProperties response;
4744  auto http_status_code
4745  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4746  httpResponse.GetStatusCode());
4747  if (!(http_status_code == 200))
4748  {
4749  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4750  }
4751  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
4752  response.LastModified = Azure::DateTime::Parse(
4753  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
4754  for (auto i = httpResponse.GetHeaders().lower_bound("x-ms-meta-");
4755  i != httpResponse.GetHeaders().end() && i->first.substr(0, 10) == "x-ms-meta-";
4756  ++i)
4757  {
4758  response.Metadata.emplace(i->first.substr(10), i->second);
4759  }
4760  auto x_ms_blob_public_access__iterator
4761  = httpResponse.GetHeaders().find("x-ms-blob-public-access");
4762  if (x_ms_blob_public_access__iterator != httpResponse.GetHeaders().end())
4763  {
4764  response.AccessType = PublicAccessType(x_ms_blob_public_access__iterator->second);
4765  }
4766  response.HasImmutabilityPolicy
4767  = httpResponse.GetHeaders().at("x-ms-has-immutability-policy") == "true";
4768  response.HasLegalHold = httpResponse.GetHeaders().at("x-ms-has-legal-hold") == "true";
4769  response.LeaseStatus = LeaseStatus(httpResponse.GetHeaders().at("x-ms-lease-status"));
4770  response.LeaseState = LeaseState(httpResponse.GetHeaders().at("x-ms-lease-state"));
4771  auto x_ms_lease_duration__iterator
4772  = httpResponse.GetHeaders().find("x-ms-lease-duration");
4773  if (x_ms_lease_duration__iterator != httpResponse.GetHeaders().end())
4774  {
4775  response.LeaseDuration = LeaseDurationType(x_ms_lease_duration__iterator->second);
4776  }
4777  response.DefaultEncryptionScope
4778  = httpResponse.GetHeaders().at("x-ms-default-encryption-scope");
4779  response.PreventEncryptionScopeOverride
4780  = httpResponse.GetHeaders().at("x-ms-deny-encryption-scope-override") == "true";
4781  return Azure::Response<BlobContainerProperties>(
4782  std::move(response), std::move(pHttpResponse));
4783  }
4784 
4785  struct SetBlobContainerMetadataOptions final
4786  {
4787  Azure::Nullable<int32_t> Timeout;
4788  Storage::Metadata Metadata;
4789  Azure::Nullable<std::string> LeaseId;
4790  Azure::Nullable<Azure::DateTime> IfModifiedSince;
4791  }; // struct SetBlobContainerMetadataOptions
4792 
4793  static Azure::Response<SetBlobContainerMetadataResult> SetMetadata(
4794  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4795  const Azure::Core::Url& url,
4796  const SetBlobContainerMetadataOptions& options,
4797  const Azure::Core::Context& context)
4798  {
4799  (void)options;
4800  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
4801  request.SetHeader("Content-Length", "0");
4802  request.GetUrl().AppendQueryParameter("restype", "container");
4803  request.GetUrl().AppendQueryParameter("comp", "metadata");
4804  request.SetHeader("x-ms-version", "2020-02-10");
4805  if (options.Timeout.HasValue())
4806  {
4807  request.GetUrl().AppendQueryParameter(
4808  "timeout", std::to_string(options.Timeout.Value()));
4809  }
4810  for (const auto& pair : options.Metadata)
4811  {
4812  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
4813  }
4814  if (options.LeaseId.HasValue())
4815  {
4816  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
4817  }
4818  if (options.IfModifiedSince.HasValue())
4819  {
4820  request.SetHeader(
4821  "If-Modified-Since",
4822  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
4823  }
4824  auto pHttpResponse = pipeline.Send(request, context);
4825  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4826  SetBlobContainerMetadataResult response;
4827  auto http_status_code
4828  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4829  httpResponse.GetStatusCode());
4830  if (!(http_status_code == 200))
4831  {
4832  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4833  }
4834  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
4835  response.LastModified = Azure::DateTime::Parse(
4836  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
4837  return Azure::Response<SetBlobContainerMetadataResult>(
4838  std::move(response), std::move(pHttpResponse));
4839  }
4840 
4841  struct ListBlobsOptions final
4842  {
4843  Azure::Nullable<int32_t> Timeout;
4844  Azure::Nullable<std::string> Prefix;
4845  Azure::Nullable<std::string> ContinuationToken;
4846  Azure::Nullable<int32_t> MaxResults;
4847  ListBlobsIncludeFlags Include = ListBlobsIncludeFlags::None;
4848  }; // struct ListBlobsOptions
4849 
4850  static Azure::Response<Models::_detail::ListBlobsResult> ListBlobs(
4851  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4852  const Azure::Core::Url& url,
4853  const ListBlobsOptions& options,
4854  const Azure::Core::Context& context)
4855  {
4856  (void)options;
4857  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
4858  request.SetHeader("x-ms-version", "2020-02-10");
4859  if (options.Timeout.HasValue())
4860  {
4861  request.GetUrl().AppendQueryParameter(
4862  "timeout", std::to_string(options.Timeout.Value()));
4863  }
4864  request.GetUrl().AppendQueryParameter("restype", "container");
4865  request.GetUrl().AppendQueryParameter("comp", "list");
4866  if (options.Prefix.HasValue())
4867  {
4868  request.GetUrl().AppendQueryParameter(
4869  "prefix", _internal::UrlEncodeQueryParameter(options.Prefix.Value()));
4870  }
4871  if (options.ContinuationToken.HasValue())
4872  {
4873  request.GetUrl().AppendQueryParameter(
4874  "marker", _internal::UrlEncodeQueryParameter(options.ContinuationToken.Value()));
4875  }
4876  if (options.MaxResults.HasValue())
4877  {
4878  request.GetUrl().AppendQueryParameter(
4879  "maxresults", std::to_string(options.MaxResults.Value()));
4880  }
4881  std::string list_blobs_include_flags = ListBlobsIncludeFlagsToString(options.Include);
4882  if (!list_blobs_include_flags.empty())
4883  {
4884  request.GetUrl().AppendQueryParameter(
4885  "include", _internal::UrlEncodeQueryParameter(list_blobs_include_flags));
4886  }
4887  auto pHttpResponse = pipeline.Send(request, context);
4888  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4889  Models::_detail::ListBlobsResult response;
4890  auto http_status_code
4891  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4892  httpResponse.GetStatusCode());
4893  if (!(http_status_code == 200))
4894  {
4895  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4896  }
4897  {
4898  const auto& httpResponseBody = httpResponse.GetBody();
4899  _internal::XmlReader reader(
4900  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
4901  response = ListBlobsResultInternalFromXml(reader);
4902  }
4903  return Azure::Response<Models::_detail::ListBlobsResult>(
4904  std::move(response), std::move(pHttpResponse));
4905  }
4906 
4907  struct ListBlobsByHierarchyOptions final
4908  {
4909  Azure::Nullable<int32_t> Timeout;
4910  Azure::Nullable<std::string> Prefix;
4911  Azure::Nullable<std::string> Delimiter;
4912  Azure::Nullable<std::string> ContinuationToken;
4913  Azure::Nullable<int32_t> MaxResults;
4914  ListBlobsIncludeFlags Include = ListBlobsIncludeFlags::None;
4915  }; // struct ListBlobsByHierarchyOptions
4916 
4917  static Azure::Response<Models::_detail::ListBlobsByHierarchyResult> ListBlobsByHierarchy(
4918  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4919  const Azure::Core::Url& url,
4920  const ListBlobsByHierarchyOptions& options,
4921  const Azure::Core::Context& context)
4922  {
4923  (void)options;
4924  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
4925  request.SetHeader("x-ms-version", "2020-02-10");
4926  if (options.Timeout.HasValue())
4927  {
4928  request.GetUrl().AppendQueryParameter(
4929  "timeout", std::to_string(options.Timeout.Value()));
4930  }
4931  request.GetUrl().AppendQueryParameter("restype", "container");
4932  request.GetUrl().AppendQueryParameter("comp", "list");
4933  if (options.Prefix.HasValue())
4934  {
4935  request.GetUrl().AppendQueryParameter(
4936  "prefix", _internal::UrlEncodeQueryParameter(options.Prefix.Value()));
4937  }
4938  if (options.Delimiter.HasValue())
4939  {
4940  request.GetUrl().AppendQueryParameter(
4941  "delimiter", _internal::UrlEncodeQueryParameter(options.Delimiter.Value()));
4942  }
4943  if (options.ContinuationToken.HasValue())
4944  {
4945  request.GetUrl().AppendQueryParameter(
4946  "marker", _internal::UrlEncodeQueryParameter(options.ContinuationToken.Value()));
4947  }
4948  if (options.MaxResults.HasValue())
4949  {
4950  request.GetUrl().AppendQueryParameter(
4951  "maxresults", std::to_string(options.MaxResults.Value()));
4952  }
4953  std::string list_blobs_include_flags = ListBlobsIncludeFlagsToString(options.Include);
4954  if (!list_blobs_include_flags.empty())
4955  {
4956  request.GetUrl().AppendQueryParameter(
4957  "include", _internal::UrlEncodeQueryParameter(list_blobs_include_flags));
4958  }
4959  auto pHttpResponse = pipeline.Send(request, context);
4960  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
4961  Models::_detail::ListBlobsByHierarchyResult response;
4962  auto http_status_code
4963  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
4964  httpResponse.GetStatusCode());
4965  if (!(http_status_code == 200))
4966  {
4967  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
4968  }
4969  {
4970  const auto& httpResponseBody = httpResponse.GetBody();
4971  _internal::XmlReader reader(
4972  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
4973  response = ListBlobsByHierarchyResultInternalFromXml(reader);
4974  }
4975  return Azure::Response<Models::_detail::ListBlobsByHierarchyResult>(
4976  std::move(response), std::move(pHttpResponse));
4977  }
4978 
4979  struct GetBlobContainerAccessPolicyOptions final
4980  {
4981  Azure::Nullable<int32_t> Timeout;
4982  Azure::Nullable<std::string> LeaseId;
4983  }; // struct GetBlobContainerAccessPolicyOptions
4984 
4985  static Azure::Response<BlobContainerAccessPolicy> GetAccessPolicy(
4986  Azure::Core::Http::_internal::HttpPipeline& pipeline,
4987  const Azure::Core::Url& url,
4988  const GetBlobContainerAccessPolicyOptions& options,
4989  const Azure::Core::Context& context)
4990  {
4991  (void)options;
4992  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
4993  request.SetHeader("x-ms-version", "2020-02-10");
4994  if (options.Timeout.HasValue())
4995  {
4996  request.GetUrl().AppendQueryParameter(
4997  "timeout", std::to_string(options.Timeout.Value()));
4998  }
4999  request.GetUrl().AppendQueryParameter("restype", "container");
5000  request.GetUrl().AppendQueryParameter("comp", "acl");
5001  auto pHttpResponse = pipeline.Send(request, context);
5002  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5003  BlobContainerAccessPolicy response;
5004  auto http_status_code
5005  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5006  httpResponse.GetStatusCode());
5007  if (!(http_status_code == 200))
5008  {
5009  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5010  }
5011  {
5012  const auto& httpResponseBody = httpResponse.GetBody();
5013  _internal::XmlReader reader(
5014  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
5015  response = BlobContainerAccessPolicyFromXml(reader);
5016  }
5017  auto x_ms_blob_public_access__iterator
5018  = httpResponse.GetHeaders().find("x-ms-blob-public-access");
5019  if (x_ms_blob_public_access__iterator != httpResponse.GetHeaders().end())
5020  {
5021  response.AccessType = PublicAccessType(x_ms_blob_public_access__iterator->second);
5022  }
5023  return Azure::Response<BlobContainerAccessPolicy>(
5024  std::move(response), std::move(pHttpResponse));
5025  }
5026 
5027  struct SetBlobContainerAccessPolicyOptions final
5028  {
5029  Azure::Nullable<int32_t> Timeout;
5030  PublicAccessType AccessType = PublicAccessType::None;
5031  Azure::Nullable<std::string> LeaseId;
5032  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5033  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5034  std::vector<SignedIdentifier> SignedIdentifiers;
5035  }; // struct SetBlobContainerAccessPolicyOptions
5036 
5037  static Azure::Response<SetBlobContainerAccessPolicyResult> SetAccessPolicy(
5038  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5039  const Azure::Core::Url& url,
5040  const SetBlobContainerAccessPolicyOptions& options,
5041  const Azure::Core::Context& context)
5042  {
5043  (void)options;
5044  std::string xml_body;
5045  {
5046  _internal::XmlWriter writer;
5047  SetBlobContainerAccessPolicyOptionsToXml(writer, options);
5048  xml_body = writer.GetDocument();
5049  writer.Write(_internal::XmlNode{_internal::XmlNodeType::End});
5050  }
5051  Azure::Core::IO::MemoryBodyStream xml_body_stream(
5052  reinterpret_cast<const uint8_t*>(xml_body.data()), xml_body.length());
5053  auto request = Azure::Core::Http::Request(
5054  Azure::Core::Http::HttpMethod::Put, url, &xml_body_stream);
5055  request.SetHeader("Content-Length", std::to_string(xml_body_stream.Length()));
5056  request.SetHeader("x-ms-version", "2020-02-10");
5057  if (options.Timeout.HasValue())
5058  {
5059  request.GetUrl().AppendQueryParameter(
5060  "timeout", std::to_string(options.Timeout.Value()));
5061  }
5062  request.GetUrl().AppendQueryParameter("restype", "container");
5063  request.GetUrl().AppendQueryParameter("comp", "acl");
5064  if (!options.AccessType.ToString().empty())
5065  {
5066  request.SetHeader("x-ms-blob-public-access", options.AccessType.ToString());
5067  }
5068  if (options.LeaseId.HasValue())
5069  {
5070  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
5071  }
5072  if (options.IfModifiedSince.HasValue())
5073  {
5074  request.SetHeader(
5075  "If-Modified-Since",
5076  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5077  }
5078  if (options.IfUnmodifiedSince.HasValue())
5079  {
5080  request.SetHeader(
5081  "If-Unmodified-Since",
5082  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5083  }
5084  auto pHttpResponse = pipeline.Send(request, context);
5085  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5086  SetBlobContainerAccessPolicyResult response;
5087  auto http_status_code
5088  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5089  httpResponse.GetStatusCode());
5090  if (!(http_status_code == 200))
5091  {
5092  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5093  }
5094  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5095  response.LastModified = Azure::DateTime::Parse(
5096  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5097  return Azure::Response<SetBlobContainerAccessPolicyResult>(
5098  std::move(response), std::move(pHttpResponse));
5099  }
5100 
5101  struct AcquireBlobContainerLeaseOptions final
5102  {
5103  Azure::Nullable<int32_t> Timeout;
5104  std::chrono::seconds LeaseDuration;
5105  Azure::Nullable<std::string> ProposedLeaseId;
5106  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5107  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5108  }; // struct AcquireBlobContainerLeaseOptions
5109 
5110  static Azure::Response<Models::_detail::AcquireBlobContainerLeaseResult> AcquireLease(
5111  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5112  const Azure::Core::Url& url,
5113  const AcquireBlobContainerLeaseOptions& options,
5114  const Azure::Core::Context& context)
5115  {
5116  (void)options;
5117  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
5118  request.SetHeader("Content-Length", "0");
5119  request.SetHeader("x-ms-version", "2020-02-10");
5120  if (options.Timeout.HasValue())
5121  {
5122  request.GetUrl().AppendQueryParameter(
5123  "timeout", std::to_string(options.Timeout.Value()));
5124  }
5125  request.GetUrl().AppendQueryParameter("restype", "container");
5126  request.GetUrl().AppendQueryParameter("comp", "lease");
5127  request.SetHeader("x-ms-lease-action", "acquire");
5128  request.SetHeader("x-ms-lease-duration", std::to_string(options.LeaseDuration.count()));
5129  if (options.ProposedLeaseId.HasValue())
5130  {
5131  request.SetHeader("x-ms-proposed-lease-id", options.ProposedLeaseId.Value());
5132  }
5133  if (options.IfModifiedSince.HasValue())
5134  {
5135  request.SetHeader(
5136  "If-Modified-Since",
5137  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5138  }
5139  if (options.IfUnmodifiedSince.HasValue())
5140  {
5141  request.SetHeader(
5142  "If-Unmodified-Since",
5143  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5144  }
5145  auto pHttpResponse = pipeline.Send(request, context);
5146  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5147  Models::_detail::AcquireBlobContainerLeaseResult response;
5148  auto http_status_code
5149  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5150  httpResponse.GetStatusCode());
5151  if (!(http_status_code == 201))
5152  {
5153  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5154  }
5155  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5156  response.LastModified = Azure::DateTime::Parse(
5157  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5158  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
5159  return Azure::Response<Models::_detail::AcquireBlobContainerLeaseResult>(
5160  std::move(response), std::move(pHttpResponse));
5161  }
5162 
5163  struct RenewBlobContainerLeaseOptions final
5164  {
5165  Azure::Nullable<int32_t> Timeout;
5166  std::string LeaseId;
5167  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5168  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5169  }; // struct RenewBlobContainerLeaseOptions
5170 
5171  static Azure::Response<Models::_detail::RenewBlobContainerLeaseResult> RenewLease(
5172  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5173  const Azure::Core::Url& url,
5174  const RenewBlobContainerLeaseOptions& options,
5175  const Azure::Core::Context& context)
5176  {
5177  (void)options;
5178  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
5179  request.SetHeader("Content-Length", "0");
5180  request.SetHeader("x-ms-version", "2020-02-10");
5181  if (options.Timeout.HasValue())
5182  {
5183  request.GetUrl().AppendQueryParameter(
5184  "timeout", std::to_string(options.Timeout.Value()));
5185  }
5186  request.GetUrl().AppendQueryParameter("restype", "container");
5187  request.GetUrl().AppendQueryParameter("comp", "lease");
5188  request.SetHeader("x-ms-lease-action", "renew");
5189  request.SetHeader("x-ms-lease-id", options.LeaseId);
5190  if (options.IfModifiedSince.HasValue())
5191  {
5192  request.SetHeader(
5193  "If-Modified-Since",
5194  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5195  }
5196  if (options.IfUnmodifiedSince.HasValue())
5197  {
5198  request.SetHeader(
5199  "If-Unmodified-Since",
5200  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5201  }
5202  auto pHttpResponse = pipeline.Send(request, context);
5203  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5204  Models::_detail::RenewBlobContainerLeaseResult response;
5205  auto http_status_code
5206  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5207  httpResponse.GetStatusCode());
5208  if (!(http_status_code == 200))
5209  {
5210  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5211  }
5212  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5213  response.LastModified = Azure::DateTime::Parse(
5214  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5215  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
5216  return Azure::Response<Models::_detail::RenewBlobContainerLeaseResult>(
5217  std::move(response), std::move(pHttpResponse));
5218  }
5219 
5220  struct ChangeBlobContainerLeaseOptions final
5221  {
5222  Azure::Nullable<int32_t> Timeout;
5223  std::string LeaseId;
5224  std::string ProposedLeaseId;
5225  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5226  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5227  }; // struct ChangeBlobContainerLeaseOptions
5228 
5229  static Azure::Response<Models::_detail::ChangeBlobContainerLeaseResult> ChangeLease(
5230  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5231  const Azure::Core::Url& url,
5232  const ChangeBlobContainerLeaseOptions& options,
5233  const Azure::Core::Context& context)
5234  {
5235  (void)options;
5236  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
5237  request.SetHeader("Content-Length", "0");
5238  request.SetHeader("x-ms-version", "2020-02-10");
5239  if (options.Timeout.HasValue())
5240  {
5241  request.GetUrl().AppendQueryParameter(
5242  "timeout", std::to_string(options.Timeout.Value()));
5243  }
5244  request.GetUrl().AppendQueryParameter("restype", "container");
5245  request.GetUrl().AppendQueryParameter("comp", "lease");
5246  request.SetHeader("x-ms-lease-action", "change");
5247  request.SetHeader("x-ms-lease-id", options.LeaseId);
5248  request.SetHeader("x-ms-proposed-lease-id", options.ProposedLeaseId);
5249  if (options.IfModifiedSince.HasValue())
5250  {
5251  request.SetHeader(
5252  "If-Modified-Since",
5253  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5254  }
5255  if (options.IfUnmodifiedSince.HasValue())
5256  {
5257  request.SetHeader(
5258  "If-Unmodified-Since",
5259  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5260  }
5261  auto pHttpResponse = pipeline.Send(request, context);
5262  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5263  Models::_detail::ChangeBlobContainerLeaseResult response;
5264  auto http_status_code
5265  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5266  httpResponse.GetStatusCode());
5267  if (!(http_status_code == 200))
5268  {
5269  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5270  }
5271  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5272  response.LastModified = Azure::DateTime::Parse(
5273  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5274  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
5275  return Azure::Response<Models::_detail::ChangeBlobContainerLeaseResult>(
5276  std::move(response), std::move(pHttpResponse));
5277  }
5278 
5279  struct ReleaseBlobContainerLeaseOptions final
5280  {
5281  Azure::Nullable<int32_t> Timeout;
5282  std::string LeaseId;
5283  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5284  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5285  }; // struct ReleaseBlobContainerLeaseOptions
5286 
5287  static Azure::Response<Models::_detail::ReleaseBlobContainerLeaseResult> ReleaseLease(
5288  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5289  const Azure::Core::Url& url,
5290  const ReleaseBlobContainerLeaseOptions& options,
5291  const Azure::Core::Context& context)
5292  {
5293  (void)options;
5294  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
5295  request.SetHeader("Content-Length", "0");
5296  request.SetHeader("x-ms-version", "2020-02-10");
5297  if (options.Timeout.HasValue())
5298  {
5299  request.GetUrl().AppendQueryParameter(
5300  "timeout", std::to_string(options.Timeout.Value()));
5301  }
5302  request.GetUrl().AppendQueryParameter("restype", "container");
5303  request.GetUrl().AppendQueryParameter("comp", "lease");
5304  request.SetHeader("x-ms-lease-action", "release");
5305  request.SetHeader("x-ms-lease-id", options.LeaseId);
5306  if (options.IfModifiedSince.HasValue())
5307  {
5308  request.SetHeader(
5309  "If-Modified-Since",
5310  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5311  }
5312  if (options.IfUnmodifiedSince.HasValue())
5313  {
5314  request.SetHeader(
5315  "If-Unmodified-Since",
5316  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5317  }
5318  auto pHttpResponse = pipeline.Send(request, context);
5319  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5320  Models::_detail::ReleaseBlobContainerLeaseResult response;
5321  auto http_status_code
5322  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5323  httpResponse.GetStatusCode());
5324  if (!(http_status_code == 200))
5325  {
5326  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5327  }
5328  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5329  response.LastModified = Azure::DateTime::Parse(
5330  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5331  return Azure::Response<Models::_detail::ReleaseBlobContainerLeaseResult>(
5332  std::move(response), std::move(pHttpResponse));
5333  }
5334 
5335  struct BreakBlobContainerLeaseOptions final
5336  {
5337  Azure::Nullable<int32_t> Timeout;
5338  Azure::Nullable<std::chrono::seconds> BreakPeriod;
5339  Azure::Nullable<Azure::DateTime> IfModifiedSince;
5340  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
5341  }; // struct BreakBlobContainerLeaseOptions
5342 
5343  static Azure::Response<Models::_detail::BreakBlobContainerLeaseResult> BreakLease(
5344  Azure::Core::Http::_internal::HttpPipeline& pipeline,
5345  const Azure::Core::Url& url,
5346  const BreakBlobContainerLeaseOptions& options,
5347  const Azure::Core::Context& context)
5348  {
5349  (void)options;
5350  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
5351  request.SetHeader("Content-Length", "0");
5352  request.SetHeader("x-ms-version", "2020-02-10");
5353  if (options.Timeout.HasValue())
5354  {
5355  request.GetUrl().AppendQueryParameter(
5356  "timeout", std::to_string(options.Timeout.Value()));
5357  }
5358  request.GetUrl().AppendQueryParameter("restype", "container");
5359  request.GetUrl().AppendQueryParameter("comp", "lease");
5360  request.SetHeader("x-ms-lease-action", "break");
5361  if (options.BreakPeriod.HasValue())
5362  {
5363  request.SetHeader(
5364  "x-ms-lease-break-period", std::to_string(options.BreakPeriod.Value().count()));
5365  }
5366  if (options.IfModifiedSince.HasValue())
5367  {
5368  request.SetHeader(
5369  "If-Modified-Since",
5370  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5371  }
5372  if (options.IfUnmodifiedSince.HasValue())
5373  {
5374  request.SetHeader(
5375  "If-Unmodified-Since",
5376  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
5377  }
5378  auto pHttpResponse = pipeline.Send(request, context);
5379  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
5380  Models::_detail::BreakBlobContainerLeaseResult response;
5381  auto http_status_code
5382  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
5383  httpResponse.GetStatusCode());
5384  if (!(http_status_code == 202))
5385  {
5386  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
5387  }
5388  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
5389  response.LastModified = Azure::DateTime::Parse(
5390  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
5391  response.LeaseTime = std::stoi(httpResponse.GetHeaders().at("x-ms-lease-time"));
5392  return Azure::Response<Models::_detail::BreakBlobContainerLeaseResult>(
5393  std::move(response), std::move(pHttpResponse));
5394  }
5395 
5396  private:
5397  static BlobContainerAccessPolicy BlobContainerAccessPolicyFromXml(
5398  _internal::XmlReader& reader)
5399  {
5400  BlobContainerAccessPolicy ret;
5401  enum class XmlTagName
5402  {
5403  k_SignedIdentifiers,
5404  k_SignedIdentifier,
5405  k_Unknown,
5406  };
5407  std::vector<XmlTagName> path;
5408  while (true)
5409  {
5410  auto node = reader.Read();
5411  if (node.Type == _internal::XmlNodeType::End)
5412  {
5413  break;
5414  }
5415  else if (node.Type == _internal::XmlNodeType::EndTag)
5416  {
5417  if (path.size() > 0)
5418  {
5419  path.pop_back();
5420  }
5421  else
5422  {
5423  break;
5424  }
5425  }
5426  else if (node.Type == _internal::XmlNodeType::StartTag)
5427  {
5428  if (std::strcmp(node.Name, "SignedIdentifiers") == 0)
5429  {
5430  path.emplace_back(XmlTagName::k_SignedIdentifiers);
5431  }
5432  else if (std::strcmp(node.Name, "SignedIdentifier") == 0)
5433  {
5434  path.emplace_back(XmlTagName::k_SignedIdentifier);
5435  }
5436  else
5437  {
5438  path.emplace_back(XmlTagName::k_Unknown);
5439  }
5440  if (path.size() == 2 && path[0] == XmlTagName::k_SignedIdentifiers
5441  && path[1] == XmlTagName::k_SignedIdentifier)
5442  {
5443  ret.SignedIdentifiers.emplace_back(SignedIdentifierFromXml(reader));
5444  path.pop_back();
5445  }
5446  }
5447  else if (node.Type == _internal::XmlNodeType::Text)
5448  {
5449  }
5450  }
5451  return ret;
5452  }
5453 
5454  static Models::_detail::ListBlobsByHierarchyResult
5455  ListBlobsByHierarchyResultInternalFromXml(_internal::XmlReader& reader)
5456  {
5457  Models::_detail::ListBlobsByHierarchyResult ret;
5458  enum class XmlTagName
5459  {
5460  k_EnumerationResults,
5461  k_Prefix,
5462  k_Delimiter,
5463  k_NextMarker,
5464  k_Blobs,
5465  k_Blob,
5466  k_BlobPrefix,
5467  k_Name,
5468  k_Unknown,
5469  };
5470  std::vector<XmlTagName> path;
5471  while (true)
5472  {
5473  auto node = reader.Read();
5474  if (node.Type == _internal::XmlNodeType::End)
5475  {
5476  break;
5477  }
5478  else if (node.Type == _internal::XmlNodeType::EndTag)
5479  {
5480  if (path.size() > 0)
5481  {
5482  path.pop_back();
5483  }
5484  else
5485  {
5486  break;
5487  }
5488  }
5489  else if (node.Type == _internal::XmlNodeType::StartTag)
5490  {
5491  if (std::strcmp(node.Name, "EnumerationResults") == 0)
5492  {
5493  path.emplace_back(XmlTagName::k_EnumerationResults);
5494  }
5495  else if (std::strcmp(node.Name, "Prefix") == 0)
5496  {
5497  path.emplace_back(XmlTagName::k_Prefix);
5498  }
5499  else if (std::strcmp(node.Name, "Delimiter") == 0)
5500  {
5501  path.emplace_back(XmlTagName::k_Delimiter);
5502  }
5503  else if (std::strcmp(node.Name, "NextMarker") == 0)
5504  {
5505  path.emplace_back(XmlTagName::k_NextMarker);
5506  }
5507  else if (std::strcmp(node.Name, "Blobs") == 0)
5508  {
5509  path.emplace_back(XmlTagName::k_Blobs);
5510  }
5511  else if (std::strcmp(node.Name, "Blob") == 0)
5512  {
5513  path.emplace_back(XmlTagName::k_Blob);
5514  }
5515  else if (std::strcmp(node.Name, "BlobPrefix") == 0)
5516  {
5517  path.emplace_back(XmlTagName::k_BlobPrefix);
5518  }
5519  else if (std::strcmp(node.Name, "Name") == 0)
5520  {
5521  path.emplace_back(XmlTagName::k_Name);
5522  }
5523  else
5524  {
5525  path.emplace_back(XmlTagName::k_Unknown);
5526  }
5527  if (path.size() == 3 && path[0] == XmlTagName::k_EnumerationResults
5528  && path[1] == XmlTagName::k_Blobs && path[2] == XmlTagName::k_Blob)
5529  {
5530  ret.Items.emplace_back(BlobItemFromXml(reader));
5531  path.pop_back();
5532  }
5533  }
5534  else if (node.Type == _internal::XmlNodeType::Text)
5535  {
5536  if (path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
5537  && path[1] == XmlTagName::k_Prefix)
5538  {
5539  ret.Prefix = node.Value;
5540  }
5541  else if (
5542  path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
5543  && path[1] == XmlTagName::k_Delimiter)
5544  {
5545  ret.Delimiter = node.Value;
5546  }
5547  else if (
5548  path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
5549  && path[1] == XmlTagName::k_NextMarker)
5550  {
5551  ret.ContinuationToken = node.Value;
5552  }
5553  else if (
5554  path.size() == 4 && path[0] == XmlTagName::k_EnumerationResults
5555  && path[1] == XmlTagName::k_Blobs && path[2] == XmlTagName::k_BlobPrefix
5556  && path[3] == XmlTagName::k_Name)
5557  {
5558  ret.BlobPrefixes.emplace_back(node.Value);
5559  }
5560  }
5561  else if (node.Type == _internal::XmlNodeType::Attribute)
5562  {
5563  if (path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
5564  && std::strcmp(node.Name, "ServiceEndpoint") == 0)
5565  {
5566  ret.ServiceEndpoint = node.Value;
5567  }
5568  else if (
5569  path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
5570  && std::strcmp(node.Name, "ContainerName") == 0)
5571  {
5572  ret.BlobContainerName = node.Value;
5573  }
5574  }
5575  }
5576  return ret;
5577  }
5578 
5579  static Models::_detail::ListBlobsResult ListBlobsResultInternalFromXml(
5580  _internal::XmlReader& reader)
5581  {
5582  Models::_detail::ListBlobsResult ret;
5583  enum class XmlTagName
5584  {
5585  k_EnumerationResults,
5586  k_Prefix,
5587  k_NextMarker,
5588  k_Blobs,
5589  k_Blob,
5590  k_Unknown,
5591  };
5592  std::vector<XmlTagName> path;
5593  while (true)
5594  {
5595  auto node = reader.Read();
5596  if (node.Type == _internal::XmlNodeType::End)
5597  {
5598  break;
5599  }
5600  else if (node.Type == _internal::XmlNodeType::EndTag)
5601  {
5602  if (path.size() > 0)
5603  {
5604  path.pop_back();
5605  }
5606  else
5607  {
5608  break;
5609  }
5610  }
5611  else if (node.Type == _internal::XmlNodeType::StartTag)
5612  {
5613  if (std::strcmp(node.Name, "EnumerationResults") == 0)
5614  {
5615  path.emplace_back(XmlTagName::k_EnumerationResults);
5616  }
5617  else if (std::strcmp(node.Name, "Prefix") == 0)
5618  {
5619  path.emplace_back(XmlTagName::k_Prefix);
5620  }
5621  else if (std::strcmp(node.Name, "NextMarker") == 0)
5622  {
5623  path.emplace_back(XmlTagName::k_NextMarker);
5624  }
5625  else if (std::strcmp(node.Name, "Blobs") == 0)
5626  {
5627  path.emplace_back(XmlTagName::k_Blobs);
5628  }
5629  else if (std::strcmp(node.Name, "Blob") == 0)
5630  {
5631  path.emplace_back(XmlTagName::k_Blob);
5632  }
5633  else
5634  {
5635  path.emplace_back(XmlTagName::k_Unknown);
5636  }
5637  if (path.size() == 3 && path[0] == XmlTagName::k_EnumerationResults
5638  && path[1] == XmlTagName::k_Blobs && path[2] == XmlTagName::k_Blob)
5639  {
5640  ret.Items.emplace_back(BlobItemFromXml(reader));
5641  path.pop_back();
5642  }
5643  }
5644  else if (node.Type == _internal::XmlNodeType::Text)
5645  {
5646  if (path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
5647  && path[1] == XmlTagName::k_Prefix)
5648  {
5649  ret.Prefix = node.Value;
5650  }
5651  else if (
5652  path.size() == 2 && path[0] == XmlTagName::k_EnumerationResults
5653  && path[1] == XmlTagName::k_NextMarker)
5654  {
5655  ret.ContinuationToken = node.Value;
5656  }
5657  }
5658  else if (node.Type == _internal::XmlNodeType::Attribute)
5659  {
5660  if (path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
5661  && std::strcmp(node.Name, "ServiceEndpoint") == 0)
5662  {
5663  ret.ServiceEndpoint = node.Value;
5664  }
5665  else if (
5666  path.size() == 1 && path[0] == XmlTagName::k_EnumerationResults
5667  && std::strcmp(node.Name, "ContainerName") == 0)
5668  {
5669  ret.BlobContainerName = node.Value;
5670  }
5671  }
5672  }
5673  return ret;
5674  }
5675 
5676  static BlobItem BlobItemFromXml(_internal::XmlReader& reader)
5677  {
5678  BlobItem ret;
5679  enum class XmlTagName
5680  {
5681  k_Name,
5682  k_Deleted,
5683  k_Snapshot,
5684  k_VersionId,
5685  k_IsCurrentVersion,
5686  k_Properties,
5687  k_ContentType,
5688  k_ContentEncoding,
5689  k_ContentLanguage,
5690  k_ContentMD5,
5691  k_CacheControl,
5692  k_ContentDisposition,
5693  k_CreationTime,
5694  k_ExpiryTime,
5695  k_LastAccessTime,
5696  k_LastModified,
5697  k_Etag,
5698  k_ContentLength,
5699  k_BlobType,
5700  k_AccessTier,
5701  k_AccessTierInferred,
5702  k_LeaseStatus,
5703  k_LeaseState,
5704  k_LeaseDuration,
5705  k_ServerEncrypted,
5706  k_EncryptionKeySHA256,
5707  k_Sealed,
5708  k_xmsblobsequencenumber,
5709  k_Metadata,
5710  k_OrMetadata,
5711  k_Unknown,
5712  };
5713  std::vector<XmlTagName> path;
5714  while (true)
5715  {
5716  auto node = reader.Read();
5717  if (node.Type == _internal::XmlNodeType::End)
5718  {
5719  break;
5720  }
5721  else if (node.Type == _internal::XmlNodeType::EndTag)
5722  {
5723  if (path.size() > 0)
5724  {
5725  path.pop_back();
5726  }
5727  else
5728  {
5729  break;
5730  }
5731  }
5732  else if (node.Type == _internal::XmlNodeType::StartTag)
5733  {
5734  if (std::strcmp(node.Name, "Name") == 0)
5735  {
5736  path.emplace_back(XmlTagName::k_Name);
5737  }
5738  else if (std::strcmp(node.Name, "Deleted") == 0)
5739  {
5740  path.emplace_back(XmlTagName::k_Deleted);
5741  }
5742  else if (std::strcmp(node.Name, "Snapshot") == 0)
5743  {
5744  path.emplace_back(XmlTagName::k_Snapshot);
5745  }
5746  else if (std::strcmp(node.Name, "VersionId") == 0)
5747  {
5748  path.emplace_back(XmlTagName::k_VersionId);
5749  }
5750  else if (std::strcmp(node.Name, "IsCurrentVersion") == 0)
5751  {
5752  path.emplace_back(XmlTagName::k_IsCurrentVersion);
5753  }
5754  else if (std::strcmp(node.Name, "Properties") == 0)
5755  {
5756  path.emplace_back(XmlTagName::k_Properties);
5757  }
5758  else if (std::strcmp(node.Name, "Content-Type") == 0)
5759  {
5760  path.emplace_back(XmlTagName::k_ContentType);
5761  }
5762  else if (std::strcmp(node.Name, "Content-Encoding") == 0)
5763  {
5764  path.emplace_back(XmlTagName::k_ContentEncoding);
5765  }
5766  else if (std::strcmp(node.Name, "Content-Language") == 0)
5767  {
5768  path.emplace_back(XmlTagName::k_ContentLanguage);
5769  }
5770  else if (std::strcmp(node.Name, "Content-MD5") == 0)
5771  {
5772  path.emplace_back(XmlTagName::k_ContentMD5);
5773  }
5774  else if (std::strcmp(node.Name, "Cache-Control") == 0)
5775  {
5776  path.emplace_back(XmlTagName::k_CacheControl);
5777  }
5778  else if (std::strcmp(node.Name, "Content-Disposition") == 0)
5779  {
5780  path.emplace_back(XmlTagName::k_ContentDisposition);
5781  }
5782  else if (std::strcmp(node.Name, "Creation-Time") == 0)
5783  {
5784  path.emplace_back(XmlTagName::k_CreationTime);
5785  }
5786  else if (std::strcmp(node.Name, "Expiry-Time") == 0)
5787  {
5788  path.emplace_back(XmlTagName::k_ExpiryTime);
5789  }
5790  else if (std::strcmp(node.Name, "LastAccessTime") == 0)
5791  {
5792  path.emplace_back(XmlTagName::k_LastAccessTime);
5793  }
5794  else if (std::strcmp(node.Name, "Last-Modified") == 0)
5795  {
5796  path.emplace_back(XmlTagName::k_LastModified);
5797  }
5798  else if (std::strcmp(node.Name, "Etag") == 0)
5799  {
5800  path.emplace_back(XmlTagName::k_Etag);
5801  }
5802  else if (std::strcmp(node.Name, "Content-Length") == 0)
5803  {
5804  path.emplace_back(XmlTagName::k_ContentLength);
5805  }
5806  else if (std::strcmp(node.Name, "BlobType") == 0)
5807  {
5808  path.emplace_back(XmlTagName::k_BlobType);
5809  }
5810  else if (std::strcmp(node.Name, "AccessTier") == 0)
5811  {
5812  path.emplace_back(XmlTagName::k_AccessTier);
5813  }
5814  else if (std::strcmp(node.Name, "AccessTierInferred") == 0)
5815  {
5816  path.emplace_back(XmlTagName::k_AccessTierInferred);
5817  }
5818  else if (std::strcmp(node.Name, "LeaseStatus") == 0)
5819  {
5820  path.emplace_back(XmlTagName::k_LeaseStatus);
5821  }
5822  else if (std::strcmp(node.Name, "LeaseState") == 0)
5823  {
5824  path.emplace_back(XmlTagName::k_LeaseState);
5825  }
5826  else if (std::strcmp(node.Name, "LeaseDuration") == 0)
5827  {
5828  path.emplace_back(XmlTagName::k_LeaseDuration);
5829  }
5830  else if (std::strcmp(node.Name, "ServerEncrypted") == 0)
5831  {
5832  path.emplace_back(XmlTagName::k_ServerEncrypted);
5833  }
5834  else if (std::strcmp(node.Name, "EncryptionKeySHA256") == 0)
5835  {
5836  path.emplace_back(XmlTagName::k_EncryptionKeySHA256);
5837  }
5838  else if (std::strcmp(node.Name, "Sealed") == 0)
5839  {
5840  path.emplace_back(XmlTagName::k_Sealed);
5841  }
5842  else if (std::strcmp(node.Name, "x-ms-blob-sequence-number") == 0)
5843  {
5844  path.emplace_back(XmlTagName::k_xmsblobsequencenumber);
5845  }
5846  else if (std::strcmp(node.Name, "Metadata") == 0)
5847  {
5848  path.emplace_back(XmlTagName::k_Metadata);
5849  }
5850  else if (std::strcmp(node.Name, "OrMetadata") == 0)
5851  {
5852  path.emplace_back(XmlTagName::k_OrMetadata);
5853  }
5854  else
5855  {
5856  path.emplace_back(XmlTagName::k_Unknown);
5857  }
5858  if (path.size() == 1 && path[0] == XmlTagName::k_Metadata)
5859  {
5860  ret.Details.Metadata = MetadataFromXml(reader);
5861  path.pop_back();
5862  }
5863  else if (path.size() == 1 && path[0] == XmlTagName::k_OrMetadata)
5864  {
5865  ret.Details.ObjectReplicationSourceProperties
5866  = ObjectReplicationSourcePropertiesFromXml(reader);
5867  path.pop_back();
5868  }
5869  }
5870  else if (node.Type == _internal::XmlNodeType::Text)
5871  {
5872  if (path.size() == 1 && path[0] == XmlTagName::k_Name)
5873  {
5874  ret.Name = node.Value;
5875  }
5876  else if (path.size() == 1 && path[0] == XmlTagName::k_Deleted)
5877  {
5878  ret.IsDeleted = std::strcmp(node.Value, "true") == 0;
5879  }
5880  else if (path.size() == 1 && path[0] == XmlTagName::k_Snapshot)
5881  {
5882  ret.Snapshot = node.Value;
5883  }
5884  else if (path.size() == 1 && path[0] == XmlTagName::k_VersionId)
5885  {
5886  ret.VersionId = node.Value;
5887  }
5888  else if (path.size() == 1 && path[0] == XmlTagName::k_IsCurrentVersion)
5889  {
5890  ret.IsCurrentVersion = std::strcmp(node.Value, "true") == 0;
5891  }
5892  else if (
5893  path.size() == 2 && path[0] == XmlTagName::k_Properties
5894  && path[1] == XmlTagName::k_ContentType)
5895  {
5896  ret.Details.HttpHeaders.ContentType = node.Value;
5897  }
5898  else if (
5899  path.size() == 2 && path[0] == XmlTagName::k_Properties
5900  && path[1] == XmlTagName::k_ContentEncoding)
5901  {
5902  ret.Details.HttpHeaders.ContentEncoding = node.Value;
5903  }
5904  else if (
5905  path.size() == 2 && path[0] == XmlTagName::k_Properties
5906  && path[1] == XmlTagName::k_ContentLanguage)
5907  {
5908  ret.Details.HttpHeaders.ContentLanguage = node.Value;
5909  }
5910  else if (
5911  path.size() == 2 && path[0] == XmlTagName::k_Properties
5912  && path[1] == XmlTagName::k_ContentMD5)
5913  {
5914  ret.Details.HttpHeaders.ContentHash.Value
5915  = Azure::Core::Convert::Base64Decode(node.Value);
5916  }
5917  else if (
5918  path.size() == 2 && path[0] == XmlTagName::k_Properties
5919  && path[1] == XmlTagName::k_CacheControl)
5920  {
5921  ret.Details.HttpHeaders.CacheControl = node.Value;
5922  }
5923  else if (
5924  path.size() == 2 && path[0] == XmlTagName::k_Properties
5925  && path[1] == XmlTagName::k_ContentDisposition)
5926  {
5927  ret.Details.HttpHeaders.ContentDisposition = node.Value;
5928  }
5929  else if (
5930  path.size() == 2 && path[0] == XmlTagName::k_Properties
5931  && path[1] == XmlTagName::k_CreationTime)
5932  {
5933  ret.Details.CreatedOn
5934  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
5935  }
5936  else if (
5937  path.size() == 2 && path[0] == XmlTagName::k_Properties
5938  && path[1] == XmlTagName::k_ExpiryTime)
5939  {
5940  ret.Details.ExpiresOn
5941  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
5942  }
5943  else if (
5944  path.size() == 2 && path[0] == XmlTagName::k_Properties
5945  && path[1] == XmlTagName::k_LastAccessTime)
5946  {
5947  ret.Details.LastAccessedOn
5948  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
5949  }
5950  else if (
5951  path.size() == 2 && path[0] == XmlTagName::k_Properties
5952  && path[1] == XmlTagName::k_LastModified)
5953  {
5954  ret.Details.LastModified
5955  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc1123);
5956  }
5957  else if (
5958  path.size() == 2 && path[0] == XmlTagName::k_Properties
5959  && path[1] == XmlTagName::k_Etag)
5960  {
5961  ret.Details.ETag = Azure::ETag(node.Value);
5962  }
5963  else if (
5964  path.size() == 2 && path[0] == XmlTagName::k_Properties
5965  && path[1] == XmlTagName::k_ContentLength)
5966  {
5967  ret.BlobSize = std::stoll(node.Value);
5968  }
5969  else if (
5970  path.size() == 2 && path[0] == XmlTagName::k_Properties
5971  && path[1] == XmlTagName::k_BlobType)
5972  {
5973  ret.BlobType = BlobType(node.Value);
5974  }
5975  else if (
5976  path.size() == 2 && path[0] == XmlTagName::k_Properties
5977  && path[1] == XmlTagName::k_AccessTier)
5978  {
5979  ret.Details.AccessTier = AccessTier(node.Value);
5980  }
5981  else if (
5982  path.size() == 2 && path[0] == XmlTagName::k_Properties
5983  && path[1] == XmlTagName::k_AccessTierInferred)
5984  {
5985  ret.Details.IsAccessTierInferred = std::strcmp(node.Value, "true") == 0;
5986  }
5987  else if (
5988  path.size() == 2 && path[0] == XmlTagName::k_Properties
5989  && path[1] == XmlTagName::k_LeaseStatus)
5990  {
5991  ret.Details.LeaseStatus = LeaseStatus(node.Value);
5992  }
5993  else if (
5994  path.size() == 2 && path[0] == XmlTagName::k_Properties
5995  && path[1] == XmlTagName::k_LeaseState)
5996  {
5997  ret.Details.LeaseState = LeaseState(node.Value);
5998  }
5999  else if (
6000  path.size() == 2 && path[0] == XmlTagName::k_Properties
6001  && path[1] == XmlTagName::k_LeaseDuration)
6002  {
6003  ret.Details.LeaseDuration = LeaseDurationType(node.Value);
6004  }
6005  else if (
6006  path.size() == 2 && path[0] == XmlTagName::k_Properties
6007  && path[1] == XmlTagName::k_ServerEncrypted)
6008  {
6009  ret.Details.IsServerEncrypted = std::strcmp(node.Value, "true") == 0;
6010  }
6011  else if (
6012  path.size() == 2 && path[0] == XmlTagName::k_Properties
6013  && path[1] == XmlTagName::k_EncryptionKeySHA256)
6014  {
6015  ret.Details.EncryptionKeySha256 = Azure::Core::Convert::Base64Decode(node.Value);
6016  }
6017  else if (
6018  path.size() == 2 && path[0] == XmlTagName::k_Properties
6019  && path[1] == XmlTagName::k_Sealed)
6020  {
6021  ret.Details.IsSealed = std::strcmp(node.Value, "true") == 0;
6022  }
6023  else if (
6024  path.size() == 2 && path[0] == XmlTagName::k_Properties
6025  && path[1] == XmlTagName::k_xmsblobsequencenumber)
6026  {
6027  ret.Details.SequenceNumber = std::stoll(node.Value);
6028  }
6029  }
6030  }
6031  return ret;
6032  }
6033 
6034  static SignedIdentifier SignedIdentifierFromXml(_internal::XmlReader& reader)
6035  {
6036  SignedIdentifier ret;
6037  enum class XmlTagName
6038  {
6039  k_Id,
6040  k_AccessPolicy,
6041  k_Start,
6042  k_Expiry,
6043  k_Permission,
6044  k_Unknown,
6045  };
6046  std::vector<XmlTagName> path;
6047  while (true)
6048  {
6049  auto node = reader.Read();
6050  if (node.Type == _internal::XmlNodeType::End)
6051  {
6052  break;
6053  }
6054  else if (node.Type == _internal::XmlNodeType::EndTag)
6055  {
6056  if (path.size() > 0)
6057  {
6058  path.pop_back();
6059  }
6060  else
6061  {
6062  break;
6063  }
6064  }
6065  else if (node.Type == _internal::XmlNodeType::StartTag)
6066  {
6067  if (std::strcmp(node.Name, "Id") == 0)
6068  {
6069  path.emplace_back(XmlTagName::k_Id);
6070  }
6071  else if (std::strcmp(node.Name, "AccessPolicy") == 0)
6072  {
6073  path.emplace_back(XmlTagName::k_AccessPolicy);
6074  }
6075  else if (std::strcmp(node.Name, "Start") == 0)
6076  {
6077  path.emplace_back(XmlTagName::k_Start);
6078  }
6079  else if (std::strcmp(node.Name, "Expiry") == 0)
6080  {
6081  path.emplace_back(XmlTagName::k_Expiry);
6082  }
6083  else if (std::strcmp(node.Name, "Permission") == 0)
6084  {
6085  path.emplace_back(XmlTagName::k_Permission);
6086  }
6087  else
6088  {
6089  path.emplace_back(XmlTagName::k_Unknown);
6090  }
6091  }
6092  else if (node.Type == _internal::XmlNodeType::Text)
6093  {
6094  if (path.size() == 1 && path[0] == XmlTagName::k_Id)
6095  {
6096  ret.Id = node.Value;
6097  }
6098  else if (
6099  path.size() == 2 && path[0] == XmlTagName::k_AccessPolicy
6100  && path[1] == XmlTagName::k_Start)
6101  {
6102  ret.StartsOn
6103  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc3339);
6104  }
6105  else if (
6106  path.size() == 2 && path[0] == XmlTagName::k_AccessPolicy
6107  && path[1] == XmlTagName::k_Expiry)
6108  {
6109  ret.ExpiresOn
6110  = Azure::DateTime::Parse(node.Value, Azure::DateTime::DateFormat::Rfc3339);
6111  }
6112  else if (
6113  path.size() == 2 && path[0] == XmlTagName::k_AccessPolicy
6114  && path[1] == XmlTagName::k_Permission)
6115  {
6116  ret.Permissions = node.Value;
6117  }
6118  }
6119  }
6120  return ret;
6121  }
6122 
6123  static std::vector<ObjectReplicationPolicy> ObjectReplicationSourcePropertiesFromXml(
6124  _internal::XmlReader& reader)
6125  {
6126  int depth = 0;
6127  std::map<std::string, std::vector<ObjectReplicationRule>> orPropertiesMap;
6128  std::string policyId;
6129  std::string ruleId;
6130  while (true)
6131  {
6132  auto node = reader.Read();
6133  if (node.Type == _internal::XmlNodeType::End)
6134  {
6135  break;
6136  }
6137  else if (node.Type == _internal::XmlNodeType::StartTag)
6138  {
6139  ++depth;
6140  std::string startTagName = node.Name;
6141  if (startTagName.substr(0, 3) == "or-")
6142  {
6143  auto underscorePos = startTagName.find('_', 3);
6144  policyId
6145  = std::string(startTagName.begin() + 3, startTagName.begin() + underscorePos);
6146  ruleId = startTagName.substr(underscorePos + 1);
6147  }
6148  }
6149  else if (node.Type == _internal::XmlNodeType::EndTag)
6150  {
6151  if (depth-- == 0)
6152  {
6153  break;
6154  }
6155  }
6156  if (depth == 1 && node.Type == _internal::XmlNodeType::Text)
6157  {
6158  ObjectReplicationRule rule;
6159  rule.RuleId = std::move(ruleId);
6160  rule.ReplicationStatus = ObjectReplicationStatus(node.Value);
6161  orPropertiesMap[policyId].emplace_back(std::move(rule));
6162  }
6163  }
6164  std::vector<ObjectReplicationPolicy> ret;
6165  for (auto& property : orPropertiesMap)
6166  {
6167  ObjectReplicationPolicy policy;
6168  policy.PolicyId = property.first;
6169  policy.Rules = std::move(property.second);
6170  ret.emplace_back(std::move(policy));
6171  }
6172  return ret;
6173  }
6174 
6175  static Metadata MetadataFromXml(_internal::XmlReader& reader)
6176  {
6177  Metadata ret;
6178  int depth = 0;
6179  std::string key;
6180  while (true)
6181  {
6182  auto node = reader.Read();
6183  if (node.Type == _internal::XmlNodeType::End)
6184  {
6185  break;
6186  }
6187  else if (node.Type == _internal::XmlNodeType::StartTag)
6188  {
6189  if (depth++ == 0)
6190  {
6191  key = node.Name;
6192  }
6193  }
6194  else if (node.Type == _internal::XmlNodeType::EndTag)
6195  {
6196  if (depth-- == 0)
6197  {
6198  break;
6199  }
6200  }
6201  else if (depth == 1 && node.Type == _internal::XmlNodeType::Text)
6202  {
6203  ret.emplace(std::move(key), std::string(node.Value));
6204  }
6205  }
6206  return ret;
6207  }
6208 
6209  static void SetBlobContainerAccessPolicyOptionsToXml(
6210  _internal::XmlWriter& writer,
6211  const SetBlobContainerAccessPolicyOptions& options)
6212  {
6213  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "SignedIdentifiers"});
6214  for (const auto& i : options.SignedIdentifiers)
6215  {
6216  SignedIdentifierToXml(writer, i);
6217  }
6218  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6219  }
6220 
6221  static void SignedIdentifierToXml(
6222  _internal::XmlWriter& writer,
6223  const SignedIdentifier& options)
6224  {
6225  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "SignedIdentifier"});
6226  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Id"});
6227  writer.Write(
6228  _internal::XmlNode{_internal::XmlNodeType::Text, nullptr, options.Id.data()});
6229  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6230  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "AccessPolicy"});
6231  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Start"});
6232  writer.Write(_internal::XmlNode{
6233  _internal::XmlNodeType::Text,
6234  nullptr,
6235  options.StartsOn
6236  .ToString(
6237  Azure::DateTime::DateFormat::Rfc3339,
6238  Azure::DateTime::TimeFractionFormat::AllDigits)
6239  .data()});
6240  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6241  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Expiry"});
6242  writer.Write(_internal::XmlNode{
6243  _internal::XmlNodeType::Text,
6244  nullptr,
6245  options.ExpiresOn
6246  .ToString(
6247  Azure::DateTime::DateFormat::Rfc3339,
6248  Azure::DateTime::TimeFractionFormat::AllDigits)
6249  .data()});
6250  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6251  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Permission"});
6252  writer.Write(_internal::XmlNode{
6253  _internal::XmlNodeType::Text, nullptr, options.Permissions.data()});
6254  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6255  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6256  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
6257  }
6258 
6259  }; // class BlobContainer
6260 
6261  class Blob final {
6262  public:
6263  struct DownloadBlobOptions final
6264  {
6265  Azure::Nullable<int32_t> Timeout;
6266  Azure::Nullable<Azure::Core::Http::HttpRange> Range;
6267  Azure::Nullable<HashAlgorithm> RangeHashAlgorithm;
6268  Azure::Nullable<std::string> EncryptionKey;
6269  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
6270  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
6271  Azure::Nullable<std::string> LeaseId;
6272  Azure::Nullable<Azure::DateTime> IfModifiedSince;
6273  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
6274  Azure::ETag IfMatch;
6275  Azure::ETag IfNoneMatch;
6276  Azure::Nullable<std::string> IfTags;
6277  }; // struct DownloadBlobOptions
6278 
6279  static Azure::Response<DownloadBlobResult> Download(
6280  Azure::Core::Http::_internal::HttpPipeline& pipeline,
6281  const Azure::Core::Url& url,
6282  const DownloadBlobOptions& options,
6283  const Azure::Core::Context& context)
6284  {
6285  (void)options;
6286  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url, false);
6287  request.SetHeader("x-ms-version", "2020-02-10");
6288  if (options.Timeout.HasValue())
6289  {
6290  request.GetUrl().AppendQueryParameter(
6291  "timeout", std::to_string(options.Timeout.Value()));
6292  }
6293  if (options.Range.HasValue())
6294  {
6295  std::string headerValue = "bytes=" + std::to_string(options.Range.Value().Offset) + "-";
6296  if (options.Range.Value().Length.HasValue())
6297  {
6298  headerValue += std::to_string(
6299  options.Range.Value().Offset + options.Range.Value().Length.Value() - 1);
6300  }
6301  request.SetHeader("x-ms-range", std::move(headerValue));
6302  }
6303  if (options.EncryptionKey.HasValue())
6304  {
6305  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
6306  }
6307  if (options.EncryptionKeySha256.HasValue())
6308  {
6309  request.SetHeader(
6310  "x-ms-encryption-key-sha256",
6311  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
6312  }
6313  if (options.EncryptionAlgorithm.HasValue())
6314  {
6315  request.SetHeader(
6316  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
6317  }
6318  if (options.IfModifiedSince.HasValue())
6319  {
6320  request.SetHeader(
6321  "If-Modified-Since",
6322  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6323  }
6324  if (options.IfUnmodifiedSince.HasValue())
6325  {
6326  request.SetHeader(
6327  "If-Unmodified-Since",
6328  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6329  }
6330  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
6331  {
6332  request.SetHeader("If-Match", options.IfMatch.ToString());
6333  }
6334  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
6335  {
6336  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
6337  }
6338  if (options.IfTags.HasValue())
6339  {
6340  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
6341  }
6342  if (options.LeaseId.HasValue())
6343  {
6344  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
6345  }
6346  if (options.RangeHashAlgorithm.HasValue())
6347  {
6348  if (options.RangeHashAlgorithm.Value() == HashAlgorithm::Md5)
6349  {
6350  request.SetHeader("x-ms-range-get-content-md5", "true");
6351  }
6352  else if (options.RangeHashAlgorithm.Value() == HashAlgorithm::Crc64)
6353  {
6354  request.SetHeader("x-ms-range-get-content-crc64", "true");
6355  }
6356  }
6357  auto pHttpResponse = pipeline.Send(request, context);
6358  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
6359  DownloadBlobResult response;
6360  auto http_status_code
6361  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
6362  httpResponse.GetStatusCode());
6363  if (!(http_status_code == 200 || http_status_code == 206))
6364  {
6365  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
6366  }
6367  response.BodyStream = httpResponse.ExtractBodyStream();
6368  {
6369  const auto& headers = httpResponse.GetHeaders();
6370  auto content_md5_iterator = headers.find("content-md5");
6371  if (content_md5_iterator != headers.end())
6372  {
6373  ContentHash hash;
6374  hash.Algorithm = HashAlgorithm::Md5;
6375  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
6376  response.TransactionalContentHash = std::move(hash);
6377  }
6378  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
6379  if (x_ms_content_crc64_iterator != headers.end())
6380  {
6381  ContentHash hash;
6382  hash.Algorithm = HashAlgorithm::Crc64;
6383  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
6384  response.TransactionalContentHash = std::move(hash);
6385  }
6386  }
6387  response.BlobType = BlobType(httpResponse.GetHeaders().at("x-ms-blob-type"));
6388  auto content_range_iterator = httpResponse.GetHeaders().find("content-range");
6389  if (content_range_iterator != httpResponse.GetHeaders().end())
6390  {
6391  const std::string& content_range = content_range_iterator->second;
6392  auto bytes_pos = content_range.find("bytes ");
6393  auto dash_pos = content_range.find("-", bytes_pos + 6);
6394  auto slash_pos = content_range.find("/", dash_pos + 1);
6395  int64_t range_start_offset = std::stoll(std::string(
6396  content_range.begin() + bytes_pos + 6, content_range.begin() + dash_pos));
6397  int64_t range_end_offset = std::stoll(std::string(
6398  content_range.begin() + dash_pos + 1, content_range.begin() + slash_pos));
6399  response.ContentRange = Azure::Core::Http::HttpRange{
6400  range_start_offset, range_end_offset - range_start_offset + 1};
6401  }
6402  else
6403  {
6404  response.ContentRange = Azure::Core::Http::HttpRange{
6405  0, std::stoll(httpResponse.GetHeaders().at("content-length"))};
6406  }
6407  if (content_range_iterator != httpResponse.GetHeaders().end())
6408  {
6409  const std::string& content_range = content_range_iterator->second;
6410  auto slash_pos = content_range.find("/");
6411  response.BlobSize = std::stoll(content_range.substr(slash_pos + 1));
6412  }
6413  else
6414  {
6415  response.BlobSize = std::stoll(httpResponse.GetHeaders().at("content-length"));
6416  }
6417  response.Details.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
6418  response.Details.LastModified = Azure::DateTime::Parse(
6419  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
6420  auto content_type__iterator = httpResponse.GetHeaders().find("content-type");
6421  if (content_type__iterator != httpResponse.GetHeaders().end())
6422  {
6423  response.Details.HttpHeaders.ContentType = content_type__iterator->second;
6424  }
6425  auto content_encoding__iterator = httpResponse.GetHeaders().find("content-encoding");
6426  if (content_encoding__iterator != httpResponse.GetHeaders().end())
6427  {
6428  response.Details.HttpHeaders.ContentEncoding = content_encoding__iterator->second;
6429  }
6430  auto content_language__iterator = httpResponse.GetHeaders().find("content-language");
6431  if (content_language__iterator != httpResponse.GetHeaders().end())
6432  {
6433  response.Details.HttpHeaders.ContentLanguage = content_language__iterator->second;
6434  }
6435  auto cache_control__iterator = httpResponse.GetHeaders().find("cache-control");
6436  if (cache_control__iterator != httpResponse.GetHeaders().end())
6437  {
6438  response.Details.HttpHeaders.CacheControl = cache_control__iterator->second;
6439  }
6440  auto content_md5__iterator = httpResponse.GetHeaders().find("content-md5");
6441  if (content_md5__iterator != httpResponse.GetHeaders().end())
6442  {
6443  response.Details.HttpHeaders.ContentHash.Value
6444  = Azure::Core::Convert::Base64Decode(content_md5__iterator->second);
6445  }
6446  auto x_ms_blob_content_md5__iterator
6447  = httpResponse.GetHeaders().find("x-ms-blob-content-md5");
6448  if (x_ms_blob_content_md5__iterator != httpResponse.GetHeaders().end())
6449  {
6450  response.Details.HttpHeaders.ContentHash.Value
6451  = Azure::Core::Convert::Base64Decode(x_ms_blob_content_md5__iterator->second);
6452  }
6453  auto content_disposition__iterator
6454  = httpResponse.GetHeaders().find("content-disposition");
6455  if (content_disposition__iterator != httpResponse.GetHeaders().end())
6456  {
6457  response.Details.HttpHeaders.ContentDisposition = content_disposition__iterator->second;
6458  }
6459  for (auto i = httpResponse.GetHeaders().lower_bound("x-ms-meta-");
6460  i != httpResponse.GetHeaders().end() && i->first.substr(0, 10) == "x-ms-meta-";
6461  ++i)
6462  {
6463  response.Details.Metadata.emplace(i->first.substr(10), i->second);
6464  }
6465  response.Details.IsServerEncrypted
6466  = httpResponse.GetHeaders().at("x-ms-server-encrypted") == "true";
6467  auto x_ms_encryption_key_sha256__iterator
6468  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
6469  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
6470  {
6471  response.Details.EncryptionKeySha256
6472  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
6473  }
6474  auto x_ms_encryption_scope__iterator
6475  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
6476  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
6477  {
6478  response.Details.EncryptionScope = x_ms_encryption_scope__iterator->second;
6479  }
6480  auto x_ms_lease_status__iterator = httpResponse.GetHeaders().find("x-ms-lease-status");
6481  if (x_ms_lease_status__iterator != httpResponse.GetHeaders().end())
6482  {
6483  response.Details.LeaseStatus = LeaseStatus(x_ms_lease_status__iterator->second);
6484  }
6485  auto x_ms_lease_state__iterator = httpResponse.GetHeaders().find("x-ms-lease-state");
6486  if (x_ms_lease_state__iterator != httpResponse.GetHeaders().end())
6487  {
6488  response.Details.LeaseState = LeaseState(x_ms_lease_state__iterator->second);
6489  }
6490  auto x_ms_lease_duration__iterator
6491  = httpResponse.GetHeaders().find("x-ms-lease-duration");
6492  if (x_ms_lease_duration__iterator != httpResponse.GetHeaders().end())
6493  {
6494  response.Details.LeaseDuration
6495  = LeaseDurationType(x_ms_lease_duration__iterator->second);
6496  }
6497  response.Details.CreatedOn = Azure::DateTime::Parse(
6498  httpResponse.GetHeaders().at("x-ms-creation-time"),
6499  Azure::DateTime::DateFormat::Rfc1123);
6500  auto x_ms_expiry_time__iterator = httpResponse.GetHeaders().find("x-ms-expiry-time");
6501  if (x_ms_expiry_time__iterator != httpResponse.GetHeaders().end())
6502  {
6503  response.Details.ExpiresOn = Azure::DateTime::Parse(
6504  x_ms_expiry_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
6505  }
6506  auto x_ms_last_access_time__iterator
6507  = httpResponse.GetHeaders().find("x-ms-last-access-time");
6508  if (x_ms_last_access_time__iterator != httpResponse.GetHeaders().end())
6509  {
6510  response.Details.LastAccessedOn = Azure::DateTime::Parse(
6511  x_ms_last_access_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
6512  }
6513  auto x_ms_blob_sequence_number__iterator
6514  = httpResponse.GetHeaders().find("x-ms-blob-sequence-number");
6515  if (x_ms_blob_sequence_number__iterator != httpResponse.GetHeaders().end())
6516  {
6517  response.Details.SequenceNumber
6518  = std::stoll(x_ms_blob_sequence_number__iterator->second);
6519  }
6520  auto x_ms_blob_committed_block_count__iterator
6521  = httpResponse.GetHeaders().find("x-ms-blob-committed-block-count");
6522  if (x_ms_blob_committed_block_count__iterator != httpResponse.GetHeaders().end())
6523  {
6524  response.Details.CommittedBlockCount
6525  = std::stoi(x_ms_blob_committed_block_count__iterator->second);
6526  }
6527  auto x_ms_blob_sealed__iterator = httpResponse.GetHeaders().find("x-ms-blob-sealed");
6528  if (x_ms_blob_sealed__iterator != httpResponse.GetHeaders().end())
6529  {
6530  response.Details.IsSealed = x_ms_blob_sealed__iterator->second == "true";
6531  }
6532  auto x_ms_or_policy_id__iterator = httpResponse.GetHeaders().find("x-ms-or-policy-id");
6533  if (x_ms_or_policy_id__iterator != httpResponse.GetHeaders().end())
6534  {
6535  response.Details.ObjectReplicationDestinationPolicyId
6536  = x_ms_or_policy_id__iterator->second;
6537  }
6538  {
6539  std::map<std::string, std::vector<ObjectReplicationRule>> orPropertiesMap;
6540  for (auto i = httpResponse.GetHeaders().lower_bound("x-ms-or-");
6541  i != httpResponse.GetHeaders().end() && i->first.substr(0, 8) == "x-ms-or-";
6542  ++i)
6543  {
6544  const std::string& header = i->first;
6545  auto underscorePos = header.find('_', 8);
6546  if (underscorePos == std::string::npos)
6547  {
6548  continue;
6549  }
6550  std::string policyId
6551  = std::string(header.begin() + 8, header.begin() + underscorePos);
6552  std::string ruleId = header.substr(underscorePos + 1);
6553 
6554  ObjectReplicationRule rule;
6555  rule.RuleId = std::move(ruleId);
6556  rule.ReplicationStatus = ObjectReplicationStatus(i->second);
6557  orPropertiesMap[policyId].emplace_back(std::move(rule));
6558  }
6559  for (auto& property : orPropertiesMap)
6560  {
6561  ObjectReplicationPolicy policy;
6562  policy.PolicyId = property.first;
6563  policy.Rules = std::move(property.second);
6564  response.Details.ObjectReplicationSourceProperties.emplace_back(std::move(policy));
6565  }
6566  }
6567  auto x_ms_tag_count__iterator = httpResponse.GetHeaders().find("x-ms-tag-count");
6568  if (x_ms_tag_count__iterator != httpResponse.GetHeaders().end())
6569  {
6570  response.Details.TagCount = std::stoi(x_ms_tag_count__iterator->second);
6571  }
6572  auto x_ms_copy_id__iterator = httpResponse.GetHeaders().find("x-ms-copy-id");
6573  if (x_ms_copy_id__iterator != httpResponse.GetHeaders().end())
6574  {
6575  response.Details.CopyId = x_ms_copy_id__iterator->second;
6576  }
6577  auto x_ms_copy_source__iterator = httpResponse.GetHeaders().find("x-ms-copy-source");
6578  if (x_ms_copy_source__iterator != httpResponse.GetHeaders().end())
6579  {
6580  response.Details.CopySource = x_ms_copy_source__iterator->second;
6581  }
6582  auto x_ms_copy_status__iterator = httpResponse.GetHeaders().find("x-ms-copy-status");
6583  if (x_ms_copy_status__iterator != httpResponse.GetHeaders().end())
6584  {
6585  response.Details.CopyStatus = CopyStatus(x_ms_copy_status__iterator->second);
6586  }
6587  auto x_ms_copy_status_description__iterator
6588  = httpResponse.GetHeaders().find("x-ms-copy-status-description");
6589  if (x_ms_copy_status_description__iterator != httpResponse.GetHeaders().end())
6590  {
6591  response.Details.CopyStatusDescription = x_ms_copy_status_description__iterator->second;
6592  }
6593  auto x_ms_copy_progress__iterator = httpResponse.GetHeaders().find("x-ms-copy-progress");
6594  if (x_ms_copy_progress__iterator != httpResponse.GetHeaders().end())
6595  {
6596  response.Details.CopyProgress = x_ms_copy_progress__iterator->second;
6597  }
6598  auto x_ms_copy_completion_time__iterator
6599  = httpResponse.GetHeaders().find("x-ms-copy-completion-time");
6600  if (x_ms_copy_completion_time__iterator != httpResponse.GetHeaders().end())
6601  {
6602  response.Details.CopyCompletedOn = Azure::DateTime::Parse(
6603  x_ms_copy_completion_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
6604  }
6605  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
6606  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
6607  {
6608  response.Details.VersionId = x_ms_version_id__iterator->second;
6609  }
6610  auto x_ms_is_current_version__iterator
6611  = httpResponse.GetHeaders().find("x-ms-is-current-version");
6612  if (x_ms_is_current_version__iterator != httpResponse.GetHeaders().end())
6613  {
6614  response.Details.IsCurrentVersion = x_ms_is_current_version__iterator->second == "true";
6615  }
6616  return Azure::Response<DownloadBlobResult>(std::move(response), std::move(pHttpResponse));
6617  }
6618 
6619  struct DeleteBlobOptions final
6620  {
6621  Azure::Nullable<int32_t> Timeout;
6622  Azure::Nullable<DeleteSnapshotsOption> DeleteSnapshots;
6623  Azure::Nullable<std::string> LeaseId;
6624  Azure::Nullable<Azure::DateTime> IfModifiedSince;
6625  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
6626  Azure::ETag IfMatch;
6627  Azure::ETag IfNoneMatch;
6628  Azure::Nullable<std::string> IfTags;
6629  }; // struct DeleteBlobOptions
6630 
6631  static Azure::Core::Http::Request DeleteCreateMessage(
6632  const Azure::Core::Url& url,
6633  const DeleteBlobOptions& options)
6634  {
6635  (void)options;
6636  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Delete, url);
6637  request.SetHeader("x-ms-version", "2020-02-10");
6638  if (options.Timeout.HasValue())
6639  {
6640  request.GetUrl().AppendQueryParameter(
6641  "timeout", std::to_string(options.Timeout.Value()));
6642  }
6643  if (options.DeleteSnapshots.HasValue())
6644  {
6645  request.SetHeader("x-ms-delete-snapshots", options.DeleteSnapshots.Value().ToString());
6646  }
6647  if (options.LeaseId.HasValue())
6648  {
6649  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
6650  }
6651  if (options.IfModifiedSince.HasValue())
6652  {
6653  request.SetHeader(
6654  "If-Modified-Since",
6655  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6656  }
6657  if (options.IfUnmodifiedSince.HasValue())
6658  {
6659  request.SetHeader(
6660  "If-Unmodified-Since",
6661  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6662  }
6663  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
6664  {
6665  request.SetHeader("If-Match", options.IfMatch.ToString());
6666  }
6667  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
6668  {
6669  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
6670  }
6671  if (options.IfTags.HasValue())
6672  {
6673  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
6674  }
6675  return request;
6676  }
6677 
6678  static Azure::Response<DeleteBlobResult> DeleteCreateResponse(
6679  std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse,
6680  const Azure::Core::Context& context)
6681  {
6682  (void)context;
6683  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
6684  DeleteBlobResult response;
6685  auto http_status_code
6686  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
6687  httpResponse.GetStatusCode());
6688  if (!(http_status_code == 202))
6689  {
6690  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
6691  }
6692  return Azure::Response<DeleteBlobResult>(std::move(response), std::move(pHttpResponse));
6693  }
6694 
6695  static Azure::Response<DeleteBlobResult> Delete(
6696  Azure::Core::Http::_internal::HttpPipeline& pipeline,
6697  const Azure::Core::Url& url,
6698  const DeleteBlobOptions& options,
6699  const Azure::Core::Context& context)
6700  {
6701  auto request = DeleteCreateMessage(url, options);
6702  auto pHttpResponse = pipeline.Send(request, context);
6703  return DeleteCreateResponse(std::move(pHttpResponse), context);
6704  }
6705 
6706  struct SetBlobExpiryOptions final
6707  {
6708  Azure::Nullable<int32_t> Timeout;
6709  ScheduleBlobExpiryOriginType ExpiryOrigin;
6710  Azure::Nullable<std::string> ExpiryTime;
6711  }; // struct SetBlobExpiryOptions
6712 
6713  static Azure::Response<SetBlobExpiryResult> ScheduleDeletion(
6714  Azure::Core::Http::_internal::HttpPipeline& pipeline,
6715  const Azure::Core::Url& url,
6716  const SetBlobExpiryOptions& options,
6717  const Azure::Core::Context& context)
6718  {
6719  (void)options;
6720  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
6721  request.SetHeader("Content-Length", "0");
6722  request.SetHeader("x-ms-version", "2020-02-10");
6723  if (options.Timeout.HasValue())
6724  {
6725  request.GetUrl().AppendQueryParameter(
6726  "timeout", std::to_string(options.Timeout.Value()));
6727  }
6728  request.GetUrl().AppendQueryParameter("comp", "expiry");
6729  request.SetHeader("x-ms-expiry-option", options.ExpiryOrigin.ToString());
6730  if (options.ExpiryTime.HasValue())
6731  {
6732  request.SetHeader("x-ms-expiry-time", options.ExpiryTime.Value());
6733  }
6734  auto pHttpResponse = pipeline.Send(request, context);
6735  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
6736  SetBlobExpiryResult response;
6737  auto http_status_code
6738  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
6739  httpResponse.GetStatusCode());
6740  if (!(http_status_code == 200))
6741  {
6742  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
6743  }
6744  return Azure::Response<SetBlobExpiryResult>(
6745  std::move(response), std::move(pHttpResponse));
6746  }
6747 
6748  struct UndeleteBlobOptions final
6749  {
6750  Azure::Nullable<int32_t> Timeout;
6751  }; // struct UndeleteBlobOptions
6752 
6753  static Azure::Response<UndeleteBlobResult> Undelete(
6754  Azure::Core::Http::_internal::HttpPipeline& pipeline,
6755  const Azure::Core::Url& url,
6756  const UndeleteBlobOptions& options,
6757  const Azure::Core::Context& context)
6758  {
6759  (void)options;
6760  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
6761  request.SetHeader("Content-Length", "0");
6762  request.SetHeader("x-ms-version", "2020-02-10");
6763  if (options.Timeout.HasValue())
6764  {
6765  request.GetUrl().AppendQueryParameter(
6766  "timeout", std::to_string(options.Timeout.Value()));
6767  }
6768  request.GetUrl().AppendQueryParameter("comp", "undelete");
6769  auto pHttpResponse = pipeline.Send(request, context);
6770  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
6771  UndeleteBlobResult response;
6772  auto http_status_code
6773  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
6774  httpResponse.GetStatusCode());
6775  if (!(http_status_code == 200))
6776  {
6777  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
6778  }
6779  return Azure::Response<UndeleteBlobResult>(std::move(response), std::move(pHttpResponse));
6780  }
6781 
6782  struct GetBlobPropertiesOptions final
6783  {
6784  Azure::Nullable<int32_t> Timeout;
6785  Azure::Nullable<std::string> EncryptionKey;
6786  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
6787  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
6788  Azure::Nullable<std::string> LeaseId;
6789  Azure::Nullable<Azure::DateTime> IfModifiedSince;
6790  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
6791  Azure::ETag IfMatch;
6792  Azure::ETag IfNoneMatch;
6793  Azure::Nullable<std::string> IfTags;
6794  }; // struct GetBlobPropertiesOptions
6795 
6796  static Azure::Response<BlobProperties> GetProperties(
6797  Azure::Core::Http::_internal::HttpPipeline& pipeline,
6798  const Azure::Core::Url& url,
6799  const GetBlobPropertiesOptions& options,
6800  const Azure::Core::Context& context)
6801  {
6802  (void)options;
6803  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Head, url);
6804  request.SetHeader("x-ms-version", "2020-02-10");
6805  if (options.Timeout.HasValue())
6806  {
6807  request.GetUrl().AppendQueryParameter(
6808  "timeout", std::to_string(options.Timeout.Value()));
6809  }
6810  if (options.EncryptionKey.HasValue())
6811  {
6812  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
6813  }
6814  if (options.EncryptionKeySha256.HasValue())
6815  {
6816  request.SetHeader(
6817  "x-ms-encryption-key-sha256",
6818  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
6819  }
6820  if (options.EncryptionAlgorithm.HasValue())
6821  {
6822  request.SetHeader(
6823  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
6824  }
6825  if (options.LeaseId.HasValue())
6826  {
6827  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
6828  }
6829  if (options.IfModifiedSince.HasValue())
6830  {
6831  request.SetHeader(
6832  "If-Modified-Since",
6833  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6834  }
6835  if (options.IfUnmodifiedSince.HasValue())
6836  {
6837  request.SetHeader(
6838  "If-Unmodified-Since",
6839  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
6840  }
6841  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
6842  {
6843  request.SetHeader("If-Match", options.IfMatch.ToString());
6844  }
6845  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
6846  {
6847  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
6848  }
6849  if (options.IfTags.HasValue())
6850  {
6851  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
6852  }
6853  auto pHttpResponse = pipeline.Send(request, context);
6854  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
6855  BlobProperties response;
6856  auto http_status_code
6857  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
6858  httpResponse.GetStatusCode());
6859  if (!(http_status_code == 200))
6860  {
6861  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
6862  }
6863  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
6864  response.LastModified = Azure::DateTime::Parse(
6865  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
6866  response.CreatedOn = Azure::DateTime::Parse(
6867  httpResponse.GetHeaders().at("x-ms-creation-time"),
6868  Azure::DateTime::DateFormat::Rfc1123);
6869  auto x_ms_expiry_time__iterator = httpResponse.GetHeaders().find("x-ms-expiry-time");
6870  if (x_ms_expiry_time__iterator != httpResponse.GetHeaders().end())
6871  {
6872  response.ExpiresOn = Azure::DateTime::Parse(
6873  x_ms_expiry_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
6874  }
6875  auto x_ms_last_access_time__iterator
6876  = httpResponse.GetHeaders().find("x-ms-last-access-time");
6877  if (x_ms_last_access_time__iterator != httpResponse.GetHeaders().end())
6878  {
6879  response.LastAccessedOn = Azure::DateTime::Parse(
6880  x_ms_last_access_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
6881  }
6882  for (auto i = httpResponse.GetHeaders().lower_bound("x-ms-meta-");
6883  i != httpResponse.GetHeaders().end() && i->first.substr(0, 10) == "x-ms-meta-";
6884  ++i)
6885  {
6886  response.Metadata.emplace(i->first.substr(10), i->second);
6887  }
6888  response.BlobType = BlobType(httpResponse.GetHeaders().at("x-ms-blob-type"));
6889  auto x_ms_lease_status__iterator = httpResponse.GetHeaders().find("x-ms-lease-status");
6890  if (x_ms_lease_status__iterator != httpResponse.GetHeaders().end())
6891  {
6892  response.LeaseStatus = LeaseStatus(x_ms_lease_status__iterator->second);
6893  }
6894  auto x_ms_lease_state__iterator = httpResponse.GetHeaders().find("x-ms-lease-state");
6895  if (x_ms_lease_state__iterator != httpResponse.GetHeaders().end())
6896  {
6897  response.LeaseState = LeaseState(x_ms_lease_state__iterator->second);
6898  }
6899  auto x_ms_lease_duration__iterator
6900  = httpResponse.GetHeaders().find("x-ms-lease-duration");
6901  if (x_ms_lease_duration__iterator != httpResponse.GetHeaders().end())
6902  {
6903  response.LeaseDuration = LeaseDurationType(x_ms_lease_duration__iterator->second);
6904  }
6905  response.BlobSize = std::stoll(httpResponse.GetHeaders().at("content-length"));
6906  auto content_type__iterator = httpResponse.GetHeaders().find("content-type");
6907  if (content_type__iterator != httpResponse.GetHeaders().end())
6908  {
6909  response.HttpHeaders.ContentType = content_type__iterator->second;
6910  }
6911  auto content_encoding__iterator = httpResponse.GetHeaders().find("content-encoding");
6912  if (content_encoding__iterator != httpResponse.GetHeaders().end())
6913  {
6914  response.HttpHeaders.ContentEncoding = content_encoding__iterator->second;
6915  }
6916  auto content_language__iterator = httpResponse.GetHeaders().find("content-language");
6917  if (content_language__iterator != httpResponse.GetHeaders().end())
6918  {
6919  response.HttpHeaders.ContentLanguage = content_language__iterator->second;
6920  }
6921  auto cache_control__iterator = httpResponse.GetHeaders().find("cache-control");
6922  if (cache_control__iterator != httpResponse.GetHeaders().end())
6923  {
6924  response.HttpHeaders.CacheControl = cache_control__iterator->second;
6925  }
6926  auto content_md5__iterator = httpResponse.GetHeaders().find("content-md5");
6927  if (content_md5__iterator != httpResponse.GetHeaders().end())
6928  {
6929  response.HttpHeaders.ContentHash.Value
6930  = Azure::Core::Convert::Base64Decode(content_md5__iterator->second);
6931  }
6932  auto x_ms_blob_content_md5__iterator
6933  = httpResponse.GetHeaders().find("x-ms-blob-content-md5");
6934  if (x_ms_blob_content_md5__iterator != httpResponse.GetHeaders().end())
6935  {
6936  response.HttpHeaders.ContentHash.Value
6937  = Azure::Core::Convert::Base64Decode(x_ms_blob_content_md5__iterator->second);
6938  }
6939  auto content_disposition__iterator
6940  = httpResponse.GetHeaders().find("content-disposition");
6941  if (content_disposition__iterator != httpResponse.GetHeaders().end())
6942  {
6943  response.HttpHeaders.ContentDisposition = content_disposition__iterator->second;
6944  }
6945  auto x_ms_blob_sequence_number__iterator
6946  = httpResponse.GetHeaders().find("x-ms-blob-sequence-number");
6947  if (x_ms_blob_sequence_number__iterator != httpResponse.GetHeaders().end())
6948  {
6949  response.SequenceNumber = std::stoll(x_ms_blob_sequence_number__iterator->second);
6950  }
6951  auto x_ms_blob_committed_block_count__iterator
6952  = httpResponse.GetHeaders().find("x-ms-blob-committed-block-count");
6953  if (x_ms_blob_committed_block_count__iterator != httpResponse.GetHeaders().end())
6954  {
6955  response.CommittedBlockCount
6956  = std::stoi(x_ms_blob_committed_block_count__iterator->second);
6957  }
6958  auto x_ms_blob_sealed__iterator = httpResponse.GetHeaders().find("x-ms-blob-sealed");
6959  if (x_ms_blob_sealed__iterator != httpResponse.GetHeaders().end())
6960  {
6961  response.IsSealed = x_ms_blob_sealed__iterator->second == "true";
6962  }
6963  response.IsServerEncrypted
6964  = httpResponse.GetHeaders().at("x-ms-server-encrypted") == "true";
6965  auto x_ms_encryption_key_sha256__iterator
6966  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
6967  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
6968  {
6969  response.EncryptionKeySha256
6970  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
6971  }
6972  auto x_ms_encryption_scope__iterator
6973  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
6974  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
6975  {
6976  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
6977  }
6978  auto x_ms_access_tier__iterator = httpResponse.GetHeaders().find("x-ms-access-tier");
6979  if (x_ms_access_tier__iterator != httpResponse.GetHeaders().end())
6980  {
6981  response.AccessTier = AccessTier(x_ms_access_tier__iterator->second);
6982  }
6983  auto x_ms_access_tier_inferred__iterator
6984  = httpResponse.GetHeaders().find("x-ms-access-tier-inferred");
6985  if (x_ms_access_tier_inferred__iterator != httpResponse.GetHeaders().end())
6986  {
6987  response.IsAccessTierInferred = x_ms_access_tier_inferred__iterator->second == "true";
6988  }
6989  auto x_ms_archive_status__iterator
6990  = httpResponse.GetHeaders().find("x-ms-archive-status");
6991  if (x_ms_archive_status__iterator != httpResponse.GetHeaders().end())
6992  {
6993  response.ArchiveStatus = ArchiveStatus(x_ms_archive_status__iterator->second);
6994  }
6995  auto x_ms_rehydrate_priority__iterator
6996  = httpResponse.GetHeaders().find("x-ms-rehydrate-priority");
6997  if (x_ms_rehydrate_priority__iterator != httpResponse.GetHeaders().end())
6998  {
6999  response.RehydratePriority
7000  = RehydratePriority(x_ms_rehydrate_priority__iterator->second);
7001  }
7002  auto x_ms_access_tier_change_time__iterator
7003  = httpResponse.GetHeaders().find("x-ms-access-tier-change-time");
7004  if (x_ms_access_tier_change_time__iterator != httpResponse.GetHeaders().end())
7005  {
7006  response.AccessTierChangedOn = Azure::DateTime::Parse(
7007  x_ms_access_tier_change_time__iterator->second,
7008  Azure::DateTime::DateFormat::Rfc1123);
7009  }
7010  auto x_ms_copy_id__iterator = httpResponse.GetHeaders().find("x-ms-copy-id");
7011  if (x_ms_copy_id__iterator != httpResponse.GetHeaders().end())
7012  {
7013  response.CopyId = x_ms_copy_id__iterator->second;
7014  }
7015  auto x_ms_copy_source__iterator = httpResponse.GetHeaders().find("x-ms-copy-source");
7016  if (x_ms_copy_source__iterator != httpResponse.GetHeaders().end())
7017  {
7018  response.CopySource = x_ms_copy_source__iterator->second;
7019  }
7020  auto x_ms_copy_status__iterator = httpResponse.GetHeaders().find("x-ms-copy-status");
7021  if (x_ms_copy_status__iterator != httpResponse.GetHeaders().end())
7022  {
7023  response.CopyStatus = CopyStatus(x_ms_copy_status__iterator->second);
7024  }
7025  auto x_ms_copy_status_description__iterator
7026  = httpResponse.GetHeaders().find("x-ms-copy-status-description");
7027  if (x_ms_copy_status_description__iterator != httpResponse.GetHeaders().end())
7028  {
7029  response.CopyStatusDescription = x_ms_copy_status_description__iterator->second;
7030  }
7031  auto x_ms_incremental_copy__iterator
7032  = httpResponse.GetHeaders().find("x-ms-incremental-copy");
7033  if (x_ms_incremental_copy__iterator != httpResponse.GetHeaders().end())
7034  {
7035  response.IsIncrementalCopy = x_ms_incremental_copy__iterator->second == "true";
7036  }
7037  auto x_ms_copy_destination_snapshot__iterator
7038  = httpResponse.GetHeaders().find("x-ms-copy-destination-snapshot");
7039  if (x_ms_copy_destination_snapshot__iterator != httpResponse.GetHeaders().end())
7040  {
7041  response.IncrementalCopyDestinationSnapshot
7042  = x_ms_copy_destination_snapshot__iterator->second;
7043  }
7044  auto x_ms_copy_progress__iterator = httpResponse.GetHeaders().find("x-ms-copy-progress");
7045  if (x_ms_copy_progress__iterator != httpResponse.GetHeaders().end())
7046  {
7047  response.CopyProgress = x_ms_copy_progress__iterator->second;
7048  }
7049  auto x_ms_copy_completion_time__iterator
7050  = httpResponse.GetHeaders().find("x-ms-copy-completion-time");
7051  if (x_ms_copy_completion_time__iterator != httpResponse.GetHeaders().end())
7052  {
7053  response.CopyCompletedOn = Azure::DateTime::Parse(
7054  x_ms_copy_completion_time__iterator->second, Azure::DateTime::DateFormat::Rfc1123);
7055  }
7056  auto x_ms_or_policy_id__iterator = httpResponse.GetHeaders().find("x-ms-or-policy-id");
7057  if (x_ms_or_policy_id__iterator != httpResponse.GetHeaders().end())
7058  {
7059  response.ObjectReplicationDestinationPolicyId = x_ms_or_policy_id__iterator->second;
7060  }
7061  {
7062  std::map<std::string, std::vector<ObjectReplicationRule>> orPropertiesMap;
7063  for (auto i = httpResponse.GetHeaders().lower_bound("x-ms-or-");
7064  i != httpResponse.GetHeaders().end() && i->first.substr(0, 8) == "x-ms-or-";
7065  ++i)
7066  {
7067  const std::string& header = i->first;
7068  auto underscorePos = header.find('_', 8);
7069  if (underscorePos == std::string::npos)
7070  {
7071  continue;
7072  }
7073  std::string policyId
7074  = std::string(header.begin() + 8, header.begin() + underscorePos);
7075  std::string ruleId = header.substr(underscorePos + 1);
7076 
7077  ObjectReplicationRule rule;
7078  rule.RuleId = std::move(ruleId);
7079  rule.ReplicationStatus = ObjectReplicationStatus(i->second);
7080  orPropertiesMap[policyId].emplace_back(std::move(rule));
7081  }
7082  for (auto& property : orPropertiesMap)
7083  {
7084  ObjectReplicationPolicy policy;
7085  policy.PolicyId = property.first;
7086  policy.Rules = std::move(property.second);
7087  response.ObjectReplicationSourceProperties.emplace_back(std::move(policy));
7088  }
7089  }
7090  auto x_ms_tag_count__iterator = httpResponse.GetHeaders().find("x-ms-tag-count");
7091  if (x_ms_tag_count__iterator != httpResponse.GetHeaders().end())
7092  {
7093  response.TagCount = std::stoi(x_ms_tag_count__iterator->second);
7094  }
7095  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
7096  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
7097  {
7098  response.VersionId = x_ms_version_id__iterator->second;
7099  }
7100  auto x_ms_is_current_version__iterator
7101  = httpResponse.GetHeaders().find("x-ms-is-current-version");
7102  if (x_ms_is_current_version__iterator != httpResponse.GetHeaders().end())
7103  {
7104  response.IsCurrentVersion = x_ms_is_current_version__iterator->second == "true";
7105  }
7106  return Azure::Response<BlobProperties>(std::move(response), std::move(pHttpResponse));
7107  }
7108 
7109  struct SetBlobHttpHeadersOptions final
7110  {
7111  Azure::Nullable<int32_t> Timeout;
7112  BlobHttpHeaders HttpHeaders;
7113  Azure::Nullable<std::string> LeaseId;
7114  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7115  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7116  Azure::ETag IfMatch;
7117  Azure::ETag IfNoneMatch;
7118  Azure::Nullable<std::string> IfTags;
7119  }; // struct SetBlobHttpHeadersOptions
7120 
7121  static Azure::Response<SetBlobHttpHeadersResult> SetHttpHeaders(
7122  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7123  const Azure::Core::Url& url,
7124  const SetBlobHttpHeadersOptions& options,
7125  const Azure::Core::Context& context)
7126  {
7127  (void)options;
7128  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7129  request.SetHeader("Content-Length", "0");
7130  request.GetUrl().AppendQueryParameter("comp", "properties");
7131  request.SetHeader("x-ms-version", "2020-02-10");
7132  if (options.Timeout.HasValue())
7133  {
7134  request.GetUrl().AppendQueryParameter(
7135  "timeout", std::to_string(options.Timeout.Value()));
7136  }
7137  if (!options.HttpHeaders.ContentType.empty())
7138  {
7139  request.SetHeader("x-ms-blob-content-type", options.HttpHeaders.ContentType);
7140  }
7141  if (!options.HttpHeaders.ContentEncoding.empty())
7142  {
7143  request.SetHeader("x-ms-blob-content-encoding", options.HttpHeaders.ContentEncoding);
7144  }
7145  if (!options.HttpHeaders.ContentLanguage.empty())
7146  {
7147  request.SetHeader("x-ms-blob-content-language", options.HttpHeaders.ContentLanguage);
7148  }
7149  if (!options.HttpHeaders.CacheControl.empty())
7150  {
7151  request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
7152  }
7153  if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
7154  {
7155  request.SetHeader(
7156  "x-ms-blob-content-md5",
7157  Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
7158  }
7159  if (!options.HttpHeaders.ContentDisposition.empty())
7160  {
7161  request.SetHeader(
7162  "x-ms-blob-content-disposition", options.HttpHeaders.ContentDisposition);
7163  }
7164  if (options.LeaseId.HasValue())
7165  {
7166  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
7167  }
7168  if (options.IfModifiedSince.HasValue())
7169  {
7170  request.SetHeader(
7171  "If-Modified-Since",
7172  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7173  }
7174  if (options.IfUnmodifiedSince.HasValue())
7175  {
7176  request.SetHeader(
7177  "If-Unmodified-Since",
7178  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7179  }
7180  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7181  {
7182  request.SetHeader("If-Match", options.IfMatch.ToString());
7183  }
7184  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7185  {
7186  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7187  }
7188  if (options.IfTags.HasValue())
7189  {
7190  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7191  }
7192  auto pHttpResponse = pipeline.Send(request, context);
7193  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7194  SetBlobHttpHeadersResult response;
7195  auto http_status_code
7196  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7197  httpResponse.GetStatusCode());
7198  if (!(http_status_code == 200))
7199  {
7200  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7201  }
7202  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7203  response.LastModified = Azure::DateTime::Parse(
7204  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7205  auto x_ms_blob_sequence_number__iterator
7206  = httpResponse.GetHeaders().find("x-ms-blob-sequence-number");
7207  if (x_ms_blob_sequence_number__iterator != httpResponse.GetHeaders().end())
7208  {
7209  response.SequenceNumber = std::stoll(x_ms_blob_sequence_number__iterator->second);
7210  }
7211  return Azure::Response<SetBlobHttpHeadersResult>(
7212  std::move(response), std::move(pHttpResponse));
7213  }
7214 
7215  struct SetBlobMetadataOptions final
7216  {
7217  Azure::Nullable<int32_t> Timeout;
7218  Storage::Metadata Metadata;
7219  Azure::Nullable<std::string> EncryptionKey;
7220  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
7221  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
7222  Azure::Nullable<std::string> EncryptionScope;
7223  Azure::Nullable<std::string> LeaseId;
7224  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7225  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7226  Azure::ETag IfMatch;
7227  Azure::ETag IfNoneMatch;
7228  Azure::Nullable<std::string> IfTags;
7229  }; // struct SetBlobMetadataOptions
7230 
7231  static Azure::Response<SetBlobMetadataResult> SetMetadata(
7232  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7233  const Azure::Core::Url& url,
7234  const SetBlobMetadataOptions& options,
7235  const Azure::Core::Context& context)
7236  {
7237  (void)options;
7238  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7239  request.SetHeader("Content-Length", "0");
7240  request.GetUrl().AppendQueryParameter("comp", "metadata");
7241  request.SetHeader("x-ms-version", "2020-02-10");
7242  if (options.Timeout.HasValue())
7243  {
7244  request.GetUrl().AppendQueryParameter(
7245  "timeout", std::to_string(options.Timeout.Value()));
7246  }
7247  for (const auto& pair : options.Metadata)
7248  {
7249  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
7250  }
7251  if (options.EncryptionKey.HasValue())
7252  {
7253  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
7254  }
7255  if (options.EncryptionKeySha256.HasValue())
7256  {
7257  request.SetHeader(
7258  "x-ms-encryption-key-sha256",
7259  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
7260  }
7261  if (options.EncryptionAlgorithm.HasValue())
7262  {
7263  request.SetHeader(
7264  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
7265  }
7266  if (options.EncryptionScope.HasValue())
7267  {
7268  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
7269  }
7270  if (options.LeaseId.HasValue())
7271  {
7272  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
7273  }
7274  if (options.IfModifiedSince.HasValue())
7275  {
7276  request.SetHeader(
7277  "If-Modified-Since",
7278  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7279  }
7280  if (options.IfUnmodifiedSince.HasValue())
7281  {
7282  request.SetHeader(
7283  "If-Unmodified-Since",
7284  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7285  }
7286  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7287  {
7288  request.SetHeader("If-Match", options.IfMatch.ToString());
7289  }
7290  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7291  {
7292  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7293  }
7294  if (options.IfTags.HasValue())
7295  {
7296  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7297  }
7298  auto pHttpResponse = pipeline.Send(request, context);
7299  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7300  SetBlobMetadataResult response;
7301  auto http_status_code
7302  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7303  httpResponse.GetStatusCode());
7304  if (!(http_status_code == 200))
7305  {
7306  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7307  }
7308  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7309  response.LastModified = Azure::DateTime::Parse(
7310  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7311  return Azure::Response<SetBlobMetadataResult>(
7312  std::move(response), std::move(pHttpResponse));
7313  }
7314 
7315  struct SetBlobAccessTierOptions final
7316  {
7317  Azure::Nullable<int32_t> Timeout;
7318  Models::AccessTier AccessTier;
7319  Azure::Nullable<Models::RehydratePriority> RehydratePriority;
7320  Azure::Nullable<std::string> IfTags;
7321  }; // struct SetBlobAccessTierOptions
7322 
7323  static Azure::Core::Http::Request SetAccessTierCreateMessage(
7324  const Azure::Core::Url& url,
7325  const SetBlobAccessTierOptions& options)
7326  {
7327  (void)options;
7328  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7329  request.SetHeader("Content-Length", "0");
7330  request.GetUrl().AppendQueryParameter("comp", "tier");
7331  request.SetHeader("x-ms-version", "2020-02-10");
7332  if (options.Timeout.HasValue())
7333  {
7334  request.GetUrl().AppendQueryParameter(
7335  "timeout", std::to_string(options.Timeout.Value()));
7336  }
7337  request.SetHeader("x-ms-access-tier", options.AccessTier.ToString());
7338  if (options.RehydratePriority.HasValue())
7339  {
7340  request.SetHeader(
7341  "x-ms-rehydrate-priority", options.RehydratePriority.Value().ToString());
7342  }
7343  if (options.IfTags.HasValue())
7344  {
7345  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7346  }
7347  return request;
7348  }
7349 
7350  static Azure::Response<SetBlobAccessTierResult> SetAccessTierCreateResponse(
7351  std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse,
7352  const Azure::Core::Context& context)
7353  {
7354  (void)context;
7355  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7356  SetBlobAccessTierResult response;
7357  auto http_status_code
7358  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7359  httpResponse.GetStatusCode());
7360  if (!(http_status_code == 200 || http_status_code == 202))
7361  {
7362  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7363  }
7364  return Azure::Response<SetBlobAccessTierResult>(
7365  std::move(response), std::move(pHttpResponse));
7366  }
7367 
7368  static Azure::Response<SetBlobAccessTierResult> SetAccessTier(
7369  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7370  const Azure::Core::Url& url,
7371  const SetBlobAccessTierOptions& options,
7372  const Azure::Core::Context& context)
7373  {
7374  auto request = SetAccessTierCreateMessage(url, options);
7375  auto pHttpResponse = pipeline.Send(request, context);
7376  return SetAccessTierCreateResponse(std::move(pHttpResponse), context);
7377  }
7378 
7379  struct StartBlobCopyFromUriOptions final
7380  {
7381  Azure::Nullable<int32_t> Timeout;
7382  Storage::Metadata Metadata;
7383  std::string SourceUri;
7384  Azure::Nullable<std::string> LeaseId;
7385  Azure::Nullable<std::string> SourceLeaseId;
7386  Azure::Nullable<Models::AccessTier> AccessTier;
7387  Azure::Nullable<Models::RehydratePriority> RehydratePriority;
7388  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7389  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7390  Azure::ETag IfMatch;
7391  Azure::ETag IfNoneMatch;
7392  Azure::Nullable<std::string> IfTags;
7393  Azure::Nullable<Azure::DateTime> SourceIfModifiedSince;
7394  Azure::Nullable<Azure::DateTime> SourceIfUnmodifiedSince;
7395  Azure::ETag SourceIfMatch;
7396  Azure::ETag SourceIfNoneMatch;
7397  Azure::Nullable<std::string> SourceIfTags;
7398  Azure::Nullable<bool> ShouldSealDestination;
7399  }; // struct StartBlobCopyFromUriOptions
7400 
7401  static Azure::Response<Models::_detail::StartBlobCopyFromUriResult> StartCopyFromUri(
7402  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7403  const Azure::Core::Url& url,
7404  const StartBlobCopyFromUriOptions& options,
7405  const Azure::Core::Context& context)
7406  {
7407  (void)options;
7408  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7409  request.SetHeader("Content-Length", "0");
7410  request.SetHeader("x-ms-version", "2020-02-10");
7411  if (options.Timeout.HasValue())
7412  {
7413  request.GetUrl().AppendQueryParameter(
7414  "timeout", std::to_string(options.Timeout.Value()));
7415  }
7416  for (const auto& pair : options.Metadata)
7417  {
7418  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
7419  }
7420  request.SetHeader("x-ms-copy-source", options.SourceUri);
7421  if (options.LeaseId.HasValue())
7422  {
7423  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
7424  }
7425  if (options.SourceLeaseId.HasValue())
7426  {
7427  request.SetHeader("x-ms-source-lease-id", options.SourceLeaseId.Value());
7428  }
7429  if (options.AccessTier.HasValue())
7430  {
7431  request.SetHeader("x-ms-access-tier", options.AccessTier.Value().ToString());
7432  }
7433  if (options.RehydratePriority.HasValue())
7434  {
7435  request.SetHeader(
7436  "x-ms-rehydrate-priority", options.RehydratePriority.Value().ToString());
7437  }
7438  if (options.ShouldSealDestination.HasValue())
7439  {
7440  request.SetHeader(
7441  "x-ms-seal-blob", options.ShouldSealDestination.Value() ? "true" : "false");
7442  }
7443  if (options.IfModifiedSince.HasValue())
7444  {
7445  request.SetHeader(
7446  "If-Modified-Since",
7447  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7448  }
7449  if (options.IfUnmodifiedSince.HasValue())
7450  {
7451  request.SetHeader(
7452  "If-Unmodified-Since",
7453  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7454  }
7455  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7456  {
7457  request.SetHeader("If-Match", options.IfMatch.ToString());
7458  }
7459  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7460  {
7461  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7462  }
7463  if (options.IfTags.HasValue())
7464  {
7465  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7466  }
7467  if (options.SourceIfModifiedSince.HasValue())
7468  {
7469  request.SetHeader(
7470  "x-ms-source-if-modified-since",
7471  options.SourceIfModifiedSince.Value().ToString(
7472  Azure::DateTime::DateFormat::Rfc1123));
7473  }
7474  if (options.SourceIfUnmodifiedSince.HasValue())
7475  {
7476  request.SetHeader(
7477  "x-ms-source-if-unmodified-since",
7478  options.SourceIfUnmodifiedSince.Value().ToString(
7479  Azure::DateTime::DateFormat::Rfc1123));
7480  }
7481  if (options.SourceIfMatch.HasValue() && !options.SourceIfMatch.ToString().empty())
7482  {
7483  request.SetHeader("x-ms-source-if-match", options.SourceIfMatch.ToString());
7484  }
7485  if (options.SourceIfNoneMatch.HasValue() && !options.SourceIfNoneMatch.ToString().empty())
7486  {
7487  request.SetHeader("x-ms-source-if-none-match", options.SourceIfNoneMatch.ToString());
7488  }
7489  if (options.SourceIfTags.HasValue())
7490  {
7491  request.SetHeader("x-ms-source-if-tags", options.SourceIfTags.Value());
7492  }
7493  auto pHttpResponse = pipeline.Send(request, context);
7494  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7495  Models::_detail::StartBlobCopyFromUriResult response;
7496  auto http_status_code
7497  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7498  httpResponse.GetStatusCode());
7499  if (!(http_status_code == 202))
7500  {
7501  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7502  }
7503  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7504  response.LastModified = Azure::DateTime::Parse(
7505  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7506  response.CopyId = httpResponse.GetHeaders().at("x-ms-copy-id");
7507  response.CopyStatus = CopyStatus(httpResponse.GetHeaders().at("x-ms-copy-status"));
7508  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
7509  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
7510  {
7511  response.VersionId = x_ms_version_id__iterator->second;
7512  }
7513  return Azure::Response<Models::_detail::StartBlobCopyFromUriResult>(
7514  std::move(response), std::move(pHttpResponse));
7515  }
7516 
7517  struct AbortBlobCopyFromUriOptions final
7518  {
7519  Azure::Nullable<int32_t> Timeout;
7520  std::string CopyId;
7521  Azure::Nullable<std::string> LeaseId;
7522  }; // struct AbortBlobCopyFromUriOptions
7523 
7524  static Azure::Response<AbortBlobCopyFromUriResult> AbortCopyFromUri(
7525  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7526  const Azure::Core::Url& url,
7527  const AbortBlobCopyFromUriOptions& options,
7528  const Azure::Core::Context& context)
7529  {
7530  (void)options;
7531  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7532  request.SetHeader("Content-Length", "0");
7533  request.SetHeader("x-ms-version", "2020-02-10");
7534  if (options.Timeout.HasValue())
7535  {
7536  request.GetUrl().AppendQueryParameter(
7537  "timeout", std::to_string(options.Timeout.Value()));
7538  }
7539  request.GetUrl().AppendQueryParameter("comp", "copy");
7540  request.GetUrl().AppendQueryParameter(
7541  "copyid", _internal::UrlEncodeQueryParameter(options.CopyId));
7542  request.SetHeader("x-ms-copy-action", "abort");
7543  if (options.LeaseId.HasValue())
7544  {
7545  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
7546  }
7547  auto pHttpResponse = pipeline.Send(request, context);
7548  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7549  AbortBlobCopyFromUriResult response;
7550  auto http_status_code
7551  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7552  httpResponse.GetStatusCode());
7553  if (!(http_status_code == 204))
7554  {
7555  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7556  }
7557  return Azure::Response<AbortBlobCopyFromUriResult>(
7558  std::move(response), std::move(pHttpResponse));
7559  }
7560 
7561  struct CreateBlobSnapshotOptions final
7562  {
7563  Azure::Nullable<int32_t> Timeout;
7564  Storage::Metadata Metadata;
7565  Azure::Nullable<std::string> LeaseId;
7566  Azure::Nullable<std::string> EncryptionKey;
7567  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
7568  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
7569  Azure::Nullable<std::string> EncryptionScope;
7570  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7571  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7572  Azure::ETag IfMatch;
7573  Azure::ETag IfNoneMatch;
7574  Azure::Nullable<std::string> IfTags;
7575  }; // struct CreateBlobSnapshotOptions
7576 
7577  static Azure::Response<CreateBlobSnapshotResult> CreateSnapshot(
7578  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7579  const Azure::Core::Url& url,
7580  const CreateBlobSnapshotOptions& options,
7581  const Azure::Core::Context& context)
7582  {
7583  (void)options;
7584  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7585  request.SetHeader("Content-Length", "0");
7586  request.GetUrl().AppendQueryParameter("comp", "snapshot");
7587  request.SetHeader("x-ms-version", "2020-02-10");
7588  if (options.Timeout.HasValue())
7589  {
7590  request.GetUrl().AppendQueryParameter(
7591  "timeout", std::to_string(options.Timeout.Value()));
7592  }
7593  if (options.EncryptionKey.HasValue())
7594  {
7595  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
7596  }
7597  if (options.EncryptionKeySha256.HasValue())
7598  {
7599  request.SetHeader(
7600  "x-ms-encryption-key-sha256",
7601  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
7602  }
7603  if (options.EncryptionAlgorithm.HasValue())
7604  {
7605  request.SetHeader(
7606  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
7607  }
7608  if (options.EncryptionScope.HasValue())
7609  {
7610  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
7611  }
7612  for (const auto& pair : options.Metadata)
7613  {
7614  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
7615  }
7616  if (options.LeaseId.HasValue())
7617  {
7618  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
7619  }
7620  if (options.IfModifiedSince.HasValue())
7621  {
7622  request.SetHeader(
7623  "If-Modified-Since",
7624  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7625  }
7626  if (options.IfUnmodifiedSince.HasValue())
7627  {
7628  request.SetHeader(
7629  "If-Unmodified-Since",
7630  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7631  }
7632  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7633  {
7634  request.SetHeader("If-Match", options.IfMatch.ToString());
7635  }
7636  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7637  {
7638  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7639  }
7640  if (options.IfTags.HasValue())
7641  {
7642  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7643  }
7644  auto pHttpResponse = pipeline.Send(request, context);
7645  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7646  CreateBlobSnapshotResult response;
7647  auto http_status_code
7648  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7649  httpResponse.GetStatusCode());
7650  if (!(http_status_code == 201))
7651  {
7652  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7653  }
7654  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7655  response.LastModified = Azure::DateTime::Parse(
7656  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7657  response.IsServerEncrypted
7658  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
7659  auto x_ms_encryption_key_sha256__iterator
7660  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
7661  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
7662  {
7663  response.EncryptionKeySha256
7664  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
7665  }
7666  auto x_ms_encryption_scope__iterator
7667  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
7668  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
7669  {
7670  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
7671  }
7672  response.Snapshot = httpResponse.GetHeaders().at("x-ms-snapshot");
7673  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
7674  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
7675  {
7676  response.VersionId = x_ms_version_id__iterator->second;
7677  }
7678  return Azure::Response<CreateBlobSnapshotResult>(
7679  std::move(response), std::move(pHttpResponse));
7680  }
7681 
7682  struct GetBlobTagsOptions final
7683  {
7684  Azure::Nullable<int32_t> Timeout;
7685  Azure::Nullable<std::string> IfTags;
7686  }; // struct GetBlobTagsOptions
7687 
7688  static Azure::Response<Models::_detail::GetBlobTagsResult> GetTags(
7689  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7690  const Azure::Core::Url& url,
7691  const GetBlobTagsOptions& options,
7692  const Azure::Core::Context& context)
7693  {
7694  (void)options;
7695  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
7696  request.SetHeader("x-ms-version", "2020-02-10");
7697  if (options.Timeout.HasValue())
7698  {
7699  request.GetUrl().AppendQueryParameter(
7700  "timeout", std::to_string(options.Timeout.Value()));
7701  }
7702  request.GetUrl().AppendQueryParameter("comp", "tags");
7703  if (options.IfTags.HasValue())
7704  {
7705  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7706  }
7707  auto pHttpResponse = pipeline.Send(request, context);
7708  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7709  Models::_detail::GetBlobTagsResult response;
7710  auto http_status_code
7711  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7712  httpResponse.GetStatusCode());
7713  if (!(http_status_code == 200))
7714  {
7715  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7716  }
7717  {
7718  const auto& httpResponseBody = httpResponse.GetBody();
7719  _internal::XmlReader reader(
7720  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
7721  response = GetBlobTagsResultInternalFromXml(reader);
7722  }
7723  return Azure::Response<Models::_detail::GetBlobTagsResult>(
7724  std::move(response), std::move(pHttpResponse));
7725  }
7726 
7727  struct SetBlobTagsOptions final
7728  {
7729  Azure::Nullable<int32_t> Timeout;
7730  std::map<std::string, std::string> Tags;
7731  Azure::Nullable<std::string> IfTags;
7732  }; // struct SetBlobTagsOptions
7733 
7734  static Azure::Response<SetBlobTagsResult> SetTags(
7735  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7736  const Azure::Core::Url& url,
7737  const SetBlobTagsOptions& options,
7738  const Azure::Core::Context& context)
7739  {
7740  (void)options;
7741  std::string xml_body;
7742  {
7743  _internal::XmlWriter writer;
7744  SetBlobTagsOptionsToXml(writer, options);
7745  xml_body = writer.GetDocument();
7746  writer.Write(_internal::XmlNode{_internal::XmlNodeType::End});
7747  }
7748  Azure::Core::IO::MemoryBodyStream xml_body_stream(
7749  reinterpret_cast<const uint8_t*>(xml_body.data()), xml_body.length());
7750  auto request = Azure::Core::Http::Request(
7751  Azure::Core::Http::HttpMethod::Put, url, &xml_body_stream);
7752  request.SetHeader("Content-Length", std::to_string(xml_body_stream.Length()));
7753  request.SetHeader("x-ms-version", "2020-02-10");
7754  if (options.Timeout.HasValue())
7755  {
7756  request.GetUrl().AppendQueryParameter(
7757  "timeout", std::to_string(options.Timeout.Value()));
7758  }
7759  request.GetUrl().AppendQueryParameter("comp", "tags");
7760  request.SetHeader("Content-Type", "application/xml; charset=UTF-8");
7761  if (options.IfTags.HasValue())
7762  {
7763  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7764  }
7765  auto pHttpResponse = pipeline.Send(request, context);
7766  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7767  SetBlobTagsResult response;
7768  auto http_status_code
7769  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7770  httpResponse.GetStatusCode());
7771  if (!(http_status_code == 204))
7772  {
7773  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7774  }
7775  return Azure::Response<SetBlobTagsResult>(std::move(response), std::move(pHttpResponse));
7776  }
7777 
7778  struct AcquireBlobLeaseOptions final
7779  {
7780  Azure::Nullable<int32_t> Timeout;
7781  std::chrono::seconds LeaseDuration;
7782  Azure::Nullable<std::string> ProposedLeaseId;
7783  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7784  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7785  Azure::ETag IfMatch;
7786  Azure::ETag IfNoneMatch;
7787  Azure::Nullable<std::string> IfTags;
7788  }; // struct AcquireBlobLeaseOptions
7789 
7790  static Azure::Response<Models::_detail::AcquireBlobLeaseResult> AcquireLease(
7791  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7792  const Azure::Core::Url& url,
7793  const AcquireBlobLeaseOptions& options,
7794  const Azure::Core::Context& context)
7795  {
7796  (void)options;
7797  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7798  request.SetHeader("Content-Length", "0");
7799  request.SetHeader("x-ms-version", "2020-02-10");
7800  if (options.Timeout.HasValue())
7801  {
7802  request.GetUrl().AppendQueryParameter(
7803  "timeout", std::to_string(options.Timeout.Value()));
7804  }
7805  request.GetUrl().AppendQueryParameter("comp", "lease");
7806  request.SetHeader("x-ms-lease-action", "acquire");
7807  request.SetHeader("x-ms-lease-duration", std::to_string(options.LeaseDuration.count()));
7808  if (options.ProposedLeaseId.HasValue())
7809  {
7810  request.SetHeader("x-ms-proposed-lease-id", options.ProposedLeaseId.Value());
7811  }
7812  if (options.IfModifiedSince.HasValue())
7813  {
7814  request.SetHeader(
7815  "If-Modified-Since",
7816  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7817  }
7818  if (options.IfUnmodifiedSince.HasValue())
7819  {
7820  request.SetHeader(
7821  "If-Unmodified-Since",
7822  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7823  }
7824  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7825  {
7826  request.SetHeader("If-Match", options.IfMatch.ToString());
7827  }
7828  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7829  {
7830  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7831  }
7832  if (options.IfTags.HasValue())
7833  {
7834  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7835  }
7836  auto pHttpResponse = pipeline.Send(request, context);
7837  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7838  Models::_detail::AcquireBlobLeaseResult response;
7839  auto http_status_code
7840  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7841  httpResponse.GetStatusCode());
7842  if (!(http_status_code == 201))
7843  {
7844  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7845  }
7846  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7847  response.LastModified = Azure::DateTime::Parse(
7848  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7849  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
7850  return Azure::Response<Models::_detail::AcquireBlobLeaseResult>(
7851  std::move(response), std::move(pHttpResponse));
7852  }
7853 
7854  struct RenewBlobLeaseOptions final
7855  {
7856  Azure::Nullable<int32_t> Timeout;
7857  std::string LeaseId;
7858  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7859  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7860  Azure::ETag IfMatch;
7861  Azure::ETag IfNoneMatch;
7862  Azure::Nullable<std::string> IfTags;
7863  }; // struct RenewBlobLeaseOptions
7864 
7865  static Azure::Response<Models::_detail::RenewBlobLeaseResult> RenewLease(
7866  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7867  const Azure::Core::Url& url,
7868  const RenewBlobLeaseOptions& options,
7869  const Azure::Core::Context& context)
7870  {
7871  (void)options;
7872  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7873  request.SetHeader("Content-Length", "0");
7874  request.SetHeader("x-ms-version", "2020-02-10");
7875  if (options.Timeout.HasValue())
7876  {
7877  request.GetUrl().AppendQueryParameter(
7878  "timeout", std::to_string(options.Timeout.Value()));
7879  }
7880  request.GetUrl().AppendQueryParameter("comp", "lease");
7881  request.SetHeader("x-ms-lease-action", "renew");
7882  request.SetHeader("x-ms-lease-id", options.LeaseId);
7883  if (options.IfModifiedSince.HasValue())
7884  {
7885  request.SetHeader(
7886  "If-Modified-Since",
7887  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7888  }
7889  if (options.IfUnmodifiedSince.HasValue())
7890  {
7891  request.SetHeader(
7892  "If-Unmodified-Since",
7893  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7894  }
7895  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7896  {
7897  request.SetHeader("If-Match", options.IfMatch.ToString());
7898  }
7899  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7900  {
7901  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7902  }
7903  if (options.IfTags.HasValue())
7904  {
7905  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7906  }
7907  auto pHttpResponse = pipeline.Send(request, context);
7908  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7909  Models::_detail::RenewBlobLeaseResult response;
7910  auto http_status_code
7911  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7912  httpResponse.GetStatusCode());
7913  if (!(http_status_code == 200))
7914  {
7915  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7916  }
7917  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7918  response.LastModified = Azure::DateTime::Parse(
7919  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7920  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
7921  return Azure::Response<Models::_detail::RenewBlobLeaseResult>(
7922  std::move(response), std::move(pHttpResponse));
7923  }
7924 
7925  struct ChangeBlobLeaseOptions final
7926  {
7927  Azure::Nullable<int32_t> Timeout;
7928  std::string LeaseId;
7929  std::string ProposedLeaseId;
7930  Azure::Nullable<Azure::DateTime> IfModifiedSince;
7931  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
7932  Azure::ETag IfMatch;
7933  Azure::ETag IfNoneMatch;
7934  Azure::Nullable<std::string> IfTags;
7935  }; // struct ChangeBlobLeaseOptions
7936 
7937  static Azure::Response<Models::_detail::ChangeBlobLeaseResult> ChangeLease(
7938  Azure::Core::Http::_internal::HttpPipeline& pipeline,
7939  const Azure::Core::Url& url,
7940  const ChangeBlobLeaseOptions& options,
7941  const Azure::Core::Context& context)
7942  {
7943  (void)options;
7944  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
7945  request.SetHeader("Content-Length", "0");
7946  request.SetHeader("x-ms-version", "2020-02-10");
7947  if (options.Timeout.HasValue())
7948  {
7949  request.GetUrl().AppendQueryParameter(
7950  "timeout", std::to_string(options.Timeout.Value()));
7951  }
7952  request.GetUrl().AppendQueryParameter("comp", "lease");
7953  request.SetHeader("x-ms-lease-action", "change");
7954  request.SetHeader("x-ms-lease-id", options.LeaseId);
7955  request.SetHeader("x-ms-proposed-lease-id", options.ProposedLeaseId);
7956  if (options.IfModifiedSince.HasValue())
7957  {
7958  request.SetHeader(
7959  "If-Modified-Since",
7960  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7961  }
7962  if (options.IfUnmodifiedSince.HasValue())
7963  {
7964  request.SetHeader(
7965  "If-Unmodified-Since",
7966  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
7967  }
7968  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
7969  {
7970  request.SetHeader("If-Match", options.IfMatch.ToString());
7971  }
7972  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
7973  {
7974  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
7975  }
7976  if (options.IfTags.HasValue())
7977  {
7978  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
7979  }
7980  auto pHttpResponse = pipeline.Send(request, context);
7981  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
7982  Models::_detail::ChangeBlobLeaseResult response;
7983  auto http_status_code
7984  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
7985  httpResponse.GetStatusCode());
7986  if (!(http_status_code == 200))
7987  {
7988  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
7989  }
7990  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
7991  response.LastModified = Azure::DateTime::Parse(
7992  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
7993  response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
7994  return Azure::Response<Models::_detail::ChangeBlobLeaseResult>(
7995  std::move(response), std::move(pHttpResponse));
7996  }
7997 
7998  struct ReleaseBlobLeaseOptions final
7999  {
8000  Azure::Nullable<int32_t> Timeout;
8001  std::string LeaseId;
8002  Azure::Nullable<Azure::DateTime> IfModifiedSince;
8003  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
8004  Azure::ETag IfMatch;
8005  Azure::ETag IfNoneMatch;
8006  Azure::Nullable<std::string> IfTags;
8007  }; // struct ReleaseBlobLeaseOptions
8008 
8009  static Azure::Response<Models::_detail::ReleaseBlobLeaseResult> ReleaseLease(
8010  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8011  const Azure::Core::Url& url,
8012  const ReleaseBlobLeaseOptions& options,
8013  const Azure::Core::Context& context)
8014  {
8015  (void)options;
8016  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
8017  request.SetHeader("Content-Length", "0");
8018  request.SetHeader("x-ms-version", "2020-02-10");
8019  if (options.Timeout.HasValue())
8020  {
8021  request.GetUrl().AppendQueryParameter(
8022  "timeout", std::to_string(options.Timeout.Value()));
8023  }
8024  request.GetUrl().AppendQueryParameter("comp", "lease");
8025  request.SetHeader("x-ms-lease-action", "release");
8026  request.SetHeader("x-ms-lease-id", options.LeaseId);
8027  if (options.IfModifiedSince.HasValue())
8028  {
8029  request.SetHeader(
8030  "If-Modified-Since",
8031  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8032  }
8033  if (options.IfUnmodifiedSince.HasValue())
8034  {
8035  request.SetHeader(
8036  "If-Unmodified-Since",
8037  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8038  }
8039  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
8040  {
8041  request.SetHeader("If-Match", options.IfMatch.ToString());
8042  }
8043  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
8044  {
8045  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
8046  }
8047  if (options.IfTags.HasValue())
8048  {
8049  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
8050  }
8051  auto pHttpResponse = pipeline.Send(request, context);
8052  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8053  Models::_detail::ReleaseBlobLeaseResult response;
8054  auto http_status_code
8055  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8056  httpResponse.GetStatusCode());
8057  if (!(http_status_code == 200))
8058  {
8059  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8060  }
8061  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
8062  response.LastModified = Azure::DateTime::Parse(
8063  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
8064  auto x_ms_blob_sequence_number__iterator
8065  = httpResponse.GetHeaders().find("x-ms-blob-sequence-number");
8066  if (x_ms_blob_sequence_number__iterator != httpResponse.GetHeaders().end())
8067  {
8068  response.SequenceNumber = std::stoll(x_ms_blob_sequence_number__iterator->second);
8069  }
8070  return Azure::Response<Models::_detail::ReleaseBlobLeaseResult>(
8071  std::move(response), std::move(pHttpResponse));
8072  }
8073 
8074  struct BreakBlobLeaseOptions final
8075  {
8076  Azure::Nullable<int32_t> Timeout;
8077  Azure::Nullable<std::chrono::seconds> BreakPeriod;
8078  Azure::Nullable<Azure::DateTime> IfModifiedSince;
8079  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
8080  Azure::ETag IfMatch;
8081  Azure::ETag IfNoneMatch;
8082  Azure::Nullable<std::string> IfTags;
8083  }; // struct BreakBlobLeaseOptions
8084 
8085  static Azure::Response<Models::_detail::BreakBlobLeaseResult> BreakLease(
8086  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8087  const Azure::Core::Url& url,
8088  const BreakBlobLeaseOptions& options,
8089  const Azure::Core::Context& context)
8090  {
8091  (void)options;
8092  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
8093  request.SetHeader("Content-Length", "0");
8094  request.SetHeader("x-ms-version", "2020-02-10");
8095  if (options.Timeout.HasValue())
8096  {
8097  request.GetUrl().AppendQueryParameter(
8098  "timeout", std::to_string(options.Timeout.Value()));
8099  }
8100  request.GetUrl().AppendQueryParameter("comp", "lease");
8101  request.SetHeader("x-ms-lease-action", "break");
8102  if (options.BreakPeriod.HasValue())
8103  {
8104  request.SetHeader(
8105  "x-ms-lease-break-period", std::to_string(options.BreakPeriod.Value().count()));
8106  }
8107  if (options.IfModifiedSince.HasValue())
8108  {
8109  request.SetHeader(
8110  "If-Modified-Since",
8111  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8112  }
8113  if (options.IfUnmodifiedSince.HasValue())
8114  {
8115  request.SetHeader(
8116  "If-Unmodified-Since",
8117  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8118  }
8119  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
8120  {
8121  request.SetHeader("If-Match", options.IfMatch.ToString());
8122  }
8123  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
8124  {
8125  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
8126  }
8127  if (options.IfTags.HasValue())
8128  {
8129  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
8130  }
8131  auto pHttpResponse = pipeline.Send(request, context);
8132  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8133  Models::_detail::BreakBlobLeaseResult response;
8134  auto http_status_code
8135  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8136  httpResponse.GetStatusCode());
8137  if (!(http_status_code == 202))
8138  {
8139  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8140  }
8141  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
8142  response.LastModified = Azure::DateTime::Parse(
8143  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
8144  response.LeaseTime = std::stoi(httpResponse.GetHeaders().at("x-ms-lease-time"));
8145  return Azure::Response<Models::_detail::BreakBlobLeaseResult>(
8146  std::move(response), std::move(pHttpResponse));
8147  }
8148 
8149  private:
8150  static Models::_detail::GetBlobTagsResult GetBlobTagsResultInternalFromXml(
8151  _internal::XmlReader& reader)
8152  {
8153  Models::_detail::GetBlobTagsResult ret;
8154  enum class XmlTagName
8155  {
8156  k_Tags,
8157  k_TagSet,
8158  k_Unknown,
8159  };
8160  std::vector<XmlTagName> path;
8161  while (true)
8162  {
8163  auto node = reader.Read();
8164  if (node.Type == _internal::XmlNodeType::End)
8165  {
8166  break;
8167  }
8168  else if (node.Type == _internal::XmlNodeType::EndTag)
8169  {
8170  if (path.size() > 0)
8171  {
8172  path.pop_back();
8173  }
8174  else
8175  {
8176  break;
8177  }
8178  }
8179  else if (node.Type == _internal::XmlNodeType::StartTag)
8180  {
8181  if (std::strcmp(node.Name, "Tags") == 0)
8182  {
8183  path.emplace_back(XmlTagName::k_Tags);
8184  }
8185  else if (std::strcmp(node.Name, "TagSet") == 0)
8186  {
8187  path.emplace_back(XmlTagName::k_TagSet);
8188  }
8189  else
8190  {
8191  path.emplace_back(XmlTagName::k_Unknown);
8192  }
8193  if (path.size() == 2 && path[0] == XmlTagName::k_Tags
8194  && path[1] == XmlTagName::k_TagSet)
8195  {
8196  ret.Tags = TagsFromXml(reader);
8197  path.pop_back();
8198  }
8199  }
8200  else if (node.Type == _internal::XmlNodeType::Text)
8201  {
8202  }
8203  }
8204  return ret;
8205  }
8206 
8207  static std::map<std::string, std::string> TagsFromXml(_internal::XmlReader& reader)
8208  {
8209  std::map<std::string, std::string> ret;
8210  int depth = 0;
8211  std::string key;
8212  bool is_key = false;
8213  bool is_value = false;
8214  while (true)
8215  {
8216  auto node = reader.Read();
8217  if (node.Type == _internal::XmlNodeType::End)
8218  {
8219  break;
8220  }
8221  else if (node.Type == _internal::XmlNodeType::StartTag)
8222  {
8223  ++depth;
8224  if (strcmp(node.Name, "Key") == 0)
8225  {
8226  is_key = true;
8227  }
8228  else if (strcmp(node.Name, "Value") == 0)
8229  {
8230  is_value = true;
8231  }
8232  }
8233  else if (node.Type == _internal::XmlNodeType::EndTag)
8234  {
8235  if (depth-- == 0)
8236  {
8237  break;
8238  }
8239  }
8240  if (depth == 2 && node.Type == _internal::XmlNodeType::Text)
8241  {
8242  if (is_key)
8243  {
8244  key = node.Value;
8245  is_key = false;
8246  }
8247  else if (is_value)
8248  {
8249  ret.emplace(std::move(key), node.Value);
8250  is_value = false;
8251  }
8252  }
8253  }
8254  return ret;
8255  }
8256 
8257  static void SetBlobTagsOptionsToXml(
8258  _internal::XmlWriter& writer,
8259  const SetBlobTagsOptions& options)
8260  {
8261  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Tags"});
8262  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "TagSet"});
8263  for (const auto& i : options.Tags)
8264  {
8265  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Tag"});
8266  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Key"});
8267  writer.Write(_internal::XmlNode{_internal::XmlNodeType::Text, nullptr, i.first.data()});
8268  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
8269  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Value"});
8270  writer.Write(
8271  _internal::XmlNode{_internal::XmlNodeType::Text, nullptr, i.second.data()});
8272  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
8273  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
8274  }
8275  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
8276  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
8277  }
8278 
8279  }; // class Blob
8280 
8281  class BlockBlob final {
8282  public:
8283  struct UploadBlockBlobOptions final
8284  {
8285  Azure::Nullable<int32_t> Timeout;
8286  Azure::Nullable<ContentHash> TransactionalContentHash;
8287  BlobHttpHeaders HttpHeaders;
8288  Storage::Metadata Metadata;
8289  Azure::Nullable<std::string> LeaseId;
8290  Azure::Nullable<Models::AccessTier> AccessTier;
8291  Azure::Nullable<std::string> EncryptionKey;
8292  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
8293  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
8294  Azure::Nullable<std::string> EncryptionScope;
8295  Azure::Nullable<Azure::DateTime> IfModifiedSince;
8296  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
8297  Azure::ETag IfMatch;
8298  Azure::ETag IfNoneMatch;
8299  Azure::Nullable<std::string> IfTags;
8300  }; // struct UploadBlockBlobOptions
8301 
8302  static Azure::Response<UploadBlockBlobResult> Upload(
8303  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8304  const Azure::Core::Url& url,
8305  Azure::Core::IO::BodyStream& requestBody,
8306  const UploadBlockBlobOptions& options,
8307  const Azure::Core::Context& context)
8308  {
8309  (void)options;
8310  auto request
8311  = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url, &requestBody);
8312  request.SetHeader("Content-Length", std::to_string(requestBody.Length()));
8313  request.SetHeader("x-ms-version", "2020-02-10");
8314  if (options.Timeout.HasValue())
8315  {
8316  request.GetUrl().AppendQueryParameter(
8317  "timeout", std::to_string(options.Timeout.Value()));
8318  }
8319  if (options.EncryptionKey.HasValue())
8320  {
8321  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
8322  }
8323  if (options.EncryptionKeySha256.HasValue())
8324  {
8325  request.SetHeader(
8326  "x-ms-encryption-key-sha256",
8327  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
8328  }
8329  if (options.EncryptionAlgorithm.HasValue())
8330  {
8331  request.SetHeader(
8332  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
8333  }
8334  if (options.EncryptionScope.HasValue())
8335  {
8336  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
8337  }
8338  if (options.TransactionalContentHash.HasValue())
8339  {
8340  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
8341  {
8342  request.SetHeader(
8343  "Content-MD5",
8344  Azure::Core::Convert::Base64Encode(
8345  options.TransactionalContentHash.Value().Value));
8346  }
8347  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
8348  {
8349  request.SetHeader(
8350  "x-ms-content-crc64",
8351  Azure::Core::Convert::Base64Encode(
8352  options.TransactionalContentHash.Value().Value));
8353  }
8354  }
8355  if (!options.HttpHeaders.ContentType.empty())
8356  {
8357  request.SetHeader("x-ms-blob-content-type", options.HttpHeaders.ContentType);
8358  }
8359  if (!options.HttpHeaders.ContentEncoding.empty())
8360  {
8361  request.SetHeader("x-ms-blob-content-encoding", options.HttpHeaders.ContentEncoding);
8362  }
8363  if (!options.HttpHeaders.ContentLanguage.empty())
8364  {
8365  request.SetHeader("x-ms-blob-content-language", options.HttpHeaders.ContentLanguage);
8366  }
8367  if (!options.HttpHeaders.CacheControl.empty())
8368  {
8369  request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
8370  }
8371  if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
8372  {
8373  request.SetHeader(
8374  "x-ms-blob-content-md5",
8375  Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
8376  }
8377  if (!options.HttpHeaders.ContentDisposition.empty())
8378  {
8379  request.SetHeader(
8380  "x-ms-blob-content-disposition", options.HttpHeaders.ContentDisposition);
8381  }
8382  for (const auto& pair : options.Metadata)
8383  {
8384  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
8385  }
8386  if (options.LeaseId.HasValue())
8387  {
8388  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
8389  }
8390  request.SetHeader("x-ms-blob-type", "BlockBlob");
8391  if (options.AccessTier.HasValue())
8392  {
8393  request.SetHeader("x-ms-access-tier", options.AccessTier.Value().ToString());
8394  }
8395  if (options.IfModifiedSince.HasValue())
8396  {
8397  request.SetHeader(
8398  "If-Modified-Since",
8399  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8400  }
8401  if (options.IfUnmodifiedSince.HasValue())
8402  {
8403  request.SetHeader(
8404  "If-Unmodified-Since",
8405  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8406  }
8407  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
8408  {
8409  request.SetHeader("If-Match", options.IfMatch.ToString());
8410  }
8411  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
8412  {
8413  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
8414  }
8415  if (options.IfTags.HasValue())
8416  {
8417  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
8418  }
8419  auto pHttpResponse = pipeline.Send(request, context);
8420  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8421  UploadBlockBlobResult response;
8422  auto http_status_code
8423  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8424  httpResponse.GetStatusCode());
8425  if (!(http_status_code == 201))
8426  {
8427  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8428  }
8429  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
8430  response.LastModified = Azure::DateTime::Parse(
8431  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
8432  {
8433  const auto& headers = httpResponse.GetHeaders();
8434  auto content_md5_iterator = headers.find("content-md5");
8435  if (content_md5_iterator != headers.end())
8436  {
8437  ContentHash hash;
8438  hash.Algorithm = HashAlgorithm::Md5;
8439  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
8440  response.TransactionalContentHash = std::move(hash);
8441  }
8442  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
8443  if (x_ms_content_crc64_iterator != headers.end())
8444  {
8445  ContentHash hash;
8446  hash.Algorithm = HashAlgorithm::Crc64;
8447  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
8448  response.TransactionalContentHash = std::move(hash);
8449  }
8450  }
8451  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
8452  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
8453  {
8454  response.VersionId = x_ms_version_id__iterator->second;
8455  }
8456  response.IsServerEncrypted
8457  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
8458  auto x_ms_encryption_key_sha256__iterator
8459  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
8460  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
8461  {
8462  response.EncryptionKeySha256
8463  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
8464  }
8465  auto x_ms_encryption_scope__iterator
8466  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
8467  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
8468  {
8469  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
8470  }
8471  return Azure::Response<UploadBlockBlobResult>(
8472  std::move(response), std::move(pHttpResponse));
8473  }
8474 
8475  struct StageBlockOptions final
8476  {
8477  Azure::Nullable<int32_t> Timeout;
8478  std::string BlockId;
8479  Azure::Nullable<ContentHash> TransactionalContentHash;
8480  Azure::Nullable<std::string> LeaseId;
8481  Azure::Nullable<std::string> EncryptionKey;
8482  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
8483  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
8484  Azure::Nullable<std::string> EncryptionScope;
8485  }; // struct StageBlockOptions
8486 
8487  static Azure::Response<StageBlockResult> StageBlock(
8488  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8489  const Azure::Core::Url& url,
8490  Azure::Core::IO::BodyStream& requestBody,
8491  const StageBlockOptions& options,
8492  const Azure::Core::Context& context)
8493  {
8494  (void)options;
8495  auto request
8496  = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url, &requestBody);
8497  request.SetHeader("Content-Length", std::to_string(requestBody.Length()));
8498  request.GetUrl().AppendQueryParameter("comp", "block");
8499  request.GetUrl().AppendQueryParameter(
8500  "blockid", _internal::UrlEncodeQueryParameter(options.BlockId));
8501  request.SetHeader("x-ms-version", "2020-02-10");
8502  if (options.Timeout.HasValue())
8503  {
8504  request.GetUrl().AppendQueryParameter(
8505  "timeout", std::to_string(options.Timeout.Value()));
8506  }
8507  if (options.TransactionalContentHash.HasValue())
8508  {
8509  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
8510  {
8511  request.SetHeader(
8512  "Content-MD5",
8513  Azure::Core::Convert::Base64Encode(
8514  options.TransactionalContentHash.Value().Value));
8515  }
8516  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
8517  {
8518  request.SetHeader(
8519  "x-ms-content-crc64",
8520  Azure::Core::Convert::Base64Encode(
8521  options.TransactionalContentHash.Value().Value));
8522  }
8523  }
8524  if (options.LeaseId.HasValue())
8525  {
8526  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
8527  }
8528  if (options.EncryptionKey.HasValue())
8529  {
8530  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
8531  }
8532  if (options.EncryptionKeySha256.HasValue())
8533  {
8534  request.SetHeader(
8535  "x-ms-encryption-key-sha256",
8536  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
8537  }
8538  if (options.EncryptionAlgorithm.HasValue())
8539  {
8540  request.SetHeader(
8541  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
8542  }
8543  if (options.EncryptionScope.HasValue())
8544  {
8545  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
8546  }
8547  auto pHttpResponse = pipeline.Send(request, context);
8548  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8549  StageBlockResult response;
8550  auto http_status_code
8551  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8552  httpResponse.GetStatusCode());
8553  if (!(http_status_code == 201))
8554  {
8555  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8556  }
8557  {
8558  const auto& headers = httpResponse.GetHeaders();
8559  auto content_md5_iterator = headers.find("content-md5");
8560  if (content_md5_iterator != headers.end())
8561  {
8562  ContentHash hash;
8563  hash.Algorithm = HashAlgorithm::Md5;
8564  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
8565  response.TransactionalContentHash = std::move(hash);
8566  }
8567  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
8568  if (x_ms_content_crc64_iterator != headers.end())
8569  {
8570  ContentHash hash;
8571  hash.Algorithm = HashAlgorithm::Crc64;
8572  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
8573  response.TransactionalContentHash = std::move(hash);
8574  }
8575  }
8576  response.IsServerEncrypted
8577  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
8578  auto x_ms_encryption_key_sha256__iterator
8579  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
8580  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
8581  {
8582  response.EncryptionKeySha256
8583  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
8584  }
8585  auto x_ms_encryption_scope__iterator
8586  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
8587  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
8588  {
8589  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
8590  }
8591  return Azure::Response<StageBlockResult>(std::move(response), std::move(pHttpResponse));
8592  }
8593 
8594  struct StageBlockFromUriOptions final
8595  {
8596  Azure::Nullable<int32_t> Timeout;
8597  std::string BlockId;
8598  std::string SourceUri;
8599  Azure::Nullable<Azure::Core::Http::HttpRange> SourceRange;
8600  Azure::Nullable<ContentHash> TransactionalContentHash;
8601  Azure::Nullable<std::string> LeaseId;
8602  Azure::Nullable<std::string> EncryptionKey;
8603  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
8604  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
8605  Azure::Nullable<std::string> EncryptionScope;
8606  Azure::Nullable<Azure::DateTime> SourceIfModifiedSince;
8607  Azure::Nullable<Azure::DateTime> SourceIfUnmodifiedSince;
8608  Azure::ETag SourceIfMatch;
8609  Azure::ETag SourceIfNoneMatch;
8610  }; // struct StageBlockFromUriOptions
8611 
8612  static Azure::Response<StageBlockFromUriResult> StageBlockFromUri(
8613  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8614  const Azure::Core::Url& url,
8615  const StageBlockFromUriOptions& options,
8616  const Azure::Core::Context& context)
8617  {
8618  (void)options;
8619  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
8620  request.SetHeader("Content-Length", "0");
8621  request.GetUrl().AppendQueryParameter("comp", "block");
8622  request.GetUrl().AppendQueryParameter(
8623  "blockid", _internal::UrlEncodeQueryParameter(options.BlockId));
8624  request.SetHeader("x-ms-version", "2020-02-10");
8625  if (options.Timeout.HasValue())
8626  {
8627  request.GetUrl().AppendQueryParameter(
8628  "timeout", std::to_string(options.Timeout.Value()));
8629  }
8630  request.SetHeader("x-ms-copy-source", options.SourceUri);
8631  if (options.SourceRange.HasValue())
8632  {
8633  std::string headerValue
8634  = "bytes=" + std::to_string(options.SourceRange.Value().Offset) + "-";
8635  if (options.SourceRange.Value().Length.HasValue())
8636  {
8637  headerValue += std::to_string(
8638  options.SourceRange.Value().Offset + options.SourceRange.Value().Length.Value()
8639  - 1);
8640  }
8641  request.SetHeader("x-ms-source_range", std::move(headerValue));
8642  }
8643  if (options.TransactionalContentHash.HasValue())
8644  {
8645  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
8646  {
8647  request.SetHeader(
8648  "x-ms-source-content-md5",
8649  Azure::Core::Convert::Base64Encode(
8650  options.TransactionalContentHash.Value().Value));
8651  }
8652  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
8653  {
8654  request.SetHeader(
8655  "x-ms-source-content-crc64",
8656  Azure::Core::Convert::Base64Encode(
8657  options.TransactionalContentHash.Value().Value));
8658  }
8659  }
8660  if (options.LeaseId.HasValue())
8661  {
8662  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
8663  }
8664  if (options.EncryptionKey.HasValue())
8665  {
8666  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
8667  }
8668  if (options.EncryptionKeySha256.HasValue())
8669  {
8670  request.SetHeader(
8671  "x-ms-encryption-key-sha256",
8672  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
8673  }
8674  if (options.EncryptionAlgorithm.HasValue())
8675  {
8676  request.SetHeader(
8677  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
8678  }
8679  if (options.EncryptionScope.HasValue())
8680  {
8681  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
8682  }
8683  if (options.SourceIfModifiedSince.HasValue())
8684  {
8685  request.SetHeader(
8686  "x-ms-source-if-modified-since",
8687  options.SourceIfModifiedSince.Value().ToString(
8688  Azure::DateTime::DateFormat::Rfc1123));
8689  }
8690  if (options.SourceIfUnmodifiedSince.HasValue())
8691  {
8692  request.SetHeader(
8693  "x-ms-source-if-unmodified-since",
8694  options.SourceIfUnmodifiedSince.Value().ToString(
8695  Azure::DateTime::DateFormat::Rfc1123));
8696  }
8697  if (options.SourceIfMatch.HasValue() && !options.SourceIfMatch.ToString().empty())
8698  {
8699  request.SetHeader("x-ms-source-if-match", options.SourceIfMatch.ToString());
8700  }
8701  if (options.SourceIfNoneMatch.HasValue() && !options.SourceIfNoneMatch.ToString().empty())
8702  {
8703  request.SetHeader("x-ms-source-if-none-match", options.SourceIfNoneMatch.ToString());
8704  }
8705  auto pHttpResponse = pipeline.Send(request, context);
8706  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8707  StageBlockFromUriResult response;
8708  auto http_status_code
8709  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8710  httpResponse.GetStatusCode());
8711  if (!(http_status_code == 201))
8712  {
8713  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8714  }
8715  {
8716  const auto& headers = httpResponse.GetHeaders();
8717  auto content_md5_iterator = headers.find("content-md5");
8718  if (content_md5_iterator != headers.end())
8719  {
8720  ContentHash hash;
8721  hash.Algorithm = HashAlgorithm::Md5;
8722  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
8723  response.TransactionalContentHash = std::move(hash);
8724  }
8725  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
8726  if (x_ms_content_crc64_iterator != headers.end())
8727  {
8728  ContentHash hash;
8729  hash.Algorithm = HashAlgorithm::Crc64;
8730  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
8731  response.TransactionalContentHash = std::move(hash);
8732  }
8733  }
8734  response.IsServerEncrypted
8735  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
8736  auto x_ms_encryption_key_sha256__iterator
8737  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
8738  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
8739  {
8740  response.EncryptionKeySha256
8741  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
8742  }
8743  auto x_ms_encryption_scope__iterator
8744  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
8745  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
8746  {
8747  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
8748  }
8749  return Azure::Response<StageBlockFromUriResult>(
8750  std::move(response), std::move(pHttpResponse));
8751  }
8752 
8753  struct CommitBlockListOptions final
8754  {
8755  Azure::Nullable<int32_t> Timeout;
8756  std::vector<std::pair<BlockType, std::string>> BlockList;
8757  BlobHttpHeaders HttpHeaders;
8758  Storage::Metadata Metadata;
8759  Azure::Nullable<std::string> LeaseId;
8760  Azure::Nullable<std::string> EncryptionKey;
8761  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
8762  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
8763  Azure::Nullable<std::string> EncryptionScope;
8764  Azure::Nullable<Azure::DateTime> IfModifiedSince;
8765  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
8766  Azure::ETag IfMatch;
8767  Azure::ETag IfNoneMatch;
8768  Azure::Nullable<std::string> IfTags;
8769  Azure::Nullable<Models::AccessTier> AccessTier;
8770  }; // struct CommitBlockListOptions
8771 
8772  static Azure::Response<CommitBlockListResult> CommitBlockList(
8773  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8774  const Azure::Core::Url& url,
8775  const CommitBlockListOptions& options,
8776  const Azure::Core::Context& context)
8777  {
8778  (void)options;
8779  std::string xml_body;
8780  {
8781  _internal::XmlWriter writer;
8782  CommitBlockListOptionsToXml(writer, options);
8783  xml_body = writer.GetDocument();
8784  writer.Write(_internal::XmlNode{_internal::XmlNodeType::End});
8785  }
8786  Azure::Core::IO::MemoryBodyStream xml_body_stream(
8787  reinterpret_cast<const uint8_t*>(xml_body.data()), xml_body.length());
8788  auto request = Azure::Core::Http::Request(
8789  Azure::Core::Http::HttpMethod::Put, url, &xml_body_stream);
8790  request.SetHeader("Content-Length", std::to_string(xml_body_stream.Length()));
8791  request.GetUrl().AppendQueryParameter("comp", "blocklist");
8792  request.SetHeader("x-ms-version", "2020-02-10");
8793  if (options.Timeout.HasValue())
8794  {
8795  request.GetUrl().AppendQueryParameter(
8796  "timeout", std::to_string(options.Timeout.Value()));
8797  }
8798  if (!options.HttpHeaders.ContentType.empty())
8799  {
8800  request.SetHeader("x-ms-blob-content-type", options.HttpHeaders.ContentType);
8801  }
8802  if (!options.HttpHeaders.ContentEncoding.empty())
8803  {
8804  request.SetHeader("x-ms-blob-content-encoding", options.HttpHeaders.ContentEncoding);
8805  }
8806  if (!options.HttpHeaders.ContentLanguage.empty())
8807  {
8808  request.SetHeader("x-ms-blob-content-language", options.HttpHeaders.ContentLanguage);
8809  }
8810  if (!options.HttpHeaders.CacheControl.empty())
8811  {
8812  request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
8813  }
8814  if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
8815  {
8816  request.SetHeader(
8817  "x-ms-blob-content-md5",
8818  Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
8819  }
8820  if (!options.HttpHeaders.ContentDisposition.empty())
8821  {
8822  request.SetHeader(
8823  "x-ms-blob-content-disposition", options.HttpHeaders.ContentDisposition);
8824  }
8825  for (const auto& pair : options.Metadata)
8826  {
8827  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
8828  }
8829  if (options.LeaseId.HasValue())
8830  {
8831  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
8832  }
8833  if (options.EncryptionKey.HasValue())
8834  {
8835  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
8836  }
8837  if (options.EncryptionKeySha256.HasValue())
8838  {
8839  request.SetHeader(
8840  "x-ms-encryption-key-sha256",
8841  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
8842  }
8843  if (options.EncryptionAlgorithm.HasValue())
8844  {
8845  request.SetHeader(
8846  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
8847  }
8848  if (options.EncryptionScope.HasValue())
8849  {
8850  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
8851  }
8852  if (options.AccessTier.HasValue())
8853  {
8854  request.SetHeader("x-ms-access-tier", options.AccessTier.Value().ToString());
8855  }
8856  if (options.IfModifiedSince.HasValue())
8857  {
8858  request.SetHeader(
8859  "If-Modified-Since",
8860  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8861  }
8862  if (options.IfUnmodifiedSince.HasValue())
8863  {
8864  request.SetHeader(
8865  "If-Unmodified-Since",
8866  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
8867  }
8868  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
8869  {
8870  request.SetHeader("If-Match", options.IfMatch.ToString());
8871  }
8872  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
8873  {
8874  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
8875  }
8876  if (options.IfTags.HasValue())
8877  {
8878  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
8879  }
8880  auto pHttpResponse = pipeline.Send(request, context);
8881  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8882  CommitBlockListResult response;
8883  auto http_status_code
8884  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8885  httpResponse.GetStatusCode());
8886  if (!(http_status_code == 201))
8887  {
8888  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8889  }
8890  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
8891  response.LastModified = Azure::DateTime::Parse(
8892  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
8893  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
8894  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
8895  {
8896  response.VersionId = x_ms_version_id__iterator->second;
8897  }
8898  response.IsServerEncrypted
8899  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
8900  auto x_ms_encryption_key_sha256__iterator
8901  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
8902  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
8903  {
8904  response.EncryptionKeySha256
8905  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
8906  }
8907  auto x_ms_encryption_scope__iterator
8908  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
8909  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
8910  {
8911  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
8912  }
8913  return Azure::Response<CommitBlockListResult>(
8914  std::move(response), std::move(pHttpResponse));
8915  }
8916 
8917  struct GetBlockListOptions final
8918  {
8919  Azure::Nullable<int32_t> Timeout;
8920  BlockListType ListType = BlockListType::Committed;
8921  Azure::Nullable<std::string> LeaseId;
8922  Azure::Nullable<std::string> IfTags;
8923  }; // struct GetBlockListOptions
8924 
8925  static Azure::Response<GetBlockListResult> GetBlockList(
8926  Azure::Core::Http::_internal::HttpPipeline& pipeline,
8927  const Azure::Core::Url& url,
8928  const GetBlockListOptions& options,
8929  const Azure::Core::Context& context)
8930  {
8931  (void)options;
8932  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
8933  request.GetUrl().AppendQueryParameter("comp", "blocklist");
8934  request.GetUrl().AppendQueryParameter(
8935  "blocklisttype", _internal::UrlEncodeQueryParameter(options.ListType.ToString()));
8936  request.SetHeader("x-ms-version", "2020-02-10");
8937  if (options.Timeout.HasValue())
8938  {
8939  request.GetUrl().AppendQueryParameter(
8940  "timeout", std::to_string(options.Timeout.Value()));
8941  }
8942  if (options.LeaseId.HasValue())
8943  {
8944  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
8945  }
8946  if (options.IfTags.HasValue())
8947  {
8948  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
8949  }
8950  auto pHttpResponse = pipeline.Send(request, context);
8951  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
8952  GetBlockListResult response;
8953  auto http_status_code
8954  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
8955  httpResponse.GetStatusCode());
8956  if (!(http_status_code == 200))
8957  {
8958  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
8959  }
8960  {
8961  const auto& httpResponseBody = httpResponse.GetBody();
8962  _internal::XmlReader reader(
8963  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
8964  response = GetBlockListResultFromXml(reader);
8965  }
8966  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
8967  response.LastModified = Azure::DateTime::Parse(
8968  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
8969  response.BlobSize = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-content-length"));
8970  return Azure::Response<GetBlockListResult>(std::move(response), std::move(pHttpResponse));
8971  }
8972 
8973  private:
8974  static GetBlockListResult GetBlockListResultFromXml(_internal::XmlReader& reader)
8975  {
8976  GetBlockListResult ret;
8977  enum class XmlTagName
8978  {
8979  k_BlockList,
8980  k_CommittedBlocks,
8981  k_Block,
8982  k_UncommittedBlocks,
8983  k_Unknown,
8984  };
8985  std::vector<XmlTagName> path;
8986  while (true)
8987  {
8988  auto node = reader.Read();
8989  if (node.Type == _internal::XmlNodeType::End)
8990  {
8991  break;
8992  }
8993  else if (node.Type == _internal::XmlNodeType::EndTag)
8994  {
8995  if (path.size() > 0)
8996  {
8997  path.pop_back();
8998  }
8999  else
9000  {
9001  break;
9002  }
9003  }
9004  else if (node.Type == _internal::XmlNodeType::StartTag)
9005  {
9006  if (std::strcmp(node.Name, "BlockList") == 0)
9007  {
9008  path.emplace_back(XmlTagName::k_BlockList);
9009  }
9010  else if (std::strcmp(node.Name, "CommittedBlocks") == 0)
9011  {
9012  path.emplace_back(XmlTagName::k_CommittedBlocks);
9013  }
9014  else if (std::strcmp(node.Name, "Block") == 0)
9015  {
9016  path.emplace_back(XmlTagName::k_Block);
9017  }
9018  else if (std::strcmp(node.Name, "UncommittedBlocks") == 0)
9019  {
9020  path.emplace_back(XmlTagName::k_UncommittedBlocks);
9021  }
9022  else
9023  {
9024  path.emplace_back(XmlTagName::k_Unknown);
9025  }
9026  if (path.size() == 3 && path[0] == XmlTagName::k_BlockList
9027  && path[1] == XmlTagName::k_CommittedBlocks && path[2] == XmlTagName::k_Block)
9028  {
9029  ret.CommittedBlocks.emplace_back(BlobBlockFromXml(reader));
9030  path.pop_back();
9031  }
9032  else if (
9033  path.size() == 3 && path[0] == XmlTagName::k_BlockList
9034  && path[1] == XmlTagName::k_UncommittedBlocks && path[2] == XmlTagName::k_Block)
9035  {
9036  ret.UncommittedBlocks.emplace_back(BlobBlockFromXml(reader));
9037  path.pop_back();
9038  }
9039  }
9040  else if (node.Type == _internal::XmlNodeType::Text)
9041  {
9042  }
9043  }
9044  return ret;
9045  }
9046 
9047  static BlobBlock BlobBlockFromXml(_internal::XmlReader& reader)
9048  {
9049  BlobBlock ret;
9050  enum class XmlTagName
9051  {
9052  k_Name,
9053  k_Size,
9054  k_Unknown,
9055  };
9056  std::vector<XmlTagName> path;
9057  while (true)
9058  {
9059  auto node = reader.Read();
9060  if (node.Type == _internal::XmlNodeType::End)
9061  {
9062  break;
9063  }
9064  else if (node.Type == _internal::XmlNodeType::EndTag)
9065  {
9066  if (path.size() > 0)
9067  {
9068  path.pop_back();
9069  }
9070  else
9071  {
9072  break;
9073  }
9074  }
9075  else if (node.Type == _internal::XmlNodeType::StartTag)
9076  {
9077  if (std::strcmp(node.Name, "Name") == 0)
9078  {
9079  path.emplace_back(XmlTagName::k_Name);
9080  }
9081  else if (std::strcmp(node.Name, "Size") == 0)
9082  {
9083  path.emplace_back(XmlTagName::k_Size);
9084  }
9085  else
9086  {
9087  path.emplace_back(XmlTagName::k_Unknown);
9088  }
9089  }
9090  else if (node.Type == _internal::XmlNodeType::Text)
9091  {
9092  if (path.size() == 1 && path[0] == XmlTagName::k_Name)
9093  {
9094  ret.Name = node.Value;
9095  }
9096  else if (path.size() == 1 && path[0] == XmlTagName::k_Size)
9097  {
9098  ret.Size = std::stoll(node.Value);
9099  }
9100  }
9101  }
9102  return ret;
9103  }
9104 
9105  static void CommitBlockListOptionsToXml(
9106  _internal::XmlWriter& writer,
9107  const CommitBlockListOptions& options)
9108  {
9109  writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "BlockList"});
9110  for (const auto& i : options.BlockList)
9111  {
9112  writer.Write(_internal::XmlNode{
9113  _internal::XmlNodeType::StartTag, i.first.ToString().data(), i.second.data()});
9114  }
9115  writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag});
9116  }
9117 
9118  }; // class BlockBlob
9119 
9120  class PageBlob final {
9121  public:
9122  struct CreatePageBlobOptions final
9123  {
9124  Azure::Nullable<int32_t> Timeout;
9125  int64_t BlobSize = -1;
9126  Azure::Nullable<int64_t> SequenceNumber;
9127  BlobHttpHeaders HttpHeaders;
9128  Storage::Metadata Metadata;
9129  Azure::Nullable<std::string> LeaseId;
9130  Azure::Nullable<Models::AccessTier> AccessTier;
9131  Azure::Nullable<std::string> EncryptionKey;
9132  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
9133  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
9134  Azure::Nullable<std::string> EncryptionScope;
9135  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9136  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9137  Azure::ETag IfMatch;
9138  Azure::ETag IfNoneMatch;
9139  Azure::Nullable<std::string> IfTags;
9140  }; // struct CreatePageBlobOptions
9141 
9142  static Azure::Response<CreatePageBlobResult> Create(
9143  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9144  const Azure::Core::Url& url,
9145  const CreatePageBlobOptions& options,
9146  const Azure::Core::Context& context)
9147  {
9148  (void)options;
9149  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
9150  request.SetHeader("Content-Length", "0");
9151  request.SetHeader("x-ms-version", "2020-02-10");
9152  if (options.Timeout.HasValue())
9153  {
9154  request.GetUrl().AppendQueryParameter(
9155  "timeout", std::to_string(options.Timeout.Value()));
9156  }
9157  if (!options.HttpHeaders.ContentType.empty())
9158  {
9159  request.SetHeader("x-ms-blob-content-type", options.HttpHeaders.ContentType);
9160  }
9161  if (!options.HttpHeaders.ContentEncoding.empty())
9162  {
9163  request.SetHeader("x-ms-blob-content-encoding", options.HttpHeaders.ContentEncoding);
9164  }
9165  if (!options.HttpHeaders.ContentLanguage.empty())
9166  {
9167  request.SetHeader("x-ms-blob-content-language", options.HttpHeaders.ContentLanguage);
9168  }
9169  if (!options.HttpHeaders.CacheControl.empty())
9170  {
9171  request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
9172  }
9173  if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
9174  {
9175  request.SetHeader(
9176  "x-ms-blob-content-md5",
9177  Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
9178  }
9179  if (!options.HttpHeaders.ContentDisposition.empty())
9180  {
9181  request.SetHeader(
9182  "x-ms-blob-content-disposition", options.HttpHeaders.ContentDisposition);
9183  }
9184  for (const auto& pair : options.Metadata)
9185  {
9186  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
9187  }
9188  if (options.LeaseId.HasValue())
9189  {
9190  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9191  }
9192  request.SetHeader("x-ms-blob-type", "PageBlob");
9193  request.SetHeader("x-ms-blob-content-length", std::to_string(options.BlobSize));
9194  if (options.SequenceNumber.HasValue())
9195  {
9196  request.SetHeader(
9197  "x-ms-blob-sequence-number", std::to_string(options.SequenceNumber.Value()));
9198  }
9199  if (options.AccessTier.HasValue())
9200  {
9201  request.SetHeader("x-ms-access-tier", options.AccessTier.Value().ToString());
9202  }
9203  if (options.EncryptionKey.HasValue())
9204  {
9205  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
9206  }
9207  if (options.EncryptionKeySha256.HasValue())
9208  {
9209  request.SetHeader(
9210  "x-ms-encryption-key-sha256",
9211  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
9212  }
9213  if (options.EncryptionAlgorithm.HasValue())
9214  {
9215  request.SetHeader(
9216  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
9217  }
9218  if (options.EncryptionScope.HasValue())
9219  {
9220  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
9221  }
9222  if (options.IfModifiedSince.HasValue())
9223  {
9224  request.SetHeader(
9225  "If-Modified-Since",
9226  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9227  }
9228  if (options.IfUnmodifiedSince.HasValue())
9229  {
9230  request.SetHeader(
9231  "If-Unmodified-Since",
9232  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9233  }
9234  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9235  {
9236  request.SetHeader("If-Match", options.IfMatch.ToString());
9237  }
9238  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9239  {
9240  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9241  }
9242  if (options.IfTags.HasValue())
9243  {
9244  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9245  }
9246  auto pHttpResponse = pipeline.Send(request, context);
9247  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9248  CreatePageBlobResult response;
9249  auto http_status_code
9250  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9251  httpResponse.GetStatusCode());
9252  if (!(http_status_code == 201))
9253  {
9254  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9255  }
9256  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
9257  response.LastModified = Azure::DateTime::Parse(
9258  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
9259  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
9260  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
9261  {
9262  response.VersionId = x_ms_version_id__iterator->second;
9263  }
9264  response.IsServerEncrypted
9265  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
9266  auto x_ms_encryption_key_sha256__iterator
9267  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
9268  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
9269  {
9270  response.EncryptionKeySha256
9271  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
9272  }
9273  auto x_ms_encryption_scope__iterator
9274  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
9275  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
9276  {
9277  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
9278  }
9279  return Azure::Response<CreatePageBlobResult>(
9280  std::move(response), std::move(pHttpResponse));
9281  }
9282 
9283  struct UploadPageBlobPagesOptions final
9284  {
9285  Azure::Nullable<int32_t> Timeout;
9286  Azure::Core::Http::HttpRange Range;
9287  Azure::Nullable<ContentHash> TransactionalContentHash;
9288  Azure::Nullable<std::string> LeaseId;
9289  Azure::Nullable<int64_t> IfSequenceNumberLessThanOrEqualTo;
9290  Azure::Nullable<int64_t> IfSequenceNumberLessThan;
9291  Azure::Nullable<int64_t> IfSequenceNumberEqualTo;
9292  Azure::Nullable<std::string> EncryptionKey;
9293  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
9294  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
9295  Azure::Nullable<std::string> EncryptionScope;
9296  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9297  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9298  Azure::ETag IfMatch;
9299  Azure::ETag IfNoneMatch;
9300  Azure::Nullable<std::string> IfTags;
9301  }; // struct UploadPageBlobPagesOptions
9302 
9303  static Azure::Response<UploadPagesResult> UploadPages(
9304  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9305  const Azure::Core::Url& url,
9306  Azure::Core::IO::BodyStream& requestBody,
9307  const UploadPageBlobPagesOptions& options,
9308  const Azure::Core::Context& context)
9309  {
9310  (void)options;
9311  auto request
9312  = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url, &requestBody);
9313  request.SetHeader("Content-Length", std::to_string(requestBody.Length()));
9314  request.GetUrl().AppendQueryParameter("comp", "page");
9315  request.SetHeader("x-ms-version", "2020-02-10");
9316  if (options.Timeout.HasValue())
9317  {
9318  request.GetUrl().AppendQueryParameter(
9319  "timeout", std::to_string(options.Timeout.Value()));
9320  }
9321  {
9322  std::string headerValue = "bytes=" + std::to_string(options.Range.Offset) + "-";
9323  if (options.Range.Length.HasValue())
9324  {
9325  headerValue
9326  += std::to_string(options.Range.Offset + options.Range.Length.Value() - 1);
9327  }
9328  request.SetHeader("x-ms-range", std::move(headerValue));
9329  }
9330  if (options.TransactionalContentHash.HasValue())
9331  {
9332  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
9333  {
9334  request.SetHeader(
9335  "Content-MD5",
9336  Azure::Core::Convert::Base64Encode(
9337  options.TransactionalContentHash.Value().Value));
9338  }
9339  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
9340  {
9341  request.SetHeader(
9342  "x-ms-content-crc64",
9343  Azure::Core::Convert::Base64Encode(
9344  options.TransactionalContentHash.Value().Value));
9345  }
9346  }
9347  request.SetHeader("x-ms-page-write", "update");
9348  if (options.LeaseId.HasValue())
9349  {
9350  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9351  }
9352  if (options.IfSequenceNumberLessThanOrEqualTo.HasValue())
9353  {
9354  request.SetHeader(
9355  "x-ms-if-sequence-number-le",
9356  std::to_string(options.IfSequenceNumberLessThanOrEqualTo.Value()));
9357  }
9358  if (options.IfSequenceNumberLessThan.HasValue())
9359  {
9360  request.SetHeader(
9361  "x-ms-if-sequence-number-lt",
9362  std::to_string(options.IfSequenceNumberLessThan.Value()));
9363  }
9364  if (options.IfSequenceNumberEqualTo.HasValue())
9365  {
9366  request.SetHeader(
9367  "x-ms-if-sequence-number-eq",
9368  std::to_string(options.IfSequenceNumberEqualTo.Value()));
9369  }
9370  if (options.EncryptionKey.HasValue())
9371  {
9372  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
9373  }
9374  if (options.EncryptionKeySha256.HasValue())
9375  {
9376  request.SetHeader(
9377  "x-ms-encryption-key-sha256",
9378  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
9379  }
9380  if (options.EncryptionAlgorithm.HasValue())
9381  {
9382  request.SetHeader(
9383  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
9384  }
9385  if (options.EncryptionScope.HasValue())
9386  {
9387  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
9388  }
9389  if (options.IfModifiedSince.HasValue())
9390  {
9391  request.SetHeader(
9392  "If-Modified-Since",
9393  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9394  }
9395  if (options.IfUnmodifiedSince.HasValue())
9396  {
9397  request.SetHeader(
9398  "If-Unmodified-Since",
9399  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9400  }
9401  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9402  {
9403  request.SetHeader("If-Match", options.IfMatch.ToString());
9404  }
9405  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9406  {
9407  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9408  }
9409  if (options.IfTags.HasValue())
9410  {
9411  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9412  }
9413  auto pHttpResponse = pipeline.Send(request, context);
9414  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9415  UploadPagesResult response;
9416  auto http_status_code
9417  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9418  httpResponse.GetStatusCode());
9419  if (!(http_status_code == 201))
9420  {
9421  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9422  }
9423  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
9424  response.LastModified = Azure::DateTime::Parse(
9425  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
9426  {
9427  const auto& headers = httpResponse.GetHeaders();
9428  auto content_md5_iterator = headers.find("content-md5");
9429  if (content_md5_iterator != headers.end())
9430  {
9431  ContentHash hash;
9432  hash.Algorithm = HashAlgorithm::Md5;
9433  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
9434  response.TransactionalContentHash = std::move(hash);
9435  }
9436  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
9437  if (x_ms_content_crc64_iterator != headers.end())
9438  {
9439  ContentHash hash;
9440  hash.Algorithm = HashAlgorithm::Crc64;
9441  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
9442  response.TransactionalContentHash = std::move(hash);
9443  }
9444  }
9445  response.SequenceNumber
9446  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-sequence-number"));
9447  response.IsServerEncrypted
9448  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
9449  auto x_ms_encryption_key_sha256__iterator
9450  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
9451  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
9452  {
9453  response.EncryptionKeySha256
9454  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
9455  }
9456  auto x_ms_encryption_scope__iterator
9457  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
9458  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
9459  {
9460  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
9461  }
9462  return Azure::Response<UploadPagesResult>(std::move(response), std::move(pHttpResponse));
9463  }
9464 
9465  struct UploadPageBlobPagesFromUriOptions final
9466  {
9467  Azure::Nullable<int32_t> Timeout;
9468  std::string SourceUri;
9469  Azure::Core::Http::HttpRange SourceRange;
9470  Azure::Core::Http::HttpRange Range;
9471  Azure::Nullable<ContentHash> TransactionalContentHash;
9472  Azure::Nullable<std::string> LeaseId;
9473  Azure::Nullable<int64_t> IfSequenceNumberLessThanOrEqualTo;
9474  Azure::Nullable<int64_t> IfSequenceNumberLessThan;
9475  Azure::Nullable<int64_t> IfSequenceNumberEqualTo;
9476  Azure::Nullable<std::string> EncryptionKey;
9477  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
9478  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
9479  Azure::Nullable<std::string> EncryptionScope;
9480  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9481  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9482  Azure::ETag IfMatch;
9483  Azure::ETag IfNoneMatch;
9484  Azure::Nullable<std::string> IfTags;
9485  }; // struct UploadPageBlobPagesFromUriOptions
9486 
9487  static Azure::Response<UploadPagesFromUriResult> UploadPagesFromUri(
9488  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9489  const Azure::Core::Url& url,
9490  const UploadPageBlobPagesFromUriOptions& options,
9491  const Azure::Core::Context& context)
9492  {
9493  (void)options;
9494  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
9495  request.SetHeader("Content-Length", "0");
9496  request.GetUrl().AppendQueryParameter("comp", "page");
9497  request.SetHeader("x-ms-version", "2020-02-10");
9498  if (options.Timeout.HasValue())
9499  {
9500  request.GetUrl().AppendQueryParameter(
9501  "timeout", std::to_string(options.Timeout.Value()));
9502  }
9503  {
9504  std::string headerValue = "bytes=" + std::to_string(options.Range.Offset) + "-";
9505  if (options.Range.Length.HasValue())
9506  {
9507  headerValue
9508  += std::to_string(options.Range.Offset + options.Range.Length.Value() - 1);
9509  }
9510  request.SetHeader("x-ms-range", std::move(headerValue));
9511  }
9512  request.SetHeader("x-ms-copy-source", options.SourceUri);
9513  {
9514  std::string headerValue = "bytes=" + std::to_string(options.SourceRange.Offset) + "-";
9515  if (options.SourceRange.Length.HasValue())
9516  {
9517  headerValue += std::to_string(
9518  options.SourceRange.Offset + options.SourceRange.Length.Value() - 1);
9519  }
9520  request.SetHeader("x-ms-source-range", std::move(headerValue));
9521  }
9522  if (options.TransactionalContentHash.HasValue())
9523  {
9524  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
9525  {
9526  request.SetHeader(
9527  "x-ms-source-content-md5",
9528  Azure::Core::Convert::Base64Encode(
9529  options.TransactionalContentHash.Value().Value));
9530  }
9531  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
9532  {
9533  request.SetHeader(
9534  "x-ms-source-content-crc64",
9535  Azure::Core::Convert::Base64Encode(
9536  options.TransactionalContentHash.Value().Value));
9537  }
9538  }
9539  request.SetHeader("x-ms-page-write", "update");
9540  if (options.LeaseId.HasValue())
9541  {
9542  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9543  }
9544  if (options.IfSequenceNumberLessThanOrEqualTo.HasValue())
9545  {
9546  request.SetHeader(
9547  "x-ms-if-sequence-number-le",
9548  std::to_string(options.IfSequenceNumberLessThanOrEqualTo.Value()));
9549  }
9550  if (options.IfSequenceNumberLessThan.HasValue())
9551  {
9552  request.SetHeader(
9553  "x-ms-if-sequence-number-lt",
9554  std::to_string(options.IfSequenceNumberLessThan.Value()));
9555  }
9556  if (options.IfSequenceNumberEqualTo.HasValue())
9557  {
9558  request.SetHeader(
9559  "x-ms-if-sequence-number-eq",
9560  std::to_string(options.IfSequenceNumberEqualTo.Value()));
9561  }
9562  if (options.EncryptionKey.HasValue())
9563  {
9564  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
9565  }
9566  if (options.EncryptionKeySha256.HasValue())
9567  {
9568  request.SetHeader(
9569  "x-ms-encryption-key-sha256",
9570  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
9571  }
9572  if (options.EncryptionAlgorithm.HasValue())
9573  {
9574  request.SetHeader(
9575  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
9576  }
9577  if (options.EncryptionScope.HasValue())
9578  {
9579  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
9580  }
9581  if (options.IfModifiedSince.HasValue())
9582  {
9583  request.SetHeader(
9584  "If-Modified-Since",
9585  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9586  }
9587  if (options.IfUnmodifiedSince.HasValue())
9588  {
9589  request.SetHeader(
9590  "If-Unmodified-Since",
9591  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9592  }
9593  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9594  {
9595  request.SetHeader("If-Match", options.IfMatch.ToString());
9596  }
9597  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9598  {
9599  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9600  }
9601  if (options.IfTags.HasValue())
9602  {
9603  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9604  }
9605  auto pHttpResponse = pipeline.Send(request, context);
9606  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9607  UploadPagesFromUriResult response;
9608  auto http_status_code
9609  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9610  httpResponse.GetStatusCode());
9611  if (!(http_status_code == 201))
9612  {
9613  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9614  }
9615  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
9616  response.LastModified = Azure::DateTime::Parse(
9617  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
9618  {
9619  const auto& headers = httpResponse.GetHeaders();
9620  auto content_md5_iterator = headers.find("content-md5");
9621  if (content_md5_iterator != headers.end())
9622  {
9623  ContentHash hash;
9624  hash.Algorithm = HashAlgorithm::Md5;
9625  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
9626  response.TransactionalContentHash = std::move(hash);
9627  }
9628  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
9629  if (x_ms_content_crc64_iterator != headers.end())
9630  {
9631  ContentHash hash;
9632  hash.Algorithm = HashAlgorithm::Crc64;
9633  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
9634  response.TransactionalContentHash = std::move(hash);
9635  }
9636  }
9637  response.SequenceNumber
9638  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-sequence-number"));
9639  response.IsServerEncrypted
9640  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
9641  auto x_ms_encryption_key_sha256__iterator
9642  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
9643  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
9644  {
9645  response.EncryptionKeySha256
9646  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
9647  }
9648  auto x_ms_encryption_scope__iterator
9649  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
9650  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
9651  {
9652  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
9653  }
9654  return Azure::Response<UploadPagesFromUriResult>(
9655  std::move(response), std::move(pHttpResponse));
9656  }
9657 
9658  struct ClearPageBlobPagesOptions final
9659  {
9660  Azure::Nullable<int32_t> Timeout;
9661  Azure::Core::Http::HttpRange Range;
9662  Azure::Nullable<std::string> LeaseId;
9663  Azure::Nullable<int64_t> IfSequenceNumberLessThanOrEqualTo;
9664  Azure::Nullable<int64_t> IfSequenceNumberLessThan;
9665  Azure::Nullable<int64_t> IfSequenceNumberEqualTo;
9666  Azure::Nullable<std::string> EncryptionKey;
9667  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
9668  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
9669  Azure::Nullable<std::string> EncryptionScope;
9670  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9671  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9672  Azure::ETag IfMatch;
9673  Azure::ETag IfNoneMatch;
9674  Azure::Nullable<std::string> IfTags;
9675  }; // struct ClearPageBlobPagesOptions
9676 
9677  static Azure::Response<ClearPagesResult> ClearPages(
9678  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9679  const Azure::Core::Url& url,
9680  const ClearPageBlobPagesOptions& options,
9681  const Azure::Core::Context& context)
9682  {
9683  (void)options;
9684  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
9685  request.SetHeader("Content-Length", "0");
9686  request.GetUrl().AppendQueryParameter("comp", "page");
9687  request.SetHeader("x-ms-version", "2020-02-10");
9688  if (options.Timeout.HasValue())
9689  {
9690  request.GetUrl().AppendQueryParameter(
9691  "timeout", std::to_string(options.Timeout.Value()));
9692  }
9693  {
9694  std::string headerValue = "bytes=" + std::to_string(options.Range.Offset) + "-";
9695  if (options.Range.Length.HasValue())
9696  {
9697  headerValue
9698  += std::to_string(options.Range.Offset + options.Range.Length.Value() - 1);
9699  }
9700  request.SetHeader("x-ms-range", std::move(headerValue));
9701  }
9702  request.SetHeader("x-ms-page-write", "clear");
9703  if (options.LeaseId.HasValue())
9704  {
9705  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9706  }
9707  if (options.IfSequenceNumberLessThanOrEqualTo.HasValue())
9708  {
9709  request.SetHeader(
9710  "x-ms-if-sequence-number-le",
9711  std::to_string(options.IfSequenceNumberLessThanOrEqualTo.Value()));
9712  }
9713  if (options.IfSequenceNumberLessThan.HasValue())
9714  {
9715  request.SetHeader(
9716  "x-ms-if-sequence-number-lt",
9717  std::to_string(options.IfSequenceNumberLessThan.Value()));
9718  }
9719  if (options.IfSequenceNumberEqualTo.HasValue())
9720  {
9721  request.SetHeader(
9722  "x-ms-if-sequence-number-eq",
9723  std::to_string(options.IfSequenceNumberEqualTo.Value()));
9724  }
9725  if (options.EncryptionKey.HasValue())
9726  {
9727  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
9728  }
9729  if (options.EncryptionKeySha256.HasValue())
9730  {
9731  request.SetHeader(
9732  "x-ms-encryption-key-sha256",
9733  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
9734  }
9735  if (options.EncryptionAlgorithm.HasValue())
9736  {
9737  request.SetHeader(
9738  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
9739  }
9740  if (options.EncryptionScope.HasValue())
9741  {
9742  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
9743  }
9744  if (options.IfModifiedSince.HasValue())
9745  {
9746  request.SetHeader(
9747  "If-Modified-Since",
9748  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9749  }
9750  if (options.IfUnmodifiedSince.HasValue())
9751  {
9752  request.SetHeader(
9753  "If-Unmodified-Since",
9754  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9755  }
9756  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9757  {
9758  request.SetHeader("If-Match", options.IfMatch.ToString());
9759  }
9760  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9761  {
9762  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9763  }
9764  if (options.IfTags.HasValue())
9765  {
9766  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9767  }
9768  auto pHttpResponse = pipeline.Send(request, context);
9769  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9770  ClearPagesResult response;
9771  auto http_status_code
9772  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9773  httpResponse.GetStatusCode());
9774  if (!(http_status_code == 201))
9775  {
9776  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9777  }
9778  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
9779  response.LastModified = Azure::DateTime::Parse(
9780  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
9781  response.SequenceNumber
9782  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-sequence-number"));
9783  return Azure::Response<ClearPagesResult>(std::move(response), std::move(pHttpResponse));
9784  }
9785 
9786  struct ResizePageBlobOptions final
9787  {
9788  Azure::Nullable<int32_t> Timeout;
9789  int64_t BlobSize = -1;
9790  Azure::Nullable<std::string> LeaseId;
9791  Azure::Nullable<int64_t> IfSequenceNumberLessThanOrEqualTo;
9792  Azure::Nullable<int64_t> IfSequenceNumberLessThan;
9793  Azure::Nullable<int64_t> IfSequenceNumberEqualTo;
9794  Azure::Nullable<std::string> EncryptionKey;
9795  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
9796  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
9797  Azure::Nullable<std::string> EncryptionScope;
9798  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9799  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9800  Azure::ETag IfMatch;
9801  Azure::ETag IfNoneMatch;
9802  Azure::Nullable<std::string> IfTags;
9803  }; // struct ResizePageBlobOptions
9804 
9805  static Azure::Response<ResizePageBlobResult> Resize(
9806  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9807  const Azure::Core::Url& url,
9808  const ResizePageBlobOptions& options,
9809  const Azure::Core::Context& context)
9810  {
9811  (void)options;
9812  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
9813  request.SetHeader("Content-Length", "0");
9814  request.GetUrl().AppendQueryParameter("comp", "properties");
9815  request.SetHeader("x-ms-version", "2020-02-10");
9816  if (options.Timeout.HasValue())
9817  {
9818  request.GetUrl().AppendQueryParameter(
9819  "timeout", std::to_string(options.Timeout.Value()));
9820  }
9821  request.SetHeader("x-ms-blob-content-length", std::to_string(options.BlobSize));
9822  if (options.LeaseId.HasValue())
9823  {
9824  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9825  }
9826  if (options.IfSequenceNumberLessThanOrEqualTo.HasValue())
9827  {
9828  request.SetHeader(
9829  "x-ms-if-sequence-number-le",
9830  std::to_string(options.IfSequenceNumberLessThanOrEqualTo.Value()));
9831  }
9832  if (options.IfSequenceNumberLessThan.HasValue())
9833  {
9834  request.SetHeader(
9835  "x-ms-if-sequence-number-lt",
9836  std::to_string(options.IfSequenceNumberLessThan.Value()));
9837  }
9838  if (options.IfSequenceNumberEqualTo.HasValue())
9839  {
9840  request.SetHeader(
9841  "x-ms-if-sequence-number-eq",
9842  std::to_string(options.IfSequenceNumberEqualTo.Value()));
9843  }
9844  if (options.EncryptionKey.HasValue())
9845  {
9846  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
9847  }
9848  if (options.EncryptionKeySha256.HasValue())
9849  {
9850  request.SetHeader(
9851  "x-ms-encryption-key-sha256",
9852  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
9853  }
9854  if (options.EncryptionAlgorithm.HasValue())
9855  {
9856  request.SetHeader(
9857  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
9858  }
9859  if (options.EncryptionScope.HasValue())
9860  {
9861  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
9862  }
9863  if (options.IfModifiedSince.HasValue())
9864  {
9865  request.SetHeader(
9866  "If-Modified-Since",
9867  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9868  }
9869  if (options.IfUnmodifiedSince.HasValue())
9870  {
9871  request.SetHeader(
9872  "If-Unmodified-Since",
9873  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9874  }
9875  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9876  {
9877  request.SetHeader("If-Match", options.IfMatch.ToString());
9878  }
9879  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9880  {
9881  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9882  }
9883  if (options.IfTags.HasValue())
9884  {
9885  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9886  }
9887  auto pHttpResponse = pipeline.Send(request, context);
9888  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9889  ResizePageBlobResult response;
9890  auto http_status_code
9891  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9892  httpResponse.GetStatusCode());
9893  if (!(http_status_code == 200))
9894  {
9895  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9896  }
9897  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
9898  response.LastModified = Azure::DateTime::Parse(
9899  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
9900  response.SequenceNumber
9901  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-sequence-number"));
9902  return Azure::Response<ResizePageBlobResult>(
9903  std::move(response), std::move(pHttpResponse));
9904  }
9905 
9906  struct GetPageBlobPageRangesOptions final
9907  {
9908  Azure::Nullable<int32_t> Timeout;
9909  Azure::Nullable<std::string> PreviousSnapshot;
9910  Azure::Nullable<std::string> PreviousSnapshotUrl;
9911  Azure::Nullable<Azure::Core::Http::HttpRange> Range;
9912  Azure::Nullable<std::string> LeaseId;
9913  Azure::Nullable<Azure::DateTime> IfModifiedSince;
9914  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
9915  Azure::ETag IfMatch;
9916  Azure::ETag IfNoneMatch;
9917  Azure::Nullable<std::string> IfTags;
9918  }; // struct GetPageBlobPageRangesOptions
9919 
9920  static Azure::Response<Models::_detail::GetPageRangesResult> GetPageRanges(
9921  Azure::Core::Http::_internal::HttpPipeline& pipeline,
9922  const Azure::Core::Url& url,
9923  const GetPageBlobPageRangesOptions& options,
9924  const Azure::Core::Context& context)
9925  {
9926  (void)options;
9927  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
9928  request.GetUrl().AppendQueryParameter("comp", "pagelist");
9929  if (options.PreviousSnapshot.HasValue())
9930  {
9931  request.GetUrl().AppendQueryParameter(
9932  "prevsnapshot",
9933  _internal::UrlEncodeQueryParameter(options.PreviousSnapshot.Value()));
9934  }
9935  request.SetHeader("x-ms-version", "2020-02-10");
9936  if (options.Timeout.HasValue())
9937  {
9938  request.GetUrl().AppendQueryParameter(
9939  "timeout", std::to_string(options.Timeout.Value()));
9940  }
9941  if (options.Range.HasValue())
9942  {
9943  std::string headerValue = "bytes=" + std::to_string(options.Range.Value().Offset) + "-";
9944  if (options.Range.Value().Length.HasValue())
9945  {
9946  headerValue += std::to_string(
9947  options.Range.Value().Offset + options.Range.Value().Length.Value() - 1);
9948  }
9949  request.SetHeader("x-ms-range", std::move(headerValue));
9950  }
9951  if (options.LeaseId.HasValue())
9952  {
9953  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
9954  }
9955  if (options.PreviousSnapshotUrl.HasValue())
9956  {
9957  request.SetHeader("x-ms-previous-snapshot-url", options.PreviousSnapshotUrl.Value());
9958  }
9959  if (options.IfModifiedSince.HasValue())
9960  {
9961  request.SetHeader(
9962  "If-Modified-Since",
9963  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9964  }
9965  if (options.IfUnmodifiedSince.HasValue())
9966  {
9967  request.SetHeader(
9968  "If-Unmodified-Since",
9969  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
9970  }
9971  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
9972  {
9973  request.SetHeader("If-Match", options.IfMatch.ToString());
9974  }
9975  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
9976  {
9977  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
9978  }
9979  if (options.IfTags.HasValue())
9980  {
9981  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
9982  }
9983  auto pHttpResponse = pipeline.Send(request, context);
9984  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
9985  Models::_detail::GetPageRangesResult response;
9986  auto http_status_code
9987  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
9988  httpResponse.GetStatusCode());
9989  if (!(http_status_code == 200))
9990  {
9991  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
9992  }
9993  {
9994  const auto& httpResponseBody = httpResponse.GetBody();
9995  _internal::XmlReader reader(
9996  reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
9997  response = GetPageRangesResultInternalFromXml(reader);
9998  }
9999  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10000  response.LastModified = Azure::DateTime::Parse(
10001  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10002  response.BlobSize = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-content-length"));
10003  return Azure::Response<Models::_detail::GetPageRangesResult>(
10004  std::move(response), std::move(pHttpResponse));
10005  }
10006 
10007  struct StartBlobCopyIncrementalOptions final
10008  {
10009  Azure::Nullable<int32_t> Timeout;
10010  std::string CopySource;
10011  Azure::Nullable<Azure::DateTime> IfModifiedSince;
10012  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
10013  Azure::ETag IfMatch;
10014  Azure::ETag IfNoneMatch;
10015  Azure::Nullable<std::string> IfTags;
10016  }; // struct StartBlobCopyIncrementalOptions
10017 
10018  static Azure::Response<Models::_detail::StartBlobCopyIncrementalResult>
10019  StartCopyIncremental(
10020  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10021  const Azure::Core::Url& url,
10022  const StartBlobCopyIncrementalOptions& options,
10023  const Azure::Core::Context& context)
10024  {
10025  (void)options;
10026  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
10027  request.SetHeader("Content-Length", "0");
10028  request.GetUrl().AppendQueryParameter("comp", "incrementalcopy");
10029  request.SetHeader("x-ms-version", "2020-02-10");
10030  if (options.Timeout.HasValue())
10031  {
10032  request.GetUrl().AppendQueryParameter(
10033  "timeout", std::to_string(options.Timeout.Value()));
10034  }
10035  request.SetHeader("x-ms-copy-source", options.CopySource);
10036  if (options.IfModifiedSince.HasValue())
10037  {
10038  request.SetHeader(
10039  "If-Modified-Since",
10040  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10041  }
10042  if (options.IfUnmodifiedSince.HasValue())
10043  {
10044  request.SetHeader(
10045  "If-Unmodified-Since",
10046  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10047  }
10048  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
10049  {
10050  request.SetHeader("If-Match", options.IfMatch.ToString());
10051  }
10052  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
10053  {
10054  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
10055  }
10056  if (options.IfTags.HasValue())
10057  {
10058  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
10059  }
10060  auto pHttpResponse = pipeline.Send(request, context);
10061  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10062  Models::_detail::StartBlobCopyIncrementalResult response;
10063  auto http_status_code
10064  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10065  httpResponse.GetStatusCode());
10066  if (!(http_status_code == 202))
10067  {
10068  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10069  }
10070  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10071  response.LastModified = Azure::DateTime::Parse(
10072  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10073  response.CopyId = httpResponse.GetHeaders().at("x-ms-copy-id");
10074  response.CopyStatus = CopyStatus(httpResponse.GetHeaders().at("x-ms-copy-status"));
10075  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
10076  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
10077  {
10078  response.VersionId = x_ms_version_id__iterator->second;
10079  }
10080  return Azure::Response<Models::_detail::StartBlobCopyIncrementalResult>(
10081  std::move(response), std::move(pHttpResponse));
10082  }
10083 
10084  private:
10085  static Models::_detail::GetPageRangesResult GetPageRangesResultInternalFromXml(
10086  _internal::XmlReader& reader)
10087  {
10088  Models::_detail::GetPageRangesResult ret;
10089  enum class XmlTagName
10090  {
10091  k_PageList,
10092  k_PageRange,
10093  k_ClearRange,
10094  k_Unknown,
10095  };
10096  std::vector<XmlTagName> path;
10097  while (true)
10098  {
10099  auto node = reader.Read();
10100  if (node.Type == _internal::XmlNodeType::End)
10101  {
10102  break;
10103  }
10104  else if (node.Type == _internal::XmlNodeType::EndTag)
10105  {
10106  if (path.size() > 0)
10107  {
10108  path.pop_back();
10109  }
10110  else
10111  {
10112  break;
10113  }
10114  }
10115  else if (node.Type == _internal::XmlNodeType::StartTag)
10116  {
10117  if (std::strcmp(node.Name, "PageList") == 0)
10118  {
10119  path.emplace_back(XmlTagName::k_PageList);
10120  }
10121  else if (std::strcmp(node.Name, "PageRange") == 0)
10122  {
10123  path.emplace_back(XmlTagName::k_PageRange);
10124  }
10125  else if (std::strcmp(node.Name, "ClearRange") == 0)
10126  {
10127  path.emplace_back(XmlTagName::k_ClearRange);
10128  }
10129  else
10130  {
10131  path.emplace_back(XmlTagName::k_Unknown);
10132  }
10133  if (path.size() == 2 && path[0] == XmlTagName::k_PageList
10134  && path[1] == XmlTagName::k_PageRange)
10135  {
10136  ret.PageRanges.emplace_back(PageRangesFromXml(reader));
10137  path.pop_back();
10138  }
10139  else if (
10140  path.size() == 2 && path[0] == XmlTagName::k_PageList
10141  && path[1] == XmlTagName::k_ClearRange)
10142  {
10143  ret.ClearRanges.emplace_back(ClearRangesFromXml(reader));
10144  path.pop_back();
10145  }
10146  }
10147  else if (node.Type == _internal::XmlNodeType::Text)
10148  {
10149  }
10150  }
10151  return ret;
10152  }
10153 
10154  static Azure::Core::Http::HttpRange ClearRangesFromXml(_internal::XmlReader& reader)
10155  {
10156  int depth = 0;
10157  bool is_start = false;
10158  bool is_end = false;
10159  int64_t start = 0;
10160  int64_t end = 0;
10161  while (true)
10162  {
10163  auto node = reader.Read();
10164  if (node.Type == _internal::XmlNodeType::End)
10165  {
10166  break;
10167  }
10168  else if (
10169  node.Type == _internal::XmlNodeType::StartTag && strcmp(node.Name, "Start") == 0)
10170  {
10171  ++depth;
10172  is_start = true;
10173  }
10174  else if (node.Type == _internal::XmlNodeType::StartTag && strcmp(node.Name, "End") == 0)
10175  {
10176  ++depth;
10177  is_end = true;
10178  }
10179  else if (node.Type == _internal::XmlNodeType::EndTag)
10180  {
10181  is_start = false;
10182  is_end = false;
10183  if (depth-- == 0)
10184  {
10185  break;
10186  }
10187  }
10188  if (depth == 1 && node.Type == _internal::XmlNodeType::Text)
10189  {
10190  if (is_start)
10191  {
10192  start = std::stoll(node.Value);
10193  }
10194  else if (is_end)
10195  {
10196  end = std::stoll(node.Value);
10197  }
10198  }
10199  }
10200  Azure::Core::Http::HttpRange ret;
10201  ret.Offset = start;
10202  ret.Length = end - start + 1;
10203  return ret;
10204  }
10205 
10206  static Azure::Core::Http::HttpRange PageRangesFromXml(_internal::XmlReader& reader)
10207  {
10208  int depth = 0;
10209  bool is_start = false;
10210  bool is_end = false;
10211  int64_t start = 0;
10212  int64_t end = 0;
10213  while (true)
10214  {
10215  auto node = reader.Read();
10216  if (node.Type == _internal::XmlNodeType::End)
10217  {
10218  break;
10219  }
10220  else if (
10221  node.Type == _internal::XmlNodeType::StartTag && strcmp(node.Name, "Start") == 0)
10222  {
10223  ++depth;
10224  is_start = true;
10225  }
10226  else if (node.Type == _internal::XmlNodeType::StartTag && strcmp(node.Name, "End") == 0)
10227  {
10228  ++depth;
10229  is_end = true;
10230  }
10231  else if (node.Type == _internal::XmlNodeType::EndTag)
10232  {
10233  is_start = false;
10234  is_end = false;
10235  if (depth-- == 0)
10236  {
10237  break;
10238  }
10239  }
10240  if (depth == 1 && node.Type == _internal::XmlNodeType::Text)
10241  {
10242  if (is_start)
10243  {
10244  start = std::stoll(node.Value);
10245  }
10246  else if (is_end)
10247  {
10248  end = std::stoll(node.Value);
10249  }
10250  }
10251  }
10252  Azure::Core::Http::HttpRange ret;
10253  ret.Offset = start;
10254  ret.Length = end - start + 1;
10255  return ret;
10256  }
10257 
10258  }; // class PageBlob
10259 
10260  class AppendBlob final {
10261  public:
10262  struct CreateAppendBlobOptions final
10263  {
10264  Azure::Nullable<int32_t> Timeout;
10265  BlobHttpHeaders HttpHeaders;
10266  Storage::Metadata Metadata;
10267  Azure::Nullable<std::string> LeaseId;
10268  Azure::Nullable<std::string> EncryptionKey;
10269  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
10270  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
10271  Azure::Nullable<std::string> EncryptionScope;
10272  Azure::Nullable<Azure::DateTime> IfModifiedSince;
10273  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
10274  Azure::ETag IfMatch;
10275  Azure::ETag IfNoneMatch;
10276  Azure::Nullable<std::string> IfTags;
10277  }; // struct CreateAppendBlobOptions
10278 
10279  static Azure::Response<CreateAppendBlobResult> Create(
10280  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10281  const Azure::Core::Url& url,
10282  const CreateAppendBlobOptions& options,
10283  const Azure::Core::Context& context)
10284  {
10285  (void)options;
10286  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
10287  request.SetHeader("Content-Length", "0");
10288  request.SetHeader("x-ms-version", "2020-02-10");
10289  if (options.Timeout.HasValue())
10290  {
10291  request.GetUrl().AppendQueryParameter(
10292  "timeout", std::to_string(options.Timeout.Value()));
10293  }
10294  if (!options.HttpHeaders.ContentType.empty())
10295  {
10296  request.SetHeader("x-ms-blob-content-type", options.HttpHeaders.ContentType);
10297  }
10298  if (!options.HttpHeaders.ContentEncoding.empty())
10299  {
10300  request.SetHeader("x-ms-blob-content-encoding", options.HttpHeaders.ContentEncoding);
10301  }
10302  if (!options.HttpHeaders.ContentLanguage.empty())
10303  {
10304  request.SetHeader("x-ms-blob-content-language", options.HttpHeaders.ContentLanguage);
10305  }
10306  if (!options.HttpHeaders.CacheControl.empty())
10307  {
10308  request.SetHeader("x-ms-blob-cache-control", options.HttpHeaders.CacheControl);
10309  }
10310  if (!Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value).empty())
10311  {
10312  request.SetHeader(
10313  "x-ms-blob-content-md5",
10314  Azure::Core::Convert::Base64Encode(options.HttpHeaders.ContentHash.Value));
10315  }
10316  if (!options.HttpHeaders.ContentDisposition.empty())
10317  {
10318  request.SetHeader(
10319  "x-ms-blob-content-disposition", options.HttpHeaders.ContentDisposition);
10320  }
10321  for (const auto& pair : options.Metadata)
10322  {
10323  request.SetHeader("x-ms-meta-" + pair.first, pair.second);
10324  }
10325  if (options.LeaseId.HasValue())
10326  {
10327  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
10328  }
10329  request.SetHeader("x-ms-blob-type", "AppendBlob");
10330  if (options.EncryptionKey.HasValue())
10331  {
10332  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
10333  }
10334  if (options.EncryptionKeySha256.HasValue())
10335  {
10336  request.SetHeader(
10337  "x-ms-encryption-key-sha256",
10338  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
10339  }
10340  if (options.EncryptionAlgorithm.HasValue())
10341  {
10342  request.SetHeader(
10343  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
10344  }
10345  if (options.EncryptionScope.HasValue())
10346  {
10347  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
10348  }
10349  if (options.IfModifiedSince.HasValue())
10350  {
10351  request.SetHeader(
10352  "If-Modified-Since",
10353  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10354  }
10355  if (options.IfUnmodifiedSince.HasValue())
10356  {
10357  request.SetHeader(
10358  "If-Unmodified-Since",
10359  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10360  }
10361  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
10362  {
10363  request.SetHeader("If-Match", options.IfMatch.ToString());
10364  }
10365  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
10366  {
10367  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
10368  }
10369  if (options.IfTags.HasValue())
10370  {
10371  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
10372  }
10373  auto pHttpResponse = pipeline.Send(request, context);
10374  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10375  CreateAppendBlobResult response;
10376  auto http_status_code
10377  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10378  httpResponse.GetStatusCode());
10379  if (!(http_status_code == 201))
10380  {
10381  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10382  }
10383  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10384  response.LastModified = Azure::DateTime::Parse(
10385  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10386  auto x_ms_version_id__iterator = httpResponse.GetHeaders().find("x-ms-version-id");
10387  if (x_ms_version_id__iterator != httpResponse.GetHeaders().end())
10388  {
10389  response.VersionId = x_ms_version_id__iterator->second;
10390  }
10391  response.IsServerEncrypted
10392  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
10393  auto x_ms_encryption_key_sha256__iterator
10394  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
10395  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
10396  {
10397  response.EncryptionKeySha256
10398  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
10399  }
10400  auto x_ms_encryption_scope__iterator
10401  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
10402  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
10403  {
10404  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
10405  }
10406  return Azure::Response<CreateAppendBlobResult>(
10407  std::move(response), std::move(pHttpResponse));
10408  }
10409 
10410  struct AppendBlockOptions final
10411  {
10412  Azure::Nullable<int32_t> Timeout;
10413  Azure::Nullable<ContentHash> TransactionalContentHash;
10414  Azure::Nullable<std::string> LeaseId;
10415  Azure::Nullable<int64_t> MaxSize;
10416  Azure::Nullable<int64_t> AppendPosition;
10417  Azure::Nullable<std::string> EncryptionKey;
10418  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
10419  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
10420  Azure::Nullable<std::string> EncryptionScope;
10421  Azure::Nullable<Azure::DateTime> IfModifiedSince;
10422  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
10423  Azure::ETag IfMatch;
10424  Azure::ETag IfNoneMatch;
10425  Azure::Nullable<std::string> IfTags;
10426  }; // struct AppendBlockOptions
10427 
10428  static Azure::Response<AppendBlockResult> AppendBlock(
10429  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10430  const Azure::Core::Url& url,
10431  Azure::Core::IO::BodyStream& requestBody,
10432  const AppendBlockOptions& options,
10433  const Azure::Core::Context& context)
10434  {
10435  (void)options;
10436  auto request
10437  = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url, &requestBody);
10438  request.SetHeader("Content-Length", std::to_string(requestBody.Length()));
10439  request.GetUrl().AppendQueryParameter("comp", "appendblock");
10440  request.SetHeader("x-ms-version", "2020-02-10");
10441  if (options.Timeout.HasValue())
10442  {
10443  request.GetUrl().AppendQueryParameter(
10444  "timeout", std::to_string(options.Timeout.Value()));
10445  }
10446  if (options.TransactionalContentHash.HasValue())
10447  {
10448  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
10449  {
10450  request.SetHeader(
10451  "Content-MD5",
10452  Azure::Core::Convert::Base64Encode(
10453  options.TransactionalContentHash.Value().Value));
10454  }
10455  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
10456  {
10457  request.SetHeader(
10458  "x-ms-content-crc64",
10459  Azure::Core::Convert::Base64Encode(
10460  options.TransactionalContentHash.Value().Value));
10461  }
10462  }
10463  if (options.LeaseId.HasValue())
10464  {
10465  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
10466  }
10467  if (options.MaxSize.HasValue())
10468  {
10469  request.SetHeader(
10470  "x-ms-blob-condition-maxsize", std::to_string(options.MaxSize.Value()));
10471  }
10472  if (options.AppendPosition.HasValue())
10473  {
10474  request.SetHeader(
10475  "x-ms-blob-condition-appendpos", std::to_string(options.AppendPosition.Value()));
10476  }
10477  if (options.EncryptionKey.HasValue())
10478  {
10479  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
10480  }
10481  if (options.EncryptionKeySha256.HasValue())
10482  {
10483  request.SetHeader(
10484  "x-ms-encryption-key-sha256",
10485  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
10486  }
10487  if (options.EncryptionAlgorithm.HasValue())
10488  {
10489  request.SetHeader(
10490  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
10491  }
10492  if (options.EncryptionScope.HasValue())
10493  {
10494  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
10495  }
10496  if (options.IfModifiedSince.HasValue())
10497  {
10498  request.SetHeader(
10499  "If-Modified-Since",
10500  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10501  }
10502  if (options.IfUnmodifiedSince.HasValue())
10503  {
10504  request.SetHeader(
10505  "If-Unmodified-Since",
10506  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10507  }
10508  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
10509  {
10510  request.SetHeader("If-Match", options.IfMatch.ToString());
10511  }
10512  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
10513  {
10514  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
10515  }
10516  if (options.IfTags.HasValue())
10517  {
10518  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
10519  }
10520  auto pHttpResponse = pipeline.Send(request, context);
10521  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10522  AppendBlockResult response;
10523  auto http_status_code
10524  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10525  httpResponse.GetStatusCode());
10526  if (!(http_status_code == 201))
10527  {
10528  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10529  }
10530  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10531  response.LastModified = Azure::DateTime::Parse(
10532  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10533  {
10534  const auto& headers = httpResponse.GetHeaders();
10535  auto content_md5_iterator = headers.find("content-md5");
10536  if (content_md5_iterator != headers.end())
10537  {
10538  ContentHash hash;
10539  hash.Algorithm = HashAlgorithm::Md5;
10540  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
10541  response.TransactionalContentHash = std::move(hash);
10542  }
10543  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
10544  if (x_ms_content_crc64_iterator != headers.end())
10545  {
10546  ContentHash hash;
10547  hash.Algorithm = HashAlgorithm::Crc64;
10548  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
10549  response.TransactionalContentHash = std::move(hash);
10550  }
10551  }
10552  response.AppendOffset
10553  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-append-offset"));
10554  response.CommittedBlockCount
10555  = std::stoi(httpResponse.GetHeaders().at("x-ms-blob-committed-block-count"));
10556  response.IsServerEncrypted
10557  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
10558  auto x_ms_encryption_key_sha256__iterator
10559  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
10560  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
10561  {
10562  response.EncryptionKeySha256
10563  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
10564  }
10565  auto x_ms_encryption_scope__iterator
10566  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
10567  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
10568  {
10569  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
10570  }
10571  return Azure::Response<AppendBlockResult>(std::move(response), std::move(pHttpResponse));
10572  }
10573 
10574  struct AppendBlockFromUriOptions final
10575  {
10576  Azure::Nullable<int32_t> Timeout;
10577  std::string SourceUri;
10578  Azure::Nullable<Azure::Core::Http::HttpRange> SourceRange;
10579  Azure::Nullable<ContentHash> TransactionalContentHash;
10580  Azure::Nullable<std::string> LeaseId;
10581  Azure::Nullable<int64_t> MaxSize;
10582  Azure::Nullable<int64_t> AppendPosition;
10583  Azure::Nullable<std::string> EncryptionKey;
10584  Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
10585  Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
10586  Azure::Nullable<std::string> EncryptionScope;
10587  Azure::Nullable<Azure::DateTime> IfModifiedSince;
10588  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
10589  Azure::ETag IfMatch;
10590  Azure::ETag IfNoneMatch;
10591  Azure::Nullable<std::string> IfTags;
10592  }; // struct AppendBlockFromUriOptions
10593 
10594  static Azure::Response<AppendBlockFromUriResult> AppendBlockFromUri(
10595  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10596  const Azure::Core::Url& url,
10597  const AppendBlockFromUriOptions& options,
10598  const Azure::Core::Context& context)
10599  {
10600  (void)options;
10601  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
10602  request.SetHeader("Content-Length", "0");
10603  request.GetUrl().AppendQueryParameter("comp", "appendblock");
10604  request.SetHeader("x-ms-version", "2020-02-10");
10605  if (options.Timeout.HasValue())
10606  {
10607  request.GetUrl().AppendQueryParameter(
10608  "timeout", std::to_string(options.Timeout.Value()));
10609  }
10610  request.SetHeader("x-ms-copy-source", options.SourceUri);
10611  if (options.SourceRange.HasValue())
10612  {
10613  std::string headerValue
10614  = "bytes=" + std::to_string(options.SourceRange.Value().Offset) + "-";
10615  if (options.SourceRange.Value().Length.HasValue())
10616  {
10617  headerValue += std::to_string(
10618  options.SourceRange.Value().Offset + options.SourceRange.Value().Length.Value()
10619  - 1);
10620  }
10621  request.SetHeader("x-ms-source-range", std::move(headerValue));
10622  }
10623  if (options.TransactionalContentHash.HasValue())
10624  {
10625  if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Md5)
10626  {
10627  request.SetHeader(
10628  "x-ms-source-content-md5",
10629  Azure::Core::Convert::Base64Encode(
10630  options.TransactionalContentHash.Value().Value));
10631  }
10632  else if (options.TransactionalContentHash.Value().Algorithm == HashAlgorithm::Crc64)
10633  {
10634  request.SetHeader(
10635  "x-ms-source-content-crc64",
10636  Azure::Core::Convert::Base64Encode(
10637  options.TransactionalContentHash.Value().Value));
10638  }
10639  }
10640  if (options.LeaseId.HasValue())
10641  {
10642  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
10643  }
10644  if (options.MaxSize.HasValue())
10645  {
10646  request.SetHeader(
10647  "x-ms-blob-condition-maxsize", std::to_string(options.MaxSize.Value()));
10648  }
10649  if (options.AppendPosition.HasValue())
10650  {
10651  request.SetHeader(
10652  "x-ms-blob-condition-appendpos", std::to_string(options.AppendPosition.Value()));
10653  }
10654  if (options.EncryptionKey.HasValue())
10655  {
10656  request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value());
10657  }
10658  if (options.EncryptionKeySha256.HasValue())
10659  {
10660  request.SetHeader(
10661  "x-ms-encryption-key-sha256",
10662  Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value()));
10663  }
10664  if (options.EncryptionAlgorithm.HasValue())
10665  {
10666  request.SetHeader(
10667  "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString());
10668  }
10669  if (options.EncryptionScope.HasValue())
10670  {
10671  request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value());
10672  }
10673  if (options.IfModifiedSince.HasValue())
10674  {
10675  request.SetHeader(
10676  "If-Modified-Since",
10677  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10678  }
10679  if (options.IfUnmodifiedSince.HasValue())
10680  {
10681  request.SetHeader(
10682  "If-Unmodified-Since",
10683  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10684  }
10685  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
10686  {
10687  request.SetHeader("If-Match", options.IfMatch.ToString());
10688  }
10689  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
10690  {
10691  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
10692  }
10693  if (options.IfTags.HasValue())
10694  {
10695  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
10696  }
10697  auto pHttpResponse = pipeline.Send(request, context);
10698  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10699  AppendBlockFromUriResult response;
10700  auto http_status_code
10701  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10702  httpResponse.GetStatusCode());
10703  if (!(http_status_code == 201))
10704  {
10705  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10706  }
10707  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10708  response.LastModified = Azure::DateTime::Parse(
10709  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10710  {
10711  const auto& headers = httpResponse.GetHeaders();
10712  auto content_md5_iterator = headers.find("content-md5");
10713  if (content_md5_iterator != headers.end())
10714  {
10715  ContentHash hash;
10716  hash.Algorithm = HashAlgorithm::Md5;
10717  hash.Value = Azure::Core::Convert::Base64Decode(content_md5_iterator->second);
10718  response.TransactionalContentHash = std::move(hash);
10719  }
10720  auto x_ms_content_crc64_iterator = headers.find("x-ms-content-crc64");
10721  if (x_ms_content_crc64_iterator != headers.end())
10722  {
10723  ContentHash hash;
10724  hash.Algorithm = HashAlgorithm::Crc64;
10725  hash.Value = Azure::Core::Convert::Base64Decode(x_ms_content_crc64_iterator->second);
10726  response.TransactionalContentHash = std::move(hash);
10727  }
10728  }
10729  response.AppendOffset
10730  = std::stoll(httpResponse.GetHeaders().at("x-ms-blob-append-offset"));
10731  response.CommittedBlockCount
10732  = std::stoi(httpResponse.GetHeaders().at("x-ms-blob-committed-block-count"));
10733  response.IsServerEncrypted
10734  = httpResponse.GetHeaders().at("x-ms-request-server-encrypted") == "true";
10735  auto x_ms_encryption_key_sha256__iterator
10736  = httpResponse.GetHeaders().find("x-ms-encryption-key-sha256");
10737  if (x_ms_encryption_key_sha256__iterator != httpResponse.GetHeaders().end())
10738  {
10739  response.EncryptionKeySha256
10740  = Azure::Core::Convert::Base64Decode(x_ms_encryption_key_sha256__iterator->second);
10741  }
10742  auto x_ms_encryption_scope__iterator
10743  = httpResponse.GetHeaders().find("x-ms-encryption-scope");
10744  if (x_ms_encryption_scope__iterator != httpResponse.GetHeaders().end())
10745  {
10746  response.EncryptionScope = x_ms_encryption_scope__iterator->second;
10747  }
10748  return Azure::Response<AppendBlockFromUriResult>(
10749  std::move(response), std::move(pHttpResponse));
10750  }
10751 
10752  struct SealAppendBlobOptions final
10753  {
10754  Azure::Nullable<int32_t> Timeout;
10755  Azure::Nullable<std::string> LeaseId;
10756  Azure::Nullable<Azure::DateTime> IfModifiedSince;
10757  Azure::Nullable<Azure::DateTime> IfUnmodifiedSince;
10758  Azure::ETag IfMatch;
10759  Azure::ETag IfNoneMatch;
10760  Azure::Nullable<std::string> IfTags;
10761  Azure::Nullable<int64_t> AppendPosition;
10762  }; // struct SealAppendBlobOptions
10763 
10764  static Azure::Response<SealAppendBlobResult> Seal(
10765  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10766  const Azure::Core::Url& url,
10767  const SealAppendBlobOptions& options,
10768  const Azure::Core::Context& context)
10769  {
10770  (void)options;
10771  auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, url);
10772  request.SetHeader("Content-Length", "0");
10773  request.GetUrl().AppendQueryParameter("comp", "seal");
10774  request.SetHeader("x-ms-version", "2020-02-10");
10775  if (options.Timeout.HasValue())
10776  {
10777  request.GetUrl().AppendQueryParameter(
10778  "timeout", std::to_string(options.Timeout.Value()));
10779  }
10780  if (options.LeaseId.HasValue())
10781  {
10782  request.SetHeader("x-ms-lease-id", options.LeaseId.Value());
10783  }
10784  if (options.IfModifiedSince.HasValue())
10785  {
10786  request.SetHeader(
10787  "If-Modified-Since",
10788  options.IfModifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10789  }
10790  if (options.IfUnmodifiedSince.HasValue())
10791  {
10792  request.SetHeader(
10793  "If-Unmodified-Since",
10794  options.IfUnmodifiedSince.Value().ToString(Azure::DateTime::DateFormat::Rfc1123));
10795  }
10796  if (options.IfMatch.HasValue() && !options.IfMatch.ToString().empty())
10797  {
10798  request.SetHeader("If-Match", options.IfMatch.ToString());
10799  }
10800  if (options.IfNoneMatch.HasValue() && !options.IfNoneMatch.ToString().empty())
10801  {
10802  request.SetHeader("If-None-Match", options.IfNoneMatch.ToString());
10803  }
10804  if (options.IfTags.HasValue())
10805  {
10806  request.SetHeader("x-ms-if-tags", options.IfTags.Value());
10807  }
10808  if (options.AppendPosition.HasValue())
10809  {
10810  request.SetHeader(
10811  "x-ms-blob-condition-appendpos", std::to_string(options.AppendPosition.Value()));
10812  }
10813  auto pHttpResponse = pipeline.Send(request, context);
10814  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10815  SealAppendBlobResult response;
10816  auto http_status_code
10817  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10818  httpResponse.GetStatusCode());
10819  if (!(http_status_code == 200))
10820  {
10821  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10822  }
10823  response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag"));
10824  response.LastModified = Azure::DateTime::Parse(
10825  httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123);
10826  return Azure::Response<SealAppendBlobResult>(
10827  std::move(response), std::move(pHttpResponse));
10828  }
10829 
10830  private:
10831  }; // class AppendBlob
10832 
10833  class BlobBatch final {
10834  public:
10835  struct SubmitBlobBatchOptions final
10836  {
10837  Azure::Nullable<int32_t> Timeout;
10838  std::string ContentType;
10839  }; // struct SubmitBlobBatchOptions
10840 
10841  static Azure::Response<Models::_detail::SubmitBlobBatchResult> SubmitBatch(
10842  Azure::Core::Http::_internal::HttpPipeline& pipeline,
10843  const Azure::Core::Url& url,
10844  Azure::Core::IO::BodyStream& requestBody,
10845  const SubmitBlobBatchOptions& options,
10846  const Azure::Core::Context& context)
10847  {
10848  (void)options;
10849  auto request
10850  = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Post, url, &requestBody);
10851  request.SetHeader("Content-Length", std::to_string(requestBody.Length()));
10852  request.GetUrl().AppendQueryParameter("comp", "batch");
10853  request.SetHeader("x-ms-version", "2020-02-10");
10854  if (options.Timeout.HasValue())
10855  {
10856  request.GetUrl().AppendQueryParameter(
10857  "timeout", std::to_string(options.Timeout.Value()));
10858  }
10859  request.SetHeader("Content-Type", options.ContentType);
10860  auto pHttpResponse = pipeline.Send(request, context);
10861  Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
10862  Models::_detail::SubmitBlobBatchResult response;
10863  auto http_status_code
10864  = static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
10865  httpResponse.GetStatusCode());
10866  if (!(http_status_code == 202))
10867  {
10868  throw StorageException::CreateFromResponse(std::move(pHttpResponse));
10869  }
10870  response.ContentType = httpResponse.GetHeaders().at("content-type");
10871  return Azure::Response<Models::_detail::SubmitBlobBatchResult>(
10872  std::move(response), std::move(pHttpResponse));
10873  }
10874 
10875  private:
10876  }; // class BlobBatch
10877 
10878  }; // class BlobRestClient
10879 
10880  } // namespace _detail
10881 
10882 }}} // namespace Azure::Storage::Blobs
Azure::Storage::Blobs::Models::LeaseStatus
Extensible enum used to identify the status of lease.
Definition: blob_rest_client.hpp:200
Azure::Storage::Blobs::Models::GeoReplication::Status
GeoReplicationStatus Status
Definition: blob_rest_client.hpp:508
Azure::Storage::Blobs::Models::SetBlobContainerAccessPolicyResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2063
Azure::Storage::Blobs::Models::StaticWebsite::ErrorDocument404Path
Azure::Nullable< std::string > ErrorDocument404Path
Definition: blob_rest_client.hpp:575
Azure::Storage::Blobs::Models::ObjectReplicationPolicy::PolicyId
std::string PolicyId
Definition: blob_rest_client.hpp:780
Azure::Storage::Blobs::Models::CreateAppendBlobResult::Created
bool Created
Definition: blob_rest_client.hpp:1585
Azure::Storage::Blobs::Models::SkuName::StandardRagrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardRagrs
Definition: blob_rest_client.hpp:338
Azure::Storage::Blobs::Models::ObjectReplicationRule
Contains the object replication rule ID and replication status of a blob.
Definition: blob_rest_client.hpp:544
Azure::Storage::Blobs::Models::SealAppendBlobResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2024
Azure::Storage::Blobs::Models::CreateAppendBlobResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1606
Azure::Storage::Blobs::Models::StageBlockFromUriResult
Response type for Azure::Storage::Blobs::BlockBlobClient::StageBlockFromUri.
Definition: blob_rest_client.hpp:2153
Azure::Storage::Blobs::Models::BlobProperties::LeaseState
Azure::Nullable< Models::LeaseState > LeaseState
Definition: blob_rest_client.hpp:1296
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1668
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2260
Azure::Storage::Blobs::Models::BlobContainerItemDetails::PreventEncryptionScopeOverride
bool PreventEncryptionScopeOverride
Definition: blob_rest_client.hpp:458
AZ_STORAGE_BLOBS_DLLEXPORT
#define AZ_STORAGE_BLOBS_DLLEXPORT
Applies DLL export attribute, when applicable.
Definition: dll_import_export.hpp:36
Azure::Storage::Blobs::Models::LeaseDurationType::Infinite
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseDurationType Infinite
Definition: blob_rest_client.hpp:151
Azure::Storage::Blobs::Models::BlobItem::Details
BlobItemDetails Details
Definition: blob_rest_client.hpp:1065
Azure::Storage::Blobs::Models::BlockListType::Uncommitted
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockListType Uncommitted
Definition: blob_rest_client.hpp:1477
Azure::Storage::Blobs::Models::BlobContainerProperties::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1207
Azure::Storage::Blobs::Models::BlobProperties::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1267
Azure::Storage::Blobs::Models::SkuName
Extensible enum that used to identify the sku of a storage account.
Definition: blob_rest_client.hpp:320
Azure::Storage::Blobs::Models::ObjectReplicationStatus
Extensible enum used to identify object replication status.
Definition: blob_rest_client.hpp:223
Azure::Storage::Blobs::Models::ClearPagesResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1523
Azure::Storage::Blobs::Models::ArchiveStatus
Extensible enum used to identify the destination tier when a blob is being rehydrated and is not comp...
Definition: blob_rest_client.hpp:666
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1672
Azure::Storage::Blobs::Models::BlobProperties::IncrementalCopyDestinationSnapshot
Azure::Nullable< std::string > IncrementalCopyDestinationSnapshot
Definition: blob_rest_client.hpp:1389
Azure::Storage::Blobs::Models::BlobContainerItemDetails::RemainingRetentionDays
Azure::Nullable< int32_t > RemainingRetentionDays
Definition: blob_rest_client.hpp:463
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopySource
Azure::Nullable< std::string > CopySource
Definition: blob_rest_client.hpp:995
Azure::Storage::Blobs::Models::AccessTier::P3
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P3
Definition: blob_rest_client.hpp:599
Azure::Storage::Blobs::Models::BlobItemDetails::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:879
Azure::Storage::Blobs::Models::CreateAppendBlobResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1610
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1104
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:2279
Azure::Storage::Blobs::Models::BlobProperties::CreatedOn
Azure::DateTime CreatedOn
Definition: blob_rest_client.hpp:1271
Azure::Storage::Blobs::Models::BlobType::AppendBlob
AZ_STORAGE_BLOBS_DLLEXPORT static const BlobType AppendBlob
Definition: blob_rest_client.hpp:763
Azure::Storage::Blobs::Models::BlobProperties::CopyStatus
Azure::Nullable< Models::CopyStatus > CopyStatus
Definition: blob_rest_client.hpp:1376
Azure::Storage::Blobs::Models::CreateBlobContainerResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1629
Azure::Storage::Blobs::Models::BlobItem::IsCurrentVersion
Azure::Nullable< bool > IsCurrentVersion
Definition: blob_rest_client.hpp:1061
Azure::Storage::Blobs::Models::BlobItemDetails::ExpiresOn
Azure::Nullable< Azure::DateTime > ExpiresOn
Definition: blob_rest_client.hpp:830
Azure::Storage::Blobs::Models::BlobContainerProperties::LeaseDuration
Azure::Nullable< LeaseDurationType > LeaseDuration
Definition: blob_rest_client.hpp:1234
Azure::Storage::Blobs::Models::AccessTier::P80
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P80
Definition: blob_rest_client.hpp:643
Azure::Storage::Blobs::Models::BlockListType
Extensible enum used to specify blocks to list.
Definition: blob_rest_client.hpp:1463
Azure::Storage::Blobs::Models::SetBlobContainerAccessPolicyResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2057
Azure::Storage::Blobs::Models::SetBlobExpiryResult
Response type for #Azure::Storage::Files::DataLake::DataLakeFileClient::ScheduleDeletion.
Definition: blob_rest_client.hpp:2088
Azure::Storage::Blobs::Models::BlobItemDetails::HttpHeaders
BlobHttpHeaders HttpHeaders
Definition: blob_rest_client.hpp:818
Azure::Storage::Blobs::Models::BlobHttpHeaders::ContentLanguage
std::string ContentLanguage
Definition: blob_rest_client.hpp:726
Azure::Storage::Blobs::Models::BlobProperties::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1416
Azure::Storage::Blobs::Models::BlobItemDetails::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:840
Azure::Storage::Blobs::Models::BlockListType::All
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockListType All
Definition: blob_rest_client.hpp:1481
Azure::Storage::Blobs::Models::AccessTier::P15
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P15
Definition: blob_rest_client.hpp:615
Azure::Storage::Blobs::Models::GeoReplicationStatus::Unavailable
AZ_STORAGE_BLOBS_DLLEXPORT static const GeoReplicationStatus Unavailable
Definition: blob_rest_client.hpp:132
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2254
Azure::Storage::Blobs::Models::AppendBlockFromUriResult
Response type for Azure::Storage::Blobs::AppendBlobClient::AppendBlockFromUri.
Definition: blob_rest_client.hpp:1100
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1647
Azure::Storage::Blobs::Models::UploadPagesResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:2315
Azure::Storage::Blobs::Models::AnalyticsLogging
Azure analytics logging settings.
Definition: blob_rest_client.hpp:384
Azure::Storage::Blobs::Models::SignedIdentifier
Describes how you reference an ACL in a blob container.
Definition: blob_rest_client.hpp:298
Azure::Storage::Blobs::Models::SkuName::StandardZrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardZrs
Definition: blob_rest_client.hpp:342
Azure::Storage::Blobs::Models::BlobType::PageBlob
AZ_STORAGE_BLOBS_DLLEXPORT static const BlobType PageBlob
Definition: blob_rest_client.hpp:759
Azure::Storage::Blobs::Models::TaggedBlobItem::BlobContainerName
std::string BlobContainerName
Definition: blob_rest_client.hpp:377
Azure::Storage::Blobs::Models::BlobHttpHeaders::ContentHash
Storage::ContentHash ContentHash
Definition: blob_rest_client.hpp:730
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::AppendOffset
int64_t AppendOffset
Definition: blob_rest_client.hpp:1118
Azure::Storage::Blobs::Models::BlobProperties::ObjectReplicationDestinationPolicyId
Azure::Nullable< std::string > ObjectReplicationDestinationPolicyId
Definition: blob_rest_client.hpp:1403
Azure::Storage::Blobs::Models::PublicAccessType::Blob
AZ_STORAGE_BLOBS_DLLEXPORT static const PublicAccessType Blob
Definition: blob_rest_client.hpp:268
Azure::Storage::Blobs::Models::BlobType
Extensible enum used to identify blob type.
Definition: blob_rest_client.hpp:745
Azure::Storage::Blobs::Models::BlobItem::IsDeleted
bool IsDeleted
Definition: blob_rest_client.hpp:1047
Azure::Storage::Blobs::Models::LeaseState::Leased
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseState Leased
Definition: blob_rest_client.hpp:178
Azure::Storage::Blobs::Models::AccountKind::StorageV2
AZ_STORAGE_BLOBS_DLLEXPORT static const AccountKind StorageV2
Definition: blob_rest_client.hpp:59
Azure::Storage::Blobs::Models::SetBlobTagsResult
Response type for Azure::Storage::Blobs::BlobClient::SetTags.
Definition: blob_rest_client.hpp:2139
Azure::Storage::Blobs::Models::CreateAppendBlobResult::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1600
Azure::Storage::Blobs::Models::BlobProperties::CommittedBlockCount
Azure::Nullable< int32_t > CommittedBlockCount
Definition: blob_rest_client.hpp:1318
Azure::Storage::Blobs::Models::BlobProperties::BlobSize
int64_t BlobSize
Definition: blob_rest_client.hpp:1304
Azure::Storage::Blobs::Models::BlockListType::Committed
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockListType Committed
Definition: blob_rest_client.hpp:1473
Azure::Storage::Blobs::Models::BlobContainerItemDetails::DeletedOn
Azure::Nullable< Azure::DateTime > DeletedOn
Definition: blob_rest_client.hpp:468
Azure::Storage::Blobs::Models::AccessTier::Hot
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier Hot
Definition: blob_rest_client.hpp:647
Azure::Storage::Blobs::Models::PublicAccessType::BlobContainer
AZ_STORAGE_BLOBS_DLLEXPORT static const PublicAccessType BlobContainer
Definition: blob_rest_client.hpp:262
Azure::Storage::Blobs::Models::GetBlockListResult
Response type for Azure::Storage::Blobs::BlockBlobClient::GetBlockList.
Definition: blob_rest_client.hpp:1823
Azure::Storage::Blobs::Models::BlobProperties::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1328
Azure::Storage::Blobs::Models::SetBlobMetadataResult::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:2132
Azure::Storage::Blobs::Models::UserDelegationKey::SignedExpiresOn
Azure::DateTime SignedExpiresOn
Definition: blob_rest_client.hpp:2346
Azure::Storage::Blobs::Models::CommitBlockListResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1545
Azure::Storage::Blobs::Models::DownloadBlobDetails::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:934
Azure::Storage::Blobs::Models::DownloadBlobDetails::ExpiresOn
Azure::Nullable< Azure::DateTime > ExpiresOn
Definition: blob_rest_client.hpp:917
Azure::Storage::Blobs::Models::SignedIdentifier::ExpiresOn
Azure::DateTime ExpiresOn
Definition: blob_rest_client.hpp:310
Azure::Storage::Blobs::Models::AppendBlockResult::CommittedBlockCount
int32_t CommittedBlockCount
Definition: blob_rest_client.hpp:1167
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:2264
Azure::Storage::Blobs::Models::BlobServiceProperties::MinuteMetrics
Metrics MinuteMetrics
Definition: blob_rest_client.hpp:1440
Azure::Storage::Blobs::Models::CommitBlockListResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1551
Azure::Storage::Blobs::Models::LeaseState::Available
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseState Available
Definition: blob_rest_client.hpp:174
Azure::Storage::Blobs::Models::CopyStatus::Success
AZ_STORAGE_BLOBS_DLLEXPORT static const CopyStatus Success
Definition: blob_rest_client.hpp:101
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1653
Azure::Storage::Blobs::Models::BlobItemDetails::Metadata
Storage::Metadata Metadata
Definition: blob_rest_client.hpp:822
Azure::Storage::Blobs::Models::StageBlockResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:2196
Azure::Storage::Blobs::Models::DownloadBlobResult::BlobType
Models::BlobType BlobType
Definition: blob_rest_client.hpp:1786
Azure::Storage::Blobs::Models::DownloadBlobDetails::ObjectReplicationDestinationPolicyId
Azure::Nullable< std::string > ObjectReplicationDestinationPolicyId
Definition: blob_rest_client.hpp:974
Azure::Storage::Blobs::Models::UndeleteBlobResult
Response type for Azure::Storage::Blobs::BlobClient::Undelete.
Definition: blob_rest_client.hpp:2203
Azure::Storage::Blobs::Models::LeaseState
Extensible enum used to identify the state of lease.
Definition: blob_rest_client.hpp:164
Azure::Storage::Blobs::Models::CreatePageBlobResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1693
Azure::Storage::Blobs::Models::UploadBlockBlobResult::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:2225
Azure::Storage::Blobs::Models::AppendBlockResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1181
Azure::Storage::Blobs::Models::StaticWebsite
The properties that enable a storage account to host a static website.
Definition: blob_rest_client.hpp:559
Azure::Storage::Blobs::Models::SkuName::StandardGrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardGrs
Definition: blob_rest_client.hpp:334
Azure::Storage::Blobs::Models::SetBlobMetadataResult
Response type for Azure::Storage::Blobs::BlobClient::SetMetadata.
Definition: blob_rest_client.hpp:2117
Azure::Storage::Blobs::Models::DownloadBlobDetails::IsSealed
Azure::Nullable< bool > IsSealed
Definition: blob_rest_client.hpp:943
Azure::Storage::Blobs::Models::BlobItemDetails
Detailed information of a blob.
Definition: blob_rest_client.hpp:814
Azure::Storage::Blobs::Models::SetBlobContainerAccessPolicyResult
Response type for Azure::Storage::Blobs::BlobContainerClient::SetAccessPolicy.
Definition: blob_rest_client.hpp:2053
Azure::Storage::Blobs::Models::DownloadBlobDetails::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:909
Azure::Storage::Blobs::Models::AccessTier::P1
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P1
Definition: blob_rest_client.hpp:591
Azure::Storage::Blobs::Models::DownloadBlobDetails::ObjectReplicationSourceProperties
std::vector< ObjectReplicationPolicy > ObjectReplicationSourceProperties
Definition: blob_rest_client.hpp:978
Azure::Storage::Blobs::Models::BlobProperties::CopyCompletedOn
Azure::Nullable< Azure::DateTime > CopyCompletedOn
Definition: blob_rest_client.hpp:1399
Azure::Storage::Blobs::Models::SetBlobMetadataResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2127
Azure::Storage::Blobs::Models::BlobItemDetails::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:884
Azure::Storage::Blobs::Models::CreatePageBlobResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1704
Azure::Storage::Blobs::Models::DownloadBlobDetails::LeaseState
Azure::Nullable< Models::LeaseState > LeaseState
Definition: blob_rest_client.hpp:952
Azure::Storage::Blobs::Models::Metrics::RetentionPolicy
Models::RetentionPolicy RetentionPolicy
Definition: blob_rest_client.hpp:533
Azure::Storage::Blobs::Models::AppendBlockResult
Response type for Azure::Storage::Blobs::AppendBlobClient::AppendBlock.
Definition: blob_rest_client.hpp:1144
Azure::Storage::Blobs::Models::AccessTier::P10
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P10
Definition: blob_rest_client.hpp:611
Azure::Storage::Blobs::Models::TaggedBlobItem::BlobName
std::string BlobName
Definition: blob_rest_client.hpp:373
Azure::Storage::Blobs::Models::StageBlockFromUriResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:2163
Azure::Storage::Blobs::Models::AnalyticsLogging::RetentionPolicy
Models::RetentionPolicy RetentionPolicy
Definition: blob_rest_client.hpp:404
Azure::Storage::Blobs::Models::AppendBlockResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1154
Azure::Storage::Blobs::Models::DeleteBlobContainerResult::Deleted
bool Deleted
Definition: blob_rest_client.hpp:1728
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::SequenceNumber
int64_t SequenceNumber
Definition: blob_rest_client.hpp:2269
Azure::Storage::Blobs::Models::BlockType::Committed
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockType Committed
Definition: blob_rest_client.hpp:1500
Azure::Storage::Blobs::Models::BlobServiceProperties::Logging
AnalyticsLogging Logging
Definition: blob_rest_client.hpp:1432
Azure::Storage::Blobs::Models::BlobProperties::AccessTierChangedOn
Azure::Nullable< Azure::DateTime > AccessTierChangedOn
Definition: blob_rest_client.hpp:1356
Azure::Storage::Blobs::Models::CorsRule::AllowedHeaders
std::string AllowedHeaders
Definition: blob_rest_client.hpp:489
Azure::Storage::Blobs::Models::ObjectReplicationPolicy
Contains object replication policy ID and the respective list of #ObjectReplicationRule s....
Definition: blob_rest_client.hpp:776
Azure::Storage::Blobs::Models::AccessTier::P2
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P2
Definition: blob_rest_client.hpp:595
Azure::Storage::Blobs::Models::CorsRule
Settings for a CORS rule.
Definition: blob_rest_client.hpp:475
Azure::Storage::Blobs::Models::CommitBlockListResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1566
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopyProgress
Azure::Nullable< std::string > CopyProgress
Definition: blob_rest_client.hpp:1012
Azure::Storage::Blobs::Models::BlobType::BlockBlob
AZ_STORAGE_BLOBS_DLLEXPORT static const BlobType BlockBlob
Definition: blob_rest_client.hpp:755
Azure::Storage::Blobs::Models::AccessTier::P40
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P40
Definition: blob_rest_client.hpp:627
Azure::Storage::Blobs::Models::DownloadBlobDetails::LastAccessedOn
Azure::Nullable< Azure::DateTime > LastAccessedOn
Definition: blob_rest_client.hpp:921
Azure::Storage::Blobs::Models::RehydratePriority::High
AZ_STORAGE_BLOBS_DLLEXPORT static const RehydratePriority High
Definition: blob_rest_client.hpp:800
Azure::Storage::Blobs::Models::UploadBlockBlobResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:2243
Azure::Storage::Blobs::Models::BlobContainerItem::Details
BlobContainerItemDetails Details
Definition: blob_rest_client.hpp:707
Azure::Storage::Blobs::Models::SetBlobAccessTierResult
Response type for Azure::Storage::Blobs::BlobClient::SetAccessTier.
Definition: blob_rest_client.hpp:2046
Azure::Storage::Blobs::Models::AccountKind::BlobStorage
AZ_STORAGE_BLOBS_DLLEXPORT static const AccountKind BlobStorage
Definition: blob_rest_client.hpp:55
Azure::Storage::Blobs::Models::BlobProperties::IsSealed
Azure::Nullable< bool > IsSealed
Definition: blob_rest_client.hpp:1322
Azure::Storage::Blobs::Models::AccountInfo::AccountKind
Models::AccountKind AccountKind
Definition: blob_rest_client.hpp:1089
Azure::Storage::Blobs::Models::SkuName::PremiumZrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName PremiumZrs
Definition: blob_rest_client.hpp:350
Azure::Storage::Blobs::Models::UploadPagesResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:2323
Azure::Storage::Blobs::Models::UploadBlockBlobResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:2239
Azure::Storage::Blobs::Models::UploadBlockBlobResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:2231
Azure::Storage::Blobs::Models::CreatePageBlobResult::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1698
Azure::Storage::Blobs::Models::LeaseState::Expired
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseState Expired
Definition: blob_rest_client.hpp:182
Azure::Storage::Blobs::Models::EncryptionAlgorithmType::Aes256
AZ_STORAGE_BLOBS_DLLEXPORT static const EncryptionAlgorithmType Aes256
Definition: blob_rest_client.hpp:1813
Azure::Storage::Blobs::Models::AnalyticsLogging::Read
bool Read
Definition: blob_rest_client.hpp:396
Azure::Storage::Blobs::Models::DeleteSnapshotsOption::OnlySnapshots
AZ_STORAGE_BLOBS_DLLEXPORT static const DeleteSnapshotsOption OnlySnapshots
Definition: blob_rest_client.hpp:1760
Azure::Storage::Blobs::Models::DownloadBlobDetails::Metadata
Storage::Metadata Metadata
Definition: blob_rest_client.hpp:929
Azure::Storage::Blobs::Models::GeoReplication
Geo-replication information for the secondary storage endpoint.
Definition: blob_rest_client.hpp:504
Azure::Storage::Blobs::Models::BlobBlock::Name
std::string Name
Definition: blob_rest_client.hpp:81
Azure::Storage::Blobs::Models::CreatePageBlobResult
Response type for Azure::Storage::Blobs::PageBlobClient::Create.
Definition: blob_rest_client.hpp:1679
Azure::Storage::Blobs::Models::BlobItem::Snapshot
std::string Snapshot
Definition: blob_rest_client.hpp:1051
Azure::Storage::Blobs::Models::AccessTier::P70
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P70
Definition: blob_rest_client.hpp:639
Azure::Storage::Blobs::Models::AccountKind::Storage
AZ_STORAGE_BLOBS_DLLEXPORT static const AccountKind Storage
Definition: blob_rest_client.hpp:51
Azure::Storage::Blobs::Models::AbortBlobCopyFromUriResult
Response type for #Azure::Storage::Blobs::BlobClient::AbortCopy.
Definition: blob_rest_client.hpp:1072
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopyStatus
Azure::Nullable< Models::CopyStatus > CopyStatus
Definition: blob_rest_client.hpp:1002
Azure::Storage::Blobs::Models::BlobContainerProperties::AccessType
PublicAccessType AccessType
Definition: blob_rest_client.hpp:1221
Azure::Storage::Blobs::Models::ResizePageBlobResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1968
Azure::Storage::Blobs::Models::CreateBlobContainerResult
Response type for Azure::Storage::Blobs::BlobContainerClient::Create.
Definition: blob_rest_client.hpp:1621
Azure::Storage::Blobs::Models::RehydratePriority
Extensible enum used to identify rehydrate priority.
Definition: blob_rest_client.hpp:790
Azure::Storage::Blobs::Models::BlobContainerProperties::HasLegalHold
bool HasLegalHold
Definition: blob_rest_client.hpp:1229
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:2283
Azure::Storage::Blobs::Models::ArchiveStatus::RehydratePendingToCool
AZ_STORAGE_BLOBS_DLLEXPORT static const ArchiveStatus RehydratePendingToCool
Definition: blob_rest_client.hpp:680
Azure::Storage::Blobs::Models::BlobProperties::LeaseDuration
Azure::Nullable< LeaseDurationType > LeaseDuration
Definition: blob_rest_client.hpp:1292
Azure::Storage::Blobs::Models::BlobItemDetails::IsSealed
Azure::Nullable< bool > IsSealed
Definition: blob_rest_client.hpp:888
Azure::Storage::Blobs::Models::BlobProperties::IsIncrementalCopy
Azure::Nullable< bool > IsIncrementalCopy
Definition: blob_rest_client.hpp:1385
Azure::Storage::Blobs::Models::BlobProperties::RehydratePriority
Azure::Nullable< Models::RehydratePriority > RehydratePriority
Definition: blob_rest_client.hpp:1352
Azure::Storage::Blobs::Models::GeoReplication::LastSyncedOn
Azure::Nullable< Azure::DateTime > LastSyncedOn
Definition: blob_rest_client.hpp:514
Azure::Storage::Blobs::Models::CorsRule::AllowedOrigins
std::string AllowedOrigins
Definition: blob_rest_client.hpp:480
Azure::Storage::Blobs::Models::UploadPagesResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2300
Azure::Storage::Blobs::Models::SetBlobHttpHeadersResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2099
Azure::Storage::Blobs::Models::BlobContainerItemDetails::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:421
Azure::Storage::Blobs::Models::AppendBlockResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:1158
Azure::Storage::Blobs::Models::AccessTier::P6
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P6
Definition: blob_rest_client.hpp:607
Azure::Storage::Blobs::Models::CreatePageBlobResult::Created
bool Created
Definition: blob_rest_client.hpp:1683
Azure::Storage::Blobs::Models::AccessTier::P50
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P50
Definition: blob_rest_client.hpp:631
Azure::Storage::Blobs::Models::UploadBlockBlobResult
Response type for Azure::Storage::Blobs::BlockBlobClient::Upload.
Definition: blob_rest_client.hpp:2210
Azure::Storage::Blobs::Models::CreateAppendBlobResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1614
Azure::Storage::Blobs::Models::BlobServiceProperties::HourMetrics
Metrics HourMetrics
Definition: blob_rest_client.hpp:1436
Azure::Storage::Blobs::Models::BlobProperties::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1332
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1137
Azure::Storage::Blobs::Models::CorsRule::MaxAgeInSeconds
int32_t MaxAgeInSeconds
Definition: blob_rest_client.hpp:497
Azure::Storage::Blobs::Models::SealAppendBlobResult::IsSealed
bool IsSealed
Definition: blob_rest_client.hpp:2028
Azure::Storage::Blobs::Models::ScheduleBlobExpiryOriginType::RelativeToNow
AZ_STORAGE_BLOBS_DLLEXPORT static const ScheduleBlobExpiryOriginType RelativeToNow
Definition: blob_rest_client.hpp:2000
Azure::Storage::Blobs::Models::RetentionPolicy
Determines how long the associated data should persist.
Definition: blob_rest_client.hpp:282
Azure::Storage::Blobs::Models::DeleteBlobContainerResult
Response type for Azure::Storage::Blobs::BlobContainerClient::Delete.
Definition: blob_rest_client.hpp:1724
Azure::Storage::Blobs::Models::DownloadBlobDetails::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1022
Azure::Storage::Blobs::Models::UserDelegationKey::SignedStartsOn
Azure::DateTime SignedStartsOn
Definition: blob_rest_client.hpp:2342
Azure::Storage::Blobs::Models::BlobProperties::CopyProgress
Azure::Nullable< std::string > CopyProgress
Definition: blob_rest_client.hpp:1394
Azure::Storage::Blobs::Models::BlobItem::BlobType
Models::BlobType BlobType
Definition: blob_rest_client.hpp:1043
Azure::Storage::Blobs::Models::DownloadBlobDetails::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:962
Azure::Storage::Blobs::Models::SetServicePropertiesResult
Response type for Azure::Storage::Blobs::BlobServiceClient::SetProperties.
Definition: blob_rest_client.hpp:2146
Azure::Storage::Blobs::Models::BlobItemDetails::LeaseDuration
Azure::Nullable< LeaseDurationType > LeaseDuration
Definition: blob_rest_client.hpp:865
Azure::Storage::Blobs::Models::AppendBlockResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1177
Azure::Storage::Blobs::Models::BlobBlock::Size
int64_t Size
Definition: blob_rest_client.hpp:85
Azure::Storage::Blobs::Models::AccessTier::P4
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P4
Definition: blob_rest_client.hpp:603
Azure::Storage::Blobs::Models::Metrics::Version
std::string Version
Definition: blob_rest_client.hpp:525
Azure::Storage::Blobs::Models::LeaseState::Breaking
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseState Breaking
Definition: blob_rest_client.hpp:187
Azure::Storage::Blobs::Models::ScheduleBlobExpiryOriginType
Extensible enum used to specify when a file's expiration time should be relative to.
Definition: blob_rest_client.hpp:1979
Azure::Storage::Blobs::Models::DownloadBlobDetails::IsCurrentVersion
Azure::Nullable< bool > IsCurrentVersion
Definition: blob_rest_client.hpp:1027
Azure::Storage::Blobs::Models::Metrics
Summary of request statistics grouped by API in hour or minute aggregates for blobs.
Definition: blob_rest_client.hpp:521
Azure::Storage::Blobs::Models::CreatePageBlobResult::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:1717
Azure::Storage::Blobs::Models::BlobContainerItemDetails::AccessType
PublicAccessType AccessType
Definition: blob_rest_client.hpp:429
Azure::Storage::Blobs::Models::SealAppendBlobResult
Response type for Azure::Storage::Blobs::AppendBlobClient::Seal.
Definition: blob_rest_client.hpp:2014
Azure::Storage::Blobs::Models::BlobContainerProperties::HasImmutabilityPolicy
bool HasImmutabilityPolicy
Definition: blob_rest_client.hpp:1225
Azure::Storage::Blobs::Models::BlockType::Uncommitted
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockType Uncommitted
Definition: blob_rest_client.hpp:1504
Azure::Storage::Blobs::Models::AccessTier::Archive
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier Archive
Definition: blob_rest_client.hpp:656
Azure::Storage::Blobs::Models::BlobProperties::IsAccessTierInferred
Azure::Nullable< bool > IsAccessTierInferred
Definition: blob_rest_client.hpp:1344
Azure::Storage::Blobs::Models::SetBlobContainerMetadataResult
Response type for Azure::Storage::Blobs::BlobContainerClient::SetMetadata.
Definition: blob_rest_client.hpp:2070
Azure::Storage::Blobs::Models::DownloadBlobResult::BodyStream
std::unique_ptr< Azure::Core::IO::BodyStream > BodyStream
Definition: blob_rest_client.hpp:1774
Azure::Storage::Blobs::Models::DownloadBlobDetails::LeaseDuration
Azure::Nullable< LeaseDurationType > LeaseDuration
Definition: blob_rest_client.hpp:948
Azure::Storage::Blobs::Models::SkuName::PremiumLrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName PremiumLrs
Definition: blob_rest_client.hpp:346
Azure::Storage::Blobs::Models::SetBlobHttpHeadersResult
Response type for Azure::Storage::Blobs::BlobClient::SetHttpHeaders.
Definition: blob_rest_client.hpp:2095
Azure::Storage::Blobs::Models::AccessTier::P60
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P60
Definition: blob_rest_client.hpp:635
Azure::Storage::Blobs::Models::BlobServiceProperties
Properties of blob service.
Definition: blob_rest_client.hpp:1428
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopyId
Azure::Nullable< std::string > CopyId
Definition: blob_rest_client.hpp:988
Azure::Storage::Blobs::Models::CreatePageBlobResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1687
Azure::Storage::Blobs::Models::LeaseState::Broken
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseState Broken
Definition: blob_rest_client.hpp:191
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1133
Azure::Storage::Blobs::Models::AccessTier::P30
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P30
Definition: blob_rest_client.hpp:623
Azure::Storage::Blobs::Models::BlobContainerItem::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:703
Azure::Storage::Blobs::Models::UploadBlockBlobResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:2235
Azure::Storage::Blobs::Models::ServiceStatistics::GeoReplication
Models::GeoReplication GeoReplication
Definition: blob_rest_client.hpp:2039
Azure::Storage::Blobs::Models::DownloadBlobDetails::CreatedOn
Azure::DateTime CreatedOn
Definition: blob_rest_client.hpp:913
Azure::Storage::Blobs::Models::DeleteSnapshotsOption::IncludeSnapshots
AZ_STORAGE_BLOBS_DLLEXPORT static const DeleteSnapshotsOption IncludeSnapshots
Definition: blob_rest_client.hpp:1756
Azure::Storage::Blobs::Models::LeaseStatus::Locked
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseStatus Locked
Definition: blob_rest_client.hpp:210
Azure::Storage::Blobs::Models::LeaseDurationType::Fixed
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseDurationType Fixed
Definition: blob_rest_client.hpp:155
Azure::Storage::Blobs::Models::AccessTier
Extensible enum used to identify access tier of a blob.
Definition: blob_rest_client.hpp:581
Azure::Storage::Blobs::Models::DownloadBlobDetails::TagCount
Azure::Nullable< int32_t > TagCount
Definition: blob_rest_client.hpp:982
Azure::Storage::Blobs::Models::BlobProperties::BlobType
Models::BlobType BlobType
Definition: blob_rest_client.hpp:1287
Azure::Storage::Blobs::Models::DeleteBlobResult::Deleted
bool Deleted
Definition: blob_rest_client.hpp:1739
Azure::Storage::Blobs::Models::EncryptionAlgorithmType
Extensible enum used to identify encryption algorithm.
Definition: blob_rest_client.hpp:1800
Azure::Storage::Blobs::Models::BlobContainerAccessPolicy::SignedIdentifiers
std::vector< SignedIdentifier > SignedIdentifiers
Definition: blob_rest_client.hpp:1196
Azure::Storage::Blobs::Models::UserDelegationKey
A user delegation key that can be used to sign user delegation SAS.
Definition: blob_rest_client.hpp:2330
Azure::Storage::Blobs::Models::SkuName::StandardRagzrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardRagzrs
Definition: blob_rest_client.hpp:358
Azure::Storage::Blobs::Models::BlobContainerItem::IsDeleted
bool IsDeleted
Definition: blob_rest_client.hpp:699
Azure::Storage::Blobs::Models::CommitBlockListResult
Response type for Azure::Storage::Blobs::BlockBlobClient::CommitBlockList.
Definition: blob_rest_client.hpp:1541
Azure::Storage::Blobs::Models::UploadPagesResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:2304
Azure::Storage::Blobs::Models::BlobContainerItemDetails::DefaultEncryptionScope
std::string DefaultEncryptionScope
Definition: blob_rest_client.hpp:454
Azure::Storage::Blobs::Models::StaticWebsite::DefaultIndexDocumentPath
Azure::Nullable< std::string > DefaultIndexDocumentPath
Definition: blob_rest_client.hpp:571
Azure::Storage::Blobs::Models::BlobHttpHeaders::ContentEncoding
std::string ContentEncoding
Definition: blob_rest_client.hpp:722
Azure::Storage::Blobs::Models::GeoReplicationStatus
Extensible enum used to identify the status of secondary storage endpoint.
Definition: blob_rest_client.hpp:114
Azure::Storage::Blobs::Models::StaticWebsite::IndexDocument
Azure::Nullable< std::string > IndexDocument
Definition: blob_rest_client.hpp:567
Azure::Storage::Blobs::Models::AccountKind::BlockBlobStorage
AZ_STORAGE_BLOBS_DLLEXPORT static const AccountKind BlockBlobStorage
Definition: blob_rest_client.hpp:67
Azure::Storage::Blobs::Models::CreatePageBlobResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1712
Azure::Storage::Blobs::Models::GetBlockListResult::BlobSize
int64_t BlobSize
Definition: blob_rest_client.hpp:1837
Azure::Storage::Blobs::Models::CreateAppendBlobResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1595
Azure::Storage::Blobs::Models::SetBlobMetadataResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2121
Azure::Storage::Blobs::Models::StageBlockFromUriResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:2171
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopyCompletedOn
Azure::Nullable< Azure::DateTime > CopyCompletedOn
Definition: blob_rest_client.hpp:1017
Azure::Storage::Blobs::Models::GetBlockListResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1827
Azure::Storage::Blobs::Models::GetBlockListResult::CommittedBlocks
std::vector< BlobBlock > CommittedBlocks
Definition: blob_rest_client.hpp:1841
Azure::Storage::Blobs::Models::BlobContainerProperties::DefaultEncryptionScope
std::string DefaultEncryptionScope
Definition: blob_rest_client.hpp:1246
Azure::Storage::Blobs::Models::BlobProperties::Metadata
Storage::Metadata Metadata
Definition: blob_rest_client.hpp:1283
Azure::Storage::Blobs::Models::BlobContainerAccessPolicy::AccessType
PublicAccessType AccessType
Definition: blob_rest_client.hpp:1192
Azure::Storage::Blobs::Models::BlobContainerAccessPolicy
Access policy for a blob container.
Definition: blob_rest_client.hpp:1188
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult
Response type for Azure::Storage::Blobs::BlobClient::CreateSnapshot.
Definition: blob_rest_client.hpp:1642
Azure::Storage::Blobs::Models::StageBlockFromUriResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:2167
Azure::Storage::Blobs::Models::DownloadBlobDetails::CopyStatusDescription
Azure::Nullable< std::string > CopyStatusDescription
Definition: blob_rest_client.hpp:1007
dll_import_export.hpp
DLL export macro.
Azure::Storage::Blobs::Models::BlobProperties::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1336
Azure::Storage::Blobs::Models::BlobContainerItemDetails::LeaseDuration
Azure::Nullable< LeaseDurationType > LeaseDuration
Definition: blob_rest_client.hpp:442
Azure::Storage::Blobs::Models::ObjectReplicationRule::RuleId
std::string RuleId
Definition: blob_rest_client.hpp:548
Azure::Storage::Blobs::Models::DownloadBlobResult::BlobSize
int64_t BlobSize
Definition: blob_rest_client.hpp:1782
Azure::Storage::Blobs::Models::CopyStatus
Extensible enum used to identify copy status of a copy operation.
Definition: blob_rest_client.hpp:91
Azure::Storage::Blobs::Models::BlobServiceProperties::DefaultServiceVersion
Azure::Nullable< std::string > DefaultServiceVersion
Definition: blob_rest_client.hpp:1449
Azure::Storage::Blobs::Models::UploadPagesFromUriResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:2275
Azure::Storage::Blobs::Models::DownloadBlobResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:1790
Azure::Storage::Blobs::Models::BlobContainerItemDetails::HasImmutabilityPolicy
bool HasImmutabilityPolicy
Definition: blob_rest_client.hpp:433
Azure::Storage::Blobs::Models::CreateBlobContainerResult::Created
bool Created
Definition: blob_rest_client.hpp:1625
Azure::Storage::Blobs::Models::BlobItemDetails::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:875
Azure::Storage::Blobs::Models::AccessTier::P20
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier P20
Definition: blob_rest_client.hpp:619
Azure::Storage::Blobs::Models::BlobContainerItemDetails
Detailed information of a blob container.
Definition: blob_rest_client.hpp:411
Azure::Storage::Blobs::Models::ObjectReplicationRule::ReplicationStatus
ObjectReplicationStatus ReplicationStatus
Definition: blob_rest_client.hpp:552
Azure::Storage::Blobs::Models::BlobServiceProperties::DeleteRetentionPolicy
RetentionPolicy DeleteRetentionPolicy
Definition: blob_rest_client.hpp:1453
Azure::Storage::Blobs::Models::BlobBlock
Describes a sinlge block in block blob.
Definition: blob_rest_client.hpp:77
Azure::Storage::Blobs::Models::UserDelegationKey::SignedVersion
std::string SignedVersion
Definition: blob_rest_client.hpp:2354
Azure::Storage::Blobs::Models::BlobProperties::CopyStatusDescription
Azure::Nullable< std::string > CopyStatusDescription
Definition: blob_rest_client.hpp:1381
Azure::Storage::Blobs::Models::CommitBlockListResult::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:1570
Azure::Storage::Blobs::Models::LeaseStatus::Unlocked
AZ_STORAGE_BLOBS_DLLEXPORT static const LeaseStatus Unlocked
Definition: blob_rest_client.hpp:214
Azure::Storage::Blobs::Models::CopyStatus::Pending
AZ_STORAGE_BLOBS_DLLEXPORT static const CopyStatus Pending
Definition: blob_rest_client.hpp:105
Azure::Storage::Blobs::Models::BlobProperties::LeaseStatus
Azure::Nullable< Models::LeaseStatus > LeaseStatus
Definition: blob_rest_client.hpp:1300
Azure::Storage::Blobs::Models::SkuName::StandardLrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardLrs
Definition: blob_rest_client.hpp:330
Azure::Storage::Blobs::Models::LeaseDurationType
Extensible enum used to identify the lease is of inifinite or fixed duration.
Definition: blob_rest_client.hpp:141
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::CommittedBlockCount
int32_t CommittedBlockCount
Definition: blob_rest_client.hpp:1123
Azure::Storage::Blobs::Models::CommitBlockListResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:1574
Azure::Storage::Blobs::Models::BlobHttpHeaders::CacheControl
std::string CacheControl
Definition: blob_rest_client.hpp:734
Azure::Storage::Blobs::Models::DeleteSnapshotsOption
Extensible enum used to specify whether base blob should be deleted in a delete blob operation.
Definition: blob_rest_client.hpp:1746
Azure::Storage::Blobs::Models::SetBlobHttpHeadersResult::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:2110
Azure::Storage::Blobs::Models::BlobItemDetails::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:844
Azure::Storage::Blobs::Models::CorsRule::AllowedMethods
std::string AllowedMethods
Definition: blob_rest_client.hpp:485
Azure::Storage::Blobs::Models::BlobItemDetails::ObjectReplicationSourceProperties
std::vector< ObjectReplicationPolicy > ObjectReplicationSourceProperties
Definition: blob_rest_client.hpp:892
Azure::Storage::Blobs::Models::AppendBlockResult::AppendOffset
int64_t AppendOffset
Definition: blob_rest_client.hpp:1162
Azure::Storage::Blobs::Models::SignedIdentifier::StartsOn
Azure::DateTime StartsOn
Definition: blob_rest_client.hpp:306
Azure::Storage::Blobs::Models::BlobItemDetails::AccessTier
Azure::Nullable< Models::AccessTier > AccessTier
Definition: blob_rest_client.hpp:848
Azure::Storage::Blobs::Models::StageBlockResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:2182
Azure::Storage::Blobs::Models::BlobProperties::HttpHeaders
BlobHttpHeaders HttpHeaders
Definition: blob_rest_client.hpp:1308
Azure::Storage::Blobs::Models::ResizePageBlobResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1962
Azure::Storage::Blobs::Models::UploadPagesResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2294
Azure::Storage::Blobs::Models::SealAppendBlobResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2018
Azure::Storage::Blobs::Models::CommitBlockListResult::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1556
Azure::Storage::Blobs::Models::StageBlockResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:2188
Azure::Storage::Blobs::Models::CreatePageBlobResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:1708
Azure::Storage::Blobs::Models::GeoReplicationStatus::Live
AZ_STORAGE_BLOBS_DLLEXPORT static const GeoReplicationStatus Live
Definition: blob_rest_client.hpp:124
Azure::Storage::Blobs::Models::BlobProperties::TagCount
Azure::Nullable< int32_t > TagCount
Definition: blob_rest_client.hpp:1411
Azure::Storage::Blobs::Models::BlobContainerItemDetails::Metadata
Storage::Metadata Metadata
Definition: blob_rest_client.hpp:425
Azure::Storage::Blobs::Models::BlobItemDetails::CreatedOn
Azure::DateTime CreatedOn
Definition: blob_rest_client.hpp:826
Azure::Storage::Blobs::Models::DownloadBlobDetails::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:903
Azure::Storage::Blobs::Models::TaggedBlobItem
Blob information from the result of Azure::Storage::Blobs::BlobServiceClient::FindBlobsByTags.
Definition: blob_rest_client.hpp:369
Azure::Storage::Blobs::Models::StageBlockResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:2192
Azure::Storage::Blobs::Models::DownloadBlobDetails::EncryptionScope
Azure::Nullable< std::string > EncryptionScope
Definition: blob_rest_client.hpp:970
Azure::Storage::Blobs::Models::BlobItemDetails::IsAccessTierInferred
Azure::Nullable< bool > IsAccessTierInferred
Definition: blob_rest_client.hpp:852
Azure::Storage::Blobs::Models::SetBlobContainerMetadataResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2080
Azure::Storage::Blobs::Models::Metrics::IncludeApis
Azure::Nullable< bool > IncludeApis
Definition: blob_rest_client.hpp:537
Azure::Storage::Blobs::Models::BlobProperties::ArchiveStatus
Azure::Nullable< Models::ArchiveStatus > ArchiveStatus
Definition: blob_rest_client.hpp:1348
Azure::Storage::Blobs::Models::ClearPagesResult::SequenceNumber
int64_t SequenceNumber
Definition: blob_rest_client.hpp:1534
Azure::Storage::Blobs::Models::BlobContainerItem
A container item from the result of Azure::Storage::Blobs::BlobServiceClient::ListBlobContainers.
Definition: blob_rest_client.hpp:691
Azure::Storage::Blobs::Models::ClearPagesResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1529
Azure::Storage::Blobs::Models::ScheduleBlobExpiryOriginType::Absolute
AZ_STORAGE_BLOBS_DLLEXPORT static const ScheduleBlobExpiryOriginType Absolute
Definition: blob_rest_client.hpp:2004
Azure::Storage::Blobs::Models::StaticWebsite::IsEnabled
bool IsEnabled
Definition: blob_rest_client.hpp:563
Azure::Storage::Blobs::Models::BlobProperties::CopyId
Azure::Nullable< std::string > CopyId
Definition: blob_rest_client.hpp:1362
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1658
Azure::Storage::Blobs::Models::BlobProperties::AccessTier
Azure::Nullable< Models::AccessTier > AccessTier
Definition: blob_rest_client.hpp:1340
Azure::Storage::Blobs::Models::BlobItemDetails::LastAccessedOn
Azure::Nullable< Azure::DateTime > LastAccessedOn
Definition: blob_rest_client.hpp:834
Azure::Storage::Blobs::Models::ArchiveStatus::RehydratePendingToHot
AZ_STORAGE_BLOBS_DLLEXPORT static const ArchiveStatus RehydratePendingToHot
Definition: blob_rest_client.hpp:676
Azure::Storage::Blobs::Models::GeoReplicationStatus::Bootstrap
AZ_STORAGE_BLOBS_DLLEXPORT static const GeoReplicationStatus Bootstrap
Definition: blob_rest_client.hpp:128
Azure::Storage::Blobs::Models::AnalyticsLogging::Delete
bool Delete
Definition: blob_rest_client.hpp:392
Azure::Storage::Blobs::Models::AccountKind
Extensible enum that used to identify the account kind.
Definition: blob_rest_client.hpp:41
Azure::Storage::Blobs::Models::ClearPagesResult
Response type for Azure::Storage::Blobs::PageBlobClient::ClearPages.
Definition: blob_rest_client.hpp:1519
Azure::Storage::Blobs::Models::PublicAccessType::None
AZ_STORAGE_BLOBS_DLLEXPORT static const PublicAccessType None
Definition: blob_rest_client.hpp:272
Azure::Storage::Blobs::Models::RetentionPolicy::Days
Azure::Nullable< int32_t > Days
Definition: blob_rest_client.hpp:291
Azure::Storage::Blobs::Models::BlobItem
A blob item from the result of Azure::Storage::Blobs::BlobContainerClient::ListBlobs.
Definition: blob_rest_client.hpp:1034
Azure::Storage::Blobs::Models::AnalyticsLogging::Write
bool Write
Definition: blob_rest_client.hpp:400
Azure::Storage::Blobs::Models::UploadPagesResult
Response type for Azure::Storage::Blobs::PageBlobClient::UploadPages.
Definition: blob_rest_client.hpp:2290
Azure::Storage::Blobs::Models::AccessTier::Cool
AZ_STORAGE_BLOBS_DLLEXPORT static const AccessTier Cool
Definition: blob_rest_client.hpp:651
Azure::Storage::Blobs::Models::CorsRule::ExposedHeaders
std::string ExposedHeaders
Definition: blob_rest_client.hpp:493
Azure::Storage::Blobs::Models::BlobProperties::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1261
Azure::Storage::Blobs::Models::DownloadBlobResult::Details
DownloadBlobDetails Details
Definition: blob_rest_client.hpp:1794
Azure::Storage::Blobs::Models::DeleteBlobResult
Response type for Azure::Storage::Blobs::BlobClient::Delete.
Definition: blob_rest_client.hpp:1735
Azure::Storage::Blobs::Models::UploadPagesResult::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:2319
Azure::Storage::Blobs::Models::DownloadBlobDetails
Detailed information of a downloaded blob.
Definition: blob_rest_client.hpp:899
Azure::Storage::Blobs::Models::StageBlockFromUriResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:2157
Azure::Storage::Blobs::Models::BlobContainerProperties::Metadata
Storage::Metadata Metadata
Definition: blob_rest_client.hpp:1217
Azure::Storage::Blobs::Models::BlockType::Latest
AZ_STORAGE_BLOBS_DLLEXPORT static const BlockType Latest
Definition: blob_rest_client.hpp:1509
Azure::Storage::Blobs::Models::SetBlobHttpHeadersResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2105
Azure::Storage::Blobs::Models::BlobContainerItemDetails::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:415
Azure::Storage::Blobs::Models::DownloadBlobDetails::EncryptionKeySha256
Azure::Nullable< std::vector< uint8_t > > EncryptionKeySha256
Definition: blob_rest_client.hpp:966
Azure::Storage::Blobs::Models::AccountInfo
Storage account information.
Definition: blob_rest_client.hpp:1079
Azure::Storage::Blobs::Models::BlobProperties::IsCurrentVersion
Azure::Nullable< bool > IsCurrentVersion
Definition: blob_rest_client.hpp:1421
Azure::Storage::Blobs::Models::BlobContainerProperties
Properties of a blob container.
Definition: blob_rest_client.hpp:1203
Azure::Storage::Blobs::Models::ScheduleBlobExpiryOriginType::NeverExpire
AZ_STORAGE_BLOBS_DLLEXPORT static const ScheduleBlobExpiryOriginType NeverExpire
Definition: blob_rest_client.hpp:1992
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1110
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::TransactionalContentHash
Azure::Nullable< ContentHash > TransactionalContentHash
Definition: blob_rest_client.hpp:1114
Azure::Storage::Blobs::Models::RehydratePriority::Standard
AZ_STORAGE_BLOBS_DLLEXPORT static const RehydratePriority Standard
Definition: blob_rest_client.hpp:804
Azure::Storage::Blobs::Models::BlobContainerProperties::PreventEncryptionScopeOverride
bool PreventEncryptionScopeOverride
Definition: blob_rest_client.hpp:1250
Azure::Storage::Blobs::Models::SignedIdentifier::Permissions
std::string Permissions
Definition: blob_rest_client.hpp:314
Azure::Storage::Blobs::Models::SetBlobContainerMetadataResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2074
Azure::Storage::Blobs::Models::BlobContainerItemDetails::HasLegalHold
bool HasLegalHold
Definition: blob_rest_client.hpp:437
Azure::Storage::Blobs::Models::BlobItem::BlobSize
int64_t BlobSize
Definition: blob_rest_client.hpp:1039
Azure::Storage::Blobs::Models::SkuName::StandardGzrs
AZ_STORAGE_BLOBS_DLLEXPORT static const SkuName StandardGzrs
Definition: blob_rest_client.hpp:354
Azure::Storage::Blobs::Models::AppendBlockResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1173
Azure::Storage::Blobs::Models::UploadBlockBlobResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:2220
Azure::Storage::Blobs::Models::ObjectReplicationPolicy::Rules
std::vector< ObjectReplicationRule > Rules
Definition: blob_rest_client.hpp:784
Azure::Storage::Blobs::Models::ServiceStatistics
Statistics for the storage service.
Definition: blob_rest_client.hpp:2035
Azure::Storage::Blobs::Models::BlobProperties::CopySource
Azure::Nullable< std::string > CopySource
Definition: blob_rest_client.hpp:1369
Azure::Storage::Blobs::Models::UploadBlockBlobResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:2214
Azure::Storage::Blobs::Models::BlobServiceProperties::StaticWebsite
Models::StaticWebsite StaticWebsite
Definition: blob_rest_client.hpp:1457
Azure::Storage::Blobs::Models::BlockType
Extensible enum used to specify how the service should look for a block ID.
Definition: blob_rest_client.hpp:1490
Azure::Storage::Blobs::Models::GetBlockListResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1833
Azure::Storage::Blobs::Models::AppendBlockFromUriResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1129
Azure::Storage::Blobs::Models::BlobHttpHeaders::ContentType
std::string ContentType
Definition: blob_rest_client.hpp:718
Azure::Storage::Blobs::Models::Metrics::IsEnabled
bool IsEnabled
Definition: blob_rest_client.hpp:529
Azure::Storage::Blobs::Models::CreateAppendBlobResult
Response type for Azure::Storage::Blobs::AppendBlobClient::Create.
Definition: blob_rest_client.hpp:1581
Azure::Storage::Blobs::Models::BlobHttpHeaders::ContentDisposition
std::string ContentDisposition
Definition: blob_rest_client.hpp:739
Azure::Storage::Blobs::Models::PublicAccessType
Extensible enum used to indicates whether data in the container may be accessed publicly and the leve...
Definition: blob_rest_client.hpp:250
Azure::Storage::Blobs::Models::ScheduleBlobExpiryOriginType::RelativeToCreation
AZ_STORAGE_BLOBS_DLLEXPORT static const ScheduleBlobExpiryOriginType RelativeToCreation
Definition: blob_rest_client.hpp:1996
Azure::Storage::Blobs::Models::BlobProperties
Properties of a blob.
Definition: blob_rest_client.hpp:1257
Azure::Storage::Blobs::Models::BlobContainerItem::Name
std::string Name
Definition: blob_rest_client.hpp:695
Azure::Storage::Blobs::Models::BlobServiceProperties::Cors
std::vector< CorsRule > Cors
Definition: blob_rest_client.hpp:1444
Azure::Storage::Blobs::Models::DownloadBlobDetails::HttpHeaders
BlobHttpHeaders HttpHeaders
Definition: blob_rest_client.hpp:925
Azure::Storage::Blobs::Models::AccountInfo::SkuName
Models::SkuName SkuName
Definition: blob_rest_client.hpp:1084
Azure::Storage::Blobs::Models::BlobHttpHeaders
Standard HTTP properties supported by containers and blobs.
Definition: blob_rest_client.hpp:714
Azure::Storage::Blobs::Models::UserDelegationKey::SignedObjectId
std::string SignedObjectId
Definition: blob_rest_client.hpp:2334
Azure::Storage::Blobs::Models::UserDelegationKey::SignedTenantId
std::string SignedTenantId
Definition: blob_rest_client.hpp:2338
Azure::Storage::Blobs::Models::CommitBlockListResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1562
Azure::Storage::Blobs::Models::ResizePageBlobResult::SequenceNumber
int64_t SequenceNumber
Definition: blob_rest_client.hpp:1973
Azure::Storage::Blobs::Models::BlobContainerProperties::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1213
Azure::Storage::Blobs::Models::BlobProperties::LastAccessedOn
Azure::Nullable< Azure::DateTime > LastAccessedOn
Definition: blob_rest_client.hpp:1279
Azure::Storage::Blobs::Models::AccountInfo::IsHierarchicalNamespaceEnabled
bool IsHierarchicalNamespaceEnabled
Definition: blob_rest_client.hpp:1093
Azure::Storage::Blobs::Models::DownloadBlobDetails::CommittedBlockCount
Azure::Nullable< int32_t > CommittedBlockCount
Definition: blob_rest_client.hpp:939
Azure::Storage::Blobs::Models::AppendBlockResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1148
Azure::Storage::Blobs::Models::ObjectReplicationStatus::Failed
AZ_STORAGE_BLOBS_DLLEXPORT static const ObjectReplicationStatus Failed
Definition: blob_rest_client.hpp:240
Azure::Storage::Blobs::Models::UploadPagesResult::SequenceNumber
int64_t SequenceNumber
Definition: blob_rest_client.hpp:2309
Azure::Storage::Blobs::Models::StageBlockResult
Response type for Azure::Storage::Blobs::BlockBlobClient::StageBlock.
Definition: blob_rest_client.hpp:2178
Azure::Storage::Blobs::Models::SignedIdentifier::Id
std::string Id
Definition: blob_rest_client.hpp:302
Azure::Storage::Blobs::Models::CreateAppendBlobResult::ETag
Azure::ETag ETag
Definition: blob_rest_client.hpp:1589
Azure::Storage::Blobs::Models::BlobItem::VersionId
Azure::Nullable< std::string > VersionId
Definition: blob_rest_client.hpp:1056
Azure::Storage::Blobs::Models::UserDelegationKey::SignedService
std::string SignedService
Definition: blob_rest_client.hpp:2350
Azure::Storage::Blobs::Models::RetentionPolicy::IsEnabled
bool IsEnabled
Definition: blob_rest_client.hpp:286
Azure::Storage::Blobs::Models::BlobProperties::ObjectReplicationSourceProperties
std::vector< ObjectReplicationPolicy > ObjectReplicationSourceProperties
Definition: blob_rest_client.hpp:1407
Azure::Storage::Blobs::Models::AnalyticsLogging::Version
std::string Version
Definition: blob_rest_client.hpp:388
Azure::Storage::Blobs::Models::ResizePageBlobResult
Azure::Storage::Blobs::PageBlobClient::Resize.
Definition: blob_rest_client.hpp:1958
Azure::Storage::Blobs::Models::ObjectReplicationStatus::Complete
AZ_STORAGE_BLOBS_DLLEXPORT static const ObjectReplicationStatus Complete
Definition: blob_rest_client.hpp:236
Azure::Storage::Blobs::Models::CreateBlobContainerResult::LastModified
Azure::DateTime LastModified
Definition: blob_rest_client.hpp:1635
Azure::Storage::Blobs::Models::DownloadBlobResult
Response type for Azure::Storage::Blobs::BlobClient::Download.
Definition: blob_rest_client.hpp:1770
Azure::Storage::Blobs::Models::AccountKind::FileStorage
AZ_STORAGE_BLOBS_DLLEXPORT static const AccountKind FileStorage
Definition: blob_rest_client.hpp:63
Azure::Storage::Blobs::Models::DownloadBlobResult::ContentRange
Azure::Core::Http::HttpRange ContentRange
Definition: blob_rest_client.hpp:1778
Azure::Storage::Blobs::Models::GetBlockListResult::UncommittedBlocks
std::vector< BlobBlock > UncommittedBlocks
Definition: blob_rest_client.hpp:1845
Azure::Storage::Blobs::Models::BlobProperties::SequenceNumber
Azure::Nullable< int64_t > SequenceNumber
Definition: blob_rest_client.hpp:1313
Azure::Storage::Blobs::Models::BlobProperties::ExpiresOn
Azure::Nullable< Azure::DateTime > ExpiresOn
Definition: blob_rest_client.hpp:1275
Azure::Storage::Blobs::Models::DownloadBlobDetails::LeaseStatus
Azure::Nullable< Models::LeaseStatus > LeaseStatus
Definition: blob_rest_client.hpp:956
Azure::Storage::Blobs::Models::BlobItemDetails::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:871
Azure::Storage::Blobs::Models::UserDelegationKey::Value
std::string Value
Definition: blob_rest_client.hpp:2358
Azure::Storage::Blobs::Models::UploadPagesFromUriResult
Response type for Azure::Storage::Blobs::PageBlobClient::UploadPagesFromUri.
Definition: blob_rest_client.hpp:2250
Azure::Storage::Blobs::Models::CreateBlobSnapshotResult::IsServerEncrypted
bool IsServerEncrypted
Definition: blob_rest_client.hpp:1664