Skip to content

Commit

Permalink
Remove Unused Public API (Azure#36325)
Browse files Browse the repository at this point in the history
* removed API

* exportapi
  • Loading branch information
jaschrep-msft authored Jun 15, 2023
1 parent 910acdd commit 0fab7ed
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public BlobStorageResourceContainer(Azure.Storage.Blobs.BlobContainerClient blob
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class BlobStorageResourceContainerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public BlobStorageResourceContainer(Azure.Storage.Blobs.BlobContainerClient blob
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class BlobStorageResourceContainerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public BlobStorageResourceContainer(Azure.Storage.Blobs.BlobContainerClient blob
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class BlobStorageResourceContainerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,40 +115,6 @@ private StorageResource GetBlobAsStorageResource(
}
}

/// <summary>
/// Gets the parent container resource for this container resource. The parent container
/// can represent either a directory prefix or the blob container itself.
/// </summary>
/// <returns>
/// The parent resource container.
/// </returns>
/// <exception cref="NotSupportedException">
/// A container resource that represents the blob container itself has no parent.
/// </exception>
public override StorageResourceContainer GetParentStorageResourceContainer()
{
// TODO: should this throw? Perhaps we return null or refactor base class for a try pattern.
if (!IsDirectory)
{
throw new NotSupportedException();
}

// TODO: if there's no parent directory, that means we should return the BlobStorageResourceContainer instead
// Recreate the blobName using the existing parent directory path
int delimiter = _directoryPrefix.LastIndexOf('/');
if (delimiter > -1)
{
return new BlobStorageResourceContainer(_blobContainerClient, new BlobStorageResourceContainerOptions
{
DirectoryPrefix = _directoryPrefix.Substring(0, delimiter)
});
}
else
{
return new BlobStorageResourceContainer(_blobContainerClient);
}
}

/// <summary>
/// Lists the blob resources in the storage blob container.
///
Expand Down
1 change: 1 addition & 0 deletions sdk/storage/Azure.Storage.DataMovement/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Breaking Changes
- [BREAKING CHANGE] Altered API signatures on `TransferManager` and `DataTransfer` for pausing.
- [BREAKING CHANGE] `StorageResouceContainer.GetParentStorageResourceContainer()` removed.
- [BREAKING CHANGE] Updated `StorageResource.CompleteTransferAsync` to have an added overwrite parameter: `StorageResource.CompleteTransferAsync(bool overwrite, CancellationToken cancellationToken = default)`.

### Bugs Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public LocalDirectoryStorageResourceContainer(string path) { }
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string childPath) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LocalFileStorageResource : Azure.Storage.DataMovement.StorageResource
Expand Down Expand Up @@ -77,7 +76,6 @@ public abstract partial class StorageResourceContainer : Azure.Storage.DataMovem
protected StorageResourceContainer() { }
public override bool IsContainer { get { throw null; } }
public abstract Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path);
public abstract Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer();
public abstract System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
public enum StorageResourceCreateMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public LocalDirectoryStorageResourceContainer(string path) { }
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string childPath) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LocalFileStorageResource : Azure.Storage.DataMovement.StorageResource
Expand Down Expand Up @@ -77,7 +76,6 @@ public abstract partial class StorageResourceContainer : Azure.Storage.DataMovem
protected StorageResourceContainer() { }
public override bool IsContainer { get { throw null; } }
public abstract Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path);
public abstract Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer();
public abstract System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
public enum StorageResourceCreateMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public LocalDirectoryStorageResourceContainer(string path) { }
public override string Path { get { throw null; } }
public override System.Uri Uri { get { throw null; } }
public override Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string childPath) { throw null; }
public override Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer() { throw null; }
public override System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class LocalFileStorageResource : Azure.Storage.DataMovement.StorageResource
Expand Down Expand Up @@ -77,7 +76,6 @@ public abstract partial class StorageResourceContainer : Azure.Storage.DataMovem
protected StorageResourceContainer() { }
public override bool IsContainer { get { throw null; } }
public abstract Azure.Storage.DataMovement.StorageResource GetChildStorageResource(string path);
public abstract Azure.Storage.DataMovement.StorageResourceContainer GetParentStorageResourceContainer();
public abstract System.Collections.Generic.IAsyncEnumerable<Azure.Storage.DataMovement.StorageResourceBase> GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
public enum StorageResourceCreateMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ public override StorageResource GetChildStorageResource(string childPath)
return new LocalFileStorageResource(concatPath);
}

/// <summary>
/// Gets the parent directory path by one level.
/// </summary>
/// <returns></returns>
public override StorageResourceContainer GetParentStorageResourceContainer()
{
return new LocalDirectoryStorageResourceContainer(_path.Substring(0, _path.LastIndexOf('/')));
}

/// <summary>
/// Lists storage resource in the filesystem.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public abstract IAsyncEnumerable<StorageResourceBase> GetStorageResourcesAsync(
/// <param name="path"></param>
public abstract StorageResource GetChildStorageResource(string path);

/// <summary>
/// Returns storage resource container from the parent container
/// </summary>
public abstract StorageResourceContainer GetParentStorageResourceContainer();

/// <summary>
/// Storage Resource is a container.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,35 +114,5 @@ public async Task GetChildStorageResourceAsync()
Assert.IsNotNull(properties);
Assert.IsNotNull(properties.ETag);
}

[RecordedTest]
public async Task GetParentStorageResourceAsync()
{
await using DisposingBlobContainer test = await GetTestContainerAsync();
await SetUpContainerForListing(test.Container);

string prefix = "baz/bar";
StorageResourceContainer containerResource =
new BlobStorageResourceContainer(test.Container, new() { DirectoryPrefix = prefix });

StorageResourceContainer resource = containerResource.GetParentStorageResourceContainer();

Assert.AreEqual("baz", resource.Path);
}

[RecordedTest]
public async Task GetParentStorageResourceAsync_Root()
{
await using DisposingBlobContainer test = await GetTestContainerAsync();
await SetUpContainerForListing(test.Container);

string prefix = "foo";
StorageResourceContainer containerResource =
new BlobStorageResourceContainer(test.Container, new() { DirectoryPrefix = prefix });

StorageResourceContainer resource = containerResource.GetParentStorageResourceContainer();

Assert.AreEqual(resource.Uri, test.Container.Uri);
}
}
}

0 comments on commit 0fab7ed

Please sign in to comment.