Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public BlobUriBuilder(System.Uri uri) { }
public Azure.Storage.Sas.BlobSasQueryParameters Sas { get { throw null; } set { } }
public string Scheme { get { throw null; } set { } }
public string Snapshot { get { throw null; } set { } }
public string VersionId { get { throw null; } set { } }
public override string ToString() { throw null; }
public System.Uri ToUri() { throw null; }
}
Expand Down Expand Up @@ -368,6 +369,7 @@ public BlobDownloadDetails() { }
public Azure.Storage.Blobs.Models.LeaseState LeaseState { get { throw null; } }
public Azure.Storage.Blobs.Models.LeaseStatus LeaseStatus { get { throw null; } }
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } }
public string VersionId { get { throw null; } }
}
public partial class BlobDownloadInfo : System.IDisposable
{
Expand Down Expand Up @@ -549,6 +551,7 @@ internal BlobInfo() { }
public long BlobSequenceNumber { get { throw null; } }
public Azure.ETag ETag { get { throw null; } }
public System.DateTimeOffset LastModified { get { throw null; } }
public string VersionId { get { throw null; } }
}
public partial class BlobItem
{
Expand Down Expand Up @@ -731,11 +734,14 @@ public static partial class BlobsModelFactory
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.Storage.Blobs.Models.BlobCopyInfo BlobCopyInfo(Azure.ETag eTag, System.DateTimeOffset lastModified, string copyId, Azure.Storage.Blobs.Models.CopyStatus copyStatus) { throw null; }
public static Azure.Storage.Blobs.Models.BlobCopyInfo BlobCopyInfo(Azure.ETag eTag, System.DateTimeOffset lastModified, string versionId, string copyId, Azure.Storage.Blobs.Models.CopyStatus copyStatus) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.Storage.Blobs.Models.BlobDownloadInfo BlobDownloadInfo(System.DateTimeOffset lastModified, long blobSequenceNumber, Azure.Storage.Blobs.Models.BlobType blobType, byte[] contentCrc64, string contentLanguage, string copyStatusDescription, string copyId, string copyProgress, System.Uri copySource, Azure.Storage.Blobs.Models.CopyStatus copyStatus, string contentDisposition, Azure.Storage.Blobs.Models.LeaseDurationType leaseDuration, string cacheControl, Azure.Storage.Blobs.Models.LeaseState leaseState, string contentEncoding, Azure.Storage.Blobs.Models.LeaseStatus leaseStatus, byte[] contentHash, string acceptRanges, Azure.ETag eTag, int blobCommittedBlockCount, string contentRange, bool isServerEncrypted, string contentType, string encryptionKeySha256, long contentLength, byte[] blobContentHash, System.Collections.Generic.IDictionary<string, string> metadata, System.IO.Stream content, System.DateTimeOffset copyCompletionTime) { throw null; }
public static Azure.Storage.Blobs.Models.BlobDownloadInfo BlobDownloadInfo(System.DateTimeOffset lastModified = default(System.DateTimeOffset), long blobSequenceNumber = (long)0, Azure.Storage.Blobs.Models.BlobType blobType = Azure.Storage.Blobs.Models.BlobType.Block, byte[] contentCrc64 = null, string contentLanguage = null, string copyStatusDescription = null, string copyId = null, string copyProgress = null, System.Uri copySource = null, Azure.Storage.Blobs.Models.CopyStatus copyStatus = Azure.Storage.Blobs.Models.CopyStatus.Pending, string contentDisposition = null, Azure.Storage.Blobs.Models.LeaseDurationType leaseDuration = Azure.Storage.Blobs.Models.LeaseDurationType.Infinite, string cacheControl = null, Azure.Storage.Blobs.Models.LeaseState leaseState = Azure.Storage.Blobs.Models.LeaseState.Available, string contentEncoding = null, Azure.Storage.Blobs.Models.LeaseStatus leaseStatus = Azure.Storage.Blobs.Models.LeaseStatus.Locked, byte[] contentHash = null, string acceptRanges = null, Azure.ETag eTag = default(Azure.ETag), int blobCommittedBlockCount = 0, string contentRange = null, bool isServerEncrypted = false, string contentType = null, string encryptionKeySha256 = null, string encryptionScope = null, long contentLength = (long)0, byte[] blobContentHash = null, System.Collections.Generic.IDictionary<string, string> metadata = null, System.IO.Stream content = null, System.DateTimeOffset copyCompletionTime = default(System.DateTimeOffset)) { throw null; }
public static Azure.Storage.Blobs.Models.BlobDownloadInfo BlobDownloadInfo(System.DateTimeOffset lastModified, long blobSequenceNumber, Azure.Storage.Blobs.Models.BlobType blobType, byte[] contentCrc64, string contentLanguage, string copyStatusDescription, string copyId, string copyProgress, System.Uri copySource, Azure.Storage.Blobs.Models.CopyStatus copyStatus, string contentDisposition, Azure.Storage.Blobs.Models.LeaseDurationType leaseDuration, string cacheControl, Azure.Storage.Blobs.Models.LeaseState leaseState, string contentEncoding, Azure.Storage.Blobs.Models.LeaseStatus leaseStatus, byte[] contentHash, string acceptRanges, Azure.ETag eTag, int blobCommittedBlockCount, string contentRange, bool isServerEncrypted, string contentType, string encryptionKeySha256, string encryptionScope, long contentLength, byte[] blobContentHash, System.Collections.Generic.IDictionary<string, string> metadata, System.IO.Stream content, System.DateTimeOffset copyCompletionTime) { throw null; }
public static Azure.Storage.Blobs.Models.BlobDownloadInfo BlobDownloadInfo(System.DateTimeOffset lastModified = default(System.DateTimeOffset), long blobSequenceNumber = (long)0, Azure.Storage.Blobs.Models.BlobType blobType = Azure.Storage.Blobs.Models.BlobType.Block, byte[] contentCrc64 = null, string contentLanguage = null, string copyStatusDescription = null, string copyId = null, string copyProgress = null, System.Uri copySource = null, Azure.Storage.Blobs.Models.CopyStatus copyStatus = Azure.Storage.Blobs.Models.CopyStatus.Pending, string contentDisposition = null, Azure.Storage.Blobs.Models.LeaseDurationType leaseDuration = Azure.Storage.Blobs.Models.LeaseDurationType.Infinite, string cacheControl = null, Azure.Storage.Blobs.Models.LeaseState leaseState = Azure.Storage.Blobs.Models.LeaseState.Available, string contentEncoding = null, Azure.Storage.Blobs.Models.LeaseStatus leaseStatus = Azure.Storage.Blobs.Models.LeaseStatus.Locked, byte[] contentHash = null, string acceptRanges = null, Azure.ETag eTag = default(Azure.ETag), int blobCommittedBlockCount = 0, string contentRange = null, bool isServerEncrypted = false, string contentType = null, string encryptionKeySha256 = null, string encryptionScope = null, long contentLength = (long)0, byte[] blobContentHash = null, string versionId = null, System.Collections.Generic.IDictionary<string, string> metadata = null, System.IO.Stream content = null, System.DateTimeOffset copyCompletionTime = default(System.DateTimeOffset)) { throw null; }
public static Azure.Storage.Blobs.Models.BlobGeoReplication BlobGeoReplication(Azure.Storage.Blobs.Models.BlobGeoReplicationStatus status, System.DateTimeOffset? lastSyncedOn = default(System.DateTimeOffset?)) { throw null; }
public static Azure.Storage.Blobs.Models.BlobHierarchyItem BlobHierarchyItem(string prefix, Azure.Storage.Blobs.Models.BlobItem blob) { throw null; }
public static Azure.Storage.Blobs.Models.BlobInfo BlobInfo(Azure.ETag eTag, System.DateTimeOffset lastModified) { throw null; }
public static Azure.Storage.Blobs.Models.BlobInfo blobInfo(Azure.ETag eTag = default(Azure.ETag), System.DateTimeOffset lastModifed = default(System.DateTimeOffset), long blobSequenceNumber = (long)0, string versionId = null) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.Storage.Blobs.Models.BlobItem BlobItem(string name, bool deleted, Azure.Storage.Blobs.Models.BlobItemProperties properties, string snapshot, System.Collections.Generic.IDictionary<string, string> metadata) { throw null; }
public static Azure.Storage.Blobs.Models.BlobItem BlobItem(string name, bool deleted, Azure.Storage.Blobs.Models.BlobItemProperties properties, string snapshot = null, string versionId = null, bool? isCurrentVersion = default(bool?), System.Collections.Generic.IDictionary<string, string> metadata = null, System.Collections.Generic.IDictionary<string, string> tags = null) { throw null; }
Expand Down Expand Up @@ -781,6 +787,7 @@ public enum BlobStates
Snapshots = 1,
Uncommitted = 2,
Deleted = 4,
Version = 8,
}
public partial class BlobStaticWebsite
{
Expand Down Expand Up @@ -1095,6 +1102,7 @@ public AppendBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCreden
public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobInfo> Seal(Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobInfo>> SealAsync(Azure.Storage.Blobs.Models.AppendBlobRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public new Azure.Storage.Blobs.Specialized.AppendBlobClient WithSnapshot(string snapshot) { throw null; }
public new Azure.Storage.Blobs.Specialized.AppendBlobClient WithVersion(string versionId) { throw null; }
}
public partial class BlobBaseClient
{
Expand Down Expand Up @@ -1154,6 +1162,8 @@ public BlobBaseClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
public virtual System.Threading.Tasks.Task<Azure.Response> UndeleteAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshot(string snapshot) { throw null; }
protected virtual Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshotCore(string snapshot) { throw null; }
public virtual Azure.Storage.Blobs.Specialized.BlobBaseClient WithVersion(string versionId) { throw null; }
protected virtual Azure.Storage.Blobs.Specialized.BlobBaseClient WithVersionCore(string versionId) { throw null; }
}
public partial class BlobLeaseClient
{
Expand Down Expand Up @@ -1201,6 +1211,7 @@ public BlockBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredent
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContentInfo>> UploadAsync(System.IO.Stream content, Azure.Storage.Blobs.Models.BlobHttpHeaders httpHeaders = null, System.Collections.Generic.IDictionary<string, string> metadata = null, Azure.Storage.Blobs.Models.BlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.AccessTier? accessTier = default(Azure.Storage.Blobs.Models.AccessTier?), System.IProgress<long> progressHandler = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public new Azure.Storage.Blobs.Specialized.BlockBlobClient WithSnapshot(string snapshot) { throw null; }
protected sealed override Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshotCore(string snapshot) { throw null; }
public new Azure.Storage.Blobs.Specialized.BlockBlobClient WithVersion(string versionId) { throw null; }
}
public partial class PageBlobClient : Azure.Storage.Blobs.Specialized.BlobBaseClient
{
Expand Down Expand Up @@ -1236,6 +1247,7 @@ public PageBlobClient(System.Uri blobUri, Azure.Storage.StorageSharedKeyCredenti
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.PageInfo>> UploadPagesFromUriAsync(System.Uri sourceUri, Azure.HttpRange sourceRange, Azure.HttpRange range, byte[] sourceContentHash = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions conditions = null, Azure.Storage.Blobs.Models.PageBlobRequestConditions sourceConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public new Azure.Storage.Blobs.Specialized.PageBlobClient WithSnapshot(string snapshot) { throw null; }
protected sealed override Azure.Storage.Blobs.Specialized.BlobBaseClient WithSnapshotCore(string snapshot) { throw null; }
public new Azure.Storage.Blobs.Specialized.PageBlobClient WithVersion(string versionId) { throw null; }
}
public static partial class SpecializedBlobExtensions
{
Expand Down
19 changes: 19 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/src/AppendBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,25 @@ internal AppendBlobClient(
return new AppendBlobClient(builder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope);
}

/// <summary>
/// Initializes a new instance of the <see cref="AppendBlobClient"/>
/// class with an identical <see cref="Uri"/> source but the specified
/// <paramref name="versionId"/> timestamp.
///
/// </summary>
/// <param name="versionId">The version identifier.</param>
/// <returns>A new <see cref="AppendBlobClient"/> instance.</returns>
/// <remarks>
/// Pass null or empty string to remove the version returning a URL
/// to the base blob.
/// </remarks>
public new AppendBlobClient WithVersion(string versionId)
{
var builder = new BlobUriBuilder(Uri) { VersionId = versionId };

return new AppendBlobClient(builder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope);
}

#region Create
/// <summary>
/// The <see cref="Create"/> operation creates a new 0-length
Expand Down
30 changes: 29 additions & 1 deletion sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,33 @@ protected virtual BlobBaseClient WithSnapshotCore(string snapshot)
return new BlobBaseClient(builder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope);
}

/// <summary>
/// Initializes a new instance of the <see cref="BlobBaseClient"/>
/// class with an identical <see cref="Uri"/> source but the specified
/// <paramref name="versionId"/> timestamp.
///
/// </summary>
/// <param name="versionId">The version identifier.</param>
/// <returns>A new <see cref="BlobBaseClient"/> instance.</returns>
/// <remarks>
/// Pass null or empty string to remove the version returning a URL
/// to the base blob.
/// </remarks>
public virtual BlobBaseClient WithVersion(string versionId) => WithVersionCore(versionId);

/// <summary>
/// Creates a new instance of the <see cref="BlobBaseClient"/> class
/// with an identical <see cref="Uri"/> source but the specified
/// <paramref name="versionId"/> timestamp.
/// </summary>
/// <param name="versionId">The version identifier.</param>
/// <returns>A new <see cref="BlobBaseClient"/> instance.</returns>
protected virtual BlobBaseClient WithVersionCore(string versionId)
{
var builder = new BlobUriBuilder(Uri) { VersionId = versionId };
return new BlobBaseClient(builder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope);
}

/// <summary>
/// Sets the various name fields if they are currently null.
/// </summary>
Expand Down Expand Up @@ -2737,7 +2764,8 @@ await BlobRestClient.Blob.SetMetadataAsync(
new BlobInfo
{
LastModified = response.Value.LastModified,
ETag = response.Value.ETag
ETag = response.Value.ETag,
VersionId = response.Value.VersionId
}, response.GetRawResponse());
}
catch (Exception ex)
Expand Down
41 changes: 29 additions & 12 deletions sdk/storage/Azure.Storage.Blobs/src/BlobUriBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ public string Snapshot
}
private string _snapshot;

/// <summary>
/// Gets or sets the name of a blob version. The value defaults to
/// <see cref="string.Empty"/> if not present in the <see cref="System.Uri"/>.
/// </summary>
public string VersionId
{
get => _versionId;
set { ResetUri(); _versionId = value; }
}
private string _versionId;

///// <summary>
///// Gets or sets the VersionId. The value defaults to
///// <see cref="String.Empty"/> if not present in the <see cref="Uri"/>.
Expand Down Expand Up @@ -162,7 +173,7 @@ public BlobUriBuilder(Uri uri)
BlobName = "";

Snapshot = "";
//this.VersionId = "";
VersionId = "";
Sas = null;
Query = "";

Expand Down Expand Up @@ -219,13 +230,18 @@ public BlobUriBuilder(Uri uri)
paramsMap.Remove(Constants.SnapshotParameterName);
}

//if(paramsMap.TryGetValue(VersionIdParameterName, out var versionId))
//{
// this.VersionId = versionId;
if (paramsMap.TryGetValue(Constants.VersionIdParameterName, out var versionId))
{
VersionId = versionId;

// // If we recognized the query parameter, remove it from the map
// paramsMap.Remove(VersionIdParameterName);
//}
// If we recognized the query parameter, remove it from the map
paramsMap.Remove(Constants.VersionIdParameterName);
}

if (!string.IsNullOrEmpty(Snapshot) && !string.IsNullOrEmpty(VersionId))
{
throw new ArgumentException("Snapshot and VersionId cannot both be set.");
}

if (paramsMap.ContainsKey(Constants.Sas.Parameters.Version))
{
Expand Down Expand Up @@ -299,11 +315,12 @@ private RequestUriBuilder BuildUri()
{ query.Append("&"); }
query.Append(Constants.SnapshotParameterName).Append("=").Append(Snapshot);
}
//if (!String.IsNullOrWhiteSpace(this.VersionId))
//{
// if (query.Length > 0) { query += "&"; }
// query.Append(VersionIdParameterName).Append("=").Append(this.VersionId);
//}
if (!string.IsNullOrWhiteSpace(VersionId))
{
if (query.Length > 0)
{ query.Append("&"); }
query.Append(Constants.VersionIdParameterName).Append("=").Append(VersionId);
}
var sas = Sas?.ToString();
if (!string.IsNullOrWhiteSpace(sas))
{
Expand Down
18 changes: 18 additions & 0 deletions sdk/storage/Azure.Storage.Blobs/src/BlockBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,24 @@ protected static BlockBlobClient CreateClient(Uri blobUri, BlobClientOptions opt
/// </remarks>
public new BlockBlobClient WithSnapshot(string snapshot) => (BlockBlobClient)WithSnapshotCore(snapshot);

/// <summary>
/// Initializes a new instance of the <see cref="BlockBlobClient"/>
/// class with an identical <see cref="Uri"/> source but the specified
/// <paramref name="versionId"/> timestamp.
///
/// </summary>
/// <param name="versionId">The version identifier.</param>
/// <returns>A new <see cref="BlockBlobClient"/> instance.</returns>
/// <remarks>
/// Pass null or empty string to remove the snapshot returning a URL
/// to the base blob.
/// </remarks>
public new BlockBlobClient WithVersion(string versionId)
{
var builder = new BlobUriBuilder(Uri) { VersionId = versionId };
return new BlockBlobClient(builder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope);
}

/// <summary>
/// Creates a new instance of the <see cref="BlockBlobClient"/> class
/// with an identical <see cref="Uri"/> source but the specified
Expand Down
Loading