diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs index aa3ea27a617fe..e9d4c3dd13f04 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthenticationSettingsContract.cs @@ -33,15 +33,10 @@ public AuthenticationSettingsContract() /// /// OAuth2 Authentication settings /// OpenID Connect Authentication Settings - /// Specifies whether - /// subscription key is required during call to this API, true - API is - /// included into closed products only, false - API is included into - /// open products alone, null - there is a mix of products. - public AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2 = default(OAuth2AuthenticationSettingsContract), OpenIdAuthenticationSettingsContract openid = default(OpenIdAuthenticationSettingsContract), bool? subscriptionKeyRequired = default(bool?)) + public AuthenticationSettingsContract(OAuth2AuthenticationSettingsContract oAuth2 = default(OAuth2AuthenticationSettingsContract), OpenIdAuthenticationSettingsContract openid = default(OpenIdAuthenticationSettingsContract)) { OAuth2 = oAuth2; Openid = openid; - SubscriptionKeyRequired = subscriptionKeyRequired; CustomInit(); } @@ -62,14 +57,5 @@ public AuthenticationSettingsContract() [JsonProperty(PropertyName = "openid")] public OpenIdAuthenticationSettingsContract Openid { get; set; } - /// - /// Gets or sets specifies whether subscription key is required during - /// call to this API, true - API is included into closed products only, - /// false - API is included into open products alone, null - there is a - /// mix of products. - /// - [JsonProperty(PropertyName = "subscriptionKeyRequired")] - public bool? SubscriptionKeyRequired { get; set; } - } } diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperations.cs index d532e462f668e..2745aead1ac06 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperations.cs @@ -62,7 +62,7 @@ internal DscCompilationJobOperations(AutomationClient client) /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. @@ -91,7 +91,7 @@ internal DscCompilationJobOperations(AutomationClient client) /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// Headers that will be added to request. @@ -741,7 +741,7 @@ internal DscCompilationJobOperations(AutomationClient client) /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperationsExtensions.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperationsExtensions.cs index 5bd975435e8d8..2b45bf1bbdfee 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperationsExtensions.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DscCompilationJobOperationsExtensions.cs @@ -36,7 +36,7 @@ public static partial class DscCompilationJobOperationsExtensions /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. @@ -60,7 +60,7 @@ public static DscCompilationJob Create(this IDscCompilationJobOperations operati /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. @@ -90,7 +90,7 @@ public static DscCompilationJob Create(this IDscCompilationJobOperations operati /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// public static DscCompilationJob Get(this IDscCompilationJobOperations operations, string resourceGroupName, string automationAccountName, string compilationJobName) { @@ -111,7 +111,7 @@ public static DscCompilationJob Get(this IDscCompilationJobOperations operations /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The cancellation token. @@ -240,7 +240,7 @@ public static JobStream GetStream(this IDscCompilationJobOperations operations, /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. @@ -264,7 +264,7 @@ public static DscCompilationJob BeginCreate(this IDscCompilationJobOperations op /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDscCompilationJobOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDscCompilationJobOperations.cs index 8483b75ca4c4b..bcfbd06102e5e 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDscCompilationJobOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDscCompilationJobOperations.cs @@ -35,7 +35,7 @@ public partial interface IDscCompilationJobOperations /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. @@ -68,7 +68,7 @@ public partial interface IDscCompilationJobOperations /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The headers that will be added to request. @@ -158,7 +158,7 @@ public partial interface IDscCompilationJobOperations /// The name of the automation account. /// /// - /// The the DSC configuration Id. + /// The DSC configuration Id. /// /// /// The parameters supplied to the create compilation job operation. diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs index 449551b0cd6dc..1c020bbdaee0d 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs @@ -63,16 +63,5 @@ public static IEnumerable> ApiInfo_AutomationClien }.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/automation/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Git\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "97aede4213f5ffb9bee11ef972a782e21bc1eb92"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - 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 50bf7e4b6b92c..63687ae3488df 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 333bc9802a1ab..fac6394a3939e 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 b8ec9621329db..564aab6846208 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 fe31c66be91b1..40bf792cb96bc 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 b42496c1c2412..f4c6fb41f8333 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 62d800ddd453b..17ca5dc610718 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 0000000000000..aef0635745932 --- /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 0000000000000..8642c1dbda4cc --- /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 0000000000000..7e876988de79c --- /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 0000000000000..e449e974e445a --- /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 311110d17c1a9..0d1e3604982bd 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 7a4181186b426..7fa8fc43785a0 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 0000000000000..a950f33365d19 --- /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 357545428fe3b..107edfb3be3dd 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 6e86f0cc9df6c..a99b90999b088 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 0000000000000..2c9728a8cd0d9 --- /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 0000000000000..d72f7f793e37c --- /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 0000000000000..e4220de6974b6 --- /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 0000000000000..8c6863afa7cbf --- /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 0000000000000..d272c94add12b --- /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 0000000000000..25bd3db49c442 --- /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 0000000000000..5edcae14e830e --- /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 ec90823197fa8..33c25ec737fe6 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 e35757d720208..2330060e78a72 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(); } } 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 0000000000000..1488b669385c6 --- /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 0000000000000..5919a270dc00f --- /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 0000000000000..740ee449c11c6 --- /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 0000000000000..49ef9a5957878 --- /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 0000000000000..8ff8db2530de4 --- /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 0000000000000..743b05022b2e1 --- /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 0000000000000..099bc55478496 --- /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 0000000000000..40487d0d70602 --- /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 0000000000000..9efcc4fb3e1bf --- /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 0000000000000..113b114257aa9 --- /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 0000000000000..a2e19985def02 --- /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 0000000000000..1ac6c00a01c03 --- /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 0000000000000..eabff2337f19d --- /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 0000000000000..4851e4efbf902 --- /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 0000000000000..0e72be35a68fc --- /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 0000000000000..800a080399114 --- /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 0000000000000..e01c15ea507be --- /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 0000000000000..1386766cdbb31 --- /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 0000000000000..de6105c004dab --- /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 0000000000000..a464dabb029b3 --- /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 0000000000000..b259cfb98f3d4 --- /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 0000000000000..2b73b6d962e26 --- /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 0000000000000..735baa7d36b30 --- /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 0000000000000..746d4df6e4d8b --- /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 0000000000000..a208ee8129c41 --- /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 0000000000000..e5b8501977e24 --- /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 0000000000000..bed6fe698a613 --- /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 0000000000000..b8731cf3636b7 --- /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 0000000000000..04835817077f3 --- /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 0000000000000..a431dbedbb4d7 --- /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 0000000000000..7761b4a3ea879 --- /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 0000000000000..01ce2abd7bb73 --- /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 0000000000000..d38be096c86a3 --- /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 0000000000000..0f65a66d0699e --- /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 0000000000000..1f891b17234d1 --- /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 0000000000000..61dc4e845a91c --- /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 0000000000000..605ea38bf6271 --- /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 0000000000000..eeb8dc20dc98d --- /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 0000000000000..501c07680265d --- /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 0000000000000..ce12933eb064c --- /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 0000000000000..ae83953a20e47 --- /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 0000000000000..2c4dabb854579 --- /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 0000000000000..c6dbf27e4db33 --- /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 0000000000000..daeac5d6a1f9b --- /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 0000000000000..6db6f5f3cb8a3 --- /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 0000000000000..9dd044fc073d8 --- /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 0000000000000..af80e43c9a91c --- /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 0000000000000..72bbdd61c1c15 --- /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 0000000000000..033cb34492eac --- /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 0000000000000..a080a4adaaa0c --- /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 0000000000000..f13c10f809fc9 --- /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 0000000000000..6d5ef2286b39b --- /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; + } + } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs new file mode 100644 index 0000000000000..ed84e77cd4fd0 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs @@ -0,0 +1,36 @@ + +// +// 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.Peering +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_PeeringManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Peering", "CheckServiceProviderAvailability", "2019-09-01-preview"), + new Tuple("Peering", "LegacyPeerings", "2019-09-01-preview"), + new Tuple("Peering", "Operations", "2019-09-01-preview"), + new Tuple("Peering", "PeerAsns", "2019-09-01-preview"), + new Tuple("Peering", "PeeringLocations", "2019-09-01-preview"), + new Tuple("Peering", "PeeringServiceLocations", "2019-09-01-preview"), + new Tuple("Peering", "PeeringServiceProviders", "2019-09-01-preview"), + new Tuple("Peering", "PeeringServices", "2019-09-01-preview"), + new Tuple("Peering", "Peerings", "2019-09-01-preview"), + new Tuple("Peering", "Prefixes", "2019-09-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs index 29a4a7d572bc4..796c5382204ea 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/INamespacesOperations.cs @@ -454,6 +454,31 @@ public partial interface INamespacesOperations /// Task> GetNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace 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>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates a service namespace. Once created, this /// namespace's resource manifest is immutable. This operation is /// idempotent. @@ -578,5 +603,27 @@ public partial interface INamespacesOperations /// Thrown when a required parameter is null /// Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// 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>> ListNetworkRuleSetsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs index bc710c0eae42b..7cfe24bb11328 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/Rule.cs @@ -87,5 +87,18 @@ public Rule() [JsonProperty(PropertyName = "properties.correlationFilter")] public CorrelationFilter CorrelationFilter { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SqlFilter != null) + { + SqlFilter.Validate(); + } + } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs index eb1bbf03609ab..f21026875bad0 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/Models/SqlFilter.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ServiceBus.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -57,11 +58,11 @@ public SqlFilter() public string SqlExpression { get; set; } /// - /// Gets this property is reserved for future use. An integer value - /// showing the compatibility level, currently hard-coded to 20. + /// Gets or sets this property is reserved for future use. An integer + /// value showing the compatibility level, currently hard-coded to 20. /// [JsonProperty(PropertyName = "compatibilityLevel")] - public int? CompatibilityLevel { get; private set; } + public int? CompatibilityLevel { get; set; } /// /// Gets or sets value that indicates whether the rule action requires @@ -70,5 +71,22 @@ public SqlFilter() [JsonProperty(PropertyName = "requiresPreprocessing")] public bool? RequiresPreprocessing { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CompatibilityLevel > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "CompatibilityLevel", 20); + } + if (CompatibilityLevel < 20) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CompatibilityLevel", 20); + } + } } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs index 3b8e4f25b6f22..dce1f03b4ac2b 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperations.cs @@ -3170,6 +3170,219 @@ internal NamespacesOperations(ServiceBusManagementClient client) return _result; } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace 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>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNetworkRuleSets", 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.ServiceBus/namespaces/{namespaceName}/networkRuleSets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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; + } + /// /// Creates or updates a service namespace. Once created, this namespace's /// resource manifest is immutable. This operation is idempotent. @@ -4112,5 +4325,173 @@ internal NamespacesOperations(ServiceBusManagementClient client) return _result; } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// 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>> ListNetworkRuleSetsNextWithHttpMessagesAsync(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, "ListNetworkRuleSetsNext", 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/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs index be74f0e08a73c..e1f14089154bd 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/NamespacesOperationsExtensions.cs @@ -724,6 +724,46 @@ public static NetworkRuleSet GetNetworkRuleSet(this INamespacesOperations operat } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + public static IPage ListNetworkRuleSets(this INamespacesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListNetworkRuleSetsAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates a service namespace. Once created, this namespace's /// resource manifest is immutable. This operation is idempotent. @@ -925,5 +965,39 @@ public static IPage ListAuthorizationRulesNext(this INamesp } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNetworkRuleSetsNext(this INamespacesOperations operations, string nextPageLink) + { + return operations.ListNetworkRuleSetsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsNextAsync(this INamespacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs index f162eb0c40242..05a5b053c266d 100644 --- a/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs +++ b/sdk/servicebus/Microsoft.Azure.Management.ServiceBus/src/Generated/RulesOperations.cs @@ -454,6 +454,10 @@ internal RulesOperations(ServiceBusManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); 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 97083c5959453..db13bc4ec97dc 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 a4b1ac267d9a8..c0afa04896901 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 ef734314a95c8..d0b0d1db2c8ac 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 0000000000000..1186b398cec07 --- /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 0000000000000..812b4ae5179f6 --- /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 fa602c14e1f75..49970cd58d2a4 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 0000000000000..c1cdc93a9e7d0 --- /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 d9fde8d12ae08..6b2e01a5db052 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 5f732c5369b0b..f56db1e0aa24f 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 3f038282e47c5..eb2d38a3a9126 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 edd23ced2cf69..35565c9e7e3bb 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 c5b50d71fd7a1..f388b676e6bef 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 c403fe1a5affd..3e26b468ba75e 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. /// diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index 99979bf5d0950..b73c428c76dcc 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -6,7 +6,8 @@ "reflect-api-versions": "", "license-header": "MICROSOFT_MIT_NO_VERSION", "sdkrel:csharp-sdks-folder": "./sdk", - "use": "@microsoft.azure/autorest.csharp" + "use": "@microsoft.azure/autorest.csharp", + "csharp.clear-output-folder": "" }, "advanced_options": { "create_sdk_pull_requests": true,