Microsoft Azure Storage Client Library for C++  7.5.0
The Microsoft Azure Storage Client Library for C++ is a library for working with the Azure Storage Services in C++.
Public Types | Public Member Functions | Static Public Member Functions | List of all members
azure::storage::access_condition Class Reference

Represents a set of access conditions to be used for operations against the Blob service. More...

Public Types

enum  sequence_number_operators { sequence_number_operators::none, sequence_number_operators::le, sequence_number_operators::lt, sequence_number_operators::eq }
 Describes the set of operators for comparing the blob's sequence number with the specified value. More...
 

Public Member Functions

 access_condition ()
 Constructs an empty access condition. More...
 
const utility::string_t & if_match_etag () const
 Gets an ETag value that must match the ETag of a resource. More...
 
void set_if_match_etag (utility::string_t value)
 Sets an ETag that must match the ETag of a resource. More...
 
const utility::string_t & if_none_match_etag () const
 Gets an ETag that must not match the ETag of a resource. More...
 
void set_if_none_match_etag (utility::string_t value)
 Sets an ETag that must not match the ETag of a resource. More...
 
utility::datetime if_modified_since_time () const
 Gets a time that must be before the last-modified time of a resource. More...
 
void set_if_modified_since_time (utility::datetime value)
 Sets a time that must be before the last-modified time of a resource. More...
 
utility::datetime if_not_modified_since_time () const
 Gets a time that must not be before the last-modified time of a resource. More...
 
void set_if_not_modified_since_time (utility::datetime value)
 Sets a time that must not be before the last-modified time of a resource. More...
 
void set_if_sequence_number_less_than_or_equal (int64_t value)
 Sets a sequence number that the current sequence number of a page blob must be less than or equal to in order for the operation to proceed. More...
 
void set_if_sequence_number_less_than (int64_t value)
 Sets a sequence number that the current sequence number of a page blob must be less than in order for the operation to proceed. More...
 
void set_if_sequence_number_equal (int64_t value)
 Sets a sequence number that the current sequence number of a page blob must be equal to in order for the operation to proceed. More...
 
int64_t sequence_number () const
 Gets a sequence number that the current sequence number of a page blob must be equal to in order for the operation to proceed. More...
 
sequence_number_operators sequence_number_operator () const
 Gets the sequence number comparison operator specified for the access condition. More...
 
int64_t max_size () const
 Gets a number that indicates the maximum size in bytes to restrict the blob to when commiting the block. More...
 
void set_max_size (int64_t value)
 Sets a number that indicates the maximum size in bytes to restrict the blob to when commiting the block. More...
 
int64_t append_position () const
 Gets an append position that the end position of an append blob must be equal to in order for the operation to proceed. More...
 
void set_append_position (int64_t value)
 Sets the append position that the end position of an append blob must be equal to in order for the operation to proceed. More...
 
const utility::string_t & lease_id () const
 Gets a lease ID that must match the lease on a resource. More...
 
void set_lease_id (utility::string_t value)
 Sets a lease ID that must match the lease on a resource. More...
 
bool is_conditional () const
 Indicates whether the azure::storage::access_condition object specifies a condition. More...
 

Static Public Member Functions

static access_condition generate_empty_condition ()
 Generates an empty access condition. More...
 
static access_condition generate_if_not_exists_condition ()
 Generates an access condition such that an operation will be performed only if the resource does not exist on the service. More...
 
static access_condition generate_if_exists_condition ()
 Generates an access condition such that an operation will be performed only if the resource exists on the service. More...
 
static access_condition generate_if_match_condition (utility::string_t etag)
 Generates an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value. More...
 
static access_condition generate_if_modified_since_condition (utility::datetime modified_time)
 Generates an access condition such that an operation will be performed only if the resource has been modified since the specified time. More...
 
static access_condition generate_if_none_match_condition (utility::string_t etag)
 Generates an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value. More...
 
