Table of Contents

Class AccessCondition

Namespace
Microsoft.WindowsAzure.Storage
Assembly
Microsoft.WindowsAzure.Storage.dll

Represents a set of access conditions to be used for operations against the storage services.

public sealed class AccessCondition
Inheritance
AccessCondition
Inherited Members

Constructors

AccessCondition()

public AccessCondition()

Properties

IfAppendPositionEqual

Gets or sets a value for a condition specifying the byte offset to check for when committing a block to an append blob. The append will succeed only if the end position is equal to this number.

public long? IfAppendPositionEqual { get; set; }

Property Value

long?

An append position number, or null if no value is set.

Remarks

This condition only applies to append blobs.

IfMatchETag

Gets or sets an ETag value for a condition specifying that the given ETag must match the ETag of the specified resource.

public string IfMatchETag { get; set; }

Property Value

string

A string containing an ETag value, or "*" to match any ETag. If null, no condition exists.

IfMaxSizeLessThanOrEqual

Gets or sets a value for a condition that specifies the maximum size allowed for an append blob when a new block is committed. The append will succeed only if the size of the blob after the append operation is less than or equal to the specified size.

public long? IfMaxSizeLessThanOrEqual { get; set; }

Property Value

long?

The maximum size in bytes, or null if no value is set.

Remarks

This condition only applies to append blobs.

IfModifiedSinceTime

Gets or sets a DateTimeOffset value for a condition specifying a time since which a resource has been modified.

public DateTimeOffset? IfModifiedSinceTime { get; set; }

Property Value

DateTimeOffset?

A DateTimeOffset value specified in UTC, or null if no condition exists.

IfNoneMatchETag

Gets or sets an ETag value for a condition specifying that the given ETag must not match the ETag of the specified resource.

public string IfNoneMatchETag { get; set; }

Property Value

string

A string containing an ETag value, or "*" to match any ETag. If null, no condition exists.

IfNotModifiedSinceTime

Gets or sets a DateTimeOffset value for a condition specifying a time since which a resource has not been modified.

public DateTimeOffset? IfNotModifiedSinceTime { get; set; }

Property Value

DateTimeOffset?

A DateTimeOffset value specified in UTC, or null if no condition exists.

IfSequenceNumberEqual

Gets or sets a value for a condition specifying that the current sequence number must be equal to the specified value.

public long? IfSequenceNumberEqual { get; set; }

Property Value

long?

A sequence number, or null if no condition exists.

Remarks

This condition only applies to page blobs.

IfSequenceNumberLessThan

Gets or sets a value for a condition specifying that the current sequence number must be less than the specified value.

public long? IfSequenceNumberLessThan { get; set; }

Property Value

long?

A sequence number, or null if no condition exists.

Remarks

This condition only applies to page blobs.

IfSequenceNumberLessThanOrEqual

Gets or sets a value for a condition specifying that the current sequence number must be less than or equal to the specified value.

public long? IfSequenceNumberLessThanOrEqual { get; set; }

Property Value

long?

A sequence number, or null if no condition exists.

Remarks

This condition only applies to page blobs.

LeaseId

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

public string LeaseId { get; set; }

Property Value

string

A string containing a lease ID, or null if no condition exists.

Methods

Clone()

Provide a shallow copy of the current access condition

public AccessCondition Clone()

Returns

AccessCondition

A shallow copy of the AccessCondition object

GenerateEmptyCondition()

Constructs an empty access condition.

public static AccessCondition GenerateEmptyCondition()

Returns

AccessCondition

An empty AccessCondition object.

GenerateIfAppendPositionEqualCondition(long)

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

public static AccessCondition GenerateIfAppendPositionEqualCondition(long appendPosition)

Parameters

appendPosition long

An integer specifying the offset to compare to the current end position of the blob.

Returns

AccessCondition

An AccessCondition object that represents the offset to compare.

GenerateIfExistsCondition()

Constructs an access condition such that an operation will be performed only if the resource exists.

public static AccessCondition GenerateIfExistsCondition()

Returns

AccessCondition

An AccessCondition object that represents a condition where a resource exists.

Remarks

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

GenerateIfMatchCondition(string)

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

public static AccessCondition GenerateIfMatchCondition(string etag)

Parameters

etag string

The ETag value to check against the resource's ETag.

Returns

AccessCondition

An AccessCondition object that represents the If-Match condition.

GenerateIfMaxSizeLessThanOrEqualCondition(long)

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

public static AccessCondition GenerateIfMaxSizeLessThanOrEqualCondition(long maxSize)

Parameters

maxSize long

An integer specifying the maximum allowed size of the blob, in bytes, when committing a new block.

Returns

AccessCondition

An AccessCondition object that represents the maximum allowed size.

GenerateIfModifiedSinceCondition(DateTimeOffset)

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

public static AccessCondition GenerateIfModifiedSinceCondition(DateTimeOffset modifiedTime)

Parameters

modifiedTime DateTimeOffset

A DateTimeOffset value specifying the time since which the resource must have been modified.

Returns

AccessCondition

An AccessCondition object that represents the If-Modified-Since condition.

GenerateIfNoneMatchCondition(string)

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

public static AccessCondition GenerateIfNoneMatchCondition(string etag)

Parameters

etag string

The ETag value to check against the resource's ETag, or "*" to require that the resource does not exist.

Returns

AccessCondition

An AccessCondition object that represents the If-None-Match condition.

Remarks

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

GenerateIfNotExistsCondition()

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

public static AccessCondition GenerateIfNotExistsCondition()

Returns

AccessCondition

An AccessCondition object that represents a condition where a resource does not exist.

Remarks

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

GenerateIfNotModifiedSinceCondition(DateTimeOffset)

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

public static AccessCondition GenerateIfNotModifiedSinceCondition(DateTimeOffset modifiedTime)

Parameters

modifiedTime DateTimeOffset

A DateTimeOffset value specifying the time since which the resource must not have been modified.

Returns

AccessCondition

An AccessCondition object that represents the If-Unmodified-Since condition.

GenerateIfSequenceNumberEqualCondition(long)

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

public static AccessCondition GenerateIfSequenceNumberEqualCondition(long sequenceNumber)

Parameters

sequenceNumber long

The value to compare to the current sequence number.

Returns

AccessCondition

An AccessCondition object that represents the If-Sequence-Number-EQ condition.

GenerateIfSequenceNumberLessThanCondition(long)

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

public static AccessCondition GenerateIfSequenceNumberLessThanCondition(long sequenceNumber)

Parameters

sequenceNumber long

The value to compare to the current sequence number.

Returns

AccessCondition

An AccessCondition object that represents the If-Sequence-Number-LT condition.

GenerateIfSequenceNumberLessThanOrEqualCondition(long)

Constructs 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.

public static AccessCondition GenerateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)

Parameters

sequenceNumber long

The value to compare to the current sequence number.

Returns

AccessCondition

An AccessCondition object that represents the If-Sequence-Number-LE condition.

GenerateLeaseCondition(string)

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

public static AccessCondition GenerateLeaseCondition(string leaseId)

Parameters

leaseId string

The lease ID to compare to the lease ID of the resource.

Returns

AccessCondition

An AccessCondition object that represents the lease condition.