Skip to content

Commit

Permalink
.NET SDK Resource Provider:'Storage'
Browse files Browse the repository at this point in the history
REST Spec PR 'Azure/azure-rest-api-specs#5562'
REST Spec PR Author 'huizlAzure'
REST Spec PR Last commit
  • Loading branch information
adxsdknet committed Apr 5, 2019
1 parent 036b575 commit 6fee538
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ internal BlobContainersOperations(StorageManagementClient client)
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
/// <param name='skipToken'>
/// Optional continuation token for the list operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -84,7 +87,7 @@ internal BlobContainersOperations(StorageManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<ListContainerItems>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<ListContainerItems>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
Expand Down Expand Up @@ -151,6 +154,7 @@ internal BlobContainersOperations(StorageManagementClient client)
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("accountName", accountName);
tracingParameters.Add("skipToken", skipToken);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
Expand All @@ -165,6 +169,10 @@ internal BlobContainersOperations(StorageManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (skipToken != null)
{
_queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ public static partial class BlobContainersOperationsExtensions
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
public static ListContainerItems List(this IBlobContainersOperations operations, string resourceGroupName, string accountName)
/// <param name='skipToken'>
/// Optional continuation token for the list operation.
/// </param>
public static ListContainerItems List(this IBlobContainersOperations operations, string resourceGroupName, string accountName, string skipToken = default(string))
{
return operations.ListAsync(resourceGroupName, accountName).GetAwaiter().GetResult();
return operations.ListAsync(resourceGroupName, accountName, skipToken).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -60,12 +63,15 @@ public static ListContainerItems List(this IBlobContainersOperations operations,
/// Storage account names must be between 3 and 24 characters in length and use
/// numbers and lower-case letters only.
/// </param>
/// <param name='skipToken'>
/// Optional continuation token for the list operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ListContainerItems> ListAsync(this IBlobContainersOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<ListContainerItems> ListAsync(this IBlobContainersOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, skipToken, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public partial interface IBlobContainersOperations
/// group. Storage account names must be between 3 and 24 characters in
/// length and use numbers and lower-case letters only.
/// </param>
/// <param name='skipToken'>
/// Optional continuation token for the list operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -51,7 +54,7 @@ public partial interface IBlobContainersOperations
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<ListContainerItems>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<AzureOperationResponse<ListContainerItems>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Creates a new container under the specified account as described by
/// request body. The container resource includes metadata and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace Microsoft.Azure.Management.Storage.Models
using System.Linq;

/// <summary>
/// The list of blob containers.
/// Response schema. Contains list of blobs returned, and if paging is
/// requested or required, a URL to next page of containers.
/// </summary>
public partial class ListContainerItems
{
Expand All @@ -31,10 +32,13 @@ public ListContainerItems()
/// <summary>
/// Initializes a new instance of the ListContainerItems class.
/// </summary>
/// <param name="value">The list of blob containers.</param>
public ListContainerItems(IList<ListContainerItem> value = default(IList<ListContainerItem>))
/// <param name="value">List of blobs containers returned.</param>
/// <param name="nextLink">Request URL with a skip token in query
/// parameters. Can be used to access next page of containers.</param>
public ListContainerItems(IList<ListContainerItem> value = default(IList<ListContainerItem>), string nextLink = default(string))
{
Value = value;
NextLink = nextLink;
CustomInit();
}

Expand All @@ -44,10 +48,17 @@ public ListContainerItems()
partial void CustomInit();

/// <summary>
/// Gets or sets the list of blob containers.
/// Gets or sets list of blobs containers returned.
/// </summary>
[JsonProperty(PropertyName = "value")]
public IList<ListContainerItem> Value { get; set; }

/// <summary>
/// Gets or sets request URL with a skip token in query parameters. Can
/// be used to access next page of containers.
/// </summary>
[JsonProperty(PropertyName = "nextLink")]
public string NextLink { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ public partial class StorageManagementClient : ServiceClient<StorageManagementCl
/// </summary>
public virtual IBlobContainersOperations BlobContainers { get; private set; }

/// <summary>
/// Initializes a new instance of the StorageManagementClient class.
/// </summary>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling StorageManagementClient.Dispose(). False: will not dispose provided httpClient</param>
protected StorageManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
{
Initialize();
}

/// <summary>
/// Initializes a new instance of the StorageManagementClient class.
/// </summary>
Expand Down Expand Up @@ -204,6 +217,33 @@ public StorageManagementClient(ServiceClientCredentials credentials, params Dele
}
}

/// <summary>
/// Initializes a new instance of the StorageManagementClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Credentials needed for the client to connect to Azure.
/// </param>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling StorageManagementClient.Dispose(). False: will not dispose provided httpClient</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public StorageManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
Credentials = credentials;
if (Credentials != null)
{
Credentials.InitializeServiceClient(this);
}
}

/// <summary>
/// Initializes a new instance of the StorageManagementClient class.
/// </summary>
Expand Down

0 comments on commit 6fee538

Please sign in to comment.