static access_condition generate_if_not_modified_since_condition (utility::datetime modified_time)
 Generates an access condition such that an operation will be performed only if the resource has not been modified since the specified time. More...
 
static access_condition generate_if_sequence_number_less_than_or_equal_condition (int64_t sequence_number)
 Generates an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value. More...
 
static access_condition generate_if_sequence_number_less_than_condition (int64_t sequence_number)
 Generates an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value. More...
 
static access_condition generate_if_sequence_number_equal_condition (int64_t sequence_number)
 Generates an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value. More...
 
static access_condition generate_lease_condition (utility::string_t lease_id)
 Generates an access condition such that an operation will be performed only if the lease ID on the resource matches the specified lease ID. More...
 
static access_condition generate_if_max_size_less_than_or_equal_condition (int64_t max_size)
 Generates an access condition such that an operation will be performed only if the size of the blob after committing the block is less than or equal to the specified value. More...
 
static access_condition generate_if_append_position_equal_condition (int64_t append_position)
 Generates an access condition such that an operation will be performed only if the end position of the blob is equal to the specified value. More...
 

Detailed Description

Represents a set of access conditions to be used for operations against the Blob service.

Member Enumeration Documentation

◆ sequence_number_operators

Describes the set of operators for comparing the blob's sequence number with the specified value.

Enumerator
none 

The blob's sequence number will not be used as an access condition.

le 

If the blob's sequence number is less than the specified value, the request proceeds.

lt 

If the blob's sequence number is less than or equal to the specified value, the request proceeds.

eq 

If the blob's sequence number is equal to the specified value, the request proceeds.

Constructor & Destructor Documentation

◆ access_condition()

azure::storage::access_condition::access_condition ( )
inline

Constructs an empty access condition.

Member Function Documentation

◆ append_position()

int64_t azure::storage::access_condition::append_position ( ) const
inline

Gets an append position that the end position of an append blob must be equal to in order for the operation to proceed.

Returns
An append position number, or -1 if no append position value is specified.

This condition only applies to append blobs.

◆ generate_empty_condition()

static access_condition azure::storage::access_condition::generate_empty_condition ( )
inlinestatic

Generates an empty access condition.

Returns
An empty azure::storage::access_condition object.

◆ generate_if_append_position_equal_condition()

static access_condition azure::storage::access_condition::generate_if_append_position_equal_condition ( int64_t  append_position)
inlinestatic

Generates an access condition such that an operation will be performed only if the end position of the blob is equal to the specified value.

Parameters
append_positionThe value to compare to the current end position of the blob.
Returns
An azure::storage::access_condition object that represents the blob-condition-appendpos condition.

◆ generate_if_exists_condition()

static access_condition azure::storage::access_condition::generate_if_exists_condition ( )
inlinestatic

Generates an access condition such that an operation will be performed only if the resource exists on the service.

Returns
An azure::storage::access_condition object that represents the If-Exists condition.

Setting this access condition modifies the request to include the HTTP If-Match conditional header.

◆ generate_if_match_condition()

static access_condition azure::storage::access_condition::generate_if_match_condition ( utility::string_t  etag)
inlinestatic

Generates an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value.

Parameters
etagThe ETag value that must be matched.
Returns
An azure::storage::access_condition object that represents the If-Match condition.

◆ generate_if_max_size_less_than_or_equal_condition()

static access_condition azure::storage::access_condition::generate_if_max_size_less_than_or_equal_condition ( int64_t  max_size)
inlinestatic

Generates an access condition such that an operation will be performed only if the size of the blob after committing the block is less than or equal to the specified value.

Parameters
max_sizeThe value specifying the maximum length to restrict the blob to when committing the block.
Returns
An azure::storage::access_condition object that represents the blob-condition-maxsize condition.

◆ generate_if_modified_since_condition()

static access_condition azure::storage::access_condition::generate_if_modified_since_condition ( utility::datetime  modified_time)
inlinestatic

