diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs index 96ff50a945af1..4c75cfe729a7d 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageAccountsOperations.cs @@ -204,7 +204,7 @@ public partial interface IStorageAccountsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all the storage accounts available under the given resource /// group. Note that storage keys are not returned; use the ListKeys @@ -471,5 +471,29 @@ public partial interface IStorageAccountsOperations /// Thrown when a required parameter is null /// Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the storage accounts available under the subscription. + /// Note that storage keys are not returned; use the ListKeys operation + /// for this. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs index 4e7117ff234d5..ade321fb01d33 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs @@ -31,16 +31,5 @@ public static IEnumerable> ApiInfo_StorageManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\code\\srpsdk\\sdk\\storage\\Microsoft.Azure.Management.Storage\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "6e6a651b6805d1811190025616f35e5a13194910"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs index 6fc4590d77db1..c7317cd9777ea 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperations.cs @@ -1049,7 +1049,7 @@ internal StorageAccountsOperations(StorageManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1185,7 +1185,7 @@ internal StorageAccountsOperations(StorageManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1198,7 +1198,7 @@ internal StorageAccountsOperations(StorageManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3176,5 +3176,179 @@ internal StorageAccountsOperations(StorageManagementClient client) return _result; } + /// + /// Lists all the storage accounts available under the subscription. Note that + /// storage keys are not returned; use the ListKeys operation for this. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs index 6e3c4d40b6cc8..0a3a10110d7cc 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageAccountsOperationsExtensions.cs @@ -297,7 +297,7 @@ public static StorageAccount Update(this IStorageAccountsOperations operations, /// /// The operations group for this extension method. /// - public static IEnumerable List(this IStorageAccountsOperations operations) + public static IPage List(this IStorageAccountsOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } @@ -312,7 +312,7 @@ public static IEnumerable List(this IStorageAccountsOperations o /// /// The cancellation token. /// - public static async Task> ListAsync(this IStorageAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IStorageAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -765,5 +765,41 @@ public static void BeginFailover(this IStorageAccountsOperations operations, str (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Lists all the storage accounts available under the subscription. Note that + /// storage keys are not returned; use the ListKeys operation for this. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IStorageAccountsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the storage accounts available under the subscription. Note that + /// storage keys are not returned; use the ListKeys operation for this. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IStorageAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } }