azure-storage-blobs
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
Azure::Storage::Blobs::BlobContainerClient Class Reference

#include <blob_container_client.hpp>

Public Member Functions

 BlobContainerClient (const std::string &containerUri, std::shared_ptr< SharedKeyCredential > credential, const BlobContainerClientOptions &options=BlobContainerClientOptions())
 Initialize a new instance of BlobContainerClient. More...
 
 BlobContainerClient (const std::string &containerUri, std::shared_ptr< Core::Credentials::ClientSecretCredential > credential, const BlobContainerClientOptions &options=BlobContainerClientOptions())
 Initialize a new instance of BlobContainerClient. More...
 
 BlobContainerClient (const std::string &containerUri, const BlobContainerClientOptions &options=BlobContainerClientOptions())
 Initialize a new instance of BlobContainerClient. More...
 
BlobClient GetBlobClient (const std::string &blobName) const
 Create a new BlobClient object by appending blobName to the end of uri. The new BlobClient uses the same request policy pipeline as this BlobContainerClient. More...
 
BlockBlobClient GetBlockBlobClient (const std::string &blobName) const
 Create a new BlockBlobClient object by appending blobName to the end of uri. The new BlockBlobClient uses the same request policy pipeline as this BlobContainerClient. More...
 
AppendBlobClient GetAppendBlobClient (const std::string &blobName) const
 Create a new AppendBlobClient object by appending blobName to the end of uri. The new AppendBlobClient uses the same request policy pipeline as this BlobContainerClient. More...
 
PageBlobClient GetPageBlobClient (const std::string &blobName) const
 Create a new PageBlobClient object by appending blobName to the end of uri. The new PageBlobClient uses the same request policy pipeline as this BlobContainerClient. More...
 
std::string GetUri () const
 Gets the container's primary uri endpoint. More...
 
Azure::Core::Response< CreateContainerResultCreate (const CreateContainerOptions &options=CreateContainerOptions()) const
 Creates a new container under the specified account. If the container with the same name already exists, the operation fails. More...
 
Azure::Core::Response< DeleteContainerResultDelete (const DeleteContainerOptions &options=DeleteContainerOptions()) const
 Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. More...
 
Azure::Core::Response< UndeleteContainerResultUndelete (const std::string &deletedContainerName, const std::string &deletedContainerVersion, const UndeleteContainerOptions &options=UndeleteContainerOptions()) const
 Restores a previously deleted container. The destionation is referenced by current BlobContainerClient. More...
 
Azure::Core::Response< GetContainerPropertiesResultGetProperties (const GetContainerPropertiesOptions &options=GetContainerPropertiesOptions()) const
 Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. More...
 
Azure::Core::Response< SetContainerMetadataResultSetMetadata (std::map< std::string, std::string > metadata, SetContainerMetadataOptions options=SetContainerMetadataOptions()) const
 Sets one or more user-defined name-value pairs for the specified container. More...
 
Azure::Core::Response< ListBlobsFlatSegmentResultListBlobsFlatSegment (const ListBlobsSegmentOptions &options=ListBlobsSegmentOptions()) const
 Returns a single segment of blobs in this container, starting from the specified Marker, Use an empty Marker to start enumeration from the beginning and the NextMarker if it's not empty to make subsequent calls to ListBlobsFlatSegment to continue enumerating the blobs segment by segment. Blobs are ordered lexicographically by name. More...
 
Azure::Core::Response< ListBlobsByHierarchySegmentResultListBlobsByHierarchySegment (const std::string &delimiter, const ListBlobsSegmentOptions &options=ListBlobsSegmentOptions()) const
 Returns a single segment of blobs in this container, starting from the specified Marker, Use an empty Marker to start enumeration from the beginning and the NextMarker if it's not empty to make subsequent calls to ListBlobsByHierarchySegment to continue enumerating the blobs segment by segment. Blobs are ordered lexicographically by name. A Delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system. More...
 
Azure::Core::Response< GetContainerAccessPolicyResultGetAccessPolicy (const GetContainerAccessPolicyOptions &options=GetContainerAccessPolicyOptions()) const
 Gets the permissions for this container. The permissions indicate whether container data may be accessed publicly. More...
 
Azure::Core::Response< SetContainerAccessPolicyResultSetAccessPolicy (const SetContainerAccessPolicyOptions &options=SetContainerAccessPolicyOptions()) const
 Sets the permissions for the specified container. The permissions indicate whether blob container data may be accessed publicly. More...
 
Azure::Core::Response< AcquireContainerLeaseResultAcquireLease (const std::string &proposedLeaseId, int32_t duration, const AcquireContainerLeaseOptions &options=AcquireContainerLeaseOptions()) const
 Acquires a lease on the container. More...
 
Azure::Core::Response< RenewContainerLeaseResultRenewLease (const std::string &leaseId, const RenewContainerLeaseOptions &options=RenewContainerLeaseOptions()) const
 Renews the container's previously-acquired lease. More...
 
Azure::Core::Response< ReleaseContainerLeaseResultReleaseLease (const std::string &leaseId, const ReleaseContainerLeaseOptions &options=ReleaseContainerLeaseOptions()) const
 Releases the container's previously-acquired lease. More...
 
Azure::Core::Response< ChangeContainerLeaseResultChangeLease (const std::string &leaseId, const std::string &proposedLeaseId, const ChangeContainerLeaseOptions &options=ChangeContainerLeaseOptions()) const
 Changes the lease of an active lease. More...
 
Azure::Core::Response< BreakContainerLeaseResultBreakLease (const BreakContainerLeaseOptions &options=BreakContainerLeaseOptions()) const
 Breaks the previously-acquired lease. More...
 

Static Public Member Functions

static BlobContainerClient CreateFromConnectionString (const std::string &connectionString, const std::string &containerName, const BlobContainerClientOptions &options=BlobContainerClientOptions())
 Initialize a new instance of BlobContainerClient. More...
 

Protected Attributes

Azure::Core::Http::Url m_containerUrl
 
std::shared_ptr< Azure::Core::Http::HttpPipeline > m_pipeline
 
Azure::Core::Nullable< EncryptionKeym_customerProvidedKey
 
Azure::Core::Nullable< std::string > m_encryptionScope
 

Friends

class BlobServiceClient
 

Detailed Description

The BlobContainerClient allows you to manipulate Azure Storage containers and their blobs.

Constructor & Destructor Documentation

◆ BlobContainerClient() [1/3]

Azure::Storage::Blobs::BlobContainerClient::BlobContainerClient ( const std::string &  containerUri,
std::shared_ptr< SharedKeyCredential >  credential,
const BlobContainerClientOptions options = BlobContainerClientOptions() 
)
explicit

Initialize a new instance of BlobContainerClient.

Parameters
containerUriA uri referencing the blob container that includes the name of the account and the name of the container.
credentialThe shared key credential used to sign requests.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
43  : BlobContainerClient(containerUri, options)
44  {
45  std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
46  policies.emplace_back(std::make_unique<Azure::Core::Http::TelemetryPolicy>(
47  Details::c_BlobServicePackageName, BlobServiceVersion));
48  policies.emplace_back(std::make_unique<Azure::Core::Http::RequestIdPolicy>());
49  for (const auto& p : options.PerOperationPolicies)
50  {
51  policies.emplace_back(p->Clone());
52  }
53  policies.emplace_back(
54  std::make_unique<Azure::Core::Http::RetryPolicy>(Azure::Core::Http::RetryOptions()));
55  for (const auto& p : options.PerRetryPolicies)
56  {
57  policies.emplace_back(p->Clone());
58  }
59  policies.emplace_back(std::make_unique<StoragePerRetryPolicy>());
60  policies.emplace_back(std::make_unique<SharedKeyPolicy>(credential));
61  policies.emplace_back(std::make_unique<Azure::Core::Http::TransportPolicy>(
62  std::make_shared<Azure::Core::Http::CurlTransport>()));
63  m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
64  }

◆ BlobContainerClient() [2/3]

Azure::Storage::Blobs::BlobContainerClient::BlobContainerClient ( const std::string &  containerUri,
std::shared_ptr< Core::Credentials::ClientSecretCredential >  credential,
const BlobContainerClientOptions options = BlobContainerClientOptions() 
)
explicit

Initialize a new instance of BlobContainerClient.

Parameters
containerUriA uri referencing the blob container that includes the name of the account and the name of the container.
credentialThe client secret credential used to sign requests.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
70  : BlobContainerClient(containerUri, options)
71  {
72  std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
73  policies.emplace_back(std::make_unique<Azure::Core::Http::TelemetryPolicy>(
74  Details::c_BlobServicePackageName, BlobServiceVersion));
75  policies.emplace_back(std::make_unique<Azure::Core::Http::RequestIdPolicy>());
76  for (const auto& p : options.PerOperationPolicies)
77  {
78  policies.emplace_back(p->Clone());
79  }
80  policies.emplace_back(
81  std::make_unique<Azure::Core::Http::RetryPolicy>(Azure::Core::Http::RetryOptions()));
82  for (const auto& p : options.PerRetryPolicies)
83  {
84  policies.emplace_back(p->Clone());
85  }
86  policies.emplace_back(std::make_unique<StoragePerRetryPolicy>());
87  policies.emplace_back(
88  std::make_unique<Core::Credentials::Policy::BearerTokenAuthenticationPolicy>(
89  credential, Details::c_StorageScope));
90  policies.emplace_back(std::make_unique<Azure::Core::Http::TransportPolicy>(
91  std::make_shared<Azure::Core::Http::CurlTransport>()));
92  m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
93  }

◆ BlobContainerClient() [3/3]

Azure::Storage::Blobs::BlobContainerClient::BlobContainerClient ( const std::string &  containerUri,
const BlobContainerClientOptions options = BlobContainerClientOptions() 
)
explicit

Initialize a new instance of BlobContainerClient.

Parameters
containerUriA uri referencing the blob that includes the name of the account and the name of the container, and possibly also a SAS token.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
98  : m_containerUrl(containerUri), m_customerProvidedKey(options.CustomerProvidedKey),
99  m_encryptionScope(options.EncryptionScope)
100  {
101  std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
102  policies.emplace_back(std::make_unique<Azure::Core::Http::TelemetryPolicy>(
103  Details::c_BlobServicePackageName, BlobServiceVersion));
104  policies.emplace_back(std::make_unique<Azure::Core::Http::RequestIdPolicy>());
105  for (const auto& p : options.PerOperationPolicies)
106  {
107  policies.emplace_back(p->Clone());
108  }
109  policies.emplace_back(
110  std::make_unique<Azure::Core::Http::RetryPolicy>(Azure::Core::Http::RetryOptions()));
111  for (const auto& p : options.PerRetryPolicies)
112  {
113  policies.emplace_back(p->Clone());
114  }
115  policies.emplace_back(std::make_unique<StoragePerRetryPolicy>());
116  policies.emplace_back(std::make_unique<Azure::Core::Http::TransportPolicy>(
117  std::make_shared<Azure::Core::Http::CurlTransport>()));
118  m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
119  }

Member Function Documentation

◆ AcquireLease()

Azure::Core::Response< AcquireContainerLeaseResult > Azure::Storage::Blobs::BlobContainerClient::AcquireLease ( const std::string &  proposedLeaseId,
int32_t  duration,
const AcquireContainerLeaseOptions options = AcquireContainerLeaseOptions() 
) const

Acquires a lease on the container.

Parameters
proposedLeaseIdProposed lease ID, in a GUID string format.
durationSpecifies the duration of the lease, in seconds, or Azure::Storage::c_InfiniteLeaseDuration for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change.
optionsOptional parameters to execute this function.
Returns
A AcquireContainerLeaseResult describing the lease.
274  {
275  BlobRestClient::Container::AcquireContainerLeaseOptions protocolLayerOptions;
276  protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
277  protocolLayerOptions.LeaseDuration = duration;
278  protocolLayerOptions.IfModifiedSince = options.IfModifiedSince;
279  protocolLayerOptions.IfUnmodifiedSince = options.IfUnmodifiedSince;
280  return BlobRestClient::Container::AcquireLease(
281  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
282  }

◆ BreakLease()

Azure::Core::Response< BreakContainerLeaseResult > Azure::Storage::Blobs::BlobContainerClient::BreakLease ( const BreakContainerLeaseOptions options = BreakContainerLeaseOptions()) const

Breaks the previously-acquired lease.

Parameters
optionsOptional parameters to execute this function.
Returns
A BreakContainerLeaseResult describing the broken lease.
324  {
325  BlobRestClient::Container::BreakContainerLeaseOptions protocolLayerOptions;
326  protocolLayerOptions.BreakPeriod = options.breakPeriod;
327  protocolLayerOptions.IfModifiedSince = options.IfModifiedSince;
328  protocolLayerOptions.IfUnmodifiedSince = options.IfUnmodifiedSince;
329  return BlobRestClient::Container::BreakLease(
330  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
331  }

◆ ChangeLease()

Azure::Core::Response< ChangeContainerLeaseResult > Azure::Storage::Blobs::BlobContainerClient::ChangeLease ( const std::string &  leaseId,
const std::string &  proposedLeaseId,
const ChangeContainerLeaseOptions options = ChangeContainerLeaseOptions() 
) const

Changes the lease of an active lease.

Parameters
leaseIdID of the previously-acquired lease.
proposedLeaseIdProposed lease ID, in a GUID string format.
optionsOptional parameters to execute this function.
Returns
A ChangeContainerLeaseResult describing the lease.
312  {
313  BlobRestClient::Container::ChangeContainerLeaseOptions protocolLayerOptions;
314  protocolLayerOptions.LeaseId = leaseId;
315  protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
316  protocolLayerOptions.IfModifiedSince = options.IfModifiedSince;
317  protocolLayerOptions.IfUnmodifiedSince = options.IfUnmodifiedSince;
318  return BlobRestClient::Container::ChangeLease(
319  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
320  }

◆ Create()

Azure::Core::Response< CreateContainerResult > Azure::Storage::Blobs::BlobContainerClient::Create ( const CreateContainerOptions options = CreateContainerOptions()) const

Creates a new container under the specified account. If the container with the same name already exists, the operation fails.

Parameters
optionsOptional parameters to execute this function.
Returns
A CreateContainerResult describing the newly created blob container.
145  {
146  BlobRestClient::Container::CreateContainerOptions protocolLayerOptions;
147  protocolLayerOptions.AccessType = options.AccessType;
148  protocolLayerOptions.Metadata = options.Metadata;
149  protocolLayerOptions.DefaultEncryptionScope = options.DefaultEncryptionScope;
150  protocolLayerOptions.PreventEncryptionScopeOverride = options.PreventEncryptionScopeOverride;
151  return BlobRestClient::Container::Create(
152  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
153  }

◆ CreateFromConnectionString()

BlobContainerClient Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString ( const std::string &  connectionString,
const std::string &  containerName,
const BlobContainerClientOptions options = BlobContainerClientOptions() 
)
static

Initialize a new instance of BlobContainerClient.

Parameters
connectionStringA connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.
containerNameThe name of the container containing this blob.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
Returns
A new BlobContainerClient instance.
23  {
24  auto parsedConnectionString = Details::ParseConnectionString(connectionString);
25  auto containerUri = std::move(parsedConnectionString.BlobServiceUri);
26  containerUri.AppendPath(containerName, true);
27 
28  if (parsedConnectionString.KeyCredential)
29  {
30  return BlobContainerClient(
31  containerUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
32  }
33  else
34  {
35  return BlobContainerClient(containerUri.GetAbsoluteUrl(), options);
36  }
37  }

◆ Delete()

Azure::Core::Response< DeleteContainerResult > Azure::Storage::Blobs::BlobContainerClient::Delete ( const DeleteContainerOptions options = DeleteContainerOptions()) const

Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.

Parameters
optionsOptional parameters to execute this function.
Returns
A DeleteContainerResult if successful.
157  {
158  BlobRestClient::Container::DeleteContainerOptions protocolLayerOptions;
159  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
160  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
161  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
162  return BlobRestClient::Container::Delete(
163  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
164  }

◆ GetAccessPolicy()

Azure::Core::Response< GetContainerAccessPolicyResult > Azure::Storage::Blobs::BlobContainerClient::GetAccessPolicy ( const GetContainerAccessPolicyOptions options = GetContainerAccessPolicyOptions()) const

Gets the permissions for this container. The permissions indicate whether container data may be accessed publicly.

Parameters
optionsOptional parameters to execute this function.
Returns
A GetContainerAccessPolicyResult describing the container's access policy.
250  {
251  BlobRestClient::Container::GetContainerAccessPolicyOptions protocolLayerOptions;
252  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
253  return BlobRestClient::Container::GetAccessPolicy(
254  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
255  }

◆ GetAppendBlobClient()

AppendBlobClient Azure::Storage::Blobs::BlobContainerClient::GetAppendBlobClient ( const std::string &  blobName) const

Create a new AppendBlobClient object by appending blobName to the end of uri. The new AppendBlobClient uses the same request policy pipeline as this BlobContainerClient.

Parameters
blobNameThe name of the blob.
Returns
A new AppendBlobClient instance.
134  {
135  return GetBlobClient(blobName).GetAppendBlobClient();
136  }

◆ GetBlobClient()

BlobClient Azure::Storage::Blobs::BlobContainerClient::GetBlobClient ( const std::string &  blobName) const

Create a new BlobClient object by appending blobName to the end of uri. The new BlobClient uses the same request policy pipeline as this BlobContainerClient.

Parameters
blobNameThe name of the blob.
Returns
A new BlobClient instance.
122  {
123  auto blobUri = m_containerUrl;
124  blobUri.AppendPath(blobName);
125  return BlobClient(std::move(blobUri), m_pipeline, m_customerProvidedKey, m_encryptionScope);
126  }

◆ GetBlockBlobClient()

BlockBlobClient Azure::Storage::Blobs::BlobContainerClient::GetBlockBlobClient ( const std::string &  blobName) const

Create a new BlockBlobClient object by appending blobName to the end of uri. The new BlockBlobClient uses the same request policy pipeline as this BlobContainerClient.

Parameters
blobNameThe name of the blob.
Returns
A new BlockBlobClient instance.
129  {
130  return GetBlobClient(blobName).GetBlockBlobClient();
131  }

◆ GetPageBlobClient()

PageBlobClient Azure::Storage::Blobs::BlobContainerClient::GetPageBlobClient ( const std::string &  blobName) const

Create a new PageBlobClient object by appending blobName to the end of uri. The new PageBlobClient uses the same request policy pipeline as this BlobContainerClient.

Parameters
blobNameThe name of the blob.
Returns
A new PageBlobClient instance.
139  {
140  return GetBlobClient(blobName).GetPageBlobClient();
141  }

◆ GetProperties()

Azure::Core::Response< GetContainerPropertiesResult > Azure::Storage::Blobs::BlobContainerClient::GetProperties ( const GetContainerPropertiesOptions options = GetContainerPropertiesOptions()) const

Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs.

Parameters
optionsOptional parameters to execute this function.
Returns
A GetContainerPropertiesResult describing the container and its properties.
180  {
181  BlobRestClient::Container::GetContainerPropertiesOptions protocolLayerOptions;
182  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
183  return BlobRestClient::Container::GetProperties(
184  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
185  }

◆ GetUri()

std::string Azure::Storage::Blobs::BlobContainerClient::GetUri ( ) const
inline

Gets the container's primary uri endpoint.

Returns
The container's primary uri endpoint.
126 { return m_containerUrl.GetAbsoluteUrl(); }

◆ ListBlobsByHierarchySegment()

Azure::Core::Response< ListBlobsByHierarchySegmentResult > Azure::Storage::Blobs::BlobContainerClient::ListBlobsByHierarchySegment ( const std::string &  delimiter,
const ListBlobsSegmentOptions options = ListBlobsSegmentOptions() 
) const

Returns a single segment of blobs in this container, starting from the specified Marker, Use an empty Marker to start enumeration from the beginning and the NextMarker if it's not empty to make subsequent calls to ListBlobsByHierarchySegment to continue enumerating the blobs segment by segment. Blobs are ordered lexicographically by name. A Delimiter can be used to traverse a virtual hierarchy of blobs as though it were a file system.

Parameters
delimiterThis can be used to to traverse a virtual hierarchy of blobs as though it were a file system. The delimiter may be a single character or a string.
optionsOptional parameters to execute this function.
Returns
A ListBlobsByHierarchySegmentResult describing a segment of the blobs in the container.
229  {
230  BlobRestClient::Container::ListBlobsByHierarchySegmentOptions protocolLayerOptions;
231  protocolLayerOptions.Prefix = options.Prefix;
232  protocolLayerOptions.Delimiter = delimiter;
233  protocolLayerOptions.Marker = options.Marker;
234  protocolLayerOptions.MaxResults = options.MaxResults;
235  protocolLayerOptions.Include = options.Include;
236  auto response = BlobRestClient::Container::ListBlobsByHierarchy(
237  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
238  for (auto& i : response->Items)
239  {
240  if (i.VersionId.HasValue() && !i.IsCurrentVersion.HasValue())
241  {
242  i.IsCurrentVersion = false;
243  }
244  }
245  return response;
246  }

◆ ListBlobsFlatSegment()

Azure::Core::Response< ListBlobsFlatSegmentResult > Azure::Storage::Blobs::BlobContainerClient::ListBlobsFlatSegment ( const ListBlobsSegmentOptions options = ListBlobsSegmentOptions()) const

Returns a single segment of blobs in this container, starting from the specified Marker, Use an empty Marker to start enumeration from the beginning and the NextMarker if it's not empty to make subsequent calls to ListBlobsFlatSegment to continue enumerating the blobs segment by segment. Blobs are ordered lexicographically by name.

Parameters
optionsOptional parameters to execute this function.
Returns
A ListBlobsFlatSegmentResult describing a segment of the blobs in the container.
207  {
208  BlobRestClient::Container::ListBlobsFlatSegmentOptions protocolLayerOptions;
209  protocolLayerOptions.Prefix = options.Prefix;
210  protocolLayerOptions.Marker = options.Marker;
211  protocolLayerOptions.MaxResults = options.MaxResults;
212  protocolLayerOptions.Include = options.Include;
213  auto response = BlobRestClient::Container::ListBlobsFlat(
214  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
215  for (auto& i : response->Items)
216  {
217  if (i.VersionId.HasValue() && !i.IsCurrentVersion.HasValue())
218  {
219  i.IsCurrentVersion = false;
220  }
221  }
222  return response;
223  }

◆ ReleaseLease()

Azure::Core::Response< ReleaseContainerLeaseResult > Azure::Storage::Blobs::BlobContainerClient::ReleaseLease ( const std::string &  leaseId,
const ReleaseContainerLeaseOptions options = ReleaseContainerLeaseOptions() 
) const

Releases the container's previously-acquired lease.

Parameters
leaseIdID of the previously-acquired lease.
optionsOptional parameters to execute this function.
Returns
A ReleaseContainerLeaseResult describing the updated container.
299  {
300  BlobRestClient::Container::ReleaseContainerLeaseOptions protocolLayerOptions;
301  protocolLayerOptions.LeaseId = leaseId;
302  protocolLayerOptions.IfModifiedSince = options.IfModifiedSince;
303  protocolLayerOptions.IfUnmodifiedSince = options.IfUnmodifiedSince;
304  return BlobRestClient::Container::ReleaseLease(
305  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
306  }

◆ RenewLease()

Azure::Core::Response< RenewContainerLeaseResult > Azure::Storage::Blobs::BlobContainerClient::RenewLease ( const std::string &  leaseId,
const RenewContainerLeaseOptions options = RenewContainerLeaseOptions() 
) const

Renews the container's previously-acquired lease.

Parameters
leaseIdID of the previously-acquired lease.
optionsOptional parameters to execute this function.
Returns
A RenewContainerLeaseResult describing the lease.
287  {
288  BlobRestClient::Container::RenewContainerLeaseOptions protocolLayerOptions;
289  protocolLayerOptions.LeaseId = leaseId;
290  protocolLayerOptions.IfModifiedSince = options.IfModifiedSince;
291  protocolLayerOptions.IfUnmodifiedSince = options.IfUnmodifiedSince;
292  return BlobRestClient::Container::RenewLease(
293  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
294  }

◆ SetAccessPolicy()

Azure::Core::Response< SetContainerAccessPolicyResult > Azure::Storage::Blobs::BlobContainerClient::SetAccessPolicy ( const SetContainerAccessPolicyOptions options = SetContainerAccessPolicyOptions()) const

Sets the permissions for the specified container. The permissions indicate whether blob container data may be accessed publicly.

Parameters
optionsOptional parameters to execute this function.
Returns
A SetContainerAccessPolicyResult describing the updated container.
259  {
260  BlobRestClient::Container::SetContainerAccessPolicyOptions protocolLayerOptions;
261  protocolLayerOptions.AccessType = options.AccessType;
262  protocolLayerOptions.SignedIdentifiers = options.SignedIdentifiers;
263  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
264  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
265  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
266  return BlobRestClient::Container::SetAccessPolicy(
267  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
268  }

◆ SetMetadata()

Azure::Core::Response< SetContainerMetadataResult > Azure::Storage::Blobs::BlobContainerClient::SetMetadata ( std::map< std::string, std::string >  metadata,
SetContainerMetadataOptions  options = SetContainerMetadataOptions() 
) const

Sets one or more user-defined name-value pairs for the specified container.

Parameters
metadataCustom metadata to set for this container.
optionsOptional parameters to execute this function.
Returns
A SetContainerMetadataResult if successful.
190  {
191  BlobRestClient::Container::SetContainerMetadataOptions protocolLayerOptions;
192  protocolLayerOptions.Metadata = metadata;
193  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
194  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
195  if (options.AccessConditions.IfUnmodifiedSince.HasValue())
196  {
197  // Strangely enough, this operation doesn't support If-Unmodified-Since while it does support
198  // If-Modified-Since
199  throw std::runtime_error("this operation doesn't support unmodified since access condition.");
200  }
201  return BlobRestClient::Container::SetMetadata(
202  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
203  }

◆ Undelete()

Azure::Core::Response< UndeleteContainerResult > Azure::Storage::Blobs::BlobContainerClient::Undelete ( const std::string &  deletedContainerName,
const std::string &  deletedContainerVersion,
const UndeleteContainerOptions options = UndeleteContainerOptions() 
) const

Restores a previously deleted container. The destionation is referenced by current BlobContainerClient.

Parameters
deletedContainerNameThe name of the previously deleted container.
deletedContainerVersionThe version of the previously deleted container.
optionsOptional parameters to execute this function.
Returns
An UndeleteContainerResult if successful.
170  {
171  BlobRestClient::Container::UndeleteContainerOptions protocolLayerOptions;
172  protocolLayerOptions.DeletedContainerName = deletedContainerName;
173  protocolLayerOptions.DeletedContainerVersion = deletedContainerVersion;
174  return BlobRestClient::Container::Undelete(
175  options.Context, *m_pipeline, m_containerUrl, protocolLayerOptions);
176  }

The documentation for this class was generated from the following files:
Azure::Storage::Blobs::BlobClient::GetPageBlobClient
PageBlobClient GetPageBlobClient() const
Creates a new PageBlobClient object with the same uri as this BlobClient. The new PageBlobClient uses...
Definition: blob_client.cpp:127
Azure::Storage::Blobs::BlobClient::GetBlockBlobClient
BlockBlobClient GetBlockBlobClient() const
Creates a new BlockBlobClient object with the same uri as this BlobClient. The new BlockBlobClient us...
Definition: blob_client.cpp:123
Azure::Storage::Blobs::BlobContainerClient::BlobContainerClient
BlobContainerClient(const std::string &containerUri, std::shared_ptr< SharedKeyCredential > credential, const BlobContainerClientOptions &options=BlobContainerClientOptions())
Initialize a new instance of BlobContainerClient.
Definition: blob_container_client.cpp:39
Azure::Storage::Blobs::BlobClient::GetAppendBlobClient
AppendBlobClient GetAppendBlobClient() const
Creates a new AppendBlobClient object with the same uri as this BlobClient. The new AppendBlobClient ...
Definition: blob_client.cpp:125
Azure::Storage::Blobs::BlobContainerClient::GetBlobClient
BlobClient GetBlobClient(const std::string &blobName) const
Create a new BlobClient object by appending blobName to the end of uri. The new BlobClient uses the s...
Definition: blob_container_client.cpp:121