From d9e8c974999c4037e4b3f69ffb9afbfc991c0991 Mon Sep 17 00:00:00 2001 From: Phoenix He Date: Mon, 30 Sep 2019 13:32:10 +0800 Subject: [PATCH 1/5] Update swagger_to_sdk_config.json --- swagger_to_sdk_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index 6e3cd9ab75a3..99979bf5d095 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -10,7 +10,7 @@ }, "advanced_options": { "create_sdk_pull_requests": true, - "sdk_generation_pull_request_base": "main_branch", + "sdk_generation_pull_request_base": "integration_branch", "main_branch": "master" }, "version": "0.2.0" From fc309524c360780dfec16514465580dec1b7852a Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2019 00:48:30 +0000 Subject: [PATCH 2/5] [AutoPR Microsoft.Azure.Management.ContainerService] Aro 2019-09-30 preview API Version (#200) * Update swagger_to_sdk_config.json * Generated from aa9913e0d2ece26504f653d3b30d22a4a35a0b38 fixing typo and indentation --- .../src/Generated/AgentPoolsOperations.cs | 456 +++++++++++++++++- .../AgentPoolsOperationsExtensions.cs | 100 ++++ .../Generated/ContainerServicesOperations.cs | 2 +- .../src/Generated/IAgentPoolsOperations.cs | 60 +++ .../Generated/ManagedClustersOperations.cs | 24 +- .../src/Generated/Models/AgentPool.cs | 45 +- .../Models/AgentPoolAvailableVersions.cs | 83 ++++ ...VersionsPropertiesAgentPoolVersionsItem.cs | 70 +++ .../Models/AgentPoolUpgradeProfile.cs | 120 +++++ ...oolUpgradeProfilePropertiesUpgradesItem.cs | 60 +++ .../Models/ContainerServiceNetworkProfile.cs | 15 +- .../src/Generated/Models/ManagedCluster.cs | 15 +- .../ManagedClusterAPIServerAccessProfile.cs | 66 +++ .../Models/ManagedClusterAgentPoolProfile.cs | 14 +- ...anagedClusterAgentPoolProfileProperties.cs | 45 +- .../ManagedClusterLoadBalancerProfile.cs | 100 ++++ ...erLoadBalancerProfileManagedOutboundIPs.cs | 75 +++ ...erLoadBalancerProfileOutboundIPPrefixes.cs | 56 +++ ...edClusterLoadBalancerProfileOutboundIPs.cs | 55 +++ .../src/Generated/Models/ResourceReference.cs | 51 ++ .../Models/ScaleSetEvictionPolicy.cs | 22 + .../src/Generated/Models/ScaleSetPriority.cs | 22 + .../src/Generated/Operations.cs | 2 +- .../SdkInfo_ContainerServiceClient.cs | 8 +- 24 files changed, 1531 insertions(+), 35 deletions(-) create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs index 50bf7e4b6b92..63687ae3488d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs @@ -120,7 +120,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -346,7 +346,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -557,6 +557,454 @@ internal AgentPoolsOperations(ContainerServiceClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (agentPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpgradeProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{agentPoolName}", System.Uri.EscapeDataString(agentPoolName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAvailableAgentPoolVersions", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + /// /// Creates or updates an agent pool. /// @@ -644,7 +1092,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -894,7 +1342,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs index 333bc9802a1a..fac6394a3939 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs @@ -228,6 +228,106 @@ public static void Delete(this IAgentPoolsOperations operations, string resource (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + public static AgentPoolUpgradeProfile GetUpgradeProfile(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + return operations.GetUpgradeProfileAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetUpgradeProfileAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpgradeProfileWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAvailableAgentPoolVersionsAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAvailableAgentPoolVersionsAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAvailableAgentPoolVersionsWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates an agent pool. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs index b8ec9621329d..564aab684620 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs @@ -735,7 +735,7 @@ internal ContainerServicesOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs index fe31c66be91b..40bf792cb96b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs @@ -148,6 +148,66 @@ public partial interface IAgentPoolsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a + /// specified resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates an agent pool. /// /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs index b42496c1c241..f4c6fb41f833 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs @@ -84,7 +84,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -278,7 +278,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -496,7 +496,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -723,7 +723,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -945,7 +945,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1165,7 +1165,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1385,7 +1385,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1756,7 +1756,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2003,7 +2003,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; TagsObject parameters = new TagsObject(); if (tags != null) { @@ -2231,7 +2231,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2441,7 +2441,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2658,7 +2658,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs index 62d800ddd453..17ca5dc61071 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs @@ -123,7 +123,17 @@ public AgentPool() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) : base(id, name, type) { Count = count; @@ -139,6 +149,10 @@ public AgentPool() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -291,6 +305,35 @@ public AgentPool() [JsonProperty(PropertyName = "properties.availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "properties.enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "properties.scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "properties.scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "properties.nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs new file mode 100644 index 000000000000..aef063574593 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available versions for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolAvailableVersions + { + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + public AgentPoolAvailableVersions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + /// Id of the agent pool available versions. + /// Name of the agent pool available + /// versions. + /// Type of the agent pool available + /// versions. + /// List of versions available for + /// agent pool. + public AgentPoolAvailableVersions(string id = default(string), string name = default(string), string type = default(string), IList agentPoolVersions = default(IList)) + { + Id = id; + Name = name; + Type = type; + AgentPoolVersions = agentPoolVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool available versions. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool available versions. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool available versions. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets list of versions available for agent pool. + /// + [JsonProperty(PropertyName = "properties.agentPoolVersions")] + public IList AgentPoolVersions { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs new file mode 100644 index 000000000000..8642c1dbda4c --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem + { + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + /// Whether this version is the default + /// agent pool version. + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(bool? defaultProperty = default(bool?), string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + DefaultProperty = defaultProperty; + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether this version is the default agent pool + /// version. + /// + [JsonProperty(PropertyName = "default")] + public bool? DefaultProperty { get; set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs new file mode 100644 index 000000000000..7e876988de79 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available upgrades for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolUpgradeProfile + { + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + public AgentPoolUpgradeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// OsType to be used to specify os type. Choose + /// from Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// Id of the agent pool upgrade profile. + /// Name of the agent pool upgrade profile. + /// Type of the agent pool upgrade profile. + /// List of orchestrator types and versions + /// available for upgrade. + public AgentPoolUpgradeProfile(string kubernetesVersion, string osType, string id = default(string), string name = default(string), string type = default(string), IList upgrades = default(IList)) + { + Id = id; + Name = name; + Type = type; + KubernetesVersion = kubernetesVersion; + OsType = osType; + Upgrades = upgrades; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "properties.kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets osType to be used to specify os type. Choose from + /// Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets list of orchestrator types and versions available for + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.upgrades")] + public IList Upgrades { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KubernetesVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KubernetesVersion"); + } + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs new file mode 100644 index 000000000000..e449e974e445 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + { + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + public AgentPoolUpgradeProfilePropertiesUpgradesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 311110d17c1a..0d1e3604982b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -51,7 +51,9 @@ public ContainerServiceNetworkProfile() /// ranges or the Kubernetes service address range. /// The load balancer sku for the managed /// cluster. Possible values include: 'standard', 'basic' - public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string)) + /// Profile of the cluster load + /// balancer. + public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile)) { NetworkPlugin = networkPlugin; NetworkPolicy = networkPolicy; @@ -60,6 +62,7 @@ public ContainerServiceNetworkProfile() DnsServiceIP = dnsServiceIP; DockerBridgeCidr = dockerBridgeCidr; LoadBalancerSku = loadBalancerSku; + LoadBalancerProfile = loadBalancerProfile; CustomInit(); } @@ -119,6 +122,12 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "loadBalancerSku")] public string LoadBalancerSku { get; set; } + /// + /// Gets or sets profile of the cluster load balancer. + /// + [JsonProperty(PropertyName = "loadBalancerProfile")] + public ManagedClusterLoadBalancerProfile LoadBalancerProfile { get; set; } + /// /// Validate the object. /// @@ -155,6 +164,10 @@ public virtual void Validate() throw new ValidationException(ValidationRules.Pattern, "DockerBridgeCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); } } + if (LoadBalancerProfile != null) + { + LoadBalancerProfile.Validate(); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs index 7a4181186b42..7fa8fc43785a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs @@ -69,11 +69,11 @@ public ManagedCluster() /// configuration. /// Profile of Azure Active Directory /// configuration. - /// (PREVIEW) Authorized IP - /// Ranges to kubernetes API server. + /// Access profile for managed + /// cluster API server. /// The identity of the managed cluster, if /// configured. - public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), IList apiServerAuthorizedIPRanges = default(IList), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) + public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; @@ -91,7 +91,7 @@ public ManagedCluster() EnablePodSecurityPolicy = enablePodSecurityPolicy; NetworkProfile = networkProfile; AadProfile = aadProfile; - ApiServerAuthorizedIPRanges = apiServerAuthorizedIPRanges; + ApiServerAccessProfile = apiServerAccessProfile; Identity = identity; CustomInit(); } @@ -201,11 +201,10 @@ public ManagedCluster() public ManagedClusterAADProfile AadProfile { get; set; } /// - /// Gets or sets (PREVIEW) Authorized IP Ranges to kubernetes API - /// server. + /// Gets or sets access profile for managed cluster API server. /// - [JsonProperty(PropertyName = "properties.apiServerAuthorizedIPRanges")] - public IList ApiServerAuthorizedIPRanges { get; set; } + [JsonProperty(PropertyName = "properties.apiServerAccessProfile")] + public ManagedClusterAPIServerAccessProfile ApiServerAccessProfile { get; set; } /// /// Gets or sets the identity of the managed cluster, if configured. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs new file mode 100644 index 000000000000..a950f33365d1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access profile for managed cluster API server. + /// + public partial class ManagedClusterAPIServerAccessProfile + { + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + public ManagedClusterAPIServerAccessProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + /// Authorized IP Ranges to kubernetes + /// API server. + /// Whether to create the cluster as + /// a private cluster or not. + public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?)) + { + AuthorizedIPRanges = authorizedIPRanges; + EnablePrivateCluster = enablePrivateCluster; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorized IP Ranges to kubernetes API server. + /// + [JsonProperty(PropertyName = "authorizedIPRanges")] + public IList AuthorizedIPRanges { get; set; } + + /// + /// Gets or sets whether to create the cluster as a private cluster or + /// not. + /// + [JsonProperty(PropertyName = "enablePrivateCluster")] + public bool? EnablePrivateCluster { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 357545428fe3..107edfb3be3d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -120,8 +120,18 @@ public ManagedClusterAgentPoolProfile() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) - : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) + : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones, enableNodePublicIP, scaleSetPriority, scaleSetEvictionPolicy, nodeTaints) { Name = name; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index 6e86f0cc9df6..a99b90999b08 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -118,7 +118,17 @@ public ManagedClusterAgentPoolProfileProperties() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) { Count = count; VmSize = vmSize; @@ -133,6 +143,10 @@ public ManagedClusterAgentPoolProfileProperties() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -285,6 +299,35 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs new file mode 100644 index 000000000000..2c9728a8cd0d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of the managed cluster load balancer + /// + public partial class ManagedClusterLoadBalancerProfile + { + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + public ManagedClusterLoadBalancerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + /// Desired managed outbound IPs for + /// the cluster load balancer. + /// Desired outbound IP Prefix + /// resources for the cluster load balancer. + /// Desired outbound IP resources for the + /// cluster load balancer. + /// The effective outbound IP + /// resources of the cluster load balancer. + public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList)) + { + ManagedOutboundIPs = managedOutboundIPs; + OutboundIPPrefixes = outboundIPPrefixes; + OutboundIPs = outboundIPs; + EffectiveOutboundIPs = effectiveOutboundIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired managed outbound IPs for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "managedOutboundIPs")] + public ManagedClusterLoadBalancerProfileManagedOutboundIPs ManagedOutboundIPs { get; set; } + + /// + /// Gets or sets desired outbound IP Prefix resources for the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "outboundIPPrefixes")] + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes OutboundIPPrefixes { get; set; } + + /// + /// Gets or sets desired outbound IP resources for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "outboundIPs")] + public ManagedClusterLoadBalancerProfileOutboundIPs OutboundIPs { get; set; } + + /// + /// Gets or sets the effective outbound IP resources of the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "effectiveOutboundIPs")] + public IList EffectiveOutboundIPs { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedOutboundIPs != null) + { + ManagedOutboundIPs.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs new file mode 100644 index 000000000000..d72f7f793e37 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Desired managed outbound IPs for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileManagedOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + /// Desired number of outbound IP created/managed + /// by Azure for the cluster load balancer. Allowed values must be in + /// the range of 1 to 100 (inclusive). The default value is 1. + public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?)) + { + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired number of outbound IP created/managed by Azure + /// for the cluster load balancer. Allowed values must be in the range + /// of 1 to 100 (inclusive). The default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Count > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Count", 100); + } + if (Count < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs new file mode 100644 index 000000000000..e4220de6974b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + /// A list of public IP prefix + /// resources. + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes = default(IList)) + { + PublicIPPrefixes = publicIPPrefixes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP prefix resources. + /// + [JsonProperty(PropertyName = "publicIPPrefixes")] + public IList PublicIPPrefixes { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs new file mode 100644 index 000000000000..8c6863afa7cb --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + /// A list of public IP resources. + public ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs = default(IList)) + { + PublicIPs = publicIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP resources. + /// + [JsonProperty(PropertyName = "publicIPs")] + public IList PublicIPs { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs new file mode 100644 index 000000000000..d272c94add12 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A reference to an Azure resource. + /// + public partial class ResourceReference + { + /// + /// Initializes a new instance of the ResourceReference class. + /// + public ResourceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceReference class. + /// + /// The fully qualified Azure resource id. + public ResourceReference(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fully qualified Azure resource id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs new file mode 100644 index 000000000000..25bd3db49c44 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetEvictionPolicy. + /// + public static class ScaleSetEvictionPolicy + { + public const string Delete = "Delete"; + public const string Deallocate = "Deallocate"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs new file mode 100644 index 000000000000..5edcae14e830 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetPriority. + /// + public static class ScaleSetPriority + { + public const string Low = "Low"; + public const string Regular = "Regular"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs index ec90823197fa..33c25ec737fe 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ContainerServiceClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs index e35757d72020..2330060e78a7 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs @@ -19,12 +19,12 @@ public static IEnumerable> ApiInfo_ContainerServic { return new Tuple[] { - new Tuple("ContainerService", "AgentPools", "2019-04-01"), + new Tuple("ContainerService", "AgentPools", "2019-08-01"), new Tuple("ContainerService", "ContainerServices", "2017-07-01"), - new Tuple("ContainerService", "ContainerServices", "2019-04-01"), - new Tuple("ContainerService", "ManagedClusters", "2019-04-01"), + new Tuple("ContainerService", "ContainerServices", "2019-08-01"), + new Tuple("ContainerService", "ManagedClusters", "2019-08-01"), new Tuple("ContainerService", "OpenShiftManagedClusters", "2019-04-30"), - new Tuple("ContainerService", "Operations", "2019-04-01"), + new Tuple("ContainerService", "Operations", "2019-08-01"), }.AsEnumerable(); } } From 9b2abf109dda808f1962668e03f26f477d5db373 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2019 03:10:48 +0000 Subject: [PATCH 3/5] [AutoPR Microsoft.Azure.Management.CostManagement] Supporting Management Group scope for Exports (#94) * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Generated from 967f9659d62a831649ef83f6a52cf2e35dbb87bd Fixed model validation --- .../src/Generated/BudgetOperations.cs | 673 ++++++ .../Generated/BudgetOperationsExtensions.cs | 248 +++ .../src/Generated/BudgetsOperations.cs | 416 ++++ .../Generated/BudgetsOperationsExtensions.cs | 127 ++ .../src/Generated/CostManagementClient.cs | 376 ++++ .../src/Generated/IBudgetOperations.cs | 153 ++ .../src/Generated/IBudgetsOperations.cs | 88 + .../src/Generated/ICostManagementClient.cs | 93 + .../src/Generated/IOperations.cs | 68 + .../src/Generated/IViewsOperations.cs | 345 +++ .../src/Generated/Models/AccumulatedType.cs | 22 + .../src/Generated/Models/BudgetModel.cs | 172 ++ .../src/Generated/Models/BudgetTimePeriod.cs | 71 + .../src/Generated/Models/CategoryType.cs | 22 + .../src/Generated/Models/ChartType.cs | 25 + .../src/Generated/Models/CurrentSpend.cs | 61 + .../src/Generated/Models/ErrorBase.cs | 69 + .../src/Generated/Models/ErrorDetails.cs | 79 + .../src/Generated/Models/ErrorResponse.cs | 52 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/GranularityType.cs | 22 + .../src/Generated/Models/KpiProperties.cs | 69 + .../src/Generated/Models/KpiTypeType.cs | 22 + .../src/Generated/Models/MetricType.cs | 23 + .../src/Generated/Models/Notification.cs | 147 ++ .../Models/NotificationOperatorType.cs | 23 + .../src/Generated/Models/Operation.cs | 61 + .../src/Generated/Models/OperationDisplay.cs | 71 + .../src/Generated/Models/OperatorType.cs | 22 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/PivotProperties.cs | 61 + .../src/Generated/Models/PivotTypeType.cs | 22 + .../src/Generated/Models/ProxyResource.cs | 81 + .../Models/ReportConfigAggregation.cs | 78 + .../Models/ReportConfigColumnType.cs | 22 + .../ReportConfigComparisonExpression.cs | 103 + .../Generated/Models/ReportConfigDataset.cs | 156 ++ .../ReportConfigDatasetConfiguration.cs | 59 + .../Generated/Models/ReportConfigFilter.cs | 140 ++ .../Generated/Models/ReportConfigGrouping.cs | 81 + .../Generated/Models/ReportConfigSorting.cs | 75 + .../Models/ReportConfigTimePeriod.cs | 70 + .../src/Generated/Models/Resource.cs | 79 + .../src/Generated/Models/Scope.cs | 73 + .../src/Generated/Models/TimeGrainType.cs | 23 + .../src/Generated/Models/TimeframeType.cs | 24 + .../src/Generated/Models/View.cs | 245 +++ .../src/Generated/Operations.cs | 390 ++++ .../src/Generated/OperationsExtensions.cs | 87 + .../Generated/SdkInfo_CostManagementClient.cs | 30 + .../src/Generated/ViewsOperations.cs | 1944 +++++++++++++++++ .../Generated/ViewsOperationsExtensions.cs | 563 +++++ 52 files changed, 8141 insertions(+) create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs new file mode 100644 index 000000000000..1488b669385c --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs @@ -0,0 +1,673 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetOperations operations. + /// + internal partial class BudgetOperations : IServiceOperations, IBudgetOperations + { + /// + /// Initializes a new instance of the BudgetOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BudgetOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// 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> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget 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> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, BudgetModel parameters = default(BudgetModel), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("PUT"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("DELETE"); + _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 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs new file mode 100644 index 000000000000..5919a270dc00 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs @@ -0,0 +1,248 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BudgetOperations. + /// + public static partial class BudgetOperationsExtensions + { + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + public static BudgetModel Get(this IBudgetOperations operations, string scope, string budgetName) + { + return operations.GetAsync(scope, budgetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget operation. + /// + public static BudgetModel CreateOrUpdate(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel)) + { + return operations.CreateOrUpdateAsync(scope, budgetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, budgetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + public static void Delete(this IBudgetOperations operations, string scope, string budgetName) + { + operations.DeleteAsync(scope, budgetName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs new file mode 100644 index 000000000000..740ee449c11c --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs @@ -0,0 +1,416 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetsOperations operations. + /// + internal partial class BudgetsOperations : IServiceOperations, IBudgetsOperations + { + /// + /// Initializes a new instance of the BudgetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BudgetsOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs new file mode 100644 index 000000000000..49ef9a595787 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BudgetsOperations. + /// + public static partial class BudgetsOperationsExtensions + { + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + public static IPage List(this IBudgetsOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBudgetsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBudgetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// 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 IBudgetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs new file mode 100644 index 000000000000..8ff8db2530de --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs @@ -0,0 +1,376 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + public partial class CostManagementClient : ServiceClient, ICostManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Version of the API to be used with the client request. The current version + /// is 2019-04-01-preview + /// + public string ApiVersion { get; private set; } + + /// + /// Azure Subscription ID. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IViewsOperations. + /// + public virtual IViewsOperations Views { get; private set; } + + /// + /// Gets the IBudgetsOperations. + /// + public virtual IBudgetsOperations Budgets { get; private set; } + + /// + /// Gets the IBudgetOperations. + /// + public virtual IBudgetOperations Budget { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient + protected CostManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CostManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CostManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected CostManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected CostManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(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); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Views = new ViewsOperations(this); + Budgets = new BudgetsOperations(this); + Budget = new BudgetOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2019-04-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs new file mode 100644 index 000000000000..743b05022b2e --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs @@ -0,0 +1,153 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetOperations operations. + /// + public partial interface IBudgetOperations + { + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// 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> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a budget. Update operation + /// requires latest eTag to be set in the request mandatorily. You may + /// obtain the latest eTag by performing a get operation. Create + /// operation does not require eTag. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget 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> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, BudgetModel parameters = default(BudgetModel), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a budget. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs new file mode 100644 index 000000000000..099bc5547849 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetsOperations operations. + /// + public partial interface IBudgetsOperations + { + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs new file mode 100644 index 000000000000..40487d0d7060 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface ICostManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Version of the API to be used with the client request. The current + /// version is 2019-04-01-preview + /// + string ApiVersion { get; } + + /// + /// Azure Subscription ID. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IViewsOperations. + /// + IViewsOperations Views { get; } + + /// + /// Gets the IBudgetsOperations. + /// + IBudgetsOperations Budgets { get; } + + /// + /// Gets the IBudgetOperations. + /// + IBudgetOperations Budget { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs new file mode 100644 index 000000000000..9efcc4fb3e1b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs new file mode 100644 index 000000000000..113b114257aa --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs @@ -0,0 +1,345 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ViewsOperations operations. + /// + public partial interface IViewsOperations + { + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// 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>> ListByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the view by view name. + /// + /// + /// + /// View name + /// + /// + /// 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> GetWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a view. Update operation requires + /// latest eTag to be set in the request. You may obtain the latest + /// eTag by performing a get operation. Create operation does not + /// require eTag. + /// + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateWithHttpMessagesAsync(string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a view. + /// + /// + /// + /// View name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// 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> GetByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a view. Update operation requires + /// latest eTag to be set in the request. You may obtain the latest + /// eTag by performing a get operation. Create operation does not + /// require eTag. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a view. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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)); + /// + /// Lists all views at the given scope. + /// + /// + /// + /// 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>> ListByScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs new file mode 100644 index 000000000000..a2e19985def0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for AccumulatedType. + /// + public static class AccumulatedType + { + public const string True = "true"; + public const string False = "false"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs new file mode 100644 index 000000000000..1ac6c00a01c0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A budget resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class BudgetModel : ProxyResource + { + /// + /// Initializes a new instance of the BudgetModel class. + /// + public BudgetModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetModel class. + /// + /// The category of the budget, whether the + /// budget tracks cost or usage. Possible values include: 'Cost', + /// 'Usage' + /// The total amount of cost to track with the + /// budget + /// The time covered by a budget. Tracking of + /// the amount will be reset based on the time grain. Possible values + /// include: 'Monthly', 'Quarterly', 'Annually' + /// Has start and end date of the budget. The + /// start date must be first of the month and should be less than the + /// end date. Budget start date must be on or after June 1, 2017. + /// Future start date should not be more than three months. Past start + /// date should be selected within the timegrain period. There are no + /// restrictions on the end date. + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + /// May be used to filter budgets. + /// The current amount of cost which is + /// being tracked for a budget. + /// Dictionary of notifications associated + /// with the budget. Budget can have up to five notifications. + public BudgetModel(string category, decimal amount, string timeGrain, BudgetTimePeriod timePeriod, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), ReportConfigFilter filter = default(ReportConfigFilter), CurrentSpend currentSpend = default(CurrentSpend), IDictionary notifications = default(IDictionary)) + : base(id, name, type, eTag) + { + Category = category; + Amount = amount; + TimeGrain = timeGrain; + TimePeriod = timePeriod; + Filter = filter; + CurrentSpend = currentSpend; + Notifications = notifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the category of the budget, whether the budget tracks + /// cost or usage. Possible values include: 'Cost', 'Usage' + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; set; } + + /// + /// Gets or sets the total amount of cost to track with the budget + /// + [JsonProperty(PropertyName = "properties.amount")] + public decimal Amount { get; set; } + + /// + /// Gets or sets the time covered by a budget. Tracking of the amount + /// will be reset based on the time grain. Possible values include: + /// 'Monthly', 'Quarterly', 'Annually' + /// + [JsonProperty(PropertyName = "properties.timeGrain")] + public string TimeGrain { get; set; } + + /// + /// Gets or sets has start and end date of the budget. The start date + /// must be first of the month and should be less than the end date. + /// Budget start date must be on or after June 1, 2017. Future start + /// date should not be more than three months. Past start date should + /// be selected within the timegrain period. There are no restrictions + /// on the end date. + /// + [JsonProperty(PropertyName = "properties.timePeriod")] + public BudgetTimePeriod TimePeriod { get; set; } + + /// + /// Gets or sets may be used to filter budgets. + /// + [JsonProperty(PropertyName = "properties.filter")] + public ReportConfigFilter Filter { get; set; } + + /// + /// Gets the current amount of cost which is being tracked for a + /// budget. + /// + [JsonProperty(PropertyName = "properties.currentSpend")] + public CurrentSpend CurrentSpend { get; private set; } + + /// + /// Gets or sets dictionary of notifications associated with the + /// budget. Budget can have up to five notifications. + /// + [JsonProperty(PropertyName = "properties.notifications")] + public IDictionary Notifications { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Category"); + } + if (TimeGrain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain"); + } + if (TimePeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimePeriod"); + } + if (TimePeriod != null) + { + TimePeriod.Validate(); + } + if (Filter != null) + { + Filter.Validate(); + } + if (Notifications != null) + { + foreach (var valueElement in Notifications.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs new file mode 100644 index 000000000000..eabff2337f19 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The start and end date for a budget. + /// + public partial class BudgetTimePeriod + { + /// + /// Initializes a new instance of the BudgetTimePeriod class. + /// + public BudgetTimePeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetTimePeriod class. + /// + /// The start date for the budget. + /// The end date for the budget. If not provided, + /// we default this to 10 years from the start date. + public BudgetTimePeriod(System.DateTime startDate, System.DateTime? endDate = default(System.DateTime?)) + { + StartDate = startDate; + EndDate = endDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start date for the budget. + /// + [JsonProperty(PropertyName = "startDate")] + public System.DateTime StartDate { get; set; } + + /// + /// Gets or sets the end date for the budget. If not provided, we + /// default this to 10 years from the start date. + /// + [JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs new file mode 100644 index 000000000000..4851e4efbf90 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for CategoryType. + /// + public static class CategoryType + { + public const string Cost = "Cost"; + public const string Usage = "Usage"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs new file mode 100644 index 000000000000..0e72be35a68f --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for ChartType. + /// + public static class ChartType + { + public const string Area = "Area"; + public const string Line = "Line"; + public const string StackedColumn = "StackedColumn"; + public const string GroupedColumn = "GroupedColumn"; + public const string Table = "Table"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs new file mode 100644 index 000000000000..800a08039911 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The current amount of cost which is being tracked for a budget. + /// + public partial class CurrentSpend + { + /// + /// Initializes a new instance of the CurrentSpend class. + /// + public CurrentSpend() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CurrentSpend class. + /// + /// The total amount of cost which is being + /// tracked by the budget. + /// The unit of measure for the budget + /// amount. + public CurrentSpend(decimal? amount = default(decimal?), string unit = default(string)) + { + Amount = amount; + Unit = unit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the total amount of cost which is being tracked by the budget. + /// + [JsonProperty(PropertyName = "amount")] + public decimal? Amount { get; private set; } + + /// + /// Gets the unit of measure for the budget amount. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs new file mode 100644 index 000000000000..e01c15ea507b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorBase + { + /// + /// Initializes a new instance of the ErrorBase class. + /// + public ErrorBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorBase class. + /// + /// A machine readable error code. + /// A human readable error message. + /// Indicates which property in the request is + /// responsible for the error. + public ErrorBase(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a machine readable error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets a human readable error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets indicates which property in the request is responsible for the + /// error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..1386766cdbb3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorDetails + { + /// + /// Initializes a new instance of the ErrorDetails class. + /// + public ErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetails class. + /// + /// A machine readable error code. + /// A human readable error message. + /// Indicates which property in the request is + /// responsible for the error. + /// error details. + public ErrorDetails(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a machine readable error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets a human readable error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets or sets indicates which property in the request is responsible + /// for the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..de6105c004da --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The details of the error. + public ErrorResponse(ErrorDetails error = default(ErrorDetails)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details of the error. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetails Error { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..a464dabb029b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs new file mode 100644 index 000000000000..b259cfb98f3d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for GranularityType. + /// + public static class GranularityType + { + public const string Daily = "Daily"; + public const string Monthly = "Monthly"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs new file mode 100644 index 000000000000..2b73b6d962e2 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Each KPI must contain a 'type' and 'enabled' key. + /// + public partial class KpiProperties + { + /// + /// Initializes a new instance of the KpiProperties class. + /// + public KpiProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KpiProperties class. + /// + /// KPI type (Forecast, Budget). Possible values + /// include: 'Forecast', 'Budget' + /// ID of resource related to metric (budget). + /// show the KPI in the UI? + public KpiProperties(string type = default(string), string id = default(string), bool? enabled = default(bool?)) + { + Type = type; + Id = id; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets KPI type (Forecast, Budget). Possible values include: + /// 'Forecast', 'Budget' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets ID of resource related to metric (budget). + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets show the KPI in the UI? + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs new file mode 100644 index 000000000000..735baa7d36b3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for KpiTypeType. + /// + public static class KpiTypeType + { + public const string Forecast = "Forecast"; + public const string Budget = "Budget"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs new file mode 100644 index 000000000000..746d4df6e4d8 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for MetricType. + /// + public static class MetricType + { + public const string ActualCost = "ActualCost"; + public const string AmortizedCost = "AmortizedCost"; + public const string AHUB = "AHUB"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs new file mode 100644 index 000000000000..a208ee8129c4 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The notification associated with a budget. + /// + public partial class Notification + { + /// + /// Initializes a new instance of the Notification class. + /// + public Notification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Notification class. + /// + /// The notification is enabled or not. + /// The comparison operator. Possible + /// values include: 'EqualTo', 'GreaterThan', + /// 'GreaterThanOrEqualTo' + /// Threshold value associated with a + /// notification. Notification is sent when the cost exceeded the + /// threshold. It is always percent and has to be between 0 and + /// 1000. + /// Email addresses to send the budget + /// notification to when the threshold is exceeded. + /// Contact roles to send the budget + /// notification to when the threshold is exceeded. + /// Action groups to send the budget + /// notification to when the threshold is exceeded. + public Notification(bool enabled, string operatorProperty, decimal threshold, IList contactEmails, IList contactRoles = default(IList), IList contactGroups = default(IList)) + { + Enabled = enabled; + OperatorProperty = operatorProperty; + Threshold = threshold; + ContactEmails = contactEmails; + ContactRoles = contactRoles; + ContactGroups = contactGroups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the notification is enabled or not. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the comparison operator. Possible values include: + /// 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets threshold value associated with a notification. + /// Notification is sent when the cost exceeded the threshold. It is + /// always percent and has to be between 0 and 1000. + /// + [JsonProperty(PropertyName = "threshold")] + public decimal Threshold { get; set; } + + /// + /// Gets or sets email addresses to send the budget notification to + /// when the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactEmails")] + public IList ContactEmails { get; set; } + + /// + /// Gets or sets contact roles to send the budget notification to when + /// the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactRoles")] + public IList ContactRoles { get; set; } + + /// + /// Gets or sets action groups to send the budget notification to when + /// the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactGroups")] + public IList ContactGroups { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (ContactEmails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContactEmails"); + } + if (ContactEmails != null) + { + if (ContactEmails.Count > 50) + { + throw new ValidationException(ValidationRules.MaxItems, "ContactEmails", 50); + } + if (ContactEmails.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "ContactEmails", 1); + } + } + if (ContactGroups != null) + { + if (ContactGroups.Count > 50) + { + throw new ValidationException(ValidationRules.MaxItems, "ContactGroups", 50); + } + if (ContactGroups.Count < 0) + { + throw new ValidationException(ValidationRules.MinItems, "ContactGroups", 0); + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs new file mode 100644 index 000000000000..e5b8501977e2 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for NotificationOperatorType. + /// + public static class NotificationOperatorType + { + public const string EqualTo = "EqualTo"; + public const string GreaterThan = "GreaterThan"; + public const string GreaterThanOrEqualTo = "GreaterThanOrEqualTo"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..bed6fe698a61 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Cost management REST API operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation}. + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name: {provider}/{resource}/{operation}. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..b8731cf3636b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: + /// Microsoft.CostManagement. + /// Resource on which the operation is + /// performed: Dimensions, Query. + /// Operation type: Read, write, delete, + /// etc. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft.CostManagement. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource on which the operation is performed: Dimensions, + /// Query. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets operation type: Read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs new file mode 100644 index 000000000000..04835817077f --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for OperatorType. + /// + public static class OperatorType + { + public const string In = "In"; + public const string Contains = "Contains"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..a431dbedbb4d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs new file mode 100644 index 000000000000..7761b4a3ea87 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Each pivot must contain a 'type' and 'name'. + /// + public partial class PivotProperties + { + /// + /// Initializes a new instance of the PivotProperties class. + /// + public PivotProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PivotProperties class. + /// + /// Data type to show in view. Possible values + /// include: 'Dimension', 'TagKey' + /// Data field to show in view. + public PivotProperties(string type = default(string), string name = default(string)) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type to show in view. Possible values include: + /// 'Dimension', 'TagKey' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets data field to show in view. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs new file mode 100644 index 000000000000..01ce2abd7bb7 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for PivotTypeType. + /// + public static class PivotTypeType + { + public const string Dimension = "Dimension"; + public const string TagKey = "TagKey"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..d38be096c86a --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string)) + { + Id = id; + Name = name; + Type = type; + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets eTag of the resource. To handle concurrent update + /// scenario, this field will be used to determine whether the user is + /// updating the latest version or not. + /// + [JsonProperty(PropertyName = "eTag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs new file mode 100644 index 000000000000..0f65a66d0699 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The aggregation expression to be used in the report. + /// + public partial class ReportConfigAggregation + { + /// + /// Initializes a new instance of the ReportConfigAggregation class. + /// + public ReportConfigAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigAggregation class. + /// + /// The name of the column to aggregate. + public ReportConfigAggregation(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ReportConfigAggregation class. + /// + static ReportConfigAggregation() + { + Function = "Sum"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the column to aggregate. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The name of the aggregation function to use. + /// + [JsonProperty(PropertyName = "function")] + public static string Function { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs new file mode 100644 index 000000000000..1f891b17234d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for ReportConfigColumnType. + /// + public static class ReportConfigColumnType + { + public const string Tag = "Tag"; + public const string Dimension = "Dimension"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs new file mode 100644 index 000000000000..61dc4e845a91 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The comparison expression to be used in the report. + /// + public partial class ReportConfigComparisonExpression + { + /// + /// Initializes a new instance of the ReportConfigComparisonExpression + /// class. + /// + public ReportConfigComparisonExpression() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigComparisonExpression + /// class. + /// + /// The name of the column to use in + /// comparison. + /// The operator to use for comparison. + /// Possible values include: 'In', 'Contains' + /// Array of values to use for comparison + public ReportConfigComparisonExpression(string name, string operatorProperty, IList values) + { + Name = name; + OperatorProperty = operatorProperty; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the column to use in comparison. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the operator to use for comparison. Possible values + /// include: 'In', 'Contains' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets array of values to use for comparison + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + if (Values != null) + { + if (Values.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "Values", 1); + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs new file mode 100644 index 000000000000..605ea38bf627 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs @@ -0,0 +1,156 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The definition of data present in the report. + /// + public partial class ReportConfigDataset + { + /// + /// Initializes a new instance of the ReportConfigDataset class. + /// + public ReportConfigDataset() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigDataset class. + /// + /// The granularity of rows in the report. + /// Possible values include: 'Daily', 'Monthly' + /// Has configuration information for the + /// data in the report. The configuration will be ignored if + /// aggregation and grouping are provided. + /// Dictionary of aggregation expression to + /// use in the report. The key of each item in the dictionary is the + /// alias for the aggregated column. Report can have up to 2 + /// aggregation clauses. + /// Array of group by expression to use in the + /// report. Report can have up to 2 group by clauses. + /// Array of order by expression to use in the + /// report. + /// Has filter expression to use in the + /// report. + public ReportConfigDataset(string granularity = default(string), ReportConfigDatasetConfiguration configuration = default(ReportConfigDatasetConfiguration), IDictionary aggregation = default(IDictionary), IList grouping = default(IList), IList sorting = default(IList), ReportConfigFilter filter = default(ReportConfigFilter)) + { + Granularity = granularity; + Configuration = configuration; + Aggregation = aggregation; + Grouping = grouping; + Sorting = sorting; + Filter = filter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the granularity of rows in the report. Possible values + /// include: 'Daily', 'Monthly' + /// + [JsonProperty(PropertyName = "granularity")] + public string Granularity { get; set; } + + /// + /// Gets or sets has configuration information for the data in the + /// report. The configuration will be ignored if aggregation and + /// grouping are provided. + /// + [JsonProperty(PropertyName = "configuration")] + public ReportConfigDatasetConfiguration Configuration { get; set; } + + /// + /// Gets or sets dictionary of aggregation expression to use in the + /// report. The key of each item in the dictionary is the alias for the + /// aggregated column. Report can have up to 2 aggregation clauses. + /// + [JsonProperty(PropertyName = "aggregation")] + public IDictionary Aggregation { get; set; } + + /// + /// Gets or sets array of group by expression to use in the report. + /// Report can have up to 2 group by clauses. + /// + [JsonProperty(PropertyName = "grouping")] + public IList Grouping { get; set; } + + /// + /// Gets or sets array of order by expression to use in the report. + /// + [JsonProperty(PropertyName = "sorting")] + public IList Sorting { get; set; } + + /// + /// Gets or sets has filter expression to use in the report. + /// + [JsonProperty(PropertyName = "filter")] + public ReportConfigFilter Filter { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Aggregation != null) + { + foreach (var valueElement in Aggregation.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (Grouping != null) + { + if (Grouping.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "Grouping", 2); + } + foreach (var element in Grouping) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Sorting != null) + { + foreach (var element1 in Sorting) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Filter != null) + { + Filter.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs new file mode 100644 index 000000000000..eeb8dc20dc98 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration of dataset in the report. + /// + public partial class ReportConfigDatasetConfiguration + { + /// + /// Initializes a new instance of the ReportConfigDatasetConfiguration + /// class. + /// + public ReportConfigDatasetConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigDatasetConfiguration + /// class. + /// + /// Array of column names to be included in the + /// report. Any valid report column name is allowed. If not provided, + /// then report includes all columns. + public ReportConfigDatasetConfiguration(IList columns = default(IList)) + { + Columns = columns; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of column names to be included in the report. + /// Any valid report column name is allowed. If not provided, then + /// report includes all columns. + /// + [JsonProperty(PropertyName = "columns")] + public IList Columns { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs new file mode 100644 index 000000000000..501c07680265 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The filter expression to be used in the report. + /// + public partial class ReportConfigFilter + { + /// + /// Initializes a new instance of the ReportConfigFilter class. + /// + public ReportConfigFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigFilter class. + /// + /// The logical "AND" expression. Must have at least + /// 2 items. + /// The logical "OR" expression. Must have at least 2 + /// items. + /// The logical "NOT" expression. + /// Has comparison expression for a + /// dimension + /// Has comparison expression for a tag + public ReportConfigFilter(IList and = default(IList), IList or = default(IList), ReportConfigFilter not = default(ReportConfigFilter), ReportConfigComparisonExpression dimension = default(ReportConfigComparisonExpression), ReportConfigComparisonExpression tag = default(ReportConfigComparisonExpression)) + { + And = and; + Or = or; + Not = not; + Dimension = dimension; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the logical "AND" expression. Must have at least 2 + /// items. + /// + [JsonProperty(PropertyName = "and")] + public IList And { get; set; } + + /// + /// Gets or sets the logical "OR" expression. Must have at least 2 + /// items. + /// + [JsonProperty(PropertyName = "or")] + public IList Or { get; set; } + + /// + /// Gets or sets the logical "NOT" expression. + /// + [JsonProperty(PropertyName = "not")] + public ReportConfigFilter Not { get; set; } + + /// + /// Gets or sets has comparison expression for a dimension + /// + [JsonProperty(PropertyName = "dimension")] + public ReportConfigComparisonExpression Dimension { get; set; } + + /// + /// Gets or sets has comparison expression for a tag + /// + [JsonProperty(PropertyName = "tag")] + public ReportConfigComparisonExpression Tag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (And != null) + { + if (And.Count < 2) + { + throw new ValidationException(ValidationRules.MinItems, "And", 2); + } + foreach (var element in And) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Or != null) + { + if (Or.Count < 2) + { + throw new ValidationException(ValidationRules.MinItems, "Or", 2); + } + foreach (var element1 in Or) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Not != null) + { + Not.Validate(); + } + if (Dimension != null) + { + Dimension.Validate(); + } + if (Tag != null) + { + Tag.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs new file mode 100644 index 000000000000..ce12933eb064 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The group by expression to be used in the report. + /// + public partial class ReportConfigGrouping + { + /// + /// Initializes a new instance of the ReportConfigGrouping class. + /// + public ReportConfigGrouping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigGrouping class. + /// + /// Has type of the column to group. Possible values + /// include: 'Tag', 'Dimension' + /// The name of the column to group. This version + /// supports subscription lowest possible grain. + public ReportConfigGrouping(string type, string name) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets has type of the column to group. Possible values + /// include: 'Tag', 'Dimension' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the column to group. This version supports + /// subscription lowest possible grain. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs new file mode 100644 index 000000000000..ae83953a20e4 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The order by expression to be used in the report. + /// + public partial class ReportConfigSorting + { + /// + /// Initializes a new instance of the ReportConfigSorting class. + /// + public ReportConfigSorting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigSorting class. + /// + /// The name of the column to sort. + /// Direction of sort. Possible values include: + /// 'Ascending', 'Descending' + public ReportConfigSorting(string name, string direction = default(string)) + { + Direction = direction; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets direction of sort. Possible values include: + /// 'Ascending', 'Descending' + /// + [JsonProperty(PropertyName = "direction")] + public string Direction { get; set; } + + /// + /// Gets or sets the name of the column to sort. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs new file mode 100644 index 000000000000..2c4dabb85457 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The start and end date for pulling data for the report. + /// + public partial class ReportConfigTimePeriod + { + /// + /// Initializes a new instance of the ReportConfigTimePeriod class. + /// + public ReportConfigTimePeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigTimePeriod class. + /// + /// The start date to pull data + /// from. + /// The end date to pull data to. + public ReportConfigTimePeriod(System.DateTime fromProperty, System.DateTime to) + { + FromProperty = fromProperty; + To = to; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start date to pull data from. + /// + [JsonProperty(PropertyName = "from")] + public System.DateTime FromProperty { get; set; } + + /// + /// Gets or sets the end date to pull data to. + /// + [JsonProperty(PropertyName = "to")] + public System.DateTime To { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..c6dbf27e4db3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + public Resource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs new file mode 100644 index 000000000000..daeac5d6a1f9 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Scope model definition + /// + public partial class Scope + { + /// + /// Initializes a new instance of the Scope class. + /// + public Scope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Scope class. + /// + /// Scope id + /// Scope name + /// Scope type + public Scope(string id = default(string), string name = default(string), string type = default(string), Scope childScope = default(Scope)) + { + Id = id; + Name = name; + Type = type; + ChildScope = childScope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scope id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets scope name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets scope type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "childScope")] + public Scope ChildScope { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs new file mode 100644 index 000000000000..6db6f5f3cb8a --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for TimeGrainType. + /// + public static class TimeGrainType + { + public const string Monthly = "Monthly"; + public const string Quarterly = "Quarterly"; + public const string Annually = "Annually"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs new file mode 100644 index 000000000000..9dd044fc073d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + + /// + /// Defines values for TimeframeType. + /// + public static class TimeframeType + { + public const string WeekToDate = "WeekToDate"; + public const string MonthToDate = "MonthToDate"; + public const string YearToDate = "YearToDate"; + public const string Custom = "Custom"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs new file mode 100644 index 000000000000..af80e43c9a91 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs @@ -0,0 +1,245 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// States and configurations of Cost Analysis. + /// + [Rest.Serialization.JsonTransformation] + public partial class View : ProxyResource + { + /// + /// Initializes a new instance of the View class. + /// + public View() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the View class. + /// + /// The time frame for pulling data for the + /// report. If custom, then a specific time period must be provided. + /// Possible values include: 'WeekToDate', 'MonthToDate', 'YearToDate', + /// 'Custom' + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + /// User input name of the view. + /// Required. + /// Cost Management scope to save the view on. This + /// includes 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for ExternalBillingAccount scope, and + /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for ExternalSubscription scope. + /// Date the user created this view. + /// Date when the user last modified this + /// view. + /// Has time period for pulling data for the + /// report. + /// Has definition for data in this report + /// config. + /// Chart type of the main view in Cost Analysis. + /// Required. Possible values include: 'Area', 'Line', 'StackedColumn', + /// 'GroupedColumn', 'Table' + /// Show costs accumulated over time. + /// Possible values include: 'true', 'false' + /// Metric to use when displaying costs. Possible + /// values include: 'ActualCost', 'AmortizedCost', 'AHUB' + /// List of KPIs to show in Cost Analysis + /// UI. + /// Configuration of 3 sub-views in the Cost + /// Analysis UI. + public View(string timeframe, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string displayName = default(string), string scope = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), ReportConfigTimePeriod timePeriod = default(ReportConfigTimePeriod), ReportConfigDataset dataset = default(ReportConfigDataset), string chart = default(string), string accumulated = default(string), string metric = default(string), IList kpis = default(IList), IList pivots = default(IList)) + : base(id, name, type, eTag) + { + DisplayName = displayName; + Scope = scope; + CreatedOn = createdOn; + ModifiedOn = modifiedOn; + Timeframe = timeframe; + TimePeriod = timePeriod; + Dataset = dataset; + Chart = chart; + Accumulated = accumulated; + Metric = metric; + Kpis = kpis; + Pivots = pivots; + CustomInit(); + } + /// + /// Static constructor for View class. + /// + static View() + { + ViewType = "Usage"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user input name of the view. Required. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets cost Management scope to save the view on. This + /// includes 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for ExternalBillingAccount scope, and + /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for ExternalSubscription scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; set; } + + /// + /// Gets date the user created this view. + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets date when the user last modified this view. + /// + [JsonProperty(PropertyName = "properties.modifiedOn")] + public System.DateTime? ModifiedOn { get; private set; } + + /// + /// Gets or sets the time frame for pulling data for the report. If + /// custom, then a specific time period must be provided. Possible + /// values include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom' + /// + [JsonProperty(PropertyName = "properties.query.timeframe")] + public string Timeframe { get; set; } + + /// + /// Gets or sets has time period for pulling data for the report. + /// + [JsonProperty(PropertyName = "properties.query.timePeriod")] + public ReportConfigTimePeriod TimePeriod { get; set; } + + /// + /// Gets or sets has definition for data in this report config. + /// + [JsonProperty(PropertyName = "properties.query.dataset")] + public ReportConfigDataset Dataset { get; set; } + + /// + /// Gets or sets chart type of the main view in Cost Analysis. + /// Required. Possible values include: 'Area', 'Line', 'StackedColumn', + /// 'GroupedColumn', 'Table' + /// + [JsonProperty(PropertyName = "properties.chart")] + public string Chart { get; set; } + + /// + /// Gets or sets show costs accumulated over time. Possible values + /// include: 'true', 'false' + /// + [JsonProperty(PropertyName = "properties.accumulated")] + public string Accumulated { get; set; } + + /// + /// Gets or sets metric to use when displaying costs. Possible values + /// include: 'ActualCost', 'AmortizedCost', 'AHUB' + /// + [JsonProperty(PropertyName = "properties.metric")] + public string Metric { get; set; } + + /// + /// Gets or sets list of KPIs to show in Cost Analysis UI. + /// + [JsonProperty(PropertyName = "properties.kpis")] + public IList Kpis { get; set; } + + /// + /// Gets or sets configuration of 3 sub-views in the Cost Analysis UI. + /// + [JsonProperty(PropertyName = "properties.pivots")] + public IList Pivots { get; set; } + + /// + /// The type of the report. Usage represents actual usage, forecast + /// represents forecasted data and UsageAndForecast represents both + /// usage and forecasted data. Actual usage and forecasted data can be + /// differentiated based on dates. + /// + [JsonProperty(PropertyName = "properties.query.type")] + public static string ViewType { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Timeframe == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timeframe"); + } + if (TimePeriod != null) + { + TimePeriod.Validate(); + } + if (Dataset != null) + { + Dataset.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs new file mode 100644 index 000000000000..72bbdd61c1c1 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..033cb34492ea --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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 IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs new file mode 100644 index 000000000000..a080a4adaaa0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs @@ -0,0 +1,30 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_CostManagementClient + { + get + { + return new Tuple[] + { + new Tuple("CostManagement", "Budget", "2019-04-01-preview"), + new Tuple("CostManagement", "Budgets", "2019-04-01-preview"), + new Tuple("CostManagement", "Operations", "2019-04-01-preview"), + new Tuple("CostManagement", "Views", "2019-04-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs new file mode 100644 index 000000000000..f13c10f809fc --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs @@ -0,0 +1,1944 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ViewsOperations operations. + /// + internal partial class ViewsOperations : IServiceOperations, IViewsOperations + { + /// + /// Initializes a new instance of the ViewsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ViewsOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// 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>> ListByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Gets the view by view name. + /// + /// + /// + /// View name + /// + /// + /// 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> GetWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateWithHttpMessagesAsync(string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("PUT"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// View name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("DELETE"); + _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 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// 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> GetByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("PUT"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("DELETE"); + _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 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// 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>> ListByScopeNextWithHttpMessagesAsync(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, "ListByScopeNext", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs new file mode 100644 index 000000000000..6d5ef2286b39 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs @@ -0,0 +1,563 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ViewsOperations. + /// + public static partial class ViewsOperationsExtensions + { + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IViewsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IViewsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + public static IPage ListByScope(this IViewsOperations operations, string scope) + { + return operations.ListByScopeAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByScopeAsync(this IViewsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByScopeWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the view by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + public static View Get(this IViewsOperations operations, string viewName) + { + return operations.GetAsync(viewName).GetAwaiter().GetResult(); + } + + /// + /// Gets the view by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IViewsOperations operations, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(viewName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + public static View CreateOrUpdate(this IViewsOperations operations, string viewName, View parameters) + { + return operations.CreateOrUpdateAsync(viewName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IViewsOperations operations, string viewName, View parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(viewName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + public static void Delete(this IViewsOperations operations, string viewName) + { + operations.DeleteAsync(viewName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IViewsOperations operations, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(viewName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + public static View GetByScope(this IViewsOperations operations, string scope, string viewName) + { + return operations.GetByScopeAsync(scope, viewName).GetAwaiter().GetResult(); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task GetByScopeAsync(this IViewsOperations operations, string scope, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByScopeWithHttpMessagesAsync(scope, viewName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + public static View CreateOrUpdateByScope(this IViewsOperations operations, string scope, string viewName, View parameters) + { + return operations.CreateOrUpdateByScopeAsync(scope, viewName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateByScopeAsync(this IViewsOperations operations, string scope, string viewName, View parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateByScopeWithHttpMessagesAsync(scope, viewName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + public static void DeleteByScope(this IViewsOperations operations, string scope, string viewName) + { + operations.DeleteByScopeAsync(scope, viewName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByScopeAsync(this IViewsOperations operations, string scope, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteByScopeWithHttpMessagesAsync(scope, viewName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IViewsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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 IViewsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByScopeNext(this IViewsOperations operations, string nextPageLink) + { + return operations.ListByScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByScopeNextAsync(this IViewsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} From aec0f69bda87c83b423f34b65fc6a63aa08c0ec1 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2019 06:55:41 +0000 Subject: [PATCH 4/5] [AutoPR Microsoft.Azure.Management.Subscription] [Hub Generated] Review request for Microsoft.Subscription to add version preview/2018-11-01-preview (#250) * Update swagger_to_sdk_config.json * Generated from 12cf92bb36d2c853720ea3480580c9ef415f9984 Corrected the createSubscriptionUnderBillingProfile example with correct profile name. --- .../src/Generated/ISubscriptionClient.cs | 8 +- .../ISubscriptionFactoryOperations.cs | 60 -- .../src/Generated/ISubscriptionsOperations.cs | 188 +++++ ...ModernCspSubscriptionCreationParameters.cs | 103 +++ ...bscriptionsCreateCspSubscriptionHeaders.cs | 66 ++ ...SubscriptionsCreateSubscriptionHeaders.cs} | 10 +- ...eSubscriptionUnderBillingProfileHeaders.cs | 66 ++ .../Generated/SdkInfo_SubscriptionClient.cs | 13 +- .../src/Generated/SubscriptionClient.cs | 10 +- .../SubscriptionFactoryOperations.cs | 244 ------ ...SubscriptionFactoryOperationsExtensions.cs | 100 --- .../src/Generated/SubscriptionsOperations.cs | 746 ++++++++++++++++++ .../SubscriptionsOperationsExtensions.cs | 316 ++++++++ 13 files changed, 1500 insertions(+), 430 deletions(-) create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs rename sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/{SubscriptionFactoryCreateSubscriptionHeaders.cs => SubscriptionsCreateSubscriptionHeaders.cs} (83%) create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs index 97083c595945..db13bc4ec97d 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs @@ -70,14 +70,14 @@ public partial interface ISubscriptionClient : System.IDisposable ISubscriptionOperationOperations SubscriptionOperation { get; } /// - /// Gets the ISubscriptionFactoryOperations. + /// Gets the ISubscriptionOperations. /// - ISubscriptionFactoryOperations SubscriptionFactory { get; } + ISubscriptionOperations SubscriptionOperations { get; } /// - /// Gets the ISubscriptionOperations. + /// Gets the ISubscriptionFactoryOperations. /// - ISubscriptionOperations SubscriptionOperations { get; } + ISubscriptionFactoryOperations SubscriptionFactory { get; } /// /// Gets the IOperations. diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs index a4b1ac267d9a..c0afa0489690 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs @@ -23,36 +23,6 @@ namespace Microsoft.Azure.Management.Subscription /// public partial interface ISubscriptionFactoryOperations { - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates an Azure subscription /// @@ -80,36 +50,6 @@ public partial interface ISubscriptionFactoryOperations /// Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Creates an Azure subscription /// /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs index ef734314a95c..d0b0d1db2c8a 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs @@ -93,6 +93,100 @@ public partial interface ISubscriptionsOperations /// Task> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new WebDirect or EA Azure subscription + /// (under billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which + /// you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all available geo-locations. /// /// @@ -161,6 +255,100 @@ public partial interface ISubscriptionsOperations /// Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new WebDirect or EA Azure subscription + /// (under billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which + /// you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all subscriptions for a tenant. /// /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs new file mode 100644 index 000000000000..1186b398cec0 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters required to create a new CSP subscription. + /// + public partial class ModernCspSubscriptionCreationParameters + { + /// + /// Initializes a new instance of the + /// ModernCspSubscriptionCreationParameters class. + /// + public ModernCspSubscriptionCreationParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ModernCspSubscriptionCreationParameters class. + /// + /// The friendly name of the + /// subscription. + /// The SKU ID of the Azure plan. Azure plan + /// determines the pricing and service-level agreement of the + /// subscription. Use 001 for Microsoft Azure Plan and 002 for + /// Microsoft Azure Plan for DevTest. + /// Reseller ID, basically MPN Id. + /// Service provider ID, basically MPN + /// Id. + public ModernCspSubscriptionCreationParameters(string displayName, string skuId, string resellerId = default(string), string serviceProviderId = default(string)) + { + DisplayName = displayName; + SkuId = skuId; + ResellerId = resellerId; + ServiceProviderId = serviceProviderId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the friendly name of the subscription. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the SKU ID of the Azure plan. Azure plan determines + /// the pricing and service-level agreement of the subscription. Use + /// 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for + /// DevTest. + /// + [JsonProperty(PropertyName = "skuId")] + public string SkuId { get; set; } + + /// + /// Gets or sets reseller ID, basically MPN Id. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; set; } + + /// + /// Gets or sets service provider ID, basically MPN Id. + /// + [JsonProperty(PropertyName = "serviceProviderId")] + public string ServiceProviderId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (SkuId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SkuId"); + } + } + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs new file mode 100644 index 000000000000..812b4ae5179f --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateCspSubscription operation. + /// + public partial class SubscriptionsCreateCspSubscriptionHeaders + { + /// + /// Initializes a new instance of the + /// SubscriptionsCreateCspSubscriptionHeaders class. + /// + public SubscriptionsCreateCspSubscriptionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubscriptionsCreateCspSubscriptionHeaders class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public SubscriptionsCreateCspSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs similarity index 83% rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs index fa602c14e1f7..49970cd58d2a 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs @@ -16,27 +16,27 @@ namespace Microsoft.Azure.Management.Subscription.Models /// /// Defines headers for CreateSubscription operation. /// - public partial class SubscriptionFactoryCreateSubscriptionHeaders + public partial class SubscriptionsCreateSubscriptionHeaders { /// /// Initializes a new instance of the - /// SubscriptionFactoryCreateSubscriptionHeaders class. + /// SubscriptionsCreateSubscriptionHeaders class. /// - public SubscriptionFactoryCreateSubscriptionHeaders() + public SubscriptionsCreateSubscriptionHeaders() { CustomInit(); } /// /// Initializes a new instance of the - /// SubscriptionFactoryCreateSubscriptionHeaders class. + /// SubscriptionsCreateSubscriptionHeaders class. /// /// GET this URL to retrieve the status of the /// asynchronous operation. /// The amount of delay to use while the /// status of the operation is checked. The value is expressed in /// seconds. - public SubscriptionFactoryCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) + public SubscriptionsCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs new file mode 100644 index 000000000000..c1cdc93a9e7d --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Subscription.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateSubscriptionUnderBillingProfile operation. + /// + public partial class SubscriptionsCreateSubscriptionUnderBillingProfileHeaders + { + /// + /// Initializes a new instance of the + /// SubscriptionsCreateSubscriptionUnderBillingProfileHeaders class. + /// + public SubscriptionsCreateSubscriptionUnderBillingProfileHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubscriptionsCreateSubscriptionUnderBillingProfileHeaders class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public SubscriptionsCreateSubscriptionUnderBillingProfileHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs index d9fde8d12ae0..6b2e01a5db05 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs @@ -20,7 +20,7 @@ public static IEnumerable> ApiInfo_SubscriptionCli return new Tuple[] { new Tuple("Billing", "SubscriptionFactory", "2018-03-01-preview"), - new Tuple("Billing", "SubscriptionFactory", "2018-11-01-preview"), + new Tuple("Billing", "Subscriptions", "2018-11-01-preview"), new Tuple("Subscription", "Operations", "2018-03-01-preview"), new Tuple("Subscription", "SubscriptionOperation", "2018-11-01-preview"), new Tuple("Subscription", "SubscriptionOperations", "2018-03-01-preview"), @@ -30,16 +30,5 @@ public static IEnumerable> ApiInfo_SubscriptionCli }.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/subscription/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\github2\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "ae48ce6edc05501e9b78d93d6e36862599cdedb5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs index 5f732c5369b0..f56db1e0aa24 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs @@ -75,14 +75,14 @@ public partial class SubscriptionClient : ServiceClient, ISu public virtual ISubscriptionOperationOperations SubscriptionOperation { get; private set; } /// - /// Gets the ISubscriptionFactoryOperations. + /// Gets the ISubscriptionOperations. /// - public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; } + public virtual ISubscriptionOperations SubscriptionOperations { get; private set; } /// - /// Gets the ISubscriptionOperations. + /// Gets the ISubscriptionFactoryOperations. /// - public virtual ISubscriptionOperations SubscriptionOperations { get; private set; } + public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; } /// /// Gets the IOperations. @@ -337,8 +337,8 @@ private void Initialize() { Subscriptions = new SubscriptionsOperations(this); SubscriptionOperation = new SubscriptionOperationOperations(this); - SubscriptionFactory = new SubscriptionFactoryOperations(this); SubscriptionOperations = new SubscriptionOperations(this); + SubscriptionFactory = new SubscriptionFactoryOperations(this); Operations = new Operations(this); Tenants = new TenantsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs index 3f038282e47c..eb2d38a3a912 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs @@ -50,33 +50,6 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) /// public SubscriptionClient Client { get; private set; } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Creates an Azure subscription /// @@ -100,223 +73,6 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - if (body != null) - { - body.Validate(); - } - string apiVersion = "2018-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - 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("POST"); - _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; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // 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 && (int)_statusCode != 202) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - 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); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Creates an Azure subscription /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs index edd23ced2cf6..35565c9e7e3b 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs @@ -21,56 +21,6 @@ namespace Microsoft.Azure.Management.Subscription /// public static partial class SubscriptionFactoryOperationsExtensions { - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) - { - return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The cancellation token. - /// - public static async Task CreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates an Azure subscription /// @@ -113,56 +63,6 @@ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(t } } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) - { - return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates an Azure subscription /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs index c5b50d71fd7a..f388b676e6be 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs @@ -589,6 +589,91 @@ internal SubscriptionsOperations(SubscriptionClient client) return _result; } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Gets all available geo-locations. /// @@ -1119,6 +1204,667 @@ internal SubscriptionsOperations(SubscriptionClient client) return _result; } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("POST"); + _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; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscriptionUnderBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("POST"); + _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; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateCspSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("POST"); + _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; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets all subscriptions for a tenant. /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs index c403fe1a5aff..3e26b468ba75 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs @@ -131,6 +131,164 @@ public static EnabledSubscriptionId Enable(this ISubscriptionsOperations operati } } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateSubscription(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateSubscriptionUnderBillingProfile(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.CreateSubscriptionUnderBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateSubscriptionUnderBillingProfileAsync(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.CreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateCspSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all available geo-locations. /// @@ -237,6 +395,164 @@ public static IPage List(this ISubscriptionsOperations operat } } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateSubscriptionUnderBillingProfile(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.BeginCreateSubscriptionUnderBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateSubscriptionUnderBillingProfileAsync(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.BeginCreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateCspSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all subscriptions for a tenant. /// From 07b2e5360431a45617944ef67fefe11b9a1c4766 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sat, 19 Oct 2019 21:27:32 +0000 Subject: [PATCH 5/5] Generated from 4c1f44ffb855c787db9602f56b76486434e014c7 Add default responses to new APIs. --- .../Generated/AvailabilitySetsOperations.cs | 14 +- .../src/Generated/ComputeManagementClient.cs | 12 + .../DedicatedHostGroupsOperations.cs | 12 +- .../src/Generated/DedicatedHostsOperations.cs | 10 +- .../Generated/DiskEncryptionSetsOperations.cs | 1681 +++++++++++++++++ .../DiskEncryptionSetsOperationsExtensions.cs | 503 +++++ .../src/Generated/DisksOperations.cs | 16 +- .../src/Generated/IComputeManagementClient.cs | 10 + .../IDiskEncryptionSetsOperations.cs | 318 ++++ .../src/Generated/IResourceSkusOperations.cs | 5 +- ...alMachineScaleSetVMExtensionsOperations.cs | 289 +++ .../IVirtualMachineScaleSetVMsOperations.cs | 6 +- .../IVirtualMachineScaleSetsOperations.cs | 6 +- .../Generated/IVirtualMachinesOperations.cs | 56 +- .../src/Generated/ImagesOperations.cs | 12 +- .../src/Generated/LogAnalyticsOperations.cs | 4 +- .../Models/AutomaticRepairsPolicy.cs | 84 + .../src/Generated/Models/DataDisk.cs | 31 +- .../src/Generated/Models/Disk.cs | 17 +- .../src/Generated/Models/DiskEncryptionSet.cs | 116 ++ .../Models/DiskEncryptionSetIdentityType.cs | 21 + .../Models/DiskEncryptionSetParameters.cs | 50 + .../Models/DiskEncryptionSetUpdate.cs | 75 + .../src/Generated/Models/Encryption.cs | 79 + .../src/Generated/Models/EncryptionType.cs | 29 + .../src/Generated/Models/ImageDataDisk.cs | 63 +- .../src/Generated/Models/ImageDisk.cs | 126 ++ .../src/Generated/Models/ImageOSDisk.cs | 69 +- .../Generated/Models/ManagedDiskParameters.cs | 12 +- .../src/Generated/Models/OSProfile.cs | 13 +- .../src/Generated/Models/ResourceIdentity.cs | 83 + .../src/Generated/Models/ScaleInPolicy.cs | 92 + .../src/Generated/Models/Snapshot.cs | 17 +- .../Models/VirtualMachineScaleSet.cs | 23 +- .../Models/VirtualMachineScaleSetDataDisk.cs | 29 +- ...ualMachineScaleSetManagedDiskParameters.cs | 12 +- ...ineScaleSetPublicIPAddressConfiguration.cs | 17 +- .../VirtualMachineScaleSetScaleInRules.cs | 23 + .../Models/VirtualMachineScaleSetUpdate.cs | 38 +- ...tualMachineScaleSetUpdateNetworkProfile.cs | 16 +- .../src/Generated/Operations.cs | 2 +- .../ProximityPlacementGroupsOperations.cs | 12 +- .../src/Generated/ResourceSkusOperations.cs | 10 +- .../ResourceSkusOperationsExtensions.cs | 14 +- .../SdkInfo_ComputeManagementClient.cs | 53 +- .../src/Generated/SnapshotsOperations.cs | 16 +- .../src/Generated/UsageOperations.cs | 2 +- ...VirtualMachineExtensionImagesOperations.cs | 6 +- .../VirtualMachineExtensionsOperations.cs | 10 +- .../VirtualMachineImagesOperations.cs | 10 +- .../VirtualMachineRunCommandsOperations.cs | 4 +- ...tualMachineScaleSetExtensionsOperations.cs | 8 +- ...achineScaleSetRollingUpgradesOperations.cs | 8 +- ...alMachineScaleSetVMExtensionsOperations.cs | 1241 ++++++++++++ ...caleSetVMExtensionsOperationsExtensions.cs | 467 +++++ .../VirtualMachineScaleSetVMsOperations.cs | 34 +- ...lMachineScaleSetVMsOperationsExtensions.cs | 12 +- .../VirtualMachineScaleSetsOperations.cs | 46 +- ...ualMachineScaleSetsOperationsExtensions.cs | 12 +- .../VirtualMachineSizesOperations.cs | 2 +- .../Generated/VirtualMachinesOperations.cs | 252 ++- .../VirtualMachinesOperationsExtensions.cs | 102 +- 62 files changed, 6089 insertions(+), 323 deletions(-) create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentity.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs create mode 100644 sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs index a4b8f9ca052f..2542025d20c8 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/AvailabilitySetsOperations.cs @@ -105,7 +105,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -511,7 +511,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -687,7 +687,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -870,7 +870,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1058,7 +1058,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1251,7 +1251,7 @@ internal AvailabilitySetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs index 66afdd540b9f..49a2c3bd0bf1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ComputeManagementClient.cs @@ -146,6 +146,11 @@ public partial class ComputeManagementClient : ServiceClient public virtual IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; private set; } + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + public virtual IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; private set; } + /// /// Gets the IVirtualMachineScaleSetVMsOperations. /// @@ -176,6 +181,11 @@ public partial class ComputeManagementClient : ServiceClient public virtual ISnapshotsOperations Snapshots { get; private set; } + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + public virtual IDiskEncryptionSetsOperations DiskEncryptionSets { get; private set; } + /// /// Gets the IGalleriesOperations. /// @@ -462,12 +472,14 @@ private void Initialize() VirtualMachineScaleSets = new VirtualMachineScaleSetsOperations(this); VirtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsOperations(this); VirtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesOperations(this); + VirtualMachineScaleSetVMExtensions = new VirtualMachineScaleSetVMExtensionsOperations(this); VirtualMachineScaleSetVMs = new VirtualMachineScaleSetVMsOperations(this); LogAnalytics = new LogAnalyticsOperations(this); VirtualMachineRunCommands = new VirtualMachineRunCommandsOperations(this); ResourceSkus = new ResourceSkusOperations(this); Disks = new DisksOperations(this); Snapshots = new SnapshotsOperations(this); + DiskEncryptionSets = new DiskEncryptionSetsOperations(this); Galleries = new GalleriesOperations(this); GalleryImages = new GalleryImagesOperations(this); GalleryImageVersions = new GalleryImageVersionsOperations(this); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs index e7bb78aad720..5461090312a6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostGroupsOperations.cs @@ -107,7 +107,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -333,7 +333,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -531,7 +531,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -707,7 +707,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -896,7 +896,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1076,7 +1076,7 @@ internal DedicatedHostGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs index 770981ee7614..c866de02c873 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DedicatedHostsOperations.cs @@ -186,7 +186,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -389,7 +389,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -601,7 +601,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -836,7 +836,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1043,7 +1043,7 @@ internal DedicatedHostsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs new file mode 100644 index 000000000000..4d9815d21f5c --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperations.cs @@ -0,0 +1,1681 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskEncryptionSetsOperations operations. + /// + internal partial class DiskEncryptionSetsOperations : IServiceOperations, IDiskEncryptionSetsOperations + { + /// + /// Initializes a new instance of the DiskEncryptionSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskEncryptionSetsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + if (diskEncryptionSet != null) + { + diskEncryptionSet.Validate(); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("PUT"); + _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; + if(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 201) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + if (diskEncryptionSet == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSet"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("diskEncryptionSet", diskEncryptionSet); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("PATCH"); + _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; + if(diskEncryptionSet != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskEncryptionSet, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 202) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (diskEncryptionSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskEncryptionSetName"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskEncryptionSetName", diskEncryptionSetName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskEncryptionSetName}", System.Uri.EscapeDataString(diskEncryptionSetName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("DELETE"); + _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 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs new file mode 100644 index 000000000000..222c6cde9788 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DiskEncryptionSetsOperationsExtensions.cs @@ -0,0 +1,503 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DiskEncryptionSetsOperations. + /// + public static partial class DiskEncryptionSetsOperationsExtensions + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet CreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet Update(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.UpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static DiskEncryptionSet Get(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + return operations.GetAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void Delete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.DeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IDiskEncryptionSetsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDiskEncryptionSetsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDiskEncryptionSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + public static DiskEncryptionSet BeginCreateOrUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a disk encryption set + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk encryption + /// set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + public static DiskEncryptionSet BeginUpdate(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) + { + return operations.BeginUpdateAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet).GetAwaiter().GetResult(); + } + + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, diskEncryptionSet, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + public static void BeginDelete(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName) + { + operations.BeginDeleteAsync(resourceGroupName, diskEncryptionSetName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a disk encryption set. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name can't + /// be changed after the disk encryption set is created. Supported characters + /// for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 + /// characters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskEncryptionSetsOperations operations, string resourceGroupName, string diskEncryptionSetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskEncryptionSetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDiskEncryptionSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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 IDiskEncryptionSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs index a5857b77def1..ce7e39d9c424 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/DisksOperations.cs @@ -150,7 +150,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,7 +539,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -793,7 +793,7 @@ internal DisksOperations(ComputeManagementClient client) { disk.Validate(); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1021,7 +1021,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "disk"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1239,7 +1239,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1428,7 +1428,7 @@ internal DisksOperations(ComputeManagementClient client) { grantAccessData.Validate(); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1628,7 +1628,7 @@ internal DisksOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs index 042e0d41f0e4..d0d9b116ec47 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IComputeManagementClient.cs @@ -141,6 +141,11 @@ public partial interface IComputeManagementClient : System.IDisposable /// IVirtualMachineScaleSetRollingUpgradesOperations VirtualMachineScaleSetRollingUpgrades { get; } + /// + /// Gets the IVirtualMachineScaleSetVMExtensionsOperations. + /// + IVirtualMachineScaleSetVMExtensionsOperations VirtualMachineScaleSetVMExtensions { get; } + /// /// Gets the IVirtualMachineScaleSetVMsOperations. /// @@ -171,6 +176,11 @@ public partial interface IComputeManagementClient : System.IDisposable /// ISnapshotsOperations Snapshots { get; } + /// + /// Gets the IDiskEncryptionSetsOperations. + /// + IDiskEncryptionSetsOperations DiskEncryptionSets { get; } + /// /// Gets the IGalleriesOperations. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs new file mode 100644 index 000000000000..84daa463bb07 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IDiskEncryptionSetsOperations.cs @@ -0,0 +1,318 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskEncryptionSetsOperations operations. + /// + public partial interface IDiskEncryptionSetsOperations + { + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a disk encryption set + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Put disk + /// encryption set 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSet diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates (patches) a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// disk encryption set object supplied in the body of the Patch disk + /// encryption set 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a disk encryption set. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the disk encryption set that is being created. The name + /// can't be changed after the disk encryption set is created. + /// Supported characters for the name are a-z, A-Z, 0-9 and _. The + /// maximum name length is 80 characters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskEncryptionSetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// 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/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs index 2a8f02d0955d..20755cb97f16 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IResourceSkusOperations.cs @@ -27,6 +27,9 @@ public partial interface IResourceSkusOperations /// Gets the list of Microsoft.Compute SKUs available for your /// Subscription. /// + /// + /// The filter to apply on the operation. + /// /// /// The headers that will be added to request. /// @@ -42,7 +45,7 @@ public partial interface IResourceSkusOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the list of Microsoft.Compute SKUs available for your /// Subscription. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 000000000000..6aaf30ab5438 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,289 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + public partial interface IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to get all extensions of an instance in Virtual + /// Machine Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the 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> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs index 0a097818c99a..fb7b7eb2e7d5 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetVMsOperations.cs @@ -343,7 +343,8 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. /// /// /// The name of the resource group. @@ -651,7 +652,8 @@ public partial interface IVirtualMachineScaleSetVMsOperations /// Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, + /// moves it to a new node, and powers it back on. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs index c61901d52d01..2fb3f5f36863 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachineScaleSetsOperations.cs @@ -391,7 +391,8 @@ public partial interface IVirtualMachineScaleSetsOperations /// Task StartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. /// /// /// The name of the resource group. @@ -814,7 +815,8 @@ public partial interface IVirtualMachineScaleSetsOperations /// Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, IList instanceIds = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale + /// set, moves them to a new node, and powers them back on. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs index a5ec2cf820ab..49d2726fb0f0 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/IVirtualMachinesOperations.cs @@ -309,6 +309,10 @@ public partial interface IVirtualMachinesOperations /// Use the nextLink property in the response to get the next page of /// virtual machines. /// + /// + /// statusOnly=true enables fetching run time status of all Virtual + /// Machines in the subscription. + /// /// /// The headers that will be added to request. /// @@ -324,7 +328,7 @@ public partial interface IVirtualMachinesOperations /// /// Thrown when a required parameter is null /// - Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListAllWithHttpMessagesAsync(string statusOnly = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all available virtual machine sizes to which the specified /// virtual machine can be resized. @@ -381,6 +385,28 @@ public partial interface IVirtualMachinesOperations /// Task PowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to restart a virtual machine. /// /// @@ -425,7 +451,8 @@ public partial interface IVirtualMachinesOperations /// Task StartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. /// /// /// The name of the resource group. @@ -709,6 +736,28 @@ public partial interface IVirtualMachinesOperations /// Task BeginPowerOffWithHttpMessagesAsync(string resourceGroupName, string vmName, bool? skipShutdown = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to restart a virtual machine. /// /// @@ -753,7 +802,8 @@ public partial interface IVirtualMachinesOperations /// Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers + /// it back on. /// /// /// The name of the resource group. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs index 30e8f9cd9afe..e0f6c15b09e1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ImagesOperations.cs @@ -169,7 +169,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -541,7 +541,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -742,7 +742,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -968,7 +968,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1184,7 +1184,7 @@ internal ImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs index 0246ea672b27..7a2de64502ef 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/LogAnalyticsOperations.cs @@ -152,7 +152,7 @@ internal LogAnalyticsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -363,7 +363,7 @@ internal LogAnalyticsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs new file mode 100644 index 000000000000..d535fae9edd3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/AutomaticRepairsPolicy.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the configuration parameters for automatic repairs on the + /// virtual machine scale set. + /// + public partial class AutomaticRepairsPolicy + { + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + public AutomaticRepairsPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomaticRepairsPolicy class. + /// + /// Specifies whether automatic repairs should be + /// enabled on the virtual machine scale set. The default value is + /// false. + /// The amount of time for which automatic + /// repairs are suspended due to a state change on VM. The grace time + /// starts after the state change has completed. This helps avoid + /// premature or accidental repairs. The time duration should be + /// specified in ISO 8601 format. The default value is 5 minutes + /// (PT5M). + /// The percentage (capacity of + /// scaleset) of virtual machines that will be simultaneously repaired. + /// The default value is 20%. + public AutomaticRepairsPolicy(bool? enabled = default(bool?), string gracePeriod = default(string), int? maxInstanceRepairsPercent = default(int?)) + { + Enabled = enabled; + GracePeriod = gracePeriod; + MaxInstanceRepairsPercent = maxInstanceRepairsPercent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether automatic repairs should be enabled + /// on the virtual machine scale set. The default value is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the amount of time for which automatic repairs are + /// suspended due to a state change on VM. The grace time starts after + /// the state change has completed. This helps avoid premature or + /// accidental repairs. The time duration should be specified in ISO + /// 8601 format. The default value is 5 minutes (PT5M). + /// + [JsonProperty(PropertyName = "gracePeriod")] + public string GracePeriod { get; set; } + + /// + /// Gets or sets the percentage (capacity of scaleset) of virtual + /// machines that will be simultaneously repaired. The default value is + /// 20%. + /// + [JsonProperty(PropertyName = "maxInstanceRepairsPercent")] + public int? MaxInstanceRepairsPercent { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs index a0295cbc9852..39c430dc8860 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DataDisk.cs @@ -66,7 +66,16 @@ public DataDisk() /// Specifies whether the data disk is in /// process of detachment from the /// VirtualMachine/VirtualMachineScaleset - public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?)) + /// Specifies the Read-Write IOPS for + /// the managed disk when StorageAccountType is UltraSSD_LRS. Returned + /// only for VirtualMachine ScaleSet VM disks. Can be updated only via + /// updates to the VirtualMachine Scale Set. + /// Specifies the bandwidth in MB per + /// second for the managed disk when StorageAccountType is + /// UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. + /// Can be updated only via updates to the VirtualMachine Scale + /// Set. + public DataDisk(int lun, string createOption, string name = default(string), VirtualHardDisk vhd = default(VirtualHardDisk), VirtualHardDisk image = default(VirtualHardDisk), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), ManagedDiskParameters managedDisk = default(ManagedDiskParameters), bool? toBeDetached = default(bool?), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) { Lun = lun; Name = name; @@ -78,6 +87,8 @@ public DataDisk() DiskSizeGB = diskSizeGB; ManagedDisk = managedDisk; ToBeDetached = toBeDetached; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; CustomInit(); } @@ -172,6 +183,24 @@ public DataDisk() [JsonProperty(PropertyName = "toBeDetached")] public bool? ToBeDetached { get; set; } + /// + /// Gets specifies the Read-Write IOPS for the managed disk when + /// StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; private set; } + + /// + /// Gets specifies the bandwidth in MB per second for the managed disk + /// when StorageAccountType is UltraSSD_LRS. Returned only for + /// VirtualMachine ScaleSet VM disks. Can be updated only via updates + /// to the VirtualMachine Scale Set. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs index 7f82ba4fa207..921a5b2183ad 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Disk.cs @@ -77,7 +77,10 @@ public Disk() /// The state of the disk. Possible values /// include: 'Unattached', 'Attached', 'Reserved', 'ActiveSAS', /// 'ReadyToUpload', 'ActiveUpload' - public Disk(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), DiskSku sku = default(DiskSku), IList zones = default(IList), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), long? diskIOPSReadWrite = default(long?), int? diskMBpsReadWrite = default(int?), string diskState = default(string)) + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + public Disk(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), DiskSku sku = default(DiskSku), IList zones = default(IList), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), long? diskIOPSReadWrite = default(long?), int? diskMBpsReadWrite = default(int?), string diskState = default(string), Encryption encryption = default(Encryption)) : base(location, id, name, type, tags) { ManagedBy = managedBy; @@ -95,6 +98,7 @@ public Disk() DiskIOPSReadWrite = diskIOPSReadWrite; DiskMBpsReadWrite = diskMBpsReadWrite; DiskState = diskState; + Encryption = encryption; CustomInit(); } @@ -208,6 +212,13 @@ public Disk() [JsonProperty(PropertyName = "properties.diskState")] public string DiskState { get; private set; } + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + /// /// Validate the object. /// @@ -229,6 +240,10 @@ public override void Validate() { EncryptionSettingsCollection.Validate(); } + if (Encryption != null) + { + Encryption.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs new file mode 100644 index 000000000000..17672b1100fa --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSet.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSet : Resource + { + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + public DiskEncryptionSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSet class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The key vault key which is currently used + /// by this disk encryption set. + /// A readonly collection of key vault keys + /// previously used by this disk encryption set while a key rotation is + /// in progress. It will be empty if there is no ongoing key + /// rotation. + /// The disk encryption set + /// provisioning state. + public DiskEncryptionSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), KeyVaultAndKeyReference activeKey = default(KeyVaultAndKeyReference), IList previousKeys = default(IList), string provisioningState = default(string)) + : base(location, id, name, type, tags) + { + Identity = identity; + ActiveKey = activeKey; + PreviousKeys = previousKeys; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets the key vault key which is currently used by this disk + /// encryption set. + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyVaultAndKeyReference ActiveKey { get; set; } + + /// + /// Gets a readonly collection of key vault keys previously used by + /// this disk encryption set while a key rotation is in progress. It + /// will be empty if there is no ongoing key rotation. + /// + [JsonProperty(PropertyName = "properties.previousKeys")] + public IList PreviousKeys { get; private set; } + + /// + /// Gets the disk encryption set provisioning state. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + if (PreviousKeys != null) + { + foreach (var element in PreviousKeys) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs new file mode 100644 index 000000000000..1e465b702f02 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetIdentityType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for DiskEncryptionSetIdentityType. + /// + public static class DiskEncryptionSetIdentityType + { + public const string SystemAssigned = "SystemAssigned"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs new file mode 100644 index 000000000000..c8a6508b3b79 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using System.Linq; + + /// + /// Describes the parameter of customer managed disk encryption set + /// resource id that can be specified for disk. <br><br> NOTE: + /// The disk encryption set resource id can only be specified for managed + /// disk. Please refer https://aka.ms/mdssewithcmkoverview for more + /// details. + /// + public partial class DiskEncryptionSetParameters : SubResource + { + /// + /// Initializes a new instance of the DiskEncryptionSetParameters + /// class. + /// + public DiskEncryptionSetParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSetParameters + /// class. + /// + /// Resource Id + public DiskEncryptionSetParameters(string id = default(string)) + : base(id) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs new file mode 100644 index 000000000000..f486b80411ed --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/DiskEncryptionSetUpdate.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// disk encryption set update resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskEncryptionSetUpdate + { + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + public DiskEncryptionSetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionSetUpdate class. + /// + /// Resource tags + public DiskEncryptionSetUpdate(KeyVaultAndKeyReference activeKey = default(KeyVaultAndKeyReference), IDictionary tags = default(IDictionary)) + { + ActiveKey = activeKey; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.activeKey")] + public KeyVaultAndKeyReference ActiveKey { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ActiveKey != null) + { + ActiveKey.Validate(); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs new file mode 100644 index 000000000000..2cb4c65820c8 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Encryption.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Encryption at rest settings for disk or snapshot + /// + public partial class Encryption + { + /// + /// Initializes a new instance of the Encryption class. + /// + public Encryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Encryption class. + /// + /// The type of key used to encrypt the data of the + /// disk. Possible values include: 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey' + /// ResourceId of the disk encryption + /// set to use for enabling encryption at rest. + public Encryption(string type, string diskEncryptionSetId = default(string)) + { + DiskEncryptionSetId = diskEncryptionSetId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resourceId of the disk encryption set to use for + /// enabling encryption at rest. + /// + [JsonProperty(PropertyName = "diskEncryptionSetId")] + public string DiskEncryptionSetId { get; set; } + + /// + /// Gets or sets the type of key used to encrypt the data of the disk. + /// Possible values include: 'EncryptionAtRestWithPlatformKey', + /// 'EncryptionAtRestWithCustomerKey' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs new file mode 100644 index 000000000000..d2173440de7f --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/EncryptionType.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for EncryptionType. + /// + public static class EncryptionType + { + /// + /// Disk is encrypted with XStore managed key at rest. It is the + /// default encryption type. + /// + public const string EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey"; + /// + /// Disk is encrypted with Customer managed key at rest. + /// + public const string EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs index ef32b2cfdd40..cc8a8b640427 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDataDisk.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Compute.Models /// /// Describes a data disk. /// - public partial class ImageDataDisk + public partial class ImageDataDisk : ImageDisk { /// /// Initializes a new instance of the ImageDataDisk class. @@ -51,15 +51,12 @@ public ImageDataDisk() /// disks, it cannot be used with OS Disk. Possible values include: /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', /// 'UltraSSD_LRS' - public ImageDataDisk(int lun, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string)) + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDataDisk(int lun, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) { Lun = lun; - Snapshot = snapshot; - ManagedDisk = managedDisk; - BlobUri = blobUri; - Caching = caching; - DiskSizeGB = diskSizeGB; - StorageAccountType = storageAccountType; CustomInit(); } @@ -76,55 +73,6 @@ public ImageDataDisk() [JsonProperty(PropertyName = "lun")] public int Lun { get; set; } - /// - /// Gets or sets the snapshot. - /// - [JsonProperty(PropertyName = "snapshot")] - public SubResource Snapshot { get; set; } - - /// - /// Gets or sets the managedDisk. - /// - [JsonProperty(PropertyName = "managedDisk")] - public SubResource ManagedDisk { get; set; } - - /// - /// Gets or sets the Virtual Hard Disk. - /// - [JsonProperty(PropertyName = "blobUri")] - public string BlobUri { get; set; } - - /// - /// Gets or sets specifies the caching requirements. - /// &lt;br&gt;&lt;br&gt; Possible values are: - /// &lt;br&gt;&lt;br&gt; **None** - /// &lt;br&gt;&lt;br&gt; **ReadOnly** - /// &lt;br&gt;&lt;br&gt; **ReadWrite** - /// &lt;br&gt;&lt;br&gt; Default: **None for Standard - /// storage. ReadOnly for Premium storage**. Possible values include: - /// 'None', 'ReadOnly', 'ReadWrite' - /// - [JsonProperty(PropertyName = "caching")] - public CachingTypes? Caching { get; set; } - - /// - /// Gets or sets specifies the size of empty data disks in gigabytes. - /// This element can be used to overwrite the name of the disk in a - /// virtual machine image. &lt;br&gt;&lt;br&gt; This - /// value cannot be larger than 1023 GB - /// - [JsonProperty(PropertyName = "diskSizeGB")] - public int? DiskSizeGB { get; set; } - - /// - /// Gets or sets specifies the storage account type for the managed - /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it - /// cannot be used with OS Disk. Possible values include: - /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' - /// - [JsonProperty(PropertyName = "storageAccountType")] - public string StorageAccountType { get; set; } - /// /// Validate the object. /// @@ -133,6 +81,7 @@ public ImageDataDisk() /// public virtual void Validate() { + //Nothing to validate } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs new file mode 100644 index 000000000000..2136d9ab3e36 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageDisk.cs @@ -0,0 +1,126 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a image disk. + /// + public partial class ImageDisk + { + /// + /// Initializes a new instance of the ImageDisk class. + /// + public ImageDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageDisk class. + /// + /// The snapshot. + /// The managedDisk. + /// The Virtual Hard Disk. + /// Specifies the caching requirements. + /// <br><br> Possible values are: <br><br> + /// **None** <br><br> **ReadOnly** <br><br> + /// **ReadWrite** <br><br> Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// Specifies the size of empty data disks in + /// gigabytes. This element can be used to overwrite the name of the + /// disk in a virtual machine image. <br><br> This value + /// cannot be larger than 1023 GB + /// Specifies the storage account type + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageDisk(SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + { + Snapshot = snapshot; + ManagedDisk = managedDisk; + BlobUri = blobUri; + Caching = caching; + DiskSizeGB = diskSizeGB; + StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the snapshot. + /// + [JsonProperty(PropertyName = "snapshot")] + public SubResource Snapshot { get; set; } + + /// + /// Gets or sets the managedDisk. + /// + [JsonProperty(PropertyName = "managedDisk")] + public SubResource ManagedDisk { get; set; } + + /// + /// Gets or sets the Virtual Hard Disk. + /// + [JsonProperty(PropertyName = "blobUri")] + public string BlobUri { get; set; } + + /// + /// Gets or sets specifies the caching requirements. + /// &lt;br&gt;&lt;br&gt; Possible values are: + /// &lt;br&gt;&lt;br&gt; **None** + /// &lt;br&gt;&lt;br&gt; **ReadOnly** + /// &lt;br&gt;&lt;br&gt; **ReadWrite** + /// &lt;br&gt;&lt;br&gt; Default: **None for Standard + /// storage. ReadOnly for Premium storage**. Possible values include: + /// 'None', 'ReadOnly', 'ReadWrite' + /// + [JsonProperty(PropertyName = "caching")] + public CachingTypes? Caching { get; set; } + + /// + /// Gets or sets specifies the size of empty data disks in gigabytes. + /// This element can be used to overwrite the name of the disk in a + /// virtual machine image. &lt;br&gt;&lt;br&gt; This + /// value cannot be larger than 1023 GB + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public int? DiskSizeGB { get; set; } + + /// + /// Gets or sets specifies the storage account type for the managed + /// disk. NOTE: UltraSSD_LRS can only be used with data disks, it + /// cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS' + /// + [JsonProperty(PropertyName = "storageAccountType")] + public string StorageAccountType { get; set; } + + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed image disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs index 511d8f578144..d85a6e103cd8 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ImageOSDisk.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Compute.Models /// /// Describes an Operating System disk. /// - public partial class ImageOSDisk + public partial class ImageOSDisk : ImageDisk { /// /// Initializes a new instance of the ImageOSDisk class. @@ -50,19 +50,17 @@ public ImageOSDisk() /// disk in a virtual machine image. <br><br> This value /// cannot be larger than 1023 GB /// Specifies the storage account type - /// for the managed disk. UltraSSD_LRS cannot be used with OS Disk. - /// Possible values include: 'Standard_LRS', 'Premium_LRS', - /// 'StandardSSD_LRS', 'UltraSSD_LRS' - public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string)) + /// for the managed disk. NOTE: UltraSSD_LRS can only be used with data + /// disks, it cannot be used with OS Disk. Possible values include: + /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', + /// 'UltraSSD_LRS' + /// Specifies the customer managed disk + /// encryption set resource id for the managed image disk. + public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osState, SubResource snapshot = default(SubResource), SubResource managedDisk = default(SubResource), string blobUri = default(string), CachingTypes? caching = default(CachingTypes?), int? diskSizeGB = default(int?), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) + : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) { OsType = osType; OsState = osState; - Snapshot = snapshot; - ManagedDisk = managedDisk; - BlobUri = blobUri; - Caching = caching; - DiskSizeGB = diskSizeGB; - StorageAccountType = storageAccountType; CustomInit(); } @@ -89,55 +87,6 @@ public ImageOSDisk() [JsonProperty(PropertyName = "osState")] public OperatingSystemStateTypes OsState { get; set; } - /// - /// Gets or sets the snapshot. - /// - [JsonProperty(PropertyName = "snapshot")] - public SubResource Snapshot { get; set; } - - /// - /// Gets or sets the managedDisk. - /// - [JsonProperty(PropertyName = "managedDisk")] - public SubResource ManagedDisk { get; set; } - - /// - /// Gets or sets the Virtual Hard Disk. - /// - [JsonProperty(PropertyName = "blobUri")] - public string BlobUri { get; set; } - - /// - /// Gets or sets specifies the caching requirements. - /// &lt;br&gt;&lt;br&gt; Possible values are: - /// &lt;br&gt;&lt;br&gt; **None** - /// &lt;br&gt;&lt;br&gt; **ReadOnly** - /// &lt;br&gt;&lt;br&gt; **ReadWrite** - /// &lt;br&gt;&lt;br&gt; Default: **None for Standard - /// storage. ReadOnly for Premium storage**. Possible values include: - /// 'None', 'ReadOnly', 'ReadWrite' - /// - [JsonProperty(PropertyName = "caching")] - public CachingTypes? Caching { get; set; } - - /// - /// Gets or sets specifies the size of empty data disks in gigabytes. - /// This element can be used to overwrite the name of the disk in a - /// virtual machine image. &lt;br&gt;&lt;br&gt; This - /// value cannot be larger than 1023 GB - /// - [JsonProperty(PropertyName = "diskSizeGB")] - public int? DiskSizeGB { get; set; } - - /// - /// Gets or sets specifies the storage account type for the managed - /// disk. UltraSSD_LRS cannot be used with OS Disk. Possible values - /// include: 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', - /// 'UltraSSD_LRS' - /// - [JsonProperty(PropertyName = "storageAccountType")] - public string StorageAccountType { get; set; } - /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs index 33d6e189ce63..2048b4a85700 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ManagedDiskParameters.cs @@ -35,10 +35,13 @@ public ManagedDiskParameters() /// disks, it cannot be used with OS Disk. Possible values include: /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', /// 'UltraSSD_LRS' - public ManagedDiskParameters(string id = default(string), string storageAccountType = default(string)) + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + public ManagedDiskParameters(string id = default(string), string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) : base(id) { StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; CustomInit(); } @@ -56,5 +59,12 @@ public ManagedDiskParameters() [JsonProperty(PropertyName = "storageAccountType")] public string StorageAccountType { get; set; } + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs index 1c9e6441e6fb..cca9dacecb89 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/OSProfile.cs @@ -97,7 +97,10 @@ public OSProfile() /// operations should be allowed on the virtual machine. /// <br><br>This may only be set to False when no /// extensions are present on the virtual machine. - public OSProfile(string computerName = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList), bool? allowExtensionOperations = default(bool?)) + /// Specifies whether the + /// guest provision signal is required from the virtual + /// machine. + public OSProfile(string computerName = default(string), string adminUsername = default(string), string adminPassword = default(string), string customData = default(string), WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), LinuxConfiguration linuxConfiguration = default(LinuxConfiguration), IList secrets = default(IList), bool? allowExtensionOperations = default(bool?), bool? requireGuestProvisionSignal = default(bool?)) { ComputerName = computerName; AdminUsername = adminUsername; @@ -107,6 +110,7 @@ public OSProfile() LinuxConfiguration = linuxConfiguration; Secrets = secrets; AllowExtensionOperations = allowExtensionOperations; + RequireGuestProvisionSignal = requireGuestProvisionSignal; CustomInit(); } @@ -227,5 +231,12 @@ public OSProfile() [JsonProperty(PropertyName = "allowExtensionOperations")] public bool? AllowExtensionOperations { get; set; } + /// + /// Gets or sets specifies whether the guest provision signal is + /// required from the virtual machine. + /// + [JsonProperty(PropertyName = "requireGuestProvisionSignal")] + public bool? RequireGuestProvisionSignal { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentity.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentity.cs new file mode 100644 index 000000000000..21b5fb329ed3 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ResourceIdentity.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The managed identity for the disk encryption set. It should be given + /// permission on the key vault before it can be used to encrypt disks. + /// + public partial class ResourceIdentity + { + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + public ResourceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + /// The type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported. Possible + /// values include: 'SystemAssigned' + /// The object id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-identity-principal-id header in the PUT request if the + /// resource has a systemAssigned(implicit) identity + /// The tenant id of the Managed Identity + /// Resource. This will be sent to the RP from ARM via the + /// x-ms-client-tenant-id header in the PUT request if the resource has + /// a systemAssigned(implicit) identity + public ResourceIdentity(string type = default(string), string principalId = default(string), string tenantId = default(string)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of Managed Identity used by the + /// DiskEncryptionSet. Only SystemAssigned is supported. Possible + /// values include: 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets the object id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-identity-principal-id header + /// in the PUT request if the resource has a systemAssigned(implicit) + /// identity + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id of the Managed Identity Resource. This will be + /// sent to the RP from ARM via the x-ms-client-tenant-id header in the + /// PUT request if the resource has a systemAssigned(implicit) identity + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs new file mode 100644 index 000000000000..894e661e2ff5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a scale-in policy for a virtual machine scale set. + /// + public partial class ScaleInPolicy + { + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + public ScaleInPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + /// The rules to be followed when scaling-in a + /// virtual machine scale set. <br><br> Possible values + /// are: <br><br> **Default** When a virtual machine scale + /// set is scaled in, the scale set will first be balanced across zones + /// if it is a zonal scale set. Then, it will be balanced across Fault + /// Domains as far as possible. Within each Fault Domain, the virtual + /// machines chosen for removal will be the newest ones that are not + /// protected from scale-in. <br><br> **OldestVM** When a + /// virtual machine scale set is being scaled-in, the oldest virtual + /// machines that are not protected from scale-in will be chosen for + /// removal. For zonal virtual machine scale sets, the scale set will + /// first be balanced across zones. Within each zone, the oldest + /// virtual machines that are not protected will be chosen for removal. + /// <br><br> **NewestVM** When a virtual machine scale set + /// is being scaled-in, the newest virtual machines that are not + /// protected from scale-in will be chosen for removal. For zonal + /// virtual machine scale sets, the scale set will first be balanced + /// across zones. Within each zone, the newest virtual machines that + /// are not protected will be chosen for removal. + /// <br><br> + public ScaleInPolicy(IList rules = default(IList)) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rules to be followed when scaling-in a virtual + /// machine scale set. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Default** When a + /// virtual machine scale set is scaled in, the scale set will first be + /// balanced across zones if it is a zonal scale set. Then, it will be + /// balanced across Fault Domains as far as possible. Within each Fault + /// Domain, the virtual machines chosen for removal will be the newest + /// ones that are not protected from scale-in. + /// &lt;br&gt;&lt;br&gt; **OldestVM** When a virtual + /// machine scale set is being scaled-in, the oldest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the oldest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; **NewestVM** When a virtual + /// machine scale set is being scaled-in, the newest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the newest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs index 872d35d257bd..ec2872c8d435 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/Snapshot.cs @@ -68,7 +68,10 @@ public Snapshot() /// Whether a snapshot is incremental. /// Incremental snapshots on the same disk occupy less space than full /// snapshots and can be diffed. - public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?)) + /// Encryption property can be used to encrypt + /// data at rest with customer managed keys or platform managed + /// keys. + public Snapshot(string location, CreationData creationData, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string managedBy = default(string), SnapshotSku sku = default(SnapshotSku), System.DateTime? timeCreated = default(System.DateTime?), OperatingSystemTypes? osType = default(OperatingSystemTypes?), string hyperVGeneration = default(string), int? diskSizeGB = default(int?), long? diskSizeBytes = default(long?), string uniqueId = default(string), EncryptionSettingsCollection encryptionSettingsCollection = default(EncryptionSettingsCollection), string provisioningState = default(string), bool? incremental = default(bool?), Encryption encryption = default(Encryption)) : base(location, id, name, type, tags) { ManagedBy = managedBy; @@ -83,6 +86,7 @@ public Snapshot() EncryptionSettingsCollection = encryptionSettingsCollection; ProvisioningState = provisioningState; Incremental = incremental; + Encryption = encryption; CustomInit(); } @@ -173,6 +177,13 @@ public Snapshot() [JsonProperty(PropertyName = "properties.incremental")] public bool? Incremental { get; set; } + /// + /// Gets or sets encryption property can be used to encrypt data at + /// rest with customer managed keys or platform managed keys. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public Encryption Encryption { get; set; } + /// /// Validate the object. /// @@ -194,6 +205,10 @@ public override void Validate() { EncryptionSettingsCollection.Validate(); } + if (Encryption != null) + { + Encryption.Validate(); + } } } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs index b72fa2db6acf..e5ddfe824110 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs @@ -48,6 +48,8 @@ public VirtualMachineScaleSet() /// then click **Want to deploy programmatically, Get Started ->**. /// Enter any required information and then click **Save**. /// The upgrade policy. + /// Policy for automatic + /// repairs. /// The virtual machine /// profile. /// The provisioning state, which only @@ -78,15 +80,19 @@ public VirtualMachineScaleSet() /// Virtual Machine Scale Set. For instance: whether the Virtual /// Machines have the capability to support attaching managed data /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. /// The identity of the virtual machine scale /// set, if configured. /// The virtual machine scale set zones. - public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList)) + public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList)) : base(location, id, name, type, tags) { Sku = sku; Plan = plan; UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; VirtualMachineProfile = virtualMachineProfile; ProvisioningState = provisioningState; Overprovision = overprovision; @@ -97,6 +103,7 @@ public VirtualMachineScaleSet() PlatformFaultDomainCount = platformFaultDomainCount; ProximityPlacementGroup = proximityPlacementGroup; AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; Identity = identity; Zones = zones; CustomInit(); @@ -131,6 +138,12 @@ public VirtualMachineScaleSet() [JsonProperty(PropertyName = "properties.upgradePolicy")] public UpgradePolicy UpgradePolicy { get; set; } + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + /// /// Gets or sets the virtual machine profile. /// @@ -205,6 +218,14 @@ public VirtualMachineScaleSet() [JsonProperty(PropertyName = "properties.additionalCapabilities")] public AdditionalCapabilities AdditionalCapabilities { get; set; } + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + /// /// Gets or sets the identity of the virtual machine scale set, if /// configured. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs index 25fb1ef90c31..e6a6744dcd77 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetDataDisk.cs @@ -52,7 +52,15 @@ public VirtualMachineScaleSetDataDisk() /// disk in a virtual machine image. <br><br> This value /// cannot be larger than 1023 GB /// The managed disk parameters. - public VirtualMachineScaleSetDataDisk(int lun, string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters)) + /// Specifies the Read-Write IOPS for + /// the managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// Specifies the bandwidth in MB per + /// second for the managed disk. Should be used only when + /// StorageAccountType is UltraSSD_LRS. If not specified, a default + /// value would be assigned based on diskSizeGB. + public VirtualMachineScaleSetDataDisk(int lun, string createOption, string name = default(string), CachingTypes? caching = default(CachingTypes?), bool? writeAcceleratorEnabled = default(bool?), int? diskSizeGB = default(int?), VirtualMachineScaleSetManagedDiskParameters managedDisk = default(VirtualMachineScaleSetManagedDiskParameters), long? diskIOPSReadWrite = default(long?), long? diskMBpsReadWrite = default(long?)) { Name = name; Lun = lun; @@ -61,6 +69,8 @@ public VirtualMachineScaleSetDataDisk() CreateOption = createOption; DiskSizeGB = diskSizeGB; ManagedDisk = managedDisk; + DiskIOPSReadWrite = diskIOPSReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; CustomInit(); } @@ -125,6 +135,23 @@ public VirtualMachineScaleSetDataDisk() [JsonProperty(PropertyName = "managedDisk")] public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; } + /// + /// Gets or sets specifies the Read-Write IOPS for the managed disk. + /// Should be used only when StorageAccountType is UltraSSD_LRS. If not + /// specified, a default value would be assigned based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskIOPSReadWrite")] + public long? DiskIOPSReadWrite { get; set; } + + /// + /// Gets or sets specifies the bandwidth in MB per second for the + /// managed disk. Should be used only when StorageAccountType is + /// UltraSSD_LRS. If not specified, a default value would be assigned + /// based on diskSizeGB. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs index 60651ea9007a..ca640e2cd0e6 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs @@ -36,9 +36,12 @@ public VirtualMachineScaleSetManagedDiskParameters() /// disks, it cannot be used with OS Disk. Possible values include: /// 'Standard_LRS', 'Premium_LRS', 'StandardSSD_LRS', /// 'UltraSSD_LRS' - public VirtualMachineScaleSetManagedDiskParameters(string storageAccountType = default(string)) + /// Specifies the customer managed disk + /// encryption set resource id for the managed disk. + public VirtualMachineScaleSetManagedDiskParameters(string storageAccountType = default(string), DiskEncryptionSetParameters diskEncryptionSet = default(DiskEncryptionSetParameters)) { StorageAccountType = storageAccountType; + DiskEncryptionSet = diskEncryptionSet; CustomInit(); } @@ -56,5 +59,12 @@ public VirtualMachineScaleSetManagedDiskParameters() [JsonProperty(PropertyName = "storageAccountType")] public string StorageAccountType { get; set; } + /// + /// Gets or sets specifies the customer managed disk encryption set + /// resource id for the managed disk. + /// + [JsonProperty(PropertyName = "diskEncryptionSet")] + public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + } } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs index e12dc7342a7d..c587d070e649 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs @@ -46,13 +46,19 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration() /// IP address. /// The PublicIPPrefix from which to /// allocate publicIP addresses. - public VirtualMachineScaleSetPublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings), IList ipTags = default(IList), SubResource publicIPPrefix = default(SubResource)) + /// Available from Api-Version + /// 2019-07-01 onwards, it represents whether the specific + /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + /// values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + /// 'IPv6' + public VirtualMachineScaleSetPublicIPAddressConfiguration(string name, int? idleTimeoutInMinutes = default(int?), VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings = default(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings), IList ipTags = default(IList), SubResource publicIPPrefix = default(SubResource), string publicIPAddressVersion = default(string)) { Name = name; IdleTimeoutInMinutes = idleTimeoutInMinutes; DnsSettings = dnsSettings; IpTags = ipTags; PublicIPPrefix = publicIPPrefix; + PublicIPAddressVersion = publicIPAddressVersion; CustomInit(); } @@ -94,6 +100,15 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration() [JsonProperty(PropertyName = "properties.publicIPPrefix")] public SubResource PublicIPPrefix { get; set; } + /// + /// Gets or sets available from Api-Version 2019-07-01 onwards, it + /// represents whether the specific ipconfiguration is IPv4 or IPv6. + /// Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. + /// Possible values include: 'IPv4', 'IPv6' + /// + [JsonProperty(PropertyName = "properties.publicIPAddressVersion")] + public string PublicIPAddressVersion { get; set; } + /// /// Validate the object. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs new file mode 100644 index 000000000000..bbe4bf22bc33 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachineScaleSetScaleInRules. + /// + public static class VirtualMachineScaleSetScaleInRules + { + public const string Default = "Default"; + public const string OldestVM = "OldestVM"; + public const string NewestVM = "NewestVM"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs index 0f18654a4461..ef54c97f4064 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs @@ -41,10 +41,17 @@ public VirtualMachineScaleSetUpdate() /// The purchase plan when deploying a virtual /// machine scale set from VM Marketplace images. /// The upgrade policy. + /// Policy for automatic + /// repairs. /// The virtual machine /// profile. /// Specifies whether the Virtual Machine /// Scale Set should be overprovisioned. + /// When + /// Overprovision is enabled, extensions are launched only on the + /// requested number of VMs which are finally kept. This property will + /// hence ensure that the extensions do not run on the extra + /// overprovisioned VMs. /// When true this limits the scale /// set to a single placement group, of max size 100 virtual /// machines. @@ -53,18 +60,24 @@ public VirtualMachineScaleSetUpdate() /// Virtual Machine Scale Set. For instance: whether the Virtual /// Machines have the capability to support attaching managed data /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. /// The identity of the virtual machine scale /// set, if configured. - public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) + public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), AutomaticRepairsPolicy automaticRepairsPolicy = default(AutomaticRepairsPolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) : base(tags) { Sku = sku; Plan = plan; UpgradePolicy = upgradePolicy; + AutomaticRepairsPolicy = automaticRepairsPolicy; VirtualMachineProfile = virtualMachineProfile; Overprovision = overprovision; + DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs; SinglePlacementGroup = singlePlacementGroup; AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; Identity = identity; CustomInit(); } @@ -93,6 +106,12 @@ public VirtualMachineScaleSetUpdate() [JsonProperty(PropertyName = "properties.upgradePolicy")] public UpgradePolicy UpgradePolicy { get; set; } + /// + /// Gets or sets policy for automatic repairs. + /// + [JsonProperty(PropertyName = "properties.automaticRepairsPolicy")] + public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; } + /// /// Gets or sets the virtual machine profile. /// @@ -106,6 +125,15 @@ public VirtualMachineScaleSetUpdate() [JsonProperty(PropertyName = "properties.overprovision")] public bool? Overprovision { get; set; } + /// + /// Gets or sets when Overprovision is enabled, extensions are launched + /// only on the requested number of VMs which are finally kept. This + /// property will hence ensure that the extensions do not run on the + /// extra overprovisioned VMs. + /// + [JsonProperty(PropertyName = "properties.doNotRunExtensionsOnOverprovisionedVMs")] + public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; } + /// /// Gets or sets when true this limits the scale set to a single /// placement group, of max size 100 virtual machines. @@ -123,6 +151,14 @@ public VirtualMachineScaleSetUpdate() [JsonProperty(PropertyName = "properties.additionalCapabilities")] public AdditionalCapabilities AdditionalCapabilities { get; set; } + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + /// /// Gets or sets the identity of the virtual machine scale set, if /// configured. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs index a387948e8f2d..55396baa7bcd 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs @@ -33,10 +33,15 @@ public VirtualMachineScaleSetUpdateNetworkProfile() /// Initializes a new instance of the /// VirtualMachineScaleSetUpdateNetworkProfile class. /// + /// A reference to a load balancer probe used + /// to determine the health of an instance in the virtual machine scale + /// set. The reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. /// The list of network /// configurations. - public VirtualMachineScaleSetUpdateNetworkProfile(IList networkInterfaceConfigurations = default(IList)) + public VirtualMachineScaleSetUpdateNetworkProfile(ApiEntityReference healthProbe = default(ApiEntityReference), IList networkInterfaceConfigurations = default(IList)) { + HealthProbe = healthProbe; NetworkInterfaceConfigurations = networkInterfaceConfigurations; CustomInit(); } @@ -46,6 +51,15 @@ public VirtualMachineScaleSetUpdateNetworkProfile() /// partial void CustomInit(); + /// + /// Gets or sets a reference to a load balancer probe used to determine + /// the health of an instance in the virtual machine scale set. The + /// reference will be in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + /// + [JsonProperty(PropertyName = "healthProbe")] + public ApiEntityReference HealthProbe { get; set; } + /// /// Gets or sets the list of network configurations. /// diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs index 8c2104e84ef8..859dd291acfc 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ComputeManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs index 452293b8d2b7..cd5ad51d6d56 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ProximityPlacementGroupsOperations.cs @@ -105,7 +105,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -327,7 +327,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; ProximityPlacementGroupUpdate parameters = new ProximityPlacementGroupUpdate(); if (tags != null) { @@ -530,7 +530,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -706,7 +706,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -886,7 +886,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1069,7 +1069,7 @@ internal ProximityPlacementGroupsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs index f876eb9d6c13..9a2e6dc44f96 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperations.cs @@ -53,6 +53,9 @@ internal ResourceSkusOperations(ComputeManagementClient client) /// /// Gets the list of Microsoft.Compute SKUs available for your Subscription. /// + /// + /// The filter to apply on the operation. + /// /// /// Headers that will be added to request. /// @@ -74,7 +77,7 @@ internal ResourceSkusOperations(ComputeManagementClient 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(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -89,6 +92,7 @@ internal ResourceSkusOperations(ComputeManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -101,6 +105,10 @@ internal ResourceSkusOperations(ComputeManagementClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs index 9ef1d1b650d2..e86f1344765e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/ResourceSkusOperationsExtensions.cs @@ -27,9 +27,12 @@ public static partial class ResourceSkusOperationsExtensions /// /// The operations group for this extension method. /// - public static IPage List(this IResourceSkusOperations operations) + /// + /// The filter to apply on the operation. + /// + public static IPage List(this IResourceSkusOperations operations, string filter = default(string)) { - return operations.ListAsync().GetAwaiter().GetResult(); + return operations.ListAsync(filter).GetAwaiter().GetResult(); } /// @@ -38,12 +41,15 @@ public static IPage List(this IResourceSkusOperations operations) /// /// The operations group for this extension method. /// + /// + /// The filter to apply on the operation. + /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IResourceSkusOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IResourceSkusOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs index e8ef6710bfa7..9f21c1d0ef39 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -19,46 +19,37 @@ public static IEnumerable> ApiInfo_ComputeManageme { return new Tuple[] { - new Tuple("Compute", "AvailabilitySets", "2019-03-01"), - new Tuple("Compute", "DedicatedHostGroups", "2019-03-01"), - new Tuple("Compute", "DedicatedHosts", "2019-03-01"), - new Tuple("Compute", "Disks", "2019-03-01"), + new Tuple("Compute", "AvailabilitySets", "2019-07-01"), + new Tuple("Compute", "DedicatedHostGroups", "2019-07-01"), + new Tuple("Compute", "DedicatedHosts", "2019-07-01"), + new Tuple("Compute", "DiskEncryptionSets", "2019-07-01"), + new Tuple("Compute", "Disks", "2019-07-01"), new Tuple("Compute", "Galleries", "2019-07-01"), new Tuple("Compute", "GalleryApplicationVersions", "2019-07-01"), new Tuple("Compute", "GalleryApplications", "2019-07-01"), new Tuple("Compute", "GalleryImageVersions", "2019-07-01"), new Tuple("Compute", "GalleryImages", "2019-07-01"), - new Tuple("Compute", "Images", "2019-03-01"), - new Tuple("Compute", "LogAnalytics", "2019-03-01"), - new Tuple("Compute", "Operations", "2019-03-01"), - new Tuple("Compute", "ProximityPlacementGroups", "2019-03-01"), + new Tuple("Compute", "Images", "2019-07-01"), + new Tuple("Compute", "LogAnalytics", "2019-07-01"), + new Tuple("Compute", "Operations", "2019-07-01"), + new Tuple("Compute", "ProximityPlacementGroups", "2019-07-01"), new Tuple("Compute", "ResourceSkus", "2019-04-01"), - new Tuple("Compute", "Snapshots", "2019-03-01"), - new Tuple("Compute", "Usage", "2019-03-01"), - new Tuple("Compute", "VirtualMachineExtensionImages", "2019-03-01"), - new Tuple("Compute", "VirtualMachineExtensions", "2019-03-01"), - new Tuple("Compute", "VirtualMachineImages", "2019-03-01"), - new Tuple("Compute", "VirtualMachineRunCommands", "2019-03-01"), - new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2019-03-01"), - new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2019-03-01"), - new Tuple("Compute", "VirtualMachineScaleSetVMs", "2019-03-01"), - new Tuple("Compute", "VirtualMachineScaleSets", "2019-03-01"), - new Tuple("Compute", "VirtualMachineSizes", "2019-03-01"), - new Tuple("Compute", "VirtualMachines", "2019-03-01"), + new Tuple("Compute", "Snapshots", "2019-07-01"), + new Tuple("Compute", "Usage", "2019-07-01"), + new Tuple("Compute", "VirtualMachineExtensionImages", "2019-07-01"), + new Tuple("Compute", "VirtualMachineExtensions", "2019-07-01"), + new Tuple("Compute", "VirtualMachineImages", "2019-07-01"), + new Tuple("Compute", "VirtualMachineRunCommands", "2019-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetExtensions", "2019-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetRollingUpgrades", "2019-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMExtensions", "2019-07-01"), + new Tuple("Compute", "VirtualMachineScaleSetVMs", "2019-07-01"), + new Tuple("Compute", "VirtualMachineScaleSets", "2019-07-01"), + new Tuple("Compute", "VirtualMachineSizes", "2019-07-01"), + new Tuple("Compute", "VirtualMachines", "2019-07-01"), new Tuple("ContainerService", "ContainerServices", "2017-01-31"), }.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/compute/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\hylee-sdk\\avset\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "6359c5dac93947b24007afd9c569e23e92848ea5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs index b079e1e22bcb..f452d823f293 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SnapshotsOperations.cs @@ -150,7 +150,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -361,7 +361,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,7 +539,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -794,7 +794,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { snapshot.Validate(); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1022,7 +1022,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshot"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1240,7 +1240,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1430,7 +1430,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { grantAccessData.Validate(); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1630,7 +1630,7 @@ internal SnapshotsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "snapshotName"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs index 3d7e35cec396..088101d9bd1f 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/UsageOperations.cs @@ -96,7 +96,7 @@ internal UsageOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs index fc0ed6255f6b..7e17816a2d93 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionImagesOperations.cs @@ -106,7 +106,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -303,7 +303,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -505,7 +505,7 @@ internal VirtualMachineExtensionImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs index 10f1939ddc35..5cbd26371e81 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineExtensionsOperations.cs @@ -186,7 +186,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -390,7 +390,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -608,7 +608,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -843,7 +843,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1050,7 +1050,7 @@ internal VirtualMachineExtensionsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs index d6eee87d187e..71a14f14cb62 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineImagesOperations.cs @@ -116,7 +116,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -334,7 +334,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -542,7 +542,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -730,7 +730,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -930,7 +930,7 @@ internal VirtualMachineImagesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs index 1682e6d4c781..951df2209353 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineRunCommandsOperations.cs @@ -94,7 +94,7 @@ internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -293,7 +293,7 @@ internal VirtualMachineRunCommandsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs index ff3808f9f32a..38cc5fd9a1d7 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetExtensionsOperations.cs @@ -158,7 +158,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -359,7 +359,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -568,7 +568,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -793,7 +793,7 @@ internal VirtualMachineScaleSetExtensionsOperations(ComputeManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs index 76e51e7170b3..d6a9e3645cc9 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradesOperations.cs @@ -164,7 +164,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -355,7 +355,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -530,7 +530,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -705,7 +705,7 @@ internal VirtualMachineScaleSetRollingUpgradesOperations(ComputeManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs new file mode 100644 index 000000000000..1c45a5101bfd --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperations.cs @@ -0,0 +1,1241 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineScaleSetVMExtensionsOperations operations. + /// + internal partial class VirtualMachineScaleSetVMExtensionsOperations : IServiceOperations, IVirtualMachineScaleSetVMExtensionsOperations + { + /// + /// Initializes a new instance of the VirtualMachineScaleSetVMExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineScaleSetVMExtensionsOperations(ComputeManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ComputeManagementClient + /// + public ComputeManagementClient Client { get; private set; } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the 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> GetWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the 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> ListWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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; + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (extensionParameters != null) + { + extensionParameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("PUT"); + _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; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 && (int)_statusCode != 201) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (extensionParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("extensionParameters", extensionParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("PATCH"); + _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; + if(extensionParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(extensionParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmScaleSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmScaleSetName"); + } + if (instanceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (vmExtensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmExtensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmScaleSetName", vmScaleSetName); + tracingParameters.Add("instanceId", instanceId); + tracingParameters.Add("vmExtensionName", vmExtensionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmScaleSetName}", System.Uri.EscapeDataString(vmScaleSetName)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); + _url = _url.Replace("{vmExtensionName}", System.Uri.EscapeDataString(vmExtensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("DELETE"); + _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 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs new file mode 100644 index 000000000000..be93828f8367 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMExtensionsOperationsExtensions.cs @@ -0,0 +1,467 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineScaleSetVMExtensionsOperations. + /// + public static partial class VirtualMachineScaleSetVMExtensionsOperationsExtensions + { + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension CreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension Update(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.UpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void Delete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.DeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtension Get(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + public static VirtualMachineExtensionsListResult List(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string)) + { + return operations.ListAsync(resourceGroupName, vmScaleSetName, instanceId, expand).GetAwaiter().GetResult(); + } + + /// + /// The operation to get all extensions of an instance in Virtual Machine + /// Scaleset. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The expand expression to apply on the operation. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginCreateOrUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Create Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtension extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + public static VirtualMachineExtension BeginUpdate(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// Parameters supplied to the Update Virtual Machine Extension operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineExtensionUpdate extensionParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + public static void BeginDelete(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName) + { + operations.BeginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete the VMSS VM extension. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the VM scale set. + /// + /// + /// The instance ID of the virtual machine. + /// + /// + /// The name of the virtual machine extension. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualMachineScaleSetVMExtensionsOperations operations, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs index 3eb7d47becc5..f1def7ae1056 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperations.cs @@ -245,7 +245,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -453,7 +453,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -655,7 +655,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -902,7 +902,8 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The name of the resource group. @@ -1033,7 +1034,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = default(VirtualMachineScaleSetVMReimageParameters); if (tempDisk != null) { @@ -1229,7 +1230,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1414,7 +1415,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1611,7 +1612,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1836,7 +1837,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2025,7 +2026,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2212,7 +2213,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2394,7 +2395,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2529,7 +2530,8 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The name of the resource group. @@ -2576,7 +2578,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2758,7 +2760,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2954,7 +2956,7 @@ internal VirtualMachineScaleSetVMsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs index 70648d15dff0..b227b0e52d79 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetVMsOperationsExtensions.cs @@ -564,7 +564,8 @@ public static void Start(this IVirtualMachineScaleSetVMsOperations operations, s } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The operations group for this extension method. @@ -584,7 +585,8 @@ public static void Redeploy(this IVirtualMachineScaleSetVMsOperations operations } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The operations group for this extension method. @@ -1091,7 +1093,8 @@ public static void BeginStart(this IVirtualMachineScaleSetVMsOperations operatio } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The operations group for this extension method. @@ -1111,7 +1114,8 @@ public static void BeginRedeploy(this IVirtualMachineScaleSetVMsOperations opera } /// - /// Redeploys a virtual machine in a VM scale set. + /// Shuts down the virtual machine in the virtual machine scale set, moves it + /// to a new node, and powers it back on. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs index 9daa85664443..3677c0c50a7a 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperations.cs @@ -166,7 +166,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -414,7 +414,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -601,7 +601,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -782,7 +782,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -973,7 +973,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1167,7 +1167,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1406,7 +1406,8 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The name of the resource group. @@ -1591,7 +1592,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1984,7 +1985,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2210,7 +2211,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2408,7 +2409,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2588,7 +2589,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -2781,7 +2782,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); if (instanceIds != null) { @@ -2978,7 +2979,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3174,7 +3175,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3365,7 +3366,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3511,7 +3512,8 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The name of the resource group. @@ -3556,7 +3558,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3750,7 +3752,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { @@ -3944,7 +3946,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "instanceIds"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); if (instanceIds != null) { @@ -4134,7 +4136,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4320,7 +4322,7 @@ internal VirtualMachineScaleSetsOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = default(VirtualMachineScaleSetVMInstanceIDs); if (instanceIds != null) { diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs index c4abaf6c2cac..f135db35a33e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineScaleSetsOperationsExtensions.cs @@ -632,7 +632,8 @@ public static IPage GetOSUpgradeHistory(th } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The operations group for this extension method. @@ -654,7 +655,8 @@ public static IPage GetOSUpgradeHistory(th } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The operations group for this extension method. @@ -1350,7 +1352,8 @@ public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The operations group for this extension method. @@ -1372,7 +1375,8 @@ public static void BeginDeleteInstances(this IVirtualMachineScaleSetsOperations } /// - /// Redeploy one or more virtual machines in a VM scale set. + /// Shuts down all the virtual machines in the virtual machine scale set, moves + /// them to a new node, and powers them back on. /// /// /// The operations group for this extension method. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs index 5b007710dc79..2cead8d4e74b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachineSizesOperations.cs @@ -95,7 +95,7 @@ internal VirtualMachineSizesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs index 120d4fb9c003..ba92fb9d5a2e 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperations.cs @@ -95,7 +95,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -390,7 +390,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -589,7 +589,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -826,7 +826,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -996,7 +996,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1148,6 +1148,10 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// Lists all of the virtual machines in the specified subscription. Use the /// nextLink property in the response to get the next page of virtual machines. /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// /// /// Headers that will be added to request. /// @@ -1169,13 +1173,13 @@ internal VirtualMachinesOperations(ComputeManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAllWithHttpMessagesAsync(string statusOnly = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1184,6 +1188,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("statusOnly", statusOnly); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); } @@ -1196,6 +1201,10 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } + if (statusOnly != null) + { + _queryParameters.Add(string.Format("statusOnly={0}", System.Uri.EscapeDataString(statusOnly))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1366,7 +1375,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1545,6 +1554,28 @@ internal VirtualMachinesOperations(ComputeManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// The operation to restart a virtual machine. /// @@ -1590,7 +1621,8 @@ internal VirtualMachinesOperations(ComputeManagementClient client) } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The name of the resource group. @@ -1742,7 +1774,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1954,7 +1986,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2180,7 +2212,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2396,7 +2428,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2570,7 +2602,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2744,7 +2776,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2924,7 +2956,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3061,6 +3093,179 @@ internal VirtualMachinesOperations(ComputeManagementClient client) return _result; } + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 BeginReapplyWithHttpMessagesAsync(string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReapply", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + 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("POST"); + _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 && (int)_statusCode != 202) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// The operation to restart a virtual machine. /// @@ -3102,7 +3307,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3275,7 +3480,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3408,7 +3613,8 @@ internal VirtualMachinesOperations(ComputeManagementClient client) } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The name of the resource group. @@ -3448,7 +3654,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3627,7 +3833,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; VirtualMachineReimageParameters parameters = default(VirtualMachineReimageParameters); if (tempDisk != null) { @@ -3813,7 +4019,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4000,7 +4206,7 @@ internal VirtualMachinesOperations(ComputeManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs index d24e2c677291..b4f3da8ba04c 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/VirtualMachinesOperationsExtensions.cs @@ -484,9 +484,13 @@ public static IPage List(this IVirtualMachinesOperations operati /// /// The operations group for this extension method. /// - public static IPage ListAll(this IVirtualMachinesOperations operations) + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// + public static IPage ListAll(this IVirtualMachinesOperations operations, string statusOnly = default(string)) { - return operations.ListAllAsync().GetAwaiter().GetResult(); + return operations.ListAllAsync(statusOnly).GetAwaiter().GetResult(); } /// @@ -496,12 +500,16 @@ public static IPage ListAll(this IVirtualMachinesOperations oper /// /// The operations group for this extension method. /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in + /// the subscription. + /// /// /// The cancellation token. /// - public static async Task> ListAllAsync(this IVirtualMachinesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAllAsync(this IVirtualMachinesOperations operations, string statusOnly = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAllWithHttpMessagesAsync(statusOnly, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -600,6 +608,43 @@ public static void PowerOff(this IVirtualMachinesOperations operations, string r (await operations.PowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void Reapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.ReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task ReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// The operation to restart a virtual machine. /// @@ -675,7 +720,8 @@ public static void Start(this IVirtualMachinesOperations operations, string reso } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The operations group for this extension method. @@ -692,7 +738,8 @@ public static void Redeploy(this IVirtualMachinesOperations operations, string r } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The operations group for this extension method. @@ -1149,6 +1196,43 @@ public static void BeginPowerOff(this IVirtualMachinesOperations operations, str (await operations.BeginPowerOffWithHttpMessagesAsync(resourceGroupName, vmName, skipShutdown, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + public static void BeginReapply(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName) + { + operations.BeginReapplyAsync(resourceGroupName, vmName).GetAwaiter().GetResult(); + } + + /// + /// The operation to reapply a virtual machine's state. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReapplyAsync(this IVirtualMachinesOperations operations, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReapplyWithHttpMessagesAsync(resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// The operation to restart a virtual machine. /// @@ -1224,7 +1308,8 @@ public static void BeginStart(this IVirtualMachinesOperations operations, string } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The operations group for this extension method. @@ -1241,7 +1326,8 @@ public static void BeginRedeploy(this IVirtualMachinesOperations operations, str } /// - /// The operation to redeploy a virtual machine. + /// Shuts down the virtual machine, moves it to a new node, and powers it back + /// on. /// /// /// The operations group for this extension method.