Generates an access condition such that an operation will be performed only if the resource has been modified since the specified time.

Parameters
modified_timeThe time since which the resource must have been modified in order for the operation to proceed.
Returns
An azure::storage::access_condition object that represents the If-Modified-Since condition.

◆ generate_if_none_match_condition()

static access_condition azure::storage::access_condition::generate_if_none_match_condition ( utility::string_t  etag)
inlinestatic

Generates an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value.

Parameters
etagThe ETag value that must be matched, or "*".
Returns
An azure::storage::access_condition object that represents the If-None-Match condition.

If "*" is specified as the parameter then this condition requires that the resource does not exist.

◆ generate_if_not_exists_condition()

static access_condition azure::storage::access_condition::generate_if_not_exists_condition ( )
inlinestatic

Generates an access condition such that an operation will be performed only if the resource does not exist on the service.

Returns
An azure::storage::access_condition object that represents the If-Not-Exists condition.

Setting this access condition modifies the request to include the HTTP If-None-Match conditional header.

◆ generate_if_not_modified_since_condition()

static access_condition azure::storage::access_condition::generate_if_not_modified_since_condition ( utility::datetime  modified_time)
inlinestatic

Generates an access condition such that an operation will be performed only if the resource has not been modified since the specified time.

Parameters
modified_timeThe time since which the resource must not have been modified in order for the operation to proceed.
Returns
An azure::storage::access_condition object that represents the If-Unmodified-Since condition.

◆ generate_if_sequence_number_equal_condition()

static access_condition azure::storage::access_condition::generate_if_sequence_number_equal_condition ( int64_t  sequence_number)
inlinestatic

Generates an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value.

Parameters
sequence_numberThe value that the current sequence number of the resource must be equal to.
Returns
An azure::storage::access_condition object that represents the If-Sequence-Number-EQ condition.

◆ generate_if_sequence_number_less_than_condition()

static access_condition azure::storage::access_condition::generate_if_sequence_number_less_than_condition ( int64_t  sequence_number)
inlinestatic

Generates an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value.

Parameters
sequence_numberThe value that the current sequence number of the resource must be less than.
Returns
An azure::storage::access_condition object that represents the If-Sequence-Number-LT condition.

◆ generate_if_sequence_number_less_than_or_equal_condition()

static access_condition azure::storage::access_condition::generate_if_sequence_number_less_than_or_equal_condition ( int64_t  sequence_number)
inlinestatic

Generates an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value.

Parameters
sequence_numberThe value that the current sequence number of the resource must be less than or equal to.
Returns
An azure::storage::access_condition object that represents the If-Sequence-Number-LE condition.

◆ generate_lease_condition()

static access_condition azure::storage::access_condition::generate_lease_condition ( utility::string_t  lease_id)
inlinestatic

Generates an access condition such that an operation will be performed only if the lease ID on the resource matches the specified lease ID.

Parameters
lease_idThe lease ID that must match the lease ID of the resource.
Returns
An azure::storage::access_condition object that represents the lease condition.

◆ if_match_etag()

const utility::string_t& azure::storage::access_condition::if_match_etag ( ) const
inline

Gets an ETag value that must match the ETag of a resource.

Returns
A string containing the ETag, in quotes.

◆ if_modified_since_time()

utility::datetime azure::storage::access_condition::if_modified_since_time ( ) const
inline

Gets a time that must be before the last-modified time of a resource.

Returns
A utility::datetime in UTC.

◆ if_none_match_etag()

const utility::string_t& azure::storage::access_condition::if_none_match_etag ( ) const
inline

Gets an ETag that must not match the ETag of a resource.

Returns
A quoted ETag string, or "*" to match any ETag.

◆ if_not_modified_since_time()

utility::datetime azure::storage::access_condition::if_not_modified_since_time ( ) const
inline

Gets a time that must not be before the last-modified time of a resource.

Returns
A utility::datetime in UTC.

◆ is_conditional()

bool azure::storage::access_condition::is_conditional ( ) const
inline

Indicates whether the azure::storage::access_condition object specifies a condition.

Returns
true if the access condition specifies a condition; otherwise, false.

◆ lease_id()

const utility::string_t& azure::storage::access_condition::lease_id ( ) const
inline

Gets a lease ID that must match the lease on a resource.

Returns
A string containing the lease ID.

◆ max_size()

int64_t azure::storage::access_condition::max_size ( ) const
inline

Gets a number that indicates the maximum size in bytes to restrict the blob to when commiting the block.

Returns
The maximum size in bytes, or -1 if no maximum size value is specified.

This condition only applies to append blobs.

◆ sequence_number()

int64_t azure::storage::access_condition::sequence_number ( ) const
inline

Gets a sequence number that the current sequence number of a page blob must be equal to in order for the operation to proceed.

Returns
A sequence number.

This condition only applies to page blobs.

◆ sequence_number_operator()

sequence_number_operators azure::storage::access_condition::sequence_number_operator ( ) const
inline

Gets the sequence number comparison operator specified for the access condition.

Returns
The sequence number comparison operator specified for the azure::storage::access_condition object.

◆ set_append_position()

void azure::storage::access_condition::set_append_position ( int64_t  value)
inline

Sets the append position that the end position of an append blob must be equal to in order for the operation to proceed.

Parameters
valueAn append position.

This condition only applies to append blobs.

◆ set_if_match_etag()

void azure::storage::access_condition::set_if_match_etag ( utility::string_t  value)
inline

Sets an ETag that must match the ETag of a resource.

Parameters
valueA string containing the ETag, in quotes.

◆ set_if_modified_since_time()

void azure::storage::access_condition::set_if_modified_since_time ( utility::datetime  value)
inline

Sets a time that must be before the last-modified time of a resource.

Parameters
valueA utility::datetime in UTC.

◆ set_if_none_match_etag()

void azure::storage::access_condition::set_if_none_match_etag ( utility::string_t  value)
inline

Sets an ETag that must not match the ETag of a resource.

Parameters
valueA quoted ETag string, or "*" to match any ETag.

◆ set_if_not_modified_since_time()

void azure::storage::access_condition::set_if_not_modified_since_time ( utility::datetime  value)
inline

Sets a time that must not be before the last-modified time of a resource.

Parameters
valueA utility::datetime in UTC.

◆ set_if_sequence_number_equal()

void azure::storage::access_condition::set_if_sequence_number_equal ( int64_t  value)
inline

Sets a sequence number that the current sequence number of a page blob must be equal to in order for the operation to proceed.

Parameters
valueA sequence number.

This condition only applies to page blobs.

◆ set_if_sequence_number_less_than()

void azure::storage::access_condition::set_if_sequence_number_less_than ( int64_t  value)
inline

Sets a sequence number that the current sequence number of a page blob must be less than in order for the operation to proceed.

Parameters
valueA sequence number.

This condition only applies to page blobs.

◆ set_if_sequence_number_less_than_or_equal()

void azure::storage::access_condition::set_if_sequence_number_less_than_or_equal ( int64_t  value)
inline

Sets a sequence number that the current sequence number of a page blob must be less than or equal to in order for the operation to proceed.

Parameters
valueA sequence number.

This condition only applies to page blobs.

◆ set_lease_id()

void azure::storage::access_condition::set_lease_id ( utility::string_t  value)
inline

Sets a lease ID that must match the lease on a resource.

Parameters
valueA string containing the lease ID.

◆ set_max_size()

void azure::storage::access_condition::set_max_size ( int64_t  value)
inline

Sets a number that indicates the maximum size in bytes to restrict the blob to when commiting the block.

Parameters
valueThe maximum size in bytes.

This condition only applies to append blobs.