blob lease client (#1424)
* blob lease client * changelog * Apply suggestions from code review
This commit is contained in:
parent
15182d5a34
commit
76db013528
@ -11,6 +11,7 @@
|
||||
- `UserDelegationKey` was changed to a member of `GetUserDelegationKeyResult` rather than a typedef like before.
|
||||
- `AccessType` in `CreateBlobContainerOptions` was changed to non-nullable.
|
||||
- `ListType` in `GetBlockListOptions` was changed to non-nullable.
|
||||
- Added `BlobLeaseClient`, all lease related APIs are moved to `BlobLeaseClient`.
|
||||
|
||||
## 12.0.0-beta.6 (2020-01-14)
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ set(
|
||||
inc/azure/storage/blobs/append_blob_client.hpp
|
||||
inc/azure/storage/blobs/blob_client.hpp
|
||||
inc/azure/storage/blobs/blob_container_client.hpp
|
||||
inc/azure/storage/blobs/blob_lease_client.hpp
|
||||
inc/azure/storage/blobs/blob_options.hpp
|
||||
inc/azure/storage/blobs/blob_responses.hpp
|
||||
inc/azure/storage/blobs/blob_sas_builder.hpp
|
||||
@ -48,6 +49,7 @@ set(
|
||||
src/append_blob_client.cpp
|
||||
src/blob_client.cpp
|
||||
src/blob_container_client.cpp
|
||||
src/blob_lease_client.cpp
|
||||
src/blob_rest_client.cpp
|
||||
src/blob_sas_builder.cpp
|
||||
src/blob_service_client.cpp
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "azure/storage/blobs/append_blob_client.hpp"
|
||||
#include "azure/storage/blobs/blob_client.hpp"
|
||||
#include "azure/storage/blobs/blob_container_client.hpp"
|
||||
#include "azure/storage/blobs/blob_lease_client.hpp"
|
||||
#include "azure/storage/blobs/blob_sas_builder.hpp"
|
||||
#include "azure/storage/blobs/blob_service_client.hpp"
|
||||
#include "azure/storage/blobs/block_blob_client.hpp"
|
||||
|
||||
@ -25,6 +25,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
class BlockBlobClient;
|
||||
class AppendBlobClient;
|
||||
class PageBlobClient;
|
||||
class BlobLeaseClient;
|
||||
|
||||
/**
|
||||
* @brief The BlobClient allows you to manipulate Azure Storage blobs.
|
||||
@ -294,67 +295,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Response<Models::UndeleteBlobResult> Undelete(
|
||||
const UndeleteBlobOptions& options = UndeleteBlobOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Acquires a lease on the blob.
|
||||
*
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param duration Specifies the duration of
|
||||
* the lease, in seconds, or Azure::Storage::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.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A AcquireBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::AcquireBlobLeaseResult> AcquireLease(
|
||||
const std::string& proposedLeaseId,
|
||||
int32_t duration,
|
||||
const AcquireBlobLeaseOptions& options = AcquireBlobLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Renews the blob's previously-acquired lease.
|
||||
*
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A RenewBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::RenewBlobLeaseResult> RenewLease(
|
||||
const std::string& leaseId,
|
||||
const RenewBlobLeaseOptions& options = RenewBlobLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Releases the blob's previously-acquired lease.
|
||||
*
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ReleaseBlobLeaseResult describing the updated container.
|
||||
*/
|
||||
Azure::Core::Response<Models::ReleaseBlobLeaseResult> ReleaseLease(
|
||||
const std::string& leaseId,
|
||||
const ReleaseBlobLeaseOptions& options = ReleaseBlobLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Changes the lease of an active lease.
|
||||
*
|
||||
* @param leaseId ID of the
|
||||
* previously-acquired lease.
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ChangeBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::ChangeBlobLeaseResult> ChangeLease(
|
||||
const std::string& leaseId,
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobLeaseOptions& options = ChangeBlobLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Breaks the previously-acquired lease.
|
||||
*
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A BreakBlobLeaseResult describing the broken lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::BreakBlobLeaseResult> BreakLease(
|
||||
const BreakBlobLeaseOptions& options = BreakBlobLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Sets tags on the underlying blob.
|
||||
*
|
||||
@ -396,5 +336,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
friend class BlobContainerClient;
|
||||
friend class Files::DataLake::DataLakeDirectoryClient;
|
||||
friend class Files::DataLake::DataLakeFileClient;
|
||||
friend class BlobLeaseClient;
|
||||
};
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
class BlobLeaseClient;
|
||||
|
||||
/**
|
||||
* The BlobContainerClient allows you to manipulate Azure Storage containers and their
|
||||
* blobs.
|
||||
@ -242,75 +244,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
const SetBlobContainerAccessPolicyOptions& options
|
||||
= SetBlobContainerAccessPolicyOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Acquires a lease on the container.
|
||||
*
|
||||
* @param proposedLeaseId
|
||||
* Proposed lease ID, in a GUID string format.
|
||||
* @param duration Specifies the duration of
|
||||
* the lease, in seconds, or Azure::Storage::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.
|
||||
* @param options Optional parameters to execute this
|
||||
* function.
|
||||
* @return A AcquireBlobContainerLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::AcquireBlobContainerLeaseResult> AcquireLease(
|
||||
const std::string& proposedLeaseId,
|
||||
int32_t duration,
|
||||
const AcquireBlobContainerLeaseOptions& options = AcquireBlobContainerLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Renews the container's previously-acquired lease.
|
||||
*
|
||||
* @param
|
||||
* leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to
|
||||
* execute this function.
|
||||
* @return A RenewBlobContainerLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::RenewBlobContainerLeaseResult> RenewLease(
|
||||
const std::string& leaseId,
|
||||
const RenewBlobContainerLeaseOptions& options = RenewBlobContainerLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Releases the container's previously-acquired lease.
|
||||
*
|
||||
* @param
|
||||
* leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to
|
||||
* execute this function.
|
||||
* @return A ReleaseBlobContainerLeaseResult describing the updated container.
|
||||
*/
|
||||
Azure::Core::Response<Models::ReleaseBlobContainerLeaseResult> ReleaseLease(
|
||||
const std::string& leaseId,
|
||||
const ReleaseBlobContainerLeaseOptions& options = ReleaseBlobContainerLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Changes the lease of an active lease.
|
||||
*
|
||||
* @param leaseId ID of the
|
||||
* previously-acquired lease.
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string
|
||||
* format.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ChangeBlobContainerLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::ChangeBlobContainerLeaseResult> ChangeLease(
|
||||
const std::string& leaseId,
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobContainerLeaseOptions& options = ChangeBlobContainerLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Breaks the previously-acquired lease.
|
||||
*
|
||||
* @param options Optional
|
||||
* parameters to execute this function.
|
||||
* @return A BreakBlobContainerLeaseResult describing the broken lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::BreakBlobContainerLeaseResult> BreakLease(
|
||||
const BreakBlobContainerLeaseOptions& options = BreakBlobContainerLeaseOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Marks the specified blob or snapshot for deletion. The blob is later deleted
|
||||
* during garbage collection. Note that in order to delete a blob, you must delete all of its
|
||||
@ -342,6 +275,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
|
||||
friend class BlobServiceClient;
|
||||
friend class BlobLeaseClient;
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/storage/blobs/blob_client.hpp"
|
||||
#include "azure/storage/blobs/blob_container_client.hpp"
|
||||
|
||||
namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
/**
|
||||
* @brief BlobLeaseClient allows you to manipulate Azure Storage leases on containers and blobs.
|
||||
*/
|
||||
class BlobLeaseClient {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the BlobLeaseClient.
|
||||
*
|
||||
* @param blobClient A BlobClient representing the blob being leased.
|
||||
* @param leaseId A lease ID. This is not required for break operation.
|
||||
*/
|
||||
explicit BlobLeaseClient(BlobClient blobClient, std::string leaseId)
|
||||
: m_blobClient(std::move(blobClient)), m_leaseId(std::move(leaseId))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a new instance of the BlobLeaseClient.
|
||||
*
|
||||
* @param blobContainerClient A BlobContainerClient representing the blob container being
|
||||
* leased.
|
||||
* @param leaseId A lease ID. This is not required for break operation.
|
||||
*/
|
||||
explicit BlobLeaseClient(BlobContainerClient blobContainerClient, std::string leaseId)
|
||||
: m_blobContainerClient(std::move(blobContainerClient)), m_leaseId(std::move(leaseId))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets a unique lease ID.
|
||||
*
|
||||
* @return A unique lease ID.
|
||||
*/
|
||||
static std::string CreateUniqueLeaseId();
|
||||
|
||||
/**
|
||||
* @brief A value representing infinite lease duration.
|
||||
*/
|
||||
constexpr static int32_t InfiniteLeaseDuration = -1;
|
||||
|
||||
/**
|
||||
* @brief Get lease id of this lease client.
|
||||
*
|
||||
* @return Lease id of this lease client.
|
||||
*/
|
||||
std::string GetLeaseId() const { return m_leaseId; }
|
||||
|
||||
/**
|
||||
* @brief Acquires a lease on the blob or blob container.
|
||||
*
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param duration Specifies the duration of
|
||||
* the lease, in seconds, or 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.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A AcquireBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::AcquireBlobLeaseResult> Acquire(
|
||||
int32_t duration,
|
||||
const AcquireBlobLeaseOptions& options = AcquireBlobLeaseOptions());
|
||||
|
||||
/**
|
||||
* @brief Renews the blob or blob container's previously-acquired lease.
|
||||
*
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A RenewBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::RenewBlobLeaseResult> Renew(
|
||||
const RenewBlobLeaseOptions& options = RenewBlobLeaseOptions());
|
||||
|
||||
/**
|
||||
* @brief Releases the blob or blob container's previously-acquired lease.
|
||||
*
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ReleaseBlobLeaseResult describing the updated container.
|
||||
*/
|
||||
Azure::Core::Response<Models::ReleaseBlobLeaseResult> Release(
|
||||
const ReleaseBlobLeaseOptions& options = ReleaseBlobLeaseOptions());
|
||||
|
||||
/**
|
||||
* @brief Changes the lease of an active lease.
|
||||
*
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ChangeBlobLeaseResult describing the lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::ChangeBlobLeaseResult> Change(
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobLeaseOptions& options = ChangeBlobLeaseOptions());
|
||||
|
||||
/**
|
||||
* @brief Breaks the previously-acquired lease.
|
||||
*
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A BreakBlobLeaseResult describing the broken lease.
|
||||
*/
|
||||
Azure::Core::Response<Models::BreakBlobLeaseResult> Break(
|
||||
const BreakBlobLeaseOptions& options = BreakBlobLeaseOptions());
|
||||
|
||||
private:
|
||||
Azure::Core::Nullable<BlobClient> m_blobClient;
|
||||
Azure::Core::Nullable<BlobContainerClient> m_blobContainerClient;
|
||||
std::string m_leaseId;
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
@ -452,95 +452,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
BlobContainerAccessConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobContainerClient::AcquireLease.
|
||||
*/
|
||||
struct AcquireBlobContainerLeaseOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Optional conditions that must be met to perform this operation.
|
||||
*/
|
||||
ModifiedTimeConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobContainerClient::RenewLease.
|
||||
*/
|
||||
struct RenewBlobContainerLeaseOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Optional conditions that must be met to perform this operation.
|
||||
*/
|
||||
ModifiedTimeConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobContainerClient::ChangeLease.
|
||||
*/
|
||||
struct ChangeBlobContainerLeaseOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Optional conditions that must be met to perform this operation.
|
||||
*/
|
||||
ModifiedTimeConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobContainerClient::ReleaseLease.
|
||||
*/
|
||||
struct ReleaseBlobContainerLeaseOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Optional conditions that must be met to perform this operation.
|
||||
*/
|
||||
ModifiedTimeConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobContainerClient::BreakLease.
|
||||
*/
|
||||
struct BreakBlobContainerLeaseOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Proposed duration the lease should continue before it is broken, in seconds,
|
||||
* between 0 and 60. This break period is only used if it is shorter than the time remaining on
|
||||
* the lease. If longer, the time remaining on the lease is used. A new lease will not be
|
||||
* available before the break period has expired, but the lease may be held for longer than the
|
||||
* break period.
|
||||
*/
|
||||
Azure::Core::Nullable<int32_t> BreakPeriod;
|
||||
|
||||
/**
|
||||
* @brief Optional conditions that must be met to perform this operation.
|
||||
*/
|
||||
ModifiedTimeConditions AccessConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::GetProperties.
|
||||
*/
|
||||
@ -783,7 +694,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::AcquireLease.
|
||||
* @brief Optional parameters for BlobLeaseClient::Acquire.
|
||||
*/
|
||||
struct AcquireBlobLeaseOptions
|
||||
{
|
||||
@ -799,7 +710,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::RenewLease.
|
||||
* @brief Optional parameters for BlobLeaseClient::Renew.
|
||||
*/
|
||||
struct RenewBlobLeaseOptions
|
||||
{
|
||||
@ -815,7 +726,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::ChangeLease.
|
||||
* @brief Optional parameters for BlobLeaseClient::Change.
|
||||
*/
|
||||
struct ChangeBlobLeaseOptions
|
||||
{
|
||||
@ -831,7 +742,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::ReleaseLease.
|
||||
* @brief Optional parameters for BlobLeaseClient::Release.
|
||||
*/
|
||||
struct ReleaseBlobLeaseOptions
|
||||
{
|
||||
@ -847,7 +758,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlobClient::BreakLease.
|
||||
* @brief Optional parameters for BlobLeaseClient::Break.
|
||||
*/
|
||||
struct BreakBlobLeaseOptions
|
||||
{
|
||||
|
||||
@ -25,4 +25,43 @@ namespace Azure { namespace Storage { namespace Blobs { namespace Models {
|
||||
|
||||
using UploadBlockBlobFromResult = UploadBlockBlobResult;
|
||||
|
||||
struct AcquireBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
};
|
||||
|
||||
struct BreakBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
int32_t LeaseTime = 0;
|
||||
};
|
||||
|
||||
struct ChangeBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
};
|
||||
|
||||
struct ReleaseBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
};
|
||||
|
||||
struct RenewBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
};
|
||||
|
||||
}}}} // namespace Azure::Storage::Blobs::Models
|
||||
|
||||
@ -85,21 +85,25 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::string m_value;
|
||||
}; // extensible enum AccountKind
|
||||
|
||||
struct AcquireBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct AcquireBlobContainerLeaseResult
|
||||
namespace Details {
|
||||
struct AcquireBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct AcquireBlobContainerLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct AcquireBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct AcquireBlobLeaseResult
|
||||
namespace Details {
|
||||
struct AcquireBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct AcquireBlobLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
class BlobArchiveStatus {
|
||||
public:
|
||||
@ -251,37 +255,45 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::string m_value;
|
||||
}; // extensible enum BlockType
|
||||
|
||||
struct BreakBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
int32_t LeaseTime = 0;
|
||||
}; // struct BreakBlobContainerLeaseResult
|
||||
namespace Details {
|
||||
struct BreakBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
int32_t LeaseTime = 0;
|
||||
}; // struct BreakBlobContainerLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct BreakBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
int32_t LeaseTime = 0;
|
||||
}; // struct BreakBlobLeaseResult
|
||||
namespace Details {
|
||||
struct BreakBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
int32_t LeaseTime = 0;
|
||||
}; // struct BreakBlobLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct ChangeBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct ChangeBlobContainerLeaseResult
|
||||
namespace Details {
|
||||
struct ChangeBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct ChangeBlobContainerLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct ChangeBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct ChangeBlobLeaseResult
|
||||
namespace Details {
|
||||
struct ChangeBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct ChangeBlobLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct ClearPageBlobPagesResult
|
||||
{
|
||||
@ -537,36 +549,44 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::string m_value;
|
||||
}; // extensible enum RehydratePriority
|
||||
|
||||
struct ReleaseBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
}; // struct ReleaseBlobContainerLeaseResult
|
||||
namespace Details {
|
||||
struct ReleaseBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
}; // struct ReleaseBlobContainerLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct ReleaseBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
Azure::Core::Nullable<int64_t> SequenceNumber;
|
||||
}; // struct ReleaseBlobLeaseResult
|
||||
namespace Details {
|
||||
struct ReleaseBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
Azure::Core::Nullable<int64_t> SequenceNumber;
|
||||
}; // struct ReleaseBlobLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct RenewBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct RenewBlobContainerLeaseResult
|
||||
namespace Details {
|
||||
struct RenewBlobContainerLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct RenewBlobContainerLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct RenewBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct RenewBlobLeaseResult
|
||||
namespace Details {
|
||||
struct RenewBlobLeaseResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ETag;
|
||||
Azure::Core::DateTime LastModified;
|
||||
std::string LeaseId;
|
||||
}; // struct RenewBlobLeaseResult
|
||||
} // namespace Details
|
||||
|
||||
struct ResizePageBlobResult
|
||||
{
|
||||
@ -673,11 +693,13 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::string m_value;
|
||||
}; // extensible enum SkuName
|
||||
|
||||
struct SubmitBlobBatchResultInternal
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ContentType;
|
||||
}; // struct SubmitBlobBatchResultInternal
|
||||
namespace Details {
|
||||
struct SubmitBlobBatchResult
|
||||
{
|
||||
std::string RequestId;
|
||||
std::string ContentType;
|
||||
}; // struct SubmitBlobBatchResult
|
||||
} // namespace Details
|
||||
|
||||
struct UndeleteBlobContainerResult
|
||||
{
|
||||
@ -3628,7 +3650,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<Azure::Core::DateTime> IfUnmodifiedSince;
|
||||
}; // struct AcquireBlobContainerLeaseOptions
|
||||
|
||||
static Azure::Core::Response<AcquireBlobContainerLeaseResult> AcquireLease(
|
||||
static Azure::Core::Response<Models::Details::AcquireBlobContainerLeaseResult> AcquireLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -3667,7 +3689,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
AcquireBlobContainerLeaseResult response;
|
||||
Models::Details::AcquireBlobContainerLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3681,7 +3703,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<AcquireBlobContainerLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::AcquireBlobContainerLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -3693,7 +3715,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<Azure::Core::DateTime> IfUnmodifiedSince;
|
||||
}; // struct RenewBlobContainerLeaseOptions
|
||||
|
||||
static Azure::Core::Response<RenewBlobContainerLeaseResult> RenewLease(
|
||||
static Azure::Core::Response<Models::Details::RenewBlobContainerLeaseResult> RenewLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -3728,7 +3750,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
RenewBlobContainerLeaseResult response;
|
||||
Models::Details::RenewBlobContainerLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3742,7 +3764,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<RenewBlobContainerLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::RenewBlobContainerLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -3755,7 +3777,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<Azure::Core::DateTime> IfUnmodifiedSince;
|
||||
}; // struct ChangeBlobContainerLeaseOptions
|
||||
|
||||
static Azure::Core::Response<ChangeBlobContainerLeaseResult> ChangeLease(
|
||||
static Azure::Core::Response<Models::Details::ChangeBlobContainerLeaseResult> ChangeLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -3791,7 +3813,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
ChangeBlobContainerLeaseResult response;
|
||||
Models::Details::ChangeBlobContainerLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3805,7 +3827,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<ChangeBlobContainerLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::ChangeBlobContainerLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -3817,7 +3839,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<Azure::Core::DateTime> IfUnmodifiedSince;
|
||||
}; // struct ReleaseBlobContainerLeaseOptions
|
||||
|
||||
static Azure::Core::Response<ReleaseBlobContainerLeaseResult> ReleaseLease(
|
||||
static Azure::Core::Response<Models::Details::ReleaseBlobContainerLeaseResult> ReleaseLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -3852,7 +3874,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
ReleaseBlobContainerLeaseResult response;
|
||||
Models::Details::ReleaseBlobContainerLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3865,7 +3887,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
response.LastModified = Azure::Core::DateTime::Parse(
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
return Azure::Core::Response<ReleaseBlobContainerLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::ReleaseBlobContainerLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -3877,7 +3899,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<Azure::Core::DateTime> IfUnmodifiedSince;
|
||||
}; // struct BreakBlobContainerLeaseOptions
|
||||
|
||||
static Azure::Core::Response<BreakBlobContainerLeaseResult> BreakLease(
|
||||
static Azure::Core::Response<Models::Details::BreakBlobContainerLeaseResult> BreakLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -3916,7 +3938,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
BreakBlobContainerLeaseResult response;
|
||||
Models::Details::BreakBlobContainerLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3930,7 +3952,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseTime = std::stoi(httpResponse.GetHeaders().at("x-ms-lease-time"));
|
||||
return Azure::Core::Response<BreakBlobContainerLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::BreakBlobContainerLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -6340,7 +6362,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfTags;
|
||||
}; // struct AcquireBlobLeaseOptions
|
||||
|
||||
static Azure::Core::Response<AcquireBlobLeaseResult> AcquireLease(
|
||||
static Azure::Core::Response<Models::Details::AcquireBlobLeaseResult> AcquireLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -6390,7 +6412,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
AcquireBlobLeaseResult response;
|
||||
Models::Details::AcquireBlobLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6404,7 +6426,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<AcquireBlobLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::AcquireBlobLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -6419,7 +6441,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfTags;
|
||||
}; // struct RenewBlobLeaseOptions
|
||||
|
||||
static Azure::Core::Response<RenewBlobLeaseResult> RenewLease(
|
||||
static Azure::Core::Response<Models::Details::RenewBlobLeaseResult> RenewLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -6465,7 +6487,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
RenewBlobLeaseResult response;
|
||||
Models::Details::RenewBlobLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6479,7 +6501,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<RenewBlobLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::RenewBlobLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -6495,7 +6517,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfTags;
|
||||
}; // struct ChangeBlobLeaseOptions
|
||||
|
||||
static Azure::Core::Response<ChangeBlobLeaseResult> ChangeLease(
|
||||
static Azure::Core::Response<Models::Details::ChangeBlobLeaseResult> ChangeLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -6542,7 +6564,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
ChangeBlobLeaseResult response;
|
||||
Models::Details::ChangeBlobLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6556,7 +6578,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseId = httpResponse.GetHeaders().at("x-ms-lease-id");
|
||||
return Azure::Core::Response<ChangeBlobLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::ChangeBlobLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -6571,7 +6593,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfTags;
|
||||
}; // struct ReleaseBlobLeaseOptions
|
||||
|
||||
static Azure::Core::Response<ReleaseBlobLeaseResult> ReleaseLease(
|
||||
static Azure::Core::Response<Models::Details::ReleaseBlobLeaseResult> ReleaseLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -6617,7 +6639,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
ReleaseBlobLeaseResult response;
|
||||
Models::Details::ReleaseBlobLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6636,7 +6658,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
response.SequenceNumber = std::stoll(x_ms_blob_sequence_number__iterator->second);
|
||||
}
|
||||
return Azure::Core::Response<ReleaseBlobLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::ReleaseBlobLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -6651,7 +6673,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfTags;
|
||||
}; // struct BreakBlobLeaseOptions
|
||||
|
||||
static Azure::Core::Response<BreakBlobLeaseResult> BreakLease(
|
||||
static Azure::Core::Response<Models::Details::BreakBlobLeaseResult> BreakLease(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -6701,7 +6723,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
BreakBlobLeaseResult response;
|
||||
Models::Details::BreakBlobLeaseResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6715,7 +6737,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
httpResponse.GetHeaders().at("last-modified"),
|
||||
Azure::Core::DateTime::DateFormat::Rfc1123);
|
||||
response.LeaseTime = std::stoi(httpResponse.GetHeaders().at("x-ms-lease-time"));
|
||||
return Azure::Core::Response<BreakBlobLeaseResult>(
|
||||
return Azure::Core::Response<Models::Details::BreakBlobLeaseResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
@ -9470,7 +9492,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::string ContentType;
|
||||
}; // struct SubmitBlobBatchOptions
|
||||
|
||||
static Azure::Core::Response<SubmitBlobBatchResultInternal> SubmitBatch(
|
||||
static Azure::Core::Response<Models::Details::SubmitBlobBatchResult> SubmitBatch(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const Azure::Core::Http::Url& url,
|
||||
@ -9491,7 +9513,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
request.AddHeader("Content-Type", options.ContentType);
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
SubmitBlobBatchResultInternal response;
|
||||
Models::Details::SubmitBlobBatchResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -9501,7 +9523,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
response.RequestId = httpResponse.GetHeaders().at("x-ms-request-id");
|
||||
response.ContentType = httpResponse.GetHeaders().at("content-type");
|
||||
return Azure::Core::Response<SubmitBlobBatchResultInternal>(
|
||||
return Azure::Core::Response<Models::Details::SubmitBlobBatchResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
|
||||
@ -651,84 +651,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::AcquireBlobLeaseResult> BlobClient::AcquireLease(
|
||||
const std::string& proposedLeaseId,
|
||||
int32_t duration,
|
||||
const AcquireBlobLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::Blob::AcquireBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.LeaseDuration = duration;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
return Details::BlobRestClient::Blob::AcquireLease(
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::RenewBlobLeaseResult> BlobClient::RenewLease(
|
||||
const std::string& leaseId,
|
||||
const RenewBlobLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::Blob::RenewBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
return Details::BlobRestClient::Blob::RenewLease(
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ReleaseBlobLeaseResult> BlobClient::ReleaseLease(
|
||||
const std::string& leaseId,
|
||||
const ReleaseBlobLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::Blob::ReleaseBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
return Details::BlobRestClient::Blob::ReleaseLease(
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ChangeBlobLeaseResult> BlobClient::ChangeLease(
|
||||
const std::string& leaseId,
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::Blob::ChangeBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
return Details::BlobRestClient::Blob::ChangeLease(
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::BreakBlobLeaseResult> BlobClient::BreakLease(
|
||||
const BreakBlobLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::Blob::BreakBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.BreakPeriod = options.BreakPeriod;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
return Details::BlobRestClient::Blob::BreakLease(
|
||||
options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::SetBlobTagsResult> BlobClient::SetTags(
|
||||
std::map<std::string, std::string> tags,
|
||||
const SetBlobTagsOptions& options) const
|
||||
|
||||
@ -301,69 +301,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::AcquireBlobContainerLeaseResult> BlobContainerClient::AcquireLease(
|
||||
const std::string& proposedLeaseId,
|
||||
int32_t duration,
|
||||
const AcquireBlobContainerLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::AcquireBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.LeaseDuration = duration;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
return Details::BlobRestClient::BlobContainer::AcquireLease(
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::RenewBlobContainerLeaseResult> BlobContainerClient::RenewLease(
|
||||
const std::string& leaseId,
|
||||
const RenewBlobContainerLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::RenewBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
return Details::BlobRestClient::BlobContainer::RenewLease(
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ReleaseBlobContainerLeaseResult> BlobContainerClient::ReleaseLease(
|
||||
const std::string& leaseId,
|
||||
const ReleaseBlobContainerLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::ReleaseBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
return Details::BlobRestClient::BlobContainer::ReleaseLease(
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ChangeBlobContainerLeaseResult> BlobContainerClient::ChangeLease(
|
||||
const std::string& leaseId,
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobContainerLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::ChangeBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = leaseId;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
return Details::BlobRestClient::BlobContainer::ChangeLease(
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::BreakBlobContainerLeaseResult> BlobContainerClient::BreakLease(
|
||||
const BreakBlobContainerLeaseOptions& options) const
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::BreakBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.BreakPeriod = options.BreakPeriod;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
return Details::BlobRestClient::BlobContainer::BreakLease(
|
||||
options.Context, *m_pipeline, m_blobContainerUrl, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<void> BlobContainerClient::DeleteBlob(
|
||||
const std::string& blobName,
|
||||
const DeleteBlobOptions& options) const
|
||||
|
||||
338
sdk/storage/azure-storage-blobs/src/blob_lease_client.cpp
Normal file
338
sdk/storage/azure-storage-blobs/src/blob_lease_client.cpp
Normal file
@ -0,0 +1,338 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "azure/storage/blobs/blob_lease_client.hpp"
|
||||
|
||||
#include <azure/core/uuid.hpp>
|
||||
|
||||
namespace Azure { namespace Storage { namespace Blobs {
|
||||
|
||||
std::string BlobLeaseClient::CreateUniqueLeaseId()
|
||||
{
|
||||
return Azure::Core::Uuid::CreateUuid().GetUuidString();
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::AcquireBlobLeaseResult> BlobLeaseClient::Acquire(
|
||||
int32_t duration,
|
||||
const AcquireBlobLeaseOptions& options)
|
||||
{
|
||||
if (m_blobClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::Blob::AcquireBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ProposedLeaseId = m_leaseId;
|
||||
protocolLayerOptions.LeaseDuration = duration;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
|
||||
auto response = Details::BlobRestClient::Blob::AcquireLease(
|
||||
options.Context,
|
||||
*(m_blobClient.GetValue().m_pipeline),
|
||||
m_blobClient.GetValue().m_blobUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::AcquireBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::AcquireBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else if (m_blobContainerClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::AcquireBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ProposedLeaseId = m_leaseId;
|
||||
protocolLayerOptions.LeaseDuration = duration;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
if (options.AccessConditions.IfMatch.HasValue()
|
||||
|| options.AccessConditions.IfNoneMatch.HasValue()
|
||||
|| options.AccessConditions.TagConditions.HasValue())
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
auto response = Details::BlobRestClient::BlobContainer::AcquireLease(
|
||||
options.Context,
|
||||
*(m_blobContainerClient.GetValue().m_pipeline),
|
||||
m_blobContainerClient.GetValue().m_blobContainerUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::AcquireBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::AcquireBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::RenewBlobLeaseResult> BlobLeaseClient::Renew(
|
||||
const RenewBlobLeaseOptions& options)
|
||||
{
|
||||
if (m_blobClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::Blob::RenewBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
|
||||
auto response = Details::BlobRestClient::Blob::RenewLease(
|
||||
options.Context,
|
||||
*(m_blobClient.GetValue().m_pipeline),
|
||||
m_blobClient.GetValue().m_blobUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::RenewBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::RenewBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else if (m_blobContainerClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::RenewBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
if (options.AccessConditions.IfMatch.HasValue()
|
||||
|| options.AccessConditions.IfNoneMatch.HasValue()
|
||||
|| options.AccessConditions.TagConditions.HasValue())
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
|
||||
auto response = Details::BlobRestClient::BlobContainer::RenewLease(
|
||||
options.Context,
|
||||
*(m_blobContainerClient.GetValue().m_pipeline),
|
||||
m_blobContainerClient.GetValue().m_blobContainerUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::RenewBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::RenewBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ReleaseBlobLeaseResult> BlobLeaseClient::Release(
|
||||
const ReleaseBlobLeaseOptions& options)
|
||||
{
|
||||
if (m_blobClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::Blob::ReleaseBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
|
||||
auto response = Details::BlobRestClient::Blob::ReleaseLease(
|
||||
options.Context,
|
||||
*(m_blobClient.GetValue().m_pipeline),
|
||||
m_blobClient.GetValue().m_blobUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::ReleaseBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
|
||||
return Azure::Core::Response<Models::ReleaseBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else if (m_blobContainerClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::ReleaseBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
if (options.AccessConditions.IfMatch.HasValue()
|
||||
|| options.AccessConditions.IfNoneMatch.HasValue()
|
||||
|| options.AccessConditions.TagConditions.HasValue())
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
|
||||
auto response = Details::BlobRestClient::BlobContainer::ReleaseLease(
|
||||
options.Context,
|
||||
*(m_blobContainerClient.GetValue().m_pipeline),
|
||||
m_blobContainerClient.GetValue().m_blobContainerUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::ReleaseBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
|
||||
return Azure::Core::Response<Models::ReleaseBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::ChangeBlobLeaseResult> BlobLeaseClient::Change(
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeBlobLeaseOptions& options)
|
||||
{
|
||||
if (m_blobClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::Blob::ChangeBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
|
||||
auto response = Details::BlobRestClient::Blob::ChangeLease(
|
||||
options.Context,
|
||||
*(m_blobClient.GetValue().m_pipeline),
|
||||
m_blobClient.GetValue().m_blobUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::ChangeBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::ChangeBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else if (m_blobContainerClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::ChangeBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.LeaseId = m_leaseId;
|
||||
protocolLayerOptions.ProposedLeaseId = proposedLeaseId;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
if (options.AccessConditions.IfMatch.HasValue()
|
||||
|| options.AccessConditions.IfNoneMatch.HasValue()
|
||||
|| options.AccessConditions.TagConditions.HasValue())
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
|
||||
auto response = Details::BlobRestClient::BlobContainer::ChangeLease(
|
||||
options.Context,
|
||||
*(m_blobContainerClient.GetValue().m_pipeline),
|
||||
m_blobContainerClient.GetValue().m_blobContainerUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::ChangeBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseId = std::move(response->LeaseId);
|
||||
m_leaseId = ret.LeaseId;
|
||||
|
||||
return Azure::Core::Response<Models::ChangeBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
|
||||
Azure::Core::Response<Models::BreakBlobLeaseResult> BlobLeaseClient::Break(
|
||||
const BreakBlobLeaseOptions& options)
|
||||
{
|
||||
if (m_blobClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::Blob::BreakBlobLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.BreakPeriod = options.BreakPeriod;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
|
||||
auto response = Details::BlobRestClient::Blob::BreakLease(
|
||||
options.Context,
|
||||
*(m_blobClient.GetValue().m_pipeline),
|
||||
m_blobClient.GetValue().m_blobUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::BreakBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseTime = response->LeaseTime;
|
||||
|
||||
return Azure::Core::Response<Models::BreakBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else if (m_blobContainerClient.HasValue())
|
||||
{
|
||||
Details::BlobRestClient::BlobContainer::BreakBlobContainerLeaseOptions protocolLayerOptions;
|
||||
protocolLayerOptions.BreakPeriod = options.BreakPeriod;
|
||||
protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
|
||||
if (options.AccessConditions.IfMatch.HasValue()
|
||||
|| options.AccessConditions.IfNoneMatch.HasValue()
|
||||
|| options.AccessConditions.TagConditions.HasValue())
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
|
||||
auto response = Details::BlobRestClient::BlobContainer::BreakLease(
|
||||
options.Context,
|
||||
*(m_blobContainerClient.GetValue().m_pipeline),
|
||||
m_blobContainerClient.GetValue().m_blobContainerUrl,
|
||||
protocolLayerOptions);
|
||||
|
||||
Models::BreakBlobLeaseResult ret;
|
||||
ret.RequestId = std::move(response->RequestId);
|
||||
ret.ETag = std::move(response->ETag);
|
||||
ret.LastModified = std::move(response->LastModified);
|
||||
ret.LeaseTime = response->LeaseTime;
|
||||
|
||||
return Azure::Core::Response<Models::BreakBlobLeaseResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
}}} // namespace Azure::Storage::Blobs
|
||||
@ -192,8 +192,9 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
StandardStorageConnectionString(), m_containerName, RandomString());
|
||||
appendBlobClient.Create();
|
||||
|
||||
std::string leaseId = CreateUniqueLeaseId();
|
||||
appendBlobClient.AcquireLease(leaseId, 30);
|
||||
std::string leaseId = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
Blobs::BlobLeaseClient leaseClient(appendBlobClient, leaseId);
|
||||
leaseClient.Acquire(30);
|
||||
EXPECT_THROW(appendBlobClient.Delete(), StorageException);
|
||||
Blobs::DeleteBlobOptions options;
|
||||
options.AccessConditions.LeaseId = leaseId;
|
||||
@ -205,8 +206,9 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto sourceBlobClient = Azure::Storage::Blobs::AppendBlobClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString(), m_containerName, RandomString());
|
||||
sourceBlobClient.Create();
|
||||
auto leaseResponse
|
||||
= sourceBlobClient.AcquireLease(CreateUniqueLeaseId(), InfiniteLeaseDuration);
|
||||
Blobs::BlobLeaseClient sourceLeaseClient(
|
||||
sourceBlobClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId());
|
||||
auto leaseResponse = sourceLeaseClient.Acquire(Blobs::BlobLeaseClient::InfiniteLeaseDuration);
|
||||
std::string leaseId = leaseResponse->LeaseId;
|
||||
std::string eTag = leaseResponse->ETag;
|
||||
auto lastModifiedTime = leaseResponse->LastModified;
|
||||
@ -218,7 +220,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
{
|
||||
Blobs::StartCopyBlobFromUriOptions options;
|
||||
options.SourceAccessConditions.LeaseId = CreateUniqueLeaseId();
|
||||
options.SourceAccessConditions.LeaseId = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
/*
|
||||
don't know why, the copy operation also succeeds even if the lease id doesn't match.
|
||||
EXPECT_THROW(
|
||||
@ -227,7 +229,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
options.SourceAccessConditions.LeaseId = leaseId;
|
||||
EXPECT_NO_THROW(destBlobClient.StartCopyFromUri(sourceBlobClient.GetUrl(), options));
|
||||
}
|
||||
sourceBlobClient.BreakLease();
|
||||
sourceLeaseClient.Break();
|
||||
{
|
||||
Blobs::StartCopyBlobFromUriOptions options;
|
||||
options.SourceAccessConditions.IfMatch = eTag;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include <azure/storage/blobs/blob_lease_client.hpp>
|
||||
#include <azure/storage/blobs/blob_sas_builder.hpp>
|
||||
#include <azure/storage/common/crypt.hpp>
|
||||
|
||||
@ -414,60 +415,72 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
TEST_F(BlobContainerClientTest, Lease)
|
||||
{
|
||||
std::string leaseId1 = CreateUniqueLeaseId();
|
||||
auto containerClient = Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString(), LowercaseRandomString());
|
||||
containerClient.Create();
|
||||
|
||||
std::string leaseId1 = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
int32_t leaseDuration = 20;
|
||||
auto aLease = *m_blobContainerClient->AcquireLease(leaseId1, leaseDuration);
|
||||
Blobs::BlobLeaseClient leaseClient(containerClient, leaseId1);
|
||||
auto aLease = *leaseClient.Acquire(leaseDuration);
|
||||
EXPECT_FALSE(aLease.RequestId.empty());
|
||||
EXPECT_FALSE(aLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(aLease.LastModified));
|
||||
EXPECT_EQ(aLease.LeaseId, leaseId1);
|
||||
aLease = *m_blobContainerClient->AcquireLease(leaseId1, leaseDuration);
|
||||
EXPECT_EQ(leaseClient.GetLeaseId(), leaseId1);
|
||||
aLease = *leaseClient.Acquire(leaseDuration);
|
||||
EXPECT_FALSE(aLease.RequestId.empty());
|
||||
EXPECT_FALSE(aLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(aLease.LastModified));
|
||||
EXPECT_EQ(aLease.LeaseId, leaseId1);
|
||||
|
||||
auto properties = *m_blobContainerClient->GetProperties();
|
||||
auto properties = *containerClient.GetProperties();
|
||||
EXPECT_EQ(properties.LeaseState, Blobs::Models::BlobLeaseState::Leased);
|
||||
EXPECT_EQ(properties.LeaseStatus, Blobs::Models::BlobLeaseStatus::Locked);
|
||||
EXPECT_FALSE(properties.LeaseDuration.GetValue().empty());
|
||||
|
||||
auto rLease = *m_blobContainerClient->RenewLease(leaseId1);
|
||||
auto rLease = *leaseClient.Renew();
|
||||
EXPECT_FALSE(rLease.RequestId.empty());
|
||||
EXPECT_FALSE(rLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(rLease.LastModified));
|
||||
EXPECT_EQ(rLease.LeaseId, leaseId1);
|
||||
|
||||
std::string leaseId2 = CreateUniqueLeaseId();
|
||||
std::string leaseId2 = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
EXPECT_NE(leaseId1, leaseId2);
|
||||
auto cLease = *m_blobContainerClient->ChangeLease(leaseId1, leaseId2);
|
||||
auto cLease = *leaseClient.Change(leaseId2);
|
||||
EXPECT_FALSE(cLease.RequestId.empty());
|
||||
EXPECT_FALSE(cLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(cLease.LastModified));
|
||||
EXPECT_EQ(cLease.LeaseId, leaseId2);
|
||||
EXPECT_EQ(leaseClient.GetLeaseId(), leaseId2);
|
||||
|
||||
auto containerInfo = *m_blobContainerClient->ReleaseLease(leaseId2);
|
||||
auto containerInfo = *leaseClient.Release();
|
||||
EXPECT_FALSE(containerInfo.RequestId.empty());
|
||||
EXPECT_FALSE(containerInfo.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(containerInfo.LastModified));
|
||||
|
||||
aLease = *m_blobContainerClient->AcquireLease(CreateUniqueLeaseId(), InfiniteLeaseDuration);
|
||||
properties = *m_blobContainerClient->GetProperties();
|
||||
leaseClient
|
||||
= Blobs::BlobLeaseClient(containerClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId());
|
||||
aLease = *leaseClient.Acquire(Blobs::BlobLeaseClient::InfiniteLeaseDuration);
|
||||
properties = *containerClient.GetProperties();
|
||||
EXPECT_FALSE(properties.LeaseDuration.GetValue().empty());
|
||||
auto brokenLease = *m_blobContainerClient->BreakLease();
|
||||
auto brokenLease = *leaseClient.Break();
|
||||
EXPECT_FALSE(brokenLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(brokenLease.LastModified));
|
||||
EXPECT_EQ(brokenLease.LeaseTime, 0);
|
||||
|
||||
aLease = *m_blobContainerClient->AcquireLease(CreateUniqueLeaseId(), leaseDuration);
|
||||
brokenLease = *m_blobContainerClient->BreakLease();
|
||||
leaseClient
|
||||
= Blobs::BlobLeaseClient(containerClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId());
|
||||
aLease = *leaseClient.Acquire(leaseDuration);
|
||||
brokenLease = *leaseClient.Break();
|
||||
EXPECT_FALSE(brokenLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(brokenLease.LastModified));
|
||||
EXPECT_NE(brokenLease.LeaseTime, 0);
|
||||
|
||||
Blobs::BreakBlobContainerLeaseOptions options;
|
||||
Blobs::BreakBlobLeaseOptions options;
|
||||
options.BreakPeriod = 0;
|
||||
m_blobContainerClient->BreakLease(options);
|
||||
leaseClient.Break(options);
|
||||
containerClient.Delete();
|
||||
}
|
||||
|
||||
TEST_F(BlobContainerClientTest, DISABLED_EncryptionScope)
|
||||
@ -701,8 +714,9 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
StandardStorageConnectionString(), LowercaseRandomString());
|
||||
containerClient.Create();
|
||||
|
||||
std::string leaseId = CreateUniqueLeaseId();
|
||||
containerClient.AcquireLease(leaseId, 30);
|
||||
std::string leaseId = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
auto leaseClient = Blobs::BlobLeaseClient(containerClient, leaseId);
|
||||
leaseClient.Acquire(30);
|
||||
EXPECT_THROW(containerClient.Delete(), StorageException);
|
||||
Blobs::DeleteBlobContainerOptions options;
|
||||
options.AccessConditions.LeaseId = leaseId;
|
||||
@ -900,18 +914,19 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
}
|
||||
|
||||
{
|
||||
std::string leaseId = CreateUniqueLeaseId();
|
||||
std::string leaseId = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
Blobs::AcquireBlobLeaseOptions options;
|
||||
options.AccessConditions.TagConditions = failWhereExpression;
|
||||
EXPECT_THROW(appendBlobClient.AcquireLease(leaseId, 60, options), StorageException);
|
||||
auto leaseClient = Blobs::BlobLeaseClient(appendBlobClient, leaseId);
|
||||
EXPECT_THROW(leaseClient.Acquire(60, options), StorageException);
|
||||
options.AccessConditions.TagConditions = successWhereExpression;
|
||||
EXPECT_NO_THROW(appendBlobClient.AcquireLease(leaseId, 60, options));
|
||||
EXPECT_NO_THROW(leaseClient.Acquire(60, options));
|
||||
|
||||
Blobs::BreakBlobLeaseOptions options2;
|
||||
options2.AccessConditions.TagConditions = failWhereExpression;
|
||||
EXPECT_THROW(appendBlobClient.BreakLease(options2), StorageException);
|
||||
EXPECT_THROW(leaseClient.Break(options2), StorageException);
|
||||
options2.AccessConditions.TagConditions = successWhereExpression;
|
||||
EXPECT_NO_THROW(appendBlobClient.BreakLease(options2));
|
||||
EXPECT_NO_THROW(leaseClient.Break(options2));
|
||||
|
||||
Blobs::DeleteBlobOptions options3;
|
||||
options3.DeleteSnapshots = Blobs::Models::DeleteSnapshotsOption::IncludeSnapshots;
|
||||
|
||||
@ -160,14 +160,16 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
TEST_F(PageBlobClientTest, Lease)
|
||||
{
|
||||
std::string leaseId1 = CreateUniqueLeaseId();
|
||||
std::string leaseId1 = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
int32_t leaseDuration = 20;
|
||||
auto aLease = *m_pageBlobClient->AcquireLease(leaseId1, leaseDuration);
|
||||
auto leaseClient = Blobs::BlobLeaseClient(*m_pageBlobClient, leaseId1);
|
||||
auto aLease = *leaseClient.Acquire(leaseDuration);
|
||||
EXPECT_FALSE(aLease.RequestId.empty());
|
||||
EXPECT_FALSE(aLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(aLease.LastModified));
|
||||
EXPECT_EQ(aLease.LeaseId, leaseId1);
|
||||
aLease = *m_pageBlobClient->AcquireLease(leaseId1, leaseDuration);
|
||||
EXPECT_EQ(leaseClient.GetLeaseId(), leaseId1);
|
||||
aLease = *leaseClient.Acquire(leaseDuration);
|
||||
EXPECT_FALSE(aLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(aLease.LastModified));
|
||||
EXPECT_EQ(aLease.LeaseId, leaseId1);
|
||||
@ -177,42 +179,47 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_EQ(properties.LeaseStatus.GetValue(), Blobs::Models::BlobLeaseStatus::Locked);
|
||||
EXPECT_FALSE(properties.LeaseDuration.GetValue().empty());
|
||||
|
||||
auto rLease = *m_pageBlobClient->RenewLease(leaseId1);
|
||||
auto rLease = *leaseClient.Renew();
|
||||
EXPECT_FALSE(rLease.RequestId.empty());
|
||||
EXPECT_FALSE(rLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(rLease.LastModified));
|
||||
EXPECT_EQ(rLease.LeaseId, leaseId1);
|
||||
|
||||
std::string leaseId2 = CreateUniqueLeaseId();
|
||||
std::string leaseId2 = Blobs::BlobLeaseClient::CreateUniqueLeaseId();
|
||||
EXPECT_NE(leaseId1, leaseId2);
|
||||
auto cLease = *m_pageBlobClient->ChangeLease(leaseId1, leaseId2);
|
||||
auto cLease = *leaseClient.Change(leaseId2);
|
||||
EXPECT_FALSE(cLease.RequestId.empty());
|
||||
EXPECT_FALSE(cLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(cLease.LastModified));
|
||||
EXPECT_EQ(cLease.LeaseId, leaseId2);
|
||||
EXPECT_EQ(leaseClient.GetLeaseId(), leaseId2);
|
||||
|
||||
auto blobInfo = *m_pageBlobClient->ReleaseLease(leaseId2);
|
||||
auto blobInfo = *leaseClient.Release();
|
||||
EXPECT_FALSE(blobInfo.RequestId.empty());
|
||||
EXPECT_FALSE(blobInfo.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(blobInfo.LastModified));
|
||||
|
||||
aLease = *m_pageBlobClient->AcquireLease(CreateUniqueLeaseId(), InfiniteLeaseDuration);
|
||||
leaseClient
|
||||
= Blobs::BlobLeaseClient(*m_pageBlobClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId());
|
||||
aLease = *leaseClient.Acquire(Blobs::BlobLeaseClient::InfiniteLeaseDuration);
|
||||
properties = *m_pageBlobClient->GetProperties();
|
||||
EXPECT_FALSE(properties.LeaseDuration.GetValue().empty());
|
||||
auto brokenLease = *m_pageBlobClient->BreakLease();
|
||||
auto brokenLease = *leaseClient.Break();
|
||||
EXPECT_FALSE(brokenLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(brokenLease.LastModified));
|
||||
EXPECT_EQ(brokenLease.LeaseTime, 0);
|
||||
|
||||
aLease = *m_pageBlobClient->AcquireLease(CreateUniqueLeaseId(), leaseDuration);
|
||||
brokenLease = *m_pageBlobClient->BreakLease();
|
||||
leaseClient
|
||||
= Blobs::BlobLeaseClient(*m_pageBlobClient, Blobs::BlobLeaseClient::CreateUniqueLeaseId());
|
||||
aLease = *leaseClient.Acquire(leaseDuration);
|
||||
brokenLease = *leaseClient.Break();
|
||||
EXPECT_FALSE(brokenLease.ETag.empty());
|
||||
EXPECT_TRUE(IsValidTime(brokenLease.LastModified));
|
||||
EXPECT_NE(brokenLease.LeaseTime, 0);
|
||||
|
||||
Blobs::BreakBlobLeaseOptions options;
|
||||
options.BreakPeriod = 0;
|
||||
m_pageBlobClient->BreakLease(options);
|
||||
leaseClient.Break(options);
|
||||
}
|
||||
|
||||
TEST_F(PageBlobClientTest, ContentMd5)
|
||||
|
||||
@ -15,6 +15,7 @@ namespace Azure { namespace Storage {
|
||||
|
||||
template <class... T> void unused(T&&...) {}
|
||||
|
||||
// Remove these two after DataLake lease client and file lease client are done.
|
||||
constexpr int32_t InfiniteLeaseDuration = -1;
|
||||
std::string CreateUniqueLeaseId();
|
||||
|
||||
|
||||
@ -204,82 +204,6 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
Storage::Metadata metadata,
|
||||
const SetDataLakePathMetadataOptions& options = SetDataLakePathMetadataOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Acquires a lease on the path.
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param duration Specifies the duration of the lease, in seconds, or
|
||||
* Azure::Storage::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.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return Azure::Core::Response<Models::AcquireDataLakePathLeaseResult> describing the lease.
|
||||
* @remark This request is sent to blob endpoint.
|
||||
*/
|
||||
Azure::Core::Response<Models::AcquireDataLakePathLeaseResult> AcquireLease(
|
||||
const std::string& proposedLeaseId,
|
||||
int32_t duration,
|
||||
const AcquireDataLakePathLeaseOptions& options = AcquireDataLakePathLeaseOptions()) const
|
||||
{
|
||||
return m_blobClient.AcquireLease(proposedLeaseId, duration, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renews the path's previously-acquired lease.
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return Azure::Core::Response<Models::RenewDataLakePathLeaseResult> describing the lease.
|
||||
* @remark This request is sent to blob endpoint.
|
||||
*/
|
||||
Azure::Core::Response<Models::RenewDataLakePathLeaseResult> RenewLease(
|
||||
const std::string& leaseId,
|
||||
const RenewDataLakePathLeaseOptions& options = RenewDataLakePathLeaseOptions()) const
|
||||
{
|
||||
return m_blobClient.RenewLease(leaseId, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Releases the path's previously-acquired lease.
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return Azure::Core::Response<Models::ReleaseDataLakePathLeaseResult> describing the updated
|
||||
* path.
|
||||
* @remark This request is sent to blob endpoint.
|
||||
*/
|
||||
Azure::Core::Response<Models::ReleaseDataLakePathLeaseResult> ReleaseLease(
|
||||
const std::string& leaseId,
|
||||
const ReleaseDataLakePathLeaseOptions& options = ReleaseDataLakePathLeaseOptions()) const
|
||||
{
|
||||
return m_blobClient.ReleaseLease(leaseId, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Changes the lease of an active lease.
|
||||
* @param leaseId ID of the previously-acquired lease.
|
||||
* @param proposedLeaseId Proposed lease ID, in a GUID string format.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return Azure::Core::Response<Models::ChangeDataLakePathLeaseResult> describing the lease.
|
||||
* @remark This request is sent to blob endpoint.
|
||||
*/
|
||||
Azure::Core::Response<Models::ChangeDataLakePathLeaseResult> ChangeLease(
|
||||
const std::string& leaseId,
|
||||
const std::string& proposedLeaseId,
|
||||
const ChangeDataLakePathLeaseOptions& options = ChangeDataLakePathLeaseOptions()) const
|
||||
{
|
||||
return m_blobClient.ChangeLease(leaseId, proposedLeaseId, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Breaks the previously-acquired lease.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return Azure::Core::Response<Models::BreakDataLakePathLeaseResult> describing the broken
|
||||
* lease.
|
||||
* @remark This request is sent to blob endpoint.
|
||||
*/
|
||||
Azure::Core::Response<Models::BreakDataLakePathLeaseResult> BreakLease(
|
||||
const BreakDataLakePathLeaseOptions& options = BreakDataLakePathLeaseOptions()) const
|
||||
{
|
||||
return m_blobClient.BreakLease(options);
|
||||
}
|
||||
|
||||
protected:
|
||||
Azure::Core::Http::Url m_dfsUrl;
|
||||
Blobs::BlobClient m_blobClient;
|
||||
|
||||
@ -282,7 +282,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_NO_THROW(pathClient.SetPermissions(pathPermissions, options1));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
TEST_F(DataLakePathClientTest, LeaseRelated)
|
||||
{
|
||||
std::string leaseId1 = CreateUniqueLeaseId();
|
||||
@ -343,7 +343,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
options.BreakPeriod = 0;
|
||||
m_pathClient->BreakLease(options);
|
||||
}
|
||||
|
||||
#endif
|
||||
TEST_F(DataLakePathClientTest, ConstructorsWorks)
|
||||
{
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user