diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs new file mode 100644 index 000000000000..67529382daa0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs @@ -0,0 +1,987 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// APIKeysOperations operations. + /// + internal partial class APIKeysOperations : IServiceOperations, IAPIKeysOperations + { + /// + /// Initializes a new instance of the APIKeysOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal APIKeysOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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; + } + + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (aPIKeyProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aPIKeyProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("aPIKeyProperties", aPIKeyProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Insights/components/{resourceName}/ApiKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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("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(aPIKeyProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(aPIKeyProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (keyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("keyId", keyId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{keyId}", System.Uri.EscapeDataString(keyId)); + 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) + { + 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; + } + + /// + /// Get the API Key for this key id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (keyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("keyId", keyId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{keyId}", System.Uri.EscapeDataString(keyId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs new file mode 100644 index 000000000000..4e850259461b --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs @@ -0,0 +1,207 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for APIKeysOperations. + /// + public static partial class APIKeysOperationsExtensions + { + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IAPIKeysOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + public static ApplicationInsightsComponentAPIKey Create(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, aPIKeyProperties).GetAwaiter().GetResult(); + } + + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, aPIKeyProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + public static ApplicationInsightsComponentAPIKey Delete(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId) + { + return operations.DeleteAsync(resourceGroupName, resourceName, keyId).GetAwaiter().GetResult(); + } + + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, keyId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the API Key for this key id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + public static ApplicationInsightsComponentAPIKey Get(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId) + { + return operations.GetAsync(resourceGroupName, resourceName, keyId).GetAwaiter().GetResult(); + } + + /// + /// Get the API Key for this key id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, keyId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs new file mode 100644 index 000000000000..062bf473adb0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs @@ -0,0 +1,1065 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// AnalyticsItemsOperations operations. + /// + internal partial class AnalyticsItemsOperations : IServiceOperations, IAnalyticsItemsOperations + { + /// + /// Initializes a new instance of the AnalyticsItemsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AnalyticsItemsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("scope", scope); + tracingParameters.Add("type", type); + tracingParameters.Add("includeContent", includeContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}").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("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (scope != null) + { + _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); + } + if (type != null) + { + _queryParameters.Add(string.Format("type={0}", System.Uri.EscapeDataString(type))); + } + if (includeContent != null) + { + _queryParameters.Add(string.Format("includeContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeContent, Client.SerializationSettings).Trim('"')))); + } + 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 specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("id", id); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item").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("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (id != null) + { + _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); + } + if (name != null) + { + _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); + } + 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; + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (itemProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "itemProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("overrideItem", overrideItem); + tracingParameters.Add("itemProperties", itemProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", 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.insights/components/{resourceName}/{scopePath}/item").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("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (overrideItem != null) + { + _queryParameters.Add(string.Format("overrideItem={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(overrideItem, Client.SerializationSettings).Trim('"')))); + } + 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(itemProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(itemProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// 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 resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("id", id); + tracingParameters.Add("name", name); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item").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("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (id != null) + { + _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); + } + if (name != null) + { + _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); + } + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs new file mode 100644 index 000000000000..8f4f7ffa4b64 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AnalyticsItemsOperations. + /// + public static partial class AnalyticsItemsOperationsExtensions + { + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + public static IList List(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?)) + { + return operations.ListAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + public static ApplicationInsightsComponentAnalyticsItem Get(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string)) + { + return operations.GetAsync(resourceGroupName, resourceName, scopePath, id, name).GetAwaiter().GetResult(); + } + + /// + /// Gets a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, id, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + public static ApplicationInsightsComponentAnalyticsItem Put(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?)) + { + return operations.PutAsync(resourceGroupName, resourceName, scopePath, itemProperties, overrideItem).GetAwaiter().GetResult(); + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, itemProperties, overrideItem, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + public static void Delete(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string)) + { + operations.DeleteAsync(resourceGroupName, resourceName, scopePath, id, name).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, id, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs new file mode 100644 index 000000000000..579a7f55dd31 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs @@ -0,0 +1,978 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// AnnotationsOperations operations. + /// + internal partial class AnnotationsOperations : IServiceOperations, IAnnotationsOperations + { + /// + /// Initializes a new instance of the AnnotationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AnnotationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string start, string end, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (start == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "start"); + } + if (end == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "end"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("start", start); + tracingParameters.Add("end", end); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (start != null) + { + _queryParameters.Add(string.Format("start={0}", System.Uri.EscapeDataString(start))); + } + if (end != null) + { + _queryParameters.Add(string.Format("end={0}", System.Uri.EscapeDataString(end))); + } + 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 AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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; + } + + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// 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>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Annotation annotationProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationProperties", annotationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Insights/components/{resourceName}/Annotations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(annotationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(annotationProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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; + } + + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// 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 resourceGroupName, string resourceName, string annotationId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationId", annotationId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{annotationId}", System.Uri.EscapeDataString(annotationId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the annotation for given id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationId", annotationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{annotationId}", System.Uri.EscapeDataString(annotationId)); + 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 AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs new file mode 100644 index 000000000000..3ac7686026fe --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs @@ -0,0 +1,222 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AnnotationsOperations. + /// + public static partial class AnnotationsOperationsExtensions + { + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + public static IEnumerable List(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string start, string end) + { + return operations.ListAsync(resourceGroupName, resourceName, start, end).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string start, string end, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, start, end, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + public static IList Create(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, Annotation annotationProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, annotationProperties).GetAwaiter().GetResult(); + } + + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, Annotation annotationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, annotationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + public static void Delete(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId) + { + operations.DeleteAsync(resourceGroupName, resourceName, annotationId).GetAwaiter().GetResult(); + } + + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, annotationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get the annotation for given id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + public static IList Get(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId) + { + return operations.GetAsync(resourceGroupName, resourceName, annotationId).GetAwaiter().GetResult(); + } + + /// + /// Get the annotation for given id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, annotationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs similarity index 55% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs index ee70799c84ea..0f94ec45392e 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs @@ -8,21 +8,23 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.ApplicationInsights.Management { 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; /// - /// Composite Swagger for Application Insights Data Client + /// Composite Swagger for Application Insights Management Client /// - public partial class ApplicationInsightsDataClient : ServiceClient, IApplicationInsightsDataClient + public partial class ApplicationInsightsManagementClient : ServiceClient, IApplicationInsightsManagementClient, IAzureClient { /// /// The base URI of the service. @@ -40,51 +42,144 @@ public partial class ApplicationInsightsDataClient : ServiceClient - /// Subscription credentials which uniquely identify client subscription. + /// Credentials needed for the client to connect to Azure. /// public ServiceClientCredentials Credentials { get; private set; } /// - /// Gets the IMetrics. + /// The API version to use for this operation. /// - public virtual IMetrics Metrics { get; private set; } + public string ApiVersion { get; private set; } /// - /// Gets the IEvents. + /// The ID of the target subscription. /// - public virtual IEvents Events { get; private set; } + public string SubscriptionId { get; set; } /// - /// Gets the IQueryOperations. + /// The preferred language for the response. /// - public virtual IQueryOperations Query { get; private set; } + public string AcceptLanguage { get; set; } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// 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 IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAnnotationsOperations. + /// + public virtual IAnnotationsOperations Annotations { get; private set; } + + /// + /// Gets the IAPIKeysOperations. + /// + public virtual IAPIKeysOperations APIKeys { get; private set; } + + /// + /// Gets the IExportConfigurationsOperations. + /// + public virtual IExportConfigurationsOperations ExportConfigurations { get; private set; } + + /// + /// Gets the IComponentCurrentBillingFeaturesOperations. + /// + public virtual IComponentCurrentBillingFeaturesOperations ComponentCurrentBillingFeatures { get; private set; } + + /// + /// Gets the IComponentQuotaStatusOperations. + /// + public virtual IComponentQuotaStatusOperations ComponentQuotaStatus { get; private set; } + + /// + /// Gets the IComponentFeatureCapabilitiesOperations. + /// + public virtual IComponentFeatureCapabilitiesOperations ComponentFeatureCapabilities { get; private set; } + + /// + /// Gets the IComponentAvailableFeaturesOperations. + /// + public virtual IComponentAvailableFeaturesOperations ComponentAvailableFeatures { get; private set; } + + /// + /// Gets the IProactiveDetectionConfigurationsOperations. + /// + public virtual IProactiveDetectionConfigurationsOperations ProactiveDetectionConfigurations { get; private set; } + + /// + /// Gets the IComponentsOperations. + /// + public virtual IComponentsOperations Components { get; private set; } + + /// + /// Gets the IWorkItemConfigurationsOperations. + /// + public virtual IWorkItemConfigurationsOperations WorkItemConfigurations { get; private set; } + + /// + /// Gets the IFavoritesOperations. + /// + public virtual IFavoritesOperations Favorites { get; private set; } + + /// + /// Gets the IWebTestLocationsOperations. + /// + public virtual IWebTestLocationsOperations WebTestLocations { get; private set; } + + /// + /// Gets the IWebTestsOperations. + /// + public virtual IWebTestsOperations WebTests { get; private set; } + + /// + /// Gets the IAnalyticsItemsOperations. + /// + public virtual IAnalyticsItemsOperations AnalyticsItems { get; private set; } + + /// + /// Gets the IWorkbooksOperations. + /// + public virtual IWorkbooksOperations Workbooks { get; private set; } + + /// + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ApplicationInsightsDataClient.Dispose(). False: will not dispose provided httpClient - protected ApplicationInsightsDataClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + /// True: will dispose the provided httpClient on calling ApplicationInsightsManagementClient.Dispose(). False: will not dispose provided httpClient + protected ApplicationInsightsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ApplicationInsightsDataClient(params DelegatingHandler[] handlers) : base(handlers) + protected ApplicationInsightsManagementClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -92,13 +187,13 @@ protected ApplicationInsightsDataClient(params DelegatingHandler[] handlers) : b /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ApplicationInsightsDataClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected ApplicationInsightsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -109,7 +204,7 @@ protected ApplicationInsightsDataClient(HttpClientHandler rootHandler, params De /// /// Thrown when a required parameter is null /// - protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected ApplicationInsightsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -119,7 +214,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHan } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -133,7 +228,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHan /// /// Thrown when a required parameter is null /// - protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected ApplicationInsightsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -143,10 +238,10 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler ro } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The delegating handlers to add to the http client pipeline. @@ -154,7 +249,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler ro /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { @@ -168,20 +263,20 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, param } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ApplicationInsightsDataClient.Dispose(). False: will not dispose provided httpClient + /// True: will dispose the provided httpClient on calling ApplicationInsightsManagementClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { @@ -195,10 +290,10 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. @@ -209,7 +304,7 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { @@ -223,13 +318,13 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The delegating handlers to add to the http client pipeline. @@ -237,7 +332,7 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public ApplicationInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -256,13 +351,13 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. @@ -273,7 +368,7 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ApplicationInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -293,17 +388,34 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential /// /// An optional partial-method to perform custom initialization. - /// + /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { - Metrics = new Metrics(this); - Events = new Events(this); - Query = new QueryOperations(this); - BaseUri = new System.Uri("https://api.applicationinsights.io/v1"); + Operations = new Operations(this); + Annotations = new AnnotationsOperations(this); + APIKeys = new APIKeysOperations(this); + ExportConfigurations = new ExportConfigurationsOperations(this); + ComponentCurrentBillingFeatures = new ComponentCurrentBillingFeaturesOperations(this); + ComponentQuotaStatus = new ComponentQuotaStatusOperations(this); + ComponentFeatureCapabilities = new ComponentFeatureCapabilitiesOperations(this); + ComponentAvailableFeatures = new ComponentAvailableFeaturesOperations(this); + ProactiveDetectionConfigurations = new ProactiveDetectionConfigurationsOperations(this); + Components = new ComponentsOperations(this); + WorkItemConfigurations = new WorkItemConfigurationsOperations(this); + Favorites = new FavoritesOperations(this); + WebTestLocations = new WebTestLocationsOperations(this); + WebTests = new WebTestsOperations(this); + AnalyticsItems = new AnalyticsItemsOperations(this); + Workbooks = new WorkbooksOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2015-05-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, @@ -312,11 +424,12 @@ private void Initialize() NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + Converters = new List { new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, @@ -329,9 +442,9 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs new file mode 100644 index 000000000000..6ce9d56bd2d2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs @@ -0,0 +1,279 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentAvailableFeaturesOperations operations. + /// + internal partial class ComponentAvailableFeaturesOperations : IServiceOperations, IComponentAvailableFeaturesOperations + { + /// + /// Initializes a new instance of the ComponentAvailableFeaturesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentAvailableFeaturesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns all available features of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs new file mode 100644 index 000000000000..7e3573984435 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentAvailableFeaturesOperations. + /// + public static partial class ComponentAvailableFeaturesOperationsExtensions + { + /// + /// Returns all available features of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentAvailableFeatures Get(this IComponentAvailableFeaturesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns all available features of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentAvailableFeaturesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs new file mode 100644 index 000000000000..b6e4872a00ef --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs @@ -0,0 +1,519 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentCurrentBillingFeaturesOperations operations. + /// + internal partial class ComponentCurrentBillingFeaturesOperations : IServiceOperations, IComponentCurrentBillingFeaturesOperations + { + /// + /// Initializes a new instance of the ComponentCurrentBillingFeaturesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentCurrentBillingFeaturesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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; + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (billingFeaturesProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingFeaturesProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("billingFeaturesProperties", billingFeaturesProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Insights/components/{resourceName}/currentbillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(billingFeaturesProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(billingFeaturesProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs new file mode 100644 index 000000000000..bfe874ee7a55 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentCurrentBillingFeaturesOperations. + /// + public static partial class ComponentCurrentBillingFeaturesOperationsExtensions + { + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentBillingFeatures Get(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + public static ApplicationInsightsComponentBillingFeatures Update(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, billingFeaturesProperties).GetAwaiter().GetResult(); + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, billingFeaturesProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs new file mode 100644 index 000000000000..310673117efe --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs @@ -0,0 +1,279 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentFeatureCapabilitiesOperations operations. + /// + internal partial class ComponentFeatureCapabilitiesOperations : IServiceOperations, IComponentFeatureCapabilitiesOperations + { + /// + /// Initializes a new instance of the ComponentFeatureCapabilitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentFeatureCapabilitiesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs new file mode 100644 index 000000000000..22beeeb25ff4 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentFeatureCapabilitiesOperations. + /// + public static partial class ComponentFeatureCapabilitiesOperationsExtensions + { + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentFeatureCapabilities Get(this IComponentFeatureCapabilitiesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentFeatureCapabilitiesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs similarity index 66% rename from sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs index b85ca0adcb1c..170b7f378779 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs @@ -1,10 +1,14 @@ // +// 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.HealthcareApis +namespace Microsoft.Azure.Management.ApplicationInsights.Management { using Microsoft.Rest; using Microsoft.Rest.Azure; @@ -19,12 +23,12 @@ namespace Microsoft.Azure.Management.HealthcareApis using System.Threading.Tasks; /// - /// MoveResourcesStatusOperations operations. + /// ComponentQuotaStatusOperations operations. /// - internal partial class MoveResourcesStatusOperations : IServiceOperations, IMoveResourcesStatusOperations + internal partial class ComponentQuotaStatusOperations : IServiceOperations, IComponentQuotaStatusOperations { /// - /// Initializes a new instance of the MoveResourcesStatusOperations class. + /// Initializes a new instance of the ComponentQuotaStatusOperations class. /// /// /// Reference to the service client. @@ -32,7 +36,7 @@ internal partial class MoveResourcesStatusOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) + internal ComponentQuotaStatusOperations(ApplicationInsightsManagementClient client) { if (client == null) { @@ -42,18 +46,19 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) } /// - /// Gets a reference to the HealthcareApisManagementClient + /// Gets a reference to the ApplicationInsightsManagementClient /// - public HealthcareApisManagementClient Client { get; private set; } + public ApplicationInsightsManagementClient Client { get; private set; } /// - /// Get the operation result for a long running move operation. + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. /// - /// - /// The location of the operation. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The ID of the operation result to get. + /// + /// The name of the Application Insights component resource. /// /// /// Headers that will be added to request. @@ -61,7 +66,7 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -76,19 +81,52 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (locationName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - if (operationResultId == null) + if (resourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -97,17 +135,17 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("locationName", locationName); - tracingParameters.Add("operationResultId", operationResultId); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/moveResourcesStatus/{operationResultId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); - _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -171,15 +209,16 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -189,6 +228,10 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) } 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); @@ -201,7 +244,7 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -214,25 +257,7 @@ internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) _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 == 404) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs new file mode 100644 index 000000000000..38372e71e887 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentQuotaStatusOperations. + /// + public static partial class ComponentQuotaStatusOperationsExtensions + { + /// + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentQuotaStatus Get(this IComponentQuotaStatusOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentQuotaStatusOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs new file mode 100644 index 000000000000..8c44df8641f3 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs @@ -0,0 +1,2204 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentsOperations operations. + /// + internal partial class ComponentsOperations : IServiceOperations, IComponentsOperations + { + /// + /// Initializes a new instance of the ComponentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/components").ToString(); + _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 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 Application Insights components within a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// 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 resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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 Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + /// + /// 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 resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (insightProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "insightProperties"); + } + if (insightProperties != null) + { + insightProperties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("insightProperties", insightProperties); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(insightProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(insightProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + TagsResource componentTags = new TagsResource(); + if (tags != null) + { + componentTags.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("componentTags", componentTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(componentTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(componentTags, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string resourceGroupName, string resourceName, ComponentPurgeBody body, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Purge", 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.Insights/components/{resourceName}/purge").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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("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 != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + /// + /// 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> GetPurgeStatusWithHttpMessagesAsync(string resourceGroupName, string resourceName, string purgeId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (purgeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "purgeId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("purgeId", purgeId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPurgeStatus", 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.Insights/components/{resourceName}/operations/{purgeId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{purgeId}", System.Uri.EscapeDataString(purgeId)); + 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 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 all Application Insights components within a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs new file mode 100644 index 000000000000..d0769c850c61 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs @@ -0,0 +1,432 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentsOperations. + /// + public static partial class ComponentsOperationsExtensions + { + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IComponentsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IComponentsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IComponentsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IComponentsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static void Delete(this IComponentsOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponent Get(this IComponentsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates (or updates) an Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + public static ApplicationInsightsComponent CreateOrUpdate(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, insightProperties).GetAwaiter().GetResult(); + } + + /// + /// Creates (or updates) an Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, insightProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + public static ApplicationInsightsComponent UpdateTags(this IComponentsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + public static ComponentPurgeResponse Purge(this IComponentsOperations operations, string resourceGroupName, string resourceName, ComponentPurgeBody body) + { + return operations.PurgeAsync(resourceGroupName, resourceName, body).GetAwaiter().GetResult(); + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task PurgeAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, ComponentPurgeBody body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PurgeWithHttpMessagesAsync(resourceGroupName, resourceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + public static ComponentPurgeStatusResponse GetPurgeStatus(this IComponentsOperations operations, string resourceGroupName, string resourceName, string purgeId) + { + return operations.GetPurgeStatusAsync(resourceGroupName, resourceName, purgeId).GetAwaiter().GetResult(); + } + + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + /// + /// The cancellation token. + /// + public static async Task GetPurgeStatusAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, string purgeId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPurgeStatusWithHttpMessagesAsync(resourceGroupName, resourceName, purgeId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IComponentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IComponentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IComponentsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IComponentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs deleted file mode 100644 index 3a8eceb61006..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs +++ /dev/null @@ -1,265 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Events. - /// - public static partial class EventsExtensions - { - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - public static EventsResults GetByType(this IEvents operations, string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string)) - { - return operations.GetByTypeAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply).GetAwaiter().GetResult(); - } - - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - /// - /// The cancellation token. - /// - public static async Task GetByTypeAsync(this IEvents operations, string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByTypeWithHttpMessagesAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - public static EventsResults Get(this IEvents operations, string appId, string eventType, string eventId, string timespan = default(string)) - { - return operations.GetAsync(appId, eventType, eventId, timespan).GetAwaiter().GetResult(); - } - - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IEvents operations, string appId, string eventType, string eventId, string timespan = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(appId, eventType, eventId, timespan, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - public static object GetOdataMetadata(this IEvents operations, string appId) - { - return operations.GetOdataMetadataAsync(appId).GetAwaiter().GetResult(); - } - - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The cancellation token. - /// - public static async Task GetOdataMetadataAsync(this IEvents operations, string appId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetOdataMetadataWithHttpMessagesAsync(appId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs new file mode 100644 index 000000000000..4098afb40040 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs @@ -0,0 +1,1242 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ExportConfigurationsOperations operations. + /// + internal partial class ExportConfigurationsOperations : IServiceOperations, IExportConfigurationsOperations + { + /// + /// Initializes a new instance of the ExportConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExportConfigurationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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; + } + + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// 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>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportProperties", exportProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Insights/components/{resourceName}/exportconfiguration").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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("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(exportProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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) + { + 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; + } + + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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 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; + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + if (exportProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + tracingParameters.Add("exportProperties", exportProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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(exportProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..538a59ebb4bc --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs @@ -0,0 +1,273 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExportConfigurationsOperations. + /// + public static partial class ExportConfigurationsOperationsExtensions + { + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IList List(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + public static IList Create(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, exportProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, exportProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + public static ApplicationInsightsComponentExportConfiguration Delete(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId) + { + return operations.DeleteAsync(resourceGroupName, resourceName, exportId).GetAwaiter().GetResult(); + } + + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + public static ApplicationInsightsComponentExportConfiguration Get(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId) + { + return operations.GetAsync(resourceGroupName, resourceName, exportId).GetAwaiter().GetResult(); + } + + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + public static ApplicationInsightsComponentExportConfiguration Update(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, exportId, exportProperties).GetAwaiter().GetResult(); + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, exportProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs new file mode 100644 index 000000000000..7cf406d1a60d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs @@ -0,0 +1,1262 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// FavoritesOperations operations. + /// + internal partial class FavoritesOperations : IServiceOperations, IFavoritesOperations + { + /// + /// Initializes a new instance of the FavoritesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FavoritesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteType", favoriteType); + tracingParameters.Add("sourceType", sourceType); + tracingParameters.Add("canFetchContent", canFetchContent); + tracingParameters.Add("tags", tags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (favoriteType != null) + { + _queryParameters.Add(string.Format("favoriteType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteType, Client.SerializationSettings).Trim('"')))); + } + if (sourceType != null) + { + _queryParameters.Add(string.Format("sourceType={0}", System.Uri.EscapeDataString(sourceType))); + } + if (canFetchContent != null) + { + _queryParameters.Add(string.Format("canFetchContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(canFetchContent, Client.SerializationSettings).Trim('"')))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(string.Join(",", tags)))); + } + 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; + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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 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; + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + /// + /// 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> AddWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + if (favoriteProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("favoriteProperties", favoriteProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Add", 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.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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(favoriteProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + if (favoriteProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("favoriteProperties", favoriteProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(favoriteProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// 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 resourceGroupName, string resourceName, string favoriteId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs new file mode 100644 index 000000000000..c4dd575d1884 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs @@ -0,0 +1,300 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FavoritesOperations. + /// + public static partial class FavoritesOperationsExtensions + { + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + public static IList List(this IFavoritesOperations operations, string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList)) + { + return operations.ListAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + public static ApplicationInsightsComponentFavorite Get(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId) + { + return operations.GetAsync(resourceGroupName, resourceName, favoriteId).GetAwaiter().GetResult(); + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + public static ApplicationInsightsComponentFavorite Add(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties) + { + return operations.AddAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).GetAwaiter().GetResult(); + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task AddAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AddWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + public static ApplicationInsightsComponentFavorite Update(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + public static void Delete(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId) + { + operations.DeleteAsync(resourceGroupName, resourceName, favoriteId).GetAwaiter().GetResult(); + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs new file mode 100644 index 000000000000..203211c53916 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs @@ -0,0 +1,139 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// APIKeysOperations operations. + /// + public partial interface IAPIKeysOperations + { + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a + /// Application Insights component. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights + /// component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the API Key for this key id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights + /// component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs new file mode 100644 index 000000000000..32f75acc4604 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs @@ -0,0 +1,189 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AnalyticsItemsOperations operations. + /// + public partial interface IAnalyticsItemsOperations + { + /// + /// Gets a list of Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values + /// include: 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each + /// applicable item. If false, only return the item information. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a specific Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights + /// component + /// + /// + /// The name of a specific item defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds or Updates a specific Analytics Item within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add + /// it to an Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specific Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights + /// component + /// + /// + /// The name of a specific item defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs new file mode 100644 index 000000000000..39371bb14b50 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs @@ -0,0 +1,143 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AnnotationsOperations operations. + /// + public partial interface IAnnotationsOperations + { + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than + /// 90 days from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string start, string end, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// 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>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Annotation annotationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application + /// Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the annotation for given id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application + /// Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs deleted file mode 100644 index 319ec8bccd5f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - - /// - /// Composite Swagger for Application Insights Data Client - /// - public partial interface IApplicationInsightsDataClient : 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; } - - /// - /// Subscription credentials which uniquely identify client - /// subscription. - /// - ServiceClientCredentials Credentials { get; } - - - /// - /// Gets the IMetrics. - /// - IMetrics Metrics { get; } - - /// - /// Gets the IEvents. - /// - IEvents Events { get; } - - /// - /// Gets the IQueryOperations. - /// - IQueryOperations Query { get; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs new file mode 100644 index 000000000000..70b2824b1e9c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Composite Swagger for Application Insights Management Client + /// + public partial interface IApplicationInsightsManagementClient : 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; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + 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 IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAnnotationsOperations. + /// + IAnnotationsOperations Annotations { get; } + + /// + /// Gets the IAPIKeysOperations. + /// + IAPIKeysOperations APIKeys { get; } + + /// + /// Gets the IExportConfigurationsOperations. + /// + IExportConfigurationsOperations ExportConfigurations { get; } + + /// + /// Gets the IComponentCurrentBillingFeaturesOperations. + /// + IComponentCurrentBillingFeaturesOperations ComponentCurrentBillingFeatures { get; } + + /// + /// Gets the IComponentQuotaStatusOperations. + /// + IComponentQuotaStatusOperations ComponentQuotaStatus { get; } + + /// + /// Gets the IComponentFeatureCapabilitiesOperations. + /// + IComponentFeatureCapabilitiesOperations ComponentFeatureCapabilities { get; } + + /// + /// Gets the IComponentAvailableFeaturesOperations. + /// + IComponentAvailableFeaturesOperations ComponentAvailableFeatures { get; } + + /// + /// Gets the IProactiveDetectionConfigurationsOperations. + /// + IProactiveDetectionConfigurationsOperations ProactiveDetectionConfigurations { get; } + + /// + /// Gets the IComponentsOperations. + /// + IComponentsOperations Components { get; } + + /// + /// Gets the IWorkItemConfigurationsOperations. + /// + IWorkItemConfigurationsOperations WorkItemConfigurations { get; } + + /// + /// Gets the IFavoritesOperations. + /// + IFavoritesOperations Favorites { get; } + + /// + /// Gets the IWebTestLocationsOperations. + /// + IWebTestLocationsOperations WebTestLocations { get; } + + /// + /// Gets the IWebTestsOperations. + /// + IWebTestsOperations WebTests { get; } + + /// + /// Gets the IAnalyticsItemsOperations. + /// + IAnalyticsItemsOperations AnalyticsItems { get; } + + /// + /// Gets the IWorkbooksOperations. + /// + IWorkbooksOperations Workbooks { get; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs new file mode 100644 index 000000000000..6245ab851381 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentAvailableFeaturesOperations operations. + /// + public partial interface IComponentAvailableFeaturesOperations + { + /// + /// Returns all available features of the application insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs new file mode 100644 index 000000000000..b4b0790c370e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentCurrentBillingFeaturesOperations operations. + /// + public partial interface IComponentCurrentBillingFeaturesOperations + { + /// + /// Returns current billing features for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update current billing features for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for + /// an Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs new file mode 100644 index 000000000000..d0ab332eba9e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentFeatureCapabilitiesOperations operations. + /// + public partial interface IComponentFeatureCapabilitiesOperations + { + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs new file mode 100644 index 000000000000..99f2abb19a76 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentQuotaStatusOperations operations. + /// + public partial interface IComponentQuotaStatusOperations + { + /// + /// Returns daily data volume cap (quota) status for an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs new file mode 100644 index 000000000000..08cdc0e3a58c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs @@ -0,0 +1,282 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentsOperations operations. + /// + public partial interface IComponentsOperations + { + /// + /// Gets a list of all Application Insights components within a + /// subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Application Insights components within a resource + /// group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates (or updates) an Application Insights component. Note: You + /// cannot specify a different value for InstrumentationKey nor AppId + /// in the Put operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application + /// Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing component's tags. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Purges data in an Application Insights component by a set of + /// user-defined filters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of + /// an Application Insights component + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string resourceGroupName, string resourceName, ComponentPurgeBody body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the + /// status of which is returned. + /// + /// + /// 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> GetPurgeStatusWithHttpMessagesAsync(string resourceGroupName, string resourceName, string purgeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all Application Insights components within a + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Application Insights components within a resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs deleted file mode 100644 index b84886dd994f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs +++ /dev/null @@ -1,165 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Events operations. - /// - public partial interface IEvents - { - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type - /// (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, - /// `exceptions`, `availabilityResults`) or `$all` to query across all - /// event types. Possible values include: '$all', 'traces', - /// 'customEvents', 'pageViews', 'browserTimings', 'requests', - /// 'dependencies', 'exceptions', 'availabilityResults', - /// 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an - /// ISO8601 time period value. This timespan is applied in addition to - /// any that are specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular - /// event should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or - /// \"desc\" to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned - /// event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - /// - /// 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> GetByTypeWithHttpMessagesAsync(string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type - /// (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, - /// `exceptions`, `availabilityResults`) or `$all` to query across all - /// event types. Possible values include: '$all', 'traces', - /// 'customEvents', 'pageViews', 'browserTimings', 'requests', - /// 'dependencies', 'exceptions', 'availabilityResults', - /// 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an - /// ISO8601 time period value. This timespan is applied in addition to - /// any that are specified in the Odata expression. - /// - /// - /// 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 appId, string eventType, string eventId, string timespan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// 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> GetOdataMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs new file mode 100644 index 000000000000..2c0937a7033e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs @@ -0,0 +1,175 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExportConfigurationsOperations operations. + /// + public partial interface IExportConfigurationsOperations + { + /// + /// Gets a list of Continuous Export configuration of an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// 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>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous + /// Export configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs new file mode 100644 index 000000000000..88410b28b122 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs @@ -0,0 +1,195 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FavoritesOperations operations. + /// + public partial interface IFavoritesOperations + { + /// + /// Gets a list of favorites defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible + /// values include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type + /// defaults to 'other' (not present in this enum). Possible values + /// include: 'retention', 'notebook', 'sessions', 'events', + /// 'userflows', 'funnel', 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for + /// favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a single favorite by its FavoriteId, defined within an + /// Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// Properties that need to be specified to create a new favorite and + /// add it to an Application Insights component. + /// + /// + /// 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> AddWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a favorite that has already been added to an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// Properties that need to be specified to update the existing + /// favorite. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a favorite that is associated to an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs deleted file mode 100644 index 657018f66eea..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs +++ /dev/null @@ -1,173 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Metrics operations. - /// - public partial interface IMetrics - { - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', - /// 'users/count', 'users/authenticated', 'pageViews/count', - /// 'pageViews/duration', 'client/processingDuration', - /// 'client/receiveDuration', 'client/networkDuration', - /// 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', - /// 'dependencies/duration', 'exceptions/count', 'exceptions/browser', - /// 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an - /// ISO8601 time period value. If timespan is omitted, a default time - /// range of `PT12H` ("last 12 hours") is used. The actual timespan - /// that is queried may be adjusted by the server based. In all cases, - /// the actual time span used for the query is included in the - /// response. - /// - /// - /// The time interval to use when retrieving metric values. This is an - /// ISO8601 duration. If interval is omitted, the metric value is - /// aggregated across the entire timespan. If interval is supplied, the - /// server may adjust the interval to a more appropriate size based on - /// the timespan used for the query. In all cases, the actual interval - /// used for the query is included in the response. - /// - /// - /// The aggregation to use when computing the metric values. To - /// retrieve more than one aggregation at a time, separate them with a - /// comma. If no aggregation is specified, then the default aggregation - /// for the metric is used. - /// - /// - /// The name of the dimension to segment the metric values by. This - /// dimension must be applicable to the metric you are retrieving. To - /// segment by more than one dimension at a time, separate them with a - /// comma (,). In this case, the metric data will be segmented in the - /// order the dimensions are listed in the parameter. - /// - /// - /// The number of segments to return. This value is only valid when - /// segment is specified. - /// - /// - /// The aggregation function and direction to sort the segments by. - /// This value is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a - /// valid OData filter expression where the keys of each clause should - /// be applicable dimensions for the metric you are retrieving. - /// - /// - /// 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 appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - /// - /// 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>> GetMultipleWithHttpMessagesAsync(string appId, IList body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// 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> GetMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs new file mode 100644 index 000000000000..fc3ceb0ca2bd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/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.ApplicationInsights.Management +{ + 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 insights 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 insights 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs new file mode 100644 index 000000000000..4c6798aa9fdf --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProactiveDetectionConfigurationsOperations operations. + /// + public partial interface IProactiveDetectionConfigurationsOperations + { + /// + /// Gets a list of ProactiveDetection configurations of an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the ProactiveDetection configuration for this configuration + /// id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the + /// ProactiveDetection configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs deleted file mode 100644 index fd2fbdd40d49..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QueryOperations operations. - /// - public partial interface IQueryOperations - { - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 - /// time period value. This timespan is applied in addition to any - /// that are specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - /// - /// 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> ExecuteWithHttpMessagesAsync(string appId, string query, string timespan = default(string), IList applications = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs new file mode 100644 index 000000000000..1f09ef7aef27 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WebTestLocationsOperations operations. + /// + public partial interface IWebTestLocationsOperations + { + /// + /// Gets a list of web test locations available to this Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs new file mode 100644 index 000000000000..779cc1bbd500 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs @@ -0,0 +1,269 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WebTestsOperations operations. + /// + public partial interface IWebTestsOperations + { + /// + /// Get all Application Insights web tests defined within a specified + /// resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest 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> GetWithHttpMessagesAsync(string resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an + /// Application Insights web test definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string webTestName, WebTest webTestDefinition, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Application Insights web test. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web tests defined for the specified + /// component. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByComponentWithHttpMessagesAsync(string componentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web tests defined within a specified + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web tests defined for the specified + /// component. + /// + /// + /// 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>> ListByComponentNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs new file mode 100644 index 000000000000..9df36927d135 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs @@ -0,0 +1,200 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkItemConfigurationsOperations operations. + /// + public partial interface IWorkItemConfigurationsOperations + { + /// + /// Gets the list work item configurations that exist for the + /// application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item + /// configuration of a Application Insights component. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets default work item configurations that exist for the + /// application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetDefaultWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a work item configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// 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> GetItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item + /// configuration for this Application Insights component. + /// + /// + /// 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> UpdateItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs new file mode 100644 index 000000000000..57188f8ed4d5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs @@ -0,0 +1,165 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkbooksOperations operations. + /// + public partial interface IWorkbooksOperations + { + /// + /// Get all Workbooks defined within a specified resource group and + /// category. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: + /// 'workbook', 'TSG', 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for + /// workbooks. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a workbook that has already been added. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs deleted file mode 100644 index 0046d58892c3..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs +++ /dev/null @@ -1,283 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Metrics. - /// - public static partial class MetricsExtensions - { - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. - /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. - /// - public static MetricsResult Get(this IMetrics operations, string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string)) - { - return operations.GetAsync(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. - /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMetrics operations, string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - public static IList GetMultiple(this IMetrics operations, string appId, IList body) - { - return operations.GetMultipleAsync(appId, body).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - /// - /// The cancellation token. - /// - public static async Task> GetMultipleAsync(this IMetrics operations, string appId, IList body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMultipleWithHttpMessagesAsync(appId, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - public static object GetMetadata(this IMetrics operations, string appId) - { - return operations.GetMetadataAsync(appId).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The cancellation token. - /// - public static async Task GetMetadataAsync(this IMetrics operations, string appId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMetadataWithHttpMessagesAsync(appId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs new file mode 100644 index 000000000000..f59d679ecb97 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component API Key creation request definition. + /// + public partial class APIKeyRequest + { + /// + /// Initializes a new instance of the APIKeyRequest class. + /// + public APIKeyRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the APIKeyRequest class. + /// + /// The name of the API Key. + /// The read access rights of this + /// API Key. + /// The write access rights of this + /// API Key. + public APIKeyRequest(string name = default(string), IList linkedReadProperties = default(IList), IList linkedWriteProperties = default(IList)) + { + Name = name; + LinkedReadProperties = linkedReadProperties; + LinkedWriteProperties = linkedWriteProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the API Key. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the read access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedReadProperties")] + public IList LinkedReadProperties { get; set; } + + /// + /// Gets or sets the write access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedWriteProperties")] + public IList LinkedWriteProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs new file mode 100644 index 000000000000..0f23f011b794 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Annotation associated with an application insights resource. + /// + public partial class Annotation + { + /// + /// Initializes a new instance of the Annotation class. + /// + public Annotation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Annotation class. + /// + /// Name of annotation + /// Category of annotation, free form + /// Time when event occurred + /// Unique Id for annotation + /// Serialized JSON object for detailed + /// properties + /// Related parent annotation if + /// any + public Annotation(string annotationName = default(string), string category = default(string), System.DateTime? eventTime = default(System.DateTime?), string id = default(string), string properties = default(string), string relatedAnnotation = default(string)) + { + AnnotationName = annotationName; + Category = category; + EventTime = eventTime; + Id = id; + Properties = properties; + RelatedAnnotation = relatedAnnotation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of annotation + /// + [JsonProperty(PropertyName = "AnnotationName")] + public string AnnotationName { get; set; } + + /// + /// Gets or sets category of annotation, free form + /// + [JsonProperty(PropertyName = "Category")] + public string Category { get; set; } + + /// + /// Gets or sets time when event occurred + /// + [JsonProperty(PropertyName = "EventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets unique Id for annotation + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "Properties")] + public string Properties { get; set; } + + /// + /// Gets or sets related parent annotation if any + /// + [JsonProperty(PropertyName = "RelatedAnnotation")] + public string RelatedAnnotation { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs similarity index 50% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs index 4f7f3c0774f0..6c19e30c6d96 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs @@ -8,33 +8,35 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// The trace information + /// Error associated with trying to create annotation with Id that already + /// exist /// - public partial class EventsTraceInfo + public partial class AnnotationError { /// - /// Initializes a new instance of the EventsTraceInfo class. + /// Initializes a new instance of the AnnotationError class. /// - public EventsTraceInfo() + public AnnotationError() { CustomInit(); } /// - /// Initializes a new instance of the EventsTraceInfo class. + /// Initializes a new instance of the AnnotationError class. /// - /// The trace message - /// The trace severity level - public EventsTraceInfo(string message = default(string), int? severityLevel = default(int?)) + /// Error detail code and explanation + /// Error message + public AnnotationError(string code = default(string), string message = default(string), InnerError innererror = default(InnerError)) { + Code = code; Message = message; - SeverityLevel = severityLevel; + Innererror = innererror; CustomInit(); } @@ -44,16 +46,21 @@ public EventsTraceInfo() partial void CustomInit(); /// - /// Gets or sets the trace message + /// Gets or sets error detail code and explanation + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message /// [JsonProperty(PropertyName = "message")] public string Message { get; set; } /// - /// Gets or sets the trace severity level /// - [JsonProperty(PropertyName = "severityLevel")] - public int? SeverityLevel { get; set; } + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs new file mode 100644 index 000000000000..fb6e93a77587 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with AnnotationError + /// information. + /// + public partial class AnnotationErrorException : 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 AnnotationError Body { get; set; } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + public AnnotationErrorException() + { + } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + /// The exception message. + public AnnotationErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + /// The exception message. + /// Inner exception. + public AnnotationErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs new file mode 100644 index 000000000000..1156ea830240 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs @@ -0,0 +1,227 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationInsightsComponent : ComponentsResource + { + /// + /// Initializes a new instance of the ApplicationInsightsComponent + /// class. + /// + public ApplicationInsightsComponent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationInsightsComponent + /// class. + /// + /// Resource location + /// The kind of application that this component + /// refers to, used to customize UI. This value is a freeform string, + /// values should typically be one of the following: web, ios, other, + /// store, java, phone. + /// Type of application being monitored. + /// Possible values include: 'web', 'other' + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// The unique ID of your application. This + /// field mirrors the 'Name' field and cannot be changed. + /// Application Insights Unique ID for your + /// Application. + /// Used by the Application Insights system to + /// determine what kind of flow this component was created by. This is + /// to be set to 'Bluefield' when creating/updating a component via the + /// REST API. Possible values include: 'Bluefield' + /// Describes what tool created this + /// Application Insights component. Customers using this API should set + /// this to the default 'rest'. Possible values include: 'rest' + /// Application Insights + /// Instrumentation key. A read-only value that applications can use to + /// identify the destination for all telemetry sent to Azure + /// Application Insights. This value will be supplied upon construction + /// of each new Application Insights component. + /// Creation Date for the Application + /// Insights component, in ISO 8601 format. + /// Azure Tenant Id. + /// The unique application ID created when a + /// new application is added to HockeyApp, used for communications with + /// HockeyApp. + /// Token used to authenticate + /// communications with between Application Insights and + /// HockeyApp. + /// Current state of this component: + /// whether or not is has been provisioned within the resource group it + /// is defined. Users cannot change this value but are able to read + /// from it. Values will include Succeeded, Deploying, Canceled, and + /// Failed. + /// Percentage of the data produced by + /// the application being monitored that is being sampled for + /// Application Insights telemetry. + public ApplicationInsightsComponent(string location, string kind, string applicationType, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string applicationId = default(string), string appId = default(string), string flowType = default(string), string requestSource = default(string), string instrumentationKey = default(string), System.DateTime? creationDate = default(System.DateTime?), string tenantId = default(string), string hockeyAppId = default(string), string hockeyAppToken = default(string), string provisioningState = default(string), double? samplingPercentage = default(double?)) + : base(location, id, name, type, tags) + { + Kind = kind; + ApplicationId = applicationId; + AppId = appId; + ApplicationType = applicationType; + FlowType = flowType; + RequestSource = requestSource; + InstrumentationKey = instrumentationKey; + CreationDate = creationDate; + TenantId = tenantId; + HockeyAppId = hockeyAppId; + HockeyAppToken = hockeyAppToken; + ProvisioningState = provisioningState; + SamplingPercentage = samplingPercentage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of application that this component refers to, + /// used to customize UI. This value is a freeform string, values + /// should typically be one of the following: web, ios, other, store, + /// java, phone. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the unique ID of your application. This field mirrors the + /// 'Name' field and cannot be changed. + /// + [JsonProperty(PropertyName = "properties.ApplicationId")] + public string ApplicationId { get; private set; } + + /// + /// Gets application Insights Unique ID for your Application. + /// + [JsonProperty(PropertyName = "properties.AppId")] + public string AppId { get; private set; } + + /// + /// Gets or sets type of application being monitored. Possible values + /// include: 'web', 'other' + /// + [JsonProperty(PropertyName = "properties.Application_Type")] + public string ApplicationType { get; set; } + + /// + /// Gets or sets used by the Application Insights system to determine + /// what kind of flow this component was created by. This is to be set + /// to 'Bluefield' when creating/updating a component via the REST API. + /// Possible values include: 'Bluefield' + /// + [JsonProperty(PropertyName = "properties.Flow_Type")] + public string FlowType { get; set; } + + /// + /// Gets or sets describes what tool created this Application Insights + /// component. Customers using this API should set this to the default + /// 'rest'. Possible values include: 'rest' + /// + [JsonProperty(PropertyName = "properties.Request_Source")] + public string RequestSource { get; set; } + + /// + /// Gets application Insights Instrumentation key. A read-only value + /// that applications can use to identify the destination for all + /// telemetry sent to Azure Application Insights. This value will be + /// supplied upon construction of each new Application Insights + /// component. + /// + [JsonProperty(PropertyName = "properties.InstrumentationKey")] + public string InstrumentationKey { get; private set; } + + /// + /// Gets creation Date for the Application Insights component, in ISO + /// 8601 format. + /// + [JsonProperty(PropertyName = "properties.CreationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets azure Tenant Id. + /// + [JsonProperty(PropertyName = "properties.TenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the unique application ID created when a new + /// application is added to HockeyApp, used for communications with + /// HockeyApp. + /// + [JsonProperty(PropertyName = "properties.HockeyAppId")] + public string HockeyAppId { get; set; } + + /// + /// Gets token used to authenticate communications with between + /// Application Insights and HockeyApp. + /// + [JsonProperty(PropertyName = "properties.HockeyAppToken")] + public string HockeyAppToken { get; private set; } + + /// + /// Gets current state of this component: whether or not is has been + /// provisioned within the resource group it is defined. Users cannot + /// change this value but are able to read from it. Values will include + /// Succeeded, Deploying, Canceled, and Failed. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets percentage of the data produced by the application + /// being monitored that is being sampled for Application Insights + /// telemetry. + /// + [JsonProperty(PropertyName = "properties.SamplingPercentage")] + public double? SamplingPercentage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + if (ApplicationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationType"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs new file mode 100644 index 000000000000..b898c2527e28 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs @@ -0,0 +1,102 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define an API key of an Application Insights Component. + /// + public partial class ApplicationInsightsComponentAPIKey + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAPIKey class. + /// + public ApplicationInsightsComponentAPIKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAPIKey class. + /// + /// The unique ID of the API key inside an Application + /// Insights component. It is auto generated when the API key is + /// created. + /// The API key value. It will be only return once + /// when the API Key was created. + /// The create date of this API key. + /// The name of the API key. + /// The read access rights of this + /// API Key. + /// The write access rights of this + /// API Key. + public ApplicationInsightsComponentAPIKey(string id = default(string), string apiKey = default(string), string createdDate = default(string), string name = default(string), IList linkedReadProperties = default(IList), IList linkedWriteProperties = default(IList)) + { + Id = id; + ApiKey = apiKey; + CreatedDate = createdDate; + Name = name; + LinkedReadProperties = linkedReadProperties; + LinkedWriteProperties = linkedWriteProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique ID of the API key inside an Application Insights + /// component. It is auto generated when the API key is created. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the API key value. It will be only return once when the API + /// Key was created. + /// + [JsonProperty(PropertyName = "apiKey")] + public string ApiKey { get; private set; } + + /// + /// Gets or sets the create date of this API key. + /// + [JsonProperty(PropertyName = "createdDate")] + public string CreatedDate { get; set; } + + /// + /// Gets or sets the name of the API key. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the read access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedReadProperties")] + public IList LinkedReadProperties { get; set; } + + /// + /// Gets or sets the write access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedWriteProperties")] + public IList LinkedWriteProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs new file mode 100644 index 000000000000..f4fe09df0b87 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs @@ -0,0 +1,131 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define an Analytics item that is associated to an + /// Application Insights component. + /// + public partial class ApplicationInsightsComponentAnalyticsItem + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItem class. + /// + public ApplicationInsightsComponentAnalyticsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItem class. + /// + /// Internally assigned unique id of the item + /// definition. + /// The user-defined name of the item. + /// The content of this item + /// This instance's version of the data model. + /// This can change as new features are added. + /// Enum indicating if this item definition is + /// owned by a specific user or is shared between all users with access + /// to the Application Insights component. Possible values include: + /// 'shared', 'user' + /// Enum indicating the type of the Analytics item. + /// Possible values include: 'query', 'function', 'folder', + /// 'recent' + /// Date and time in UTC when this item was + /// created. + /// Date and time in UTC of the last + /// modification that was made to this item. + public ApplicationInsightsComponentAnalyticsItem(string id = default(string), string name = default(string), string content = default(string), string version = default(string), string scope = default(string), string type = default(string), string timeCreated = default(string), string timeModified = default(string), ApplicationInsightsComponentAnalyticsItemProperties properties = default(ApplicationInsightsComponentAnalyticsItemProperties)) + { + Id = id; + Name = name; + Content = content; + Version = version; + Scope = scope; + Type = type; + TimeCreated = timeCreated; + TimeModified = timeModified; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets internally assigned unique id of the item definition. + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets the user-defined name of the item. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets the content of this item + /// + [JsonProperty(PropertyName = "Content")] + public string Content { get; set; } + + /// + /// Gets this instance's version of the data model. This can change as + /// new features are added. + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; private set; } + + /// + /// Gets or sets enum indicating if this item definition is owned by a + /// specific user or is shared between all users with access to the + /// Application Insights component. Possible values include: 'shared', + /// 'user' + /// + [JsonProperty(PropertyName = "Scope")] + public string Scope { get; set; } + + /// + /// Gets or sets enum indicating the type of the Analytics item. + /// Possible values include: 'query', 'function', 'folder', 'recent' + /// + [JsonProperty(PropertyName = "Type")] + public string Type { get; set; } + + /// + /// Gets date and time in UTC when this item was created. + /// + [JsonProperty(PropertyName = "TimeCreated")] + public string TimeCreated { get; private set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this item. + /// + [JsonProperty(PropertyName = "TimeModified")] + public string TimeModified { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "Properties")] + public ApplicationInsightsComponentAnalyticsItemProperties Properties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs new file mode 100644 index 000000000000..a9eb6b1a2063 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A set of properties that can be defined in the context of a specific + /// item type. Each type may have its own properties. + /// + public partial class ApplicationInsightsComponentAnalyticsItemProperties + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItemProperties class. + /// + public ApplicationInsightsComponentAnalyticsItemProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItemProperties class. + /// + /// A function alias, used when the type of + /// the item is Function + public ApplicationInsightsComponentAnalyticsItemProperties(string functionAlias = default(string)) + { + FunctionAlias = functionAlias; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a function alias, used when the type of the item is + /// Function + /// + [JsonProperty(PropertyName = "functionAlias")] + public string FunctionAlias { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs new file mode 100644 index 000000000000..2c0aa2d8411c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component available features. + /// + public partial class ApplicationInsightsComponentAvailableFeatures + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAvailableFeatures class. + /// + public ApplicationInsightsComponentAvailableFeatures() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAvailableFeatures class. + /// + /// A list of Application Insights component + /// feature. + public ApplicationInsightsComponentAvailableFeatures(IList result = default(IList)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of Application Insights component feature. + /// + [JsonProperty(PropertyName = "Result")] + public IList Result { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs new file mode 100644 index 000000000000..27c4f3f8b9a0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component billing features + /// + public partial class ApplicationInsightsComponentBillingFeatures + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentBillingFeatures class. + /// + public ApplicationInsightsComponentBillingFeatures() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentBillingFeatures class. + /// + /// An Application Insights component daily + /// data volume cap + /// Current enabled pricing plan. + /// When the component is in the Enterprise plan, this will list both + /// 'Basic' and 'Application Insights Enterprise'. + public ApplicationInsightsComponentBillingFeatures(ApplicationInsightsComponentDataVolumeCap dataVolumeCap = default(ApplicationInsightsComponentDataVolumeCap), IList currentBillingFeatures = default(IList)) + { + DataVolumeCap = dataVolumeCap; + CurrentBillingFeatures = currentBillingFeatures; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an Application Insights component daily data volume + /// cap + /// + [JsonProperty(PropertyName = "DataVolumeCap")] + public ApplicationInsightsComponentDataVolumeCap DataVolumeCap { get; set; } + + /// + /// Gets or sets current enabled pricing plan. When the component is in + /// the Enterprise plan, this will list both 'Basic' and 'Application + /// Insights Enterprise'. + /// + [JsonProperty(PropertyName = "CurrentBillingFeatures")] + public IList CurrentBillingFeatures { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs new file mode 100644 index 000000000000..8492b7665344 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs @@ -0,0 +1,99 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap + /// + public partial class ApplicationInsightsComponentDataVolumeCap + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentDataVolumeCap class. + /// + public ApplicationInsightsComponentDataVolumeCap() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentDataVolumeCap class. + /// + /// Daily data volume cap in GB. + /// Daily data volume cap UTC reset + /// hour. + /// Reserved, not used for now. + /// Reserved, not + /// used for now. + /// Do not send a + /// notification email when the daily data volume cap is met. + /// Maximum daily data volume cap that the + /// user can set for this component. + public ApplicationInsightsComponentDataVolumeCap(double? cap = default(double?), int? resetTime = default(int?), int? warningThreshold = default(int?), bool? stopSendNotificationWhenHitThreshold = default(bool?), bool? stopSendNotificationWhenHitCap = default(bool?), double? maxHistoryCap = default(double?)) + { + Cap = cap; + ResetTime = resetTime; + WarningThreshold = warningThreshold; + StopSendNotificationWhenHitThreshold = stopSendNotificationWhenHitThreshold; + StopSendNotificationWhenHitCap = stopSendNotificationWhenHitCap; + MaxHistoryCap = maxHistoryCap; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets daily data volume cap in GB. + /// + [JsonProperty(PropertyName = "Cap")] + public double? Cap { get; set; } + + /// + /// Gets daily data volume cap UTC reset hour. + /// + [JsonProperty(PropertyName = "ResetTime")] + public int? ResetTime { get; private set; } + + /// + /// Gets or sets reserved, not used for now. + /// + [JsonProperty(PropertyName = "WarningThreshold")] + public int? WarningThreshold { get; set; } + + /// + /// Gets or sets reserved, not used for now. + /// + [JsonProperty(PropertyName = "StopSendNotificationWhenHitThreshold")] + public bool? StopSendNotificationWhenHitThreshold { get; set; } + + /// + /// Gets or sets do not send a notification email when the daily data + /// volume cap is met. + /// + [JsonProperty(PropertyName = "StopSendNotificationWhenHitCap")] + public bool? StopSendNotificationWhenHitCap { get; set; } + + /// + /// Gets maximum daily data volume cap that the user can set for this + /// component. + /// + [JsonProperty(PropertyName = "MaxHistoryCap")] + public double? MaxHistoryCap { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs new file mode 100644 index 000000000000..f72147caec09 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs @@ -0,0 +1,234 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define a Continuous Export configuration. + /// + public partial class ApplicationInsightsComponentExportConfiguration + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportConfiguration class. + /// + public ApplicationInsightsComponentExportConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportConfiguration class. + /// + /// The unique ID of the export configuration + /// inside an Application Insights component. It is auto generated when + /// the Continuous Export configuration is created. + /// The instrumentation key of the + /// Application Insights component. + /// This comma separated list of document + /// types that will be exported. The possible values include + /// 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', + /// 'PageViewPerformance', 'Rdd', 'PerformanceCounters', + /// 'Availability', 'Messages'. + /// The name of the Application Insights + /// component. + /// The subscription of the Application + /// Insights component. + /// The resource group of the Application + /// Insights component. + /// The destination + /// storage account subscription ID. + /// The destination account + /// location ID. + /// The name of destination + /// account. + /// The destination type. + /// This will be 'true' if the Continuous + /// Export configuration is enabled, otherwise it will be + /// 'false'. + /// Last time the Continuous Export + /// configuration was updated. + /// Deprecated + /// This indicates current Continuous Export + /// configuration status. The possible values are 'Preparing', + /// 'Success', 'Failure'. + /// The last time data was successfully + /// delivered to the destination storage container for this Continuous + /// Export configuration. + /// The last time the Continuous Export + /// configuration started failing. + /// This is the reason the + /// Continuous Export configuration started failing. It can be + /// 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. + /// The name of the destination storage + /// account. + /// The name of the destination storage + /// container. + public ApplicationInsightsComponentExportConfiguration(string exportId = default(string), string instrumentationKey = default(string), string recordTypes = default(string), string applicationName = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string destinationStorageSubscriptionId = default(string), string destinationStorageLocationId = default(string), string destinationAccountId = default(string), string destinationType = default(string), string isUserEnabled = default(string), string lastUserUpdate = default(string), string notificationQueueEnabled = default(string), string exportStatus = default(string), string lastSuccessTime = default(string), string lastGapTime = default(string), string permanentErrorReason = default(string), string storageName = default(string), string containerName = default(string)) + { + ExportId = exportId; + InstrumentationKey = instrumentationKey; + RecordTypes = recordTypes; + ApplicationName = applicationName; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + DestinationStorageSubscriptionId = destinationStorageSubscriptionId; + DestinationStorageLocationId = destinationStorageLocationId; + DestinationAccountId = destinationAccountId; + DestinationType = destinationType; + IsUserEnabled = isUserEnabled; + LastUserUpdate = lastUserUpdate; + NotificationQueueEnabled = notificationQueueEnabled; + ExportStatus = exportStatus; + LastSuccessTime = lastSuccessTime; + LastGapTime = lastGapTime; + PermanentErrorReason = permanentErrorReason; + StorageName = storageName; + ContainerName = containerName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique ID of the export configuration inside an + /// Application Insights component. It is auto generated when the + /// Continuous Export configuration is created. + /// + [JsonProperty(PropertyName = "ExportId")] + public string ExportId { get; private set; } + + /// + /// Gets the instrumentation key of the Application Insights component. + /// + [JsonProperty(PropertyName = "InstrumentationKey")] + public string InstrumentationKey { get; private set; } + + /// + /// Gets or sets this comma separated list of document types that will + /// be exported. The possible values include 'Requests', 'Event', + /// 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// + [JsonProperty(PropertyName = "RecordTypes")] + public string RecordTypes { get; set; } + + /// + /// Gets the name of the Application Insights component. + /// + [JsonProperty(PropertyName = "ApplicationName")] + public string ApplicationName { get; private set; } + + /// + /// Gets the subscription of the Application Insights component. + /// + [JsonProperty(PropertyName = "SubscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets the resource group of the Application Insights component. + /// + [JsonProperty(PropertyName = "ResourceGroup")] + public string ResourceGroup { get; private set; } + + /// + /// Gets the destination storage account subscription ID. + /// + [JsonProperty(PropertyName = "DestinationStorageSubscriptionId")] + public string DestinationStorageSubscriptionId { get; private set; } + + /// + /// Gets the destination account location ID. + /// + [JsonProperty(PropertyName = "DestinationStorageLocationId")] + public string DestinationStorageLocationId { get; private set; } + + /// + /// Gets the name of destination account. + /// + [JsonProperty(PropertyName = "DestinationAccountId")] + public string DestinationAccountId { get; private set; } + + /// + /// Gets the destination type. + /// + [JsonProperty(PropertyName = "DestinationType")] + public string DestinationType { get; private set; } + + /// + /// Gets this will be 'true' if the Continuous Export configuration is + /// enabled, otherwise it will be 'false'. + /// + [JsonProperty(PropertyName = "IsUserEnabled")] + public string IsUserEnabled { get; private set; } + + /// + /// Gets last time the Continuous Export configuration was updated. + /// + [JsonProperty(PropertyName = "LastUserUpdate")] + public string LastUserUpdate { get; private set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueEnabled")] + public string NotificationQueueEnabled { get; set; } + + /// + /// Gets this indicates current Continuous Export configuration status. + /// The possible values are 'Preparing', 'Success', 'Failure'. + /// + [JsonProperty(PropertyName = "ExportStatus")] + public string ExportStatus { get; private set; } + + /// + /// Gets the last time data was successfully delivered to the + /// destination storage container for this Continuous Export + /// configuration. + /// + [JsonProperty(PropertyName = "LastSuccessTime")] + public string LastSuccessTime { get; private set; } + + /// + /// Gets the last time the Continuous Export configuration started + /// failing. + /// + [JsonProperty(PropertyName = "LastGapTime")] + public string LastGapTime { get; private set; } + + /// + /// Gets this is the reason the Continuous Export configuration started + /// failing. It can be 'AzureStorageNotFound' or + /// 'AzureStorageAccessDenied'. + /// + [JsonProperty(PropertyName = "PermanentErrorReason")] + public string PermanentErrorReason { get; private set; } + + /// + /// Gets the name of the destination storage account. + /// + [JsonProperty(PropertyName = "StorageName")] + public string StorageName { get; private set; } + + /// + /// Gets the name of the destination storage container. + /// + [JsonProperty(PropertyName = "ContainerName")] + public string ContainerName { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs new file mode 100644 index 000000000000..103e9334fde2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs @@ -0,0 +1,134 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component Continuous Export configuration + /// request definition. + /// + public partial class ApplicationInsightsComponentExportRequest + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportRequest class. + /// + public ApplicationInsightsComponentExportRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportRequest class. + /// + /// The document types to be exported, as + /// comma separated values. Allowed values include 'Requests', 'Event', + /// 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// The Continuous Export destination + /// type. This has to be 'Blob'. + /// The SAS URL for the destination + /// storage container. It must grant write permission. + /// Set to 'true' to create a Continuous Export + /// configuration as enabled, otherwise set it to 'false'. + /// Deprecated + /// Deprecated + /// The subscription ID + /// of the destination storage container. + /// The location ID of the + /// destination storage container. + /// The name of destination storage + /// account. + public ApplicationInsightsComponentExportRequest(string recordTypes = default(string), string destinationType = default(string), string destinationAddress = default(string), string isEnabled = default(string), string notificationQueueEnabled = default(string), string notificationQueueUri = default(string), string destinationStorageSubscriptionId = default(string), string destinationStorageLocationId = default(string), string destinationAccountId = default(string)) + { + RecordTypes = recordTypes; + DestinationType = destinationType; + DestinationAddress = destinationAddress; + IsEnabled = isEnabled; + NotificationQueueEnabled = notificationQueueEnabled; + NotificationQueueUri = notificationQueueUri; + DestinationStorageSubscriptionId = destinationStorageSubscriptionId; + DestinationStorageLocationId = destinationStorageLocationId; + DestinationAccountId = destinationAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the document types to be exported, as comma separated + /// values. Allowed values include 'Requests', 'Event', 'Exceptions', + /// 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// + [JsonProperty(PropertyName = "RecordTypes")] + public string RecordTypes { get; set; } + + /// + /// Gets or sets the Continuous Export destination type. This has to be + /// 'Blob'. + /// + [JsonProperty(PropertyName = "DestinationType")] + public string DestinationType { get; set; } + + /// + /// Gets or sets the SAS URL for the destination storage container. It + /// must grant write permission. + /// + [JsonProperty(PropertyName = "DestinationAddress")] + public string DestinationAddress { get; set; } + + /// + /// Gets or sets set to 'true' to create a Continuous Export + /// configuration as enabled, otherwise set it to 'false'. + /// + [JsonProperty(PropertyName = "IsEnabled")] + public string IsEnabled { get; set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueEnabled")] + public string NotificationQueueEnabled { get; set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueUri")] + public string NotificationQueueUri { get; set; } + + /// + /// Gets or sets the subscription ID of the destination storage + /// container. + /// + [JsonProperty(PropertyName = "DestinationStorageSubscriptionId")] + public string DestinationStorageSubscriptionId { get; set; } + + /// + /// Gets or sets the location ID of the destination storage container. + /// + [JsonProperty(PropertyName = "DestinationStorageLocationId")] + public string DestinationStorageLocationId { get; set; } + + /// + /// Gets or sets the name of destination storage account. + /// + [JsonProperty(PropertyName = "DestinationAccountId")] + public string DestinationAccountId { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs new file mode 100644 index 000000000000..8356da1aa70d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs @@ -0,0 +1,162 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define a favorite that is associated to an Application + /// Insights component. + /// + public partial class ApplicationInsightsComponentFavorite + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFavorite class. + /// + public ApplicationInsightsComponentFavorite() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFavorite class. + /// + /// The user-defined name of the favorite. + /// Configuration of this particular favorite, + /// which are driven by the Azure portal UX. Configuration data is a + /// string containing valid JSON + /// This instance's version of the data model. + /// This can change as new features are added that can be marked + /// favorite. Current examples include MetricsExplorer (ME) and + /// Search. + /// Internally assigned unique id of the + /// favorite definition. + /// Enum indicating if this favorite + /// definition is owned by a specific user or is shared between all + /// users with access to the Application Insights component. Possible + /// values include: 'shared', 'user' + /// The source of the favorite + /// definition. + /// Date and time in UTC of the last + /// modification that was made to this favorite definition. + /// A list of 0 or more tags that are associated + /// with this favorite definition + /// Favorite category, as defined by the user at + /// creation time. + /// Flag denoting wether or not + /// this favorite was generated from a template. + /// Unique user id of the specific user that owns + /// this favorite. + public ApplicationInsightsComponentFavorite(string name = default(string), string config = default(string), string version = default(string), string favoriteId = default(string), FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), string timeModified = default(string), IList tags = default(IList), string category = default(string), bool? isGeneratedFromTemplate = default(bool?), string userId = default(string)) + { + Name = name; + Config = config; + Version = version; + FavoriteId = favoriteId; + FavoriteType = favoriteType; + SourceType = sourceType; + TimeModified = timeModified; + Tags = tags; + Category = category; + IsGeneratedFromTemplate = isGeneratedFromTemplate; + UserId = userId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the user-defined name of the favorite. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets configuration of this particular favorite, which are + /// driven by the Azure portal UX. Configuration data is a string + /// containing valid JSON + /// + [JsonProperty(PropertyName = "Config")] + public string Config { get; set; } + + /// + /// Gets or sets this instance's version of the data model. This can + /// change as new features are added that can be marked favorite. + /// Current examples include MetricsExplorer (ME) and Search. + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; set; } + + /// + /// Gets internally assigned unique id of the favorite definition. + /// + [JsonProperty(PropertyName = "FavoriteId")] + public string FavoriteId { get; private set; } + + /// + /// Gets or sets enum indicating if this favorite definition is owned + /// by a specific user or is shared between all users with access to + /// the Application Insights component. Possible values include: + /// 'shared', 'user' + /// + [JsonProperty(PropertyName = "FavoriteType")] + public FavoriteType? FavoriteType { get; set; } + + /// + /// Gets or sets the source of the favorite definition. + /// + [JsonProperty(PropertyName = "SourceType")] + public string SourceType { get; set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this favorite definition. + /// + [JsonProperty(PropertyName = "TimeModified")] + public string TimeModified { get; private set; } + + /// + /// Gets or sets a list of 0 or more tags that are associated with this + /// favorite definition + /// + [JsonProperty(PropertyName = "Tags")] + public IList Tags { get; set; } + + /// + /// Gets or sets favorite category, as defined by the user at creation + /// time. + /// + [JsonProperty(PropertyName = "Category")] + public string Category { get; set; } + + /// + /// Gets or sets flag denoting wether or not this favorite was + /// generated from a template. + /// + [JsonProperty(PropertyName = "IsGeneratedFromTemplate")] + public bool? IsGeneratedFromTemplate { get; set; } + + /// + /// Gets unique user id of the specific user that owns this favorite. + /// + [JsonProperty(PropertyName = "UserId")] + public string UserId { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs new file mode 100644 index 000000000000..7d779fdac849 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs @@ -0,0 +1,123 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap status + /// + public partial class ApplicationInsightsComponentFeature + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeature class. + /// + public ApplicationInsightsComponentFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeature class. + /// + /// The pricing feature name. + /// The meter id used for the feature. + /// The meter rate for the feature's + /// meter. + /// Reserved, not used now. + /// Reserved, not used now. + /// A list of Application Insights component + /// feature capability. + /// Display name of the feature. + /// Whether can apply addon feature on to + /// it. + /// The add on features on main + /// feature. + public ApplicationInsightsComponentFeature(string featureName = default(string), string meterId = default(string), string meterRateFrequency = default(string), string resouceId = default(string), bool? isHidden = default(bool?), IList capabilities = default(IList), string title = default(string), bool? isMainFeature = default(bool?), string supportedAddonFeatures = default(string)) + { + FeatureName = featureName; + MeterId = meterId; + MeterRateFrequency = meterRateFrequency; + ResouceId = resouceId; + IsHidden = isHidden; + Capabilities = capabilities; + Title = title; + IsMainFeature = isMainFeature; + SupportedAddonFeatures = supportedAddonFeatures; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the pricing feature name. + /// + [JsonProperty(PropertyName = "FeatureName")] + public string FeatureName { get; private set; } + + /// + /// Gets the meter id used for the feature. + /// + [JsonProperty(PropertyName = "MeterId")] + public string MeterId { get; private set; } + + /// + /// Gets the meter rate for the feature's meter. + /// + [JsonProperty(PropertyName = "MeterRateFrequency")] + public string MeterRateFrequency { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ResouceId")] + public string ResouceId { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "IsHidden")] + public bool? IsHidden { get; private set; } + + /// + /// Gets a list of Application Insights component feature capability. + /// + [JsonProperty(PropertyName = "Capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets display name of the feature. + /// + [JsonProperty(PropertyName = "Title")] + public string Title { get; private set; } + + /// + /// Gets whether can apply addon feature on to it. + /// + [JsonProperty(PropertyName = "IsMainFeature")] + public bool? IsMainFeature { get; private set; } + + /// + /// Gets the add on features on main feature. + /// + [JsonProperty(PropertyName = "SupportedAddonFeatures")] + public string SupportedAddonFeatures { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs new file mode 100644 index 000000000000..5a7b1dcbf1f2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs @@ -0,0 +1,178 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component feature capabilities + /// + public partial class ApplicationInsightsComponentFeatureCapabilities + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapabilities class. + /// + public ApplicationInsightsComponentFeatureCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapabilities class. + /// + /// Whether allow to use continuous + /// export feature. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Whether allow to use work item + /// integration feature. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Whether allow to use multiple + /// steps web test feature. + /// Reserved, not used now. + /// The application insights component used + /// tracking type. + /// Daily data volume cap in GB. + /// Daily data volume cap UTC reset + /// hour. + /// Reserved, not used now. + public ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData = default(bool?), string burstThrottlePolicy = default(string), string metadataClass = default(string), bool? liveStreamMetrics = default(bool?), bool? applicationMap = default(bool?), bool? workItemIntegration = default(bool?), bool? powerBIIntegration = default(bool?), bool? openSchema = default(bool?), bool? proactiveDetection = default(bool?), bool? analyticsIntegration = default(bool?), bool? multipleStepWebTest = default(bool?), string apiAccessLevel = default(string), string trackingType = default(string), double? dailyCap = default(double?), double? dailyCapResetTime = default(double?), double? throttleRate = default(double?)) + { + SupportExportData = supportExportData; + BurstThrottlePolicy = burstThrottlePolicy; + MetadataClass = metadataClass; + LiveStreamMetrics = liveStreamMetrics; + ApplicationMap = applicationMap; + WorkItemIntegration = workItemIntegration; + PowerBIIntegration = powerBIIntegration; + OpenSchema = openSchema; + ProactiveDetection = proactiveDetection; + AnalyticsIntegration = analyticsIntegration; + MultipleStepWebTest = multipleStepWebTest; + ApiAccessLevel = apiAccessLevel; + TrackingType = trackingType; + DailyCap = dailyCap; + DailyCapResetTime = dailyCapResetTime; + ThrottleRate = throttleRate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets whether allow to use continuous export feature. + /// + [JsonProperty(PropertyName = "SupportExportData")] + public bool? SupportExportData { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "BurstThrottlePolicy")] + public string BurstThrottlePolicy { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "MetadataClass")] + public string MetadataClass { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "LiveStreamMetrics")] + public bool? LiveStreamMetrics { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ApplicationMap")] + public bool? ApplicationMap { get; private set; } + + /// + /// Gets whether allow to use work item integration feature. + /// + [JsonProperty(PropertyName = "WorkItemIntegration")] + public bool? WorkItemIntegration { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "PowerBIIntegration")] + public bool? PowerBIIntegration { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "OpenSchema")] + public bool? OpenSchema { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ProactiveDetection")] + public bool? ProactiveDetection { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "AnalyticsIntegration")] + public bool? AnalyticsIntegration { get; private set; } + + /// + /// Gets whether allow to use multiple steps web test feature. + /// + [JsonProperty(PropertyName = "MultipleStepWebTest")] + public bool? MultipleStepWebTest { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ApiAccessLevel")] + public string ApiAccessLevel { get; private set; } + + /// + /// Gets the application insights component used tracking type. + /// + [JsonProperty(PropertyName = "TrackingType")] + public string TrackingType { get; private set; } + + /// + /// Gets daily data volume cap in GB. + /// + [JsonProperty(PropertyName = "DailyCap")] + public double? DailyCap { get; private set; } + + /// + /// Gets daily data volume cap UTC reset hour. + /// + [JsonProperty(PropertyName = "DailyCapResetTime")] + public double? DailyCapResetTime { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ThrottleRate")] + public double? ThrottleRate { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs new file mode 100644 index 000000000000..8725afb35bb5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs @@ -0,0 +1,95 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component feature capability + /// + public partial class ApplicationInsightsComponentFeatureCapability + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapability class. + /// + public ApplicationInsightsComponentFeatureCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapability class. + /// + /// The name of the capability. + /// The description of the + /// capability. + /// The value of the capability. + /// The unit of the capability. + /// The meter used for the capability. + /// The meter rate of the + /// meter. + public ApplicationInsightsComponentFeatureCapability(string name = default(string), string description = default(string), string value = default(string), string unit = default(string), string meterId = default(string), string meterRateFrequency = default(string)) + { + Name = name; + Description = description; + Value = value; + Unit = unit; + MeterId = meterId; + MeterRateFrequency = meterRateFrequency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the capability. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; private set; } + + /// + /// Gets the description of the capability. + /// + [JsonProperty(PropertyName = "Description")] + public string Description { get; private set; } + + /// + /// Gets the value of the capability. + /// + [JsonProperty(PropertyName = "Value")] + public string Value { get; private set; } + + /// + /// Gets the unit of the capability. + /// + [JsonProperty(PropertyName = "Unit")] + public string Unit { get; private set; } + + /// + /// Gets the meter used for the capability. + /// + [JsonProperty(PropertyName = "MeterId")] + public string MeterId { get; private set; } + + /// + /// Gets the meter rate of the meter. + /// + [JsonProperty(PropertyName = "MeterRateFrequency")] + public string MeterRateFrequency { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs new file mode 100644 index 000000000000..5b5eb49a6b8e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs @@ -0,0 +1,107 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define a ProactiveDetection configuration. + /// + public partial class ApplicationInsightsComponentProactiveDetectionConfiguration : IResource + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfiguration class. + /// + public ApplicationInsightsComponentProactiveDetectionConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfiguration class. + /// + /// The rule name + /// A flag that indicates whether this rule is + /// enabled by the user + /// A flag that indicated + /// whether notifications on this rule should be sent to subscription + /// owners + /// Custom email addresses for this rule + /// notifications + /// The last time this rule was + /// updated + /// Static definitions of the + /// ProactiveDetection configuration rule (same values for all + /// components). + public ApplicationInsightsComponentProactiveDetectionConfiguration(string name = default(string), bool? enabled = default(bool?), bool? sendEmailsToSubscriptionOwners = default(bool?), IList customEmails = default(IList), string lastUpdatedTime = default(string), ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions ruleDefinitions = default(ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions)) + { + Name = name; + Enabled = enabled; + SendEmailsToSubscriptionOwners = sendEmailsToSubscriptionOwners; + CustomEmails = customEmails; + LastUpdatedTime = lastUpdatedTime; + RuleDefinitions = ruleDefinitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule name + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets a flag that indicates whether this rule is enabled by + /// the user + /// + [JsonProperty(PropertyName = "Enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets a flag that indicated whether notifications on this + /// rule should be sent to subscription owners + /// + [JsonProperty(PropertyName = "SendEmailsToSubscriptionOwners")] + public bool? SendEmailsToSubscriptionOwners { get; set; } + + /// + /// Gets or sets custom email addresses for this rule notifications + /// + [JsonProperty(PropertyName = "CustomEmails")] + public IList CustomEmails { get; set; } + + /// + /// Gets or sets the last time this rule was updated + /// + [JsonProperty(PropertyName = "LastUpdatedTime")] + public string LastUpdatedTime { get; set; } + + /// + /// Gets or sets static definitions of the ProactiveDetection + /// configuration rule (same values for all components). + /// + [JsonProperty(PropertyName = "RuleDefinitions")] + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions RuleDefinitions { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs new file mode 100644 index 000000000000..7fe4fe181470 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs @@ -0,0 +1,123 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Static definitions of the ProactiveDetection configuration rule (same + /// values for all components). + /// + public partial class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + /// class. + /// + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + /// class. + /// + /// The rule name + /// The rule name as it is displayed in + /// UI + /// The rule description + /// URL which displays additional info about the + /// proactive detection rule + /// A flag indicating whether the rule is hidden + /// (from the UI) + /// A flag indicating whether the rule + /// is enabled by default + /// A flag indicating whether the rule is in + /// preview + /// A flag indicating whether + /// email notifications are supported for detections for this + /// rule + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(string name = default(string), string displayName = default(string), string description = default(string), string helpUrl = default(string), bool? isHidden = default(bool?), bool? isEnabledByDefault = default(bool?), bool? isInPreview = default(bool?), bool? supportsEmailNotifications = default(bool?)) + { + Name = name; + DisplayName = displayName; + Description = description; + HelpUrl = helpUrl; + IsHidden = isHidden; + IsEnabledByDefault = isEnabledByDefault; + IsInPreview = isInPreview; + SupportsEmailNotifications = supportsEmailNotifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule name + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets the rule name as it is displayed in UI + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the rule description + /// + [JsonProperty(PropertyName = "Description")] + public string Description { get; set; } + + /// + /// Gets or sets URL which displays additional info about the proactive + /// detection rule + /// + [JsonProperty(PropertyName = "HelpUrl")] + public string HelpUrl { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is hidden (from the + /// UI) + /// + [JsonProperty(PropertyName = "IsHidden")] + public bool? IsHidden { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is enabled by + /// default + /// + [JsonProperty(PropertyName = "IsEnabledByDefault")] + public bool? IsEnabledByDefault { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is in preview + /// + [JsonProperty(PropertyName = "IsInPreview")] + public bool? IsInPreview { get; set; } + + /// + /// Gets or sets a flag indicating whether email notifications are + /// supported for detections for this rule + /// + [JsonProperty(PropertyName = "SupportsEmailNotifications")] + public bool? SupportsEmailNotifications { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs new file mode 100644 index 000000000000..8fe7951dc36e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs @@ -0,0 +1,74 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap status + /// + public partial class ApplicationInsightsComponentQuotaStatus + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentQuotaStatus class. + /// + public ApplicationInsightsComponentQuotaStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentQuotaStatus class. + /// + /// The Application ID for the Application Insights + /// component. + /// The daily data volume cap is met, + /// and data ingestion will be stopped. + /// Date and time when the daily data + /// volume cap will be reset, and data ingestion will resume. + public ApplicationInsightsComponentQuotaStatus(string appId = default(string), bool? shouldBeThrottled = default(bool?), string expirationTime = default(string)) + { + AppId = appId; + ShouldBeThrottled = shouldBeThrottled; + ExpirationTime = expirationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Application ID for the Application Insights component. + /// + [JsonProperty(PropertyName = "AppId")] + public string AppId { get; private set; } + + /// + /// Gets the daily data volume cap is met, and data ingestion will be + /// stopped. + /// + [JsonProperty(PropertyName = "ShouldBeThrottled")] + public bool? ShouldBeThrottled { get; private set; } + + /// + /// Gets date and time when the daily data volume cap will be reset, + /// and data ingestion will resume. + /// + [JsonProperty(PropertyName = "ExpirationTime")] + public string ExpirationTime { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs new file mode 100644 index 000000000000..896db3859aba --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs @@ -0,0 +1,64 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define a web test location available to an Application + /// Insights Component. + /// + public partial class ApplicationInsightsComponentWebTestLocation + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentWebTestLocation class. + /// + public ApplicationInsightsComponentWebTestLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentWebTestLocation class. + /// + /// The display name of the web test + /// location. + /// Internally defined geographic location + /// tag. + public ApplicationInsightsComponentWebTestLocation(string displayName = default(string), string tag = default(string)) + { + DisplayName = displayName; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the display name of the web test location. + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; private set; } + + /// + /// Gets internally defined geographic location tag. + /// + [JsonProperty(PropertyName = "Tag")] + public string Tag { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs similarity index 50% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs index c667cc0575b3..d381307a1069 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs @@ -8,19 +8,15 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { /// - /// Defines values for MetricsAggregation. + /// Defines values for ApplicationType. /// - public static class MetricsAggregation + public static class ApplicationType { - public const string Min = "min"; - public const string Max = "max"; - public const string Avg = "avg"; - public const string Sum = "sum"; - public const string Count = "count"; - public const string Unique = "unique"; + public const string Web = "web"; + public const string Other = "other"; } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.cs new file mode 100644 index 000000000000..9f20ace2fd37 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for CategoryType. + /// + public static class CategoryType + { + public const string Workbook = "workbook"; + public const string TSG = "TSG"; + public const string Performance = "performance"; + public const string Retention = "retention"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs new file mode 100644 index 000000000000..4d5d7af33f6f --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the body of a purge request for an App Insights component + /// + public partial class ComponentPurgeBody + { + /// + /// Initializes a new instance of the ComponentPurgeBody class. + /// + public ComponentPurgeBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentPurgeBody class. + /// + /// Table from which to purge data. + /// The set of columns and filters (queries) to + /// run over them to purge the resulting data. + public ComponentPurgeBody(string table, IList filters) + { + Table = table; + Filters = filters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets table from which to purge data. + /// + [JsonProperty(PropertyName = "table")] + public string Table { get; set; } + + /// + /// Gets or sets the set of columns and filters (queries) to run over + /// them to purge the resulting data. + /// + [JsonProperty(PropertyName = "filters")] + public IList Filters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Table == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); + } + if (Filters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Filters"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs new file mode 100644 index 000000000000..83c4c5781afa --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs @@ -0,0 +1,90 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User-defined filters to return data which will be purged from the + /// table. + /// + public partial class ComponentPurgeBodyFilters + { + /// + /// Initializes a new instance of the ComponentPurgeBodyFilters class. + /// + public ComponentPurgeBodyFilters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentPurgeBodyFilters class. + /// + /// The column of the table over which the given + /// query should run + /// A query operator to evaluate over + /// the provided column and value(s). Supported operators are ==, =~, + /// in, in~, >, >=, <, <=, between, and have the same + /// behavior as they would in a KQL query. + /// the value for the operator to function over. + /// This can be a number (e.g., > 100), a string (timestamp >= + /// '2017-09-01') or array of values. + /// When filtering over custom dimensions, this key + /// will be used as the name of the custom dimension. + public ComponentPurgeBodyFilters(string column = default(string), string operatorProperty = default(string), object value = default(object), string key = default(string)) + { + Column = column; + OperatorProperty = operatorProperty; + Value = value; + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the column of the table over which the given query + /// should run + /// + [JsonProperty(PropertyName = "column")] + public string Column { get; set; } + + /// + /// Gets or sets a query operator to evaluate over the provided column + /// and value(s). Supported operators are ==, =~, in, in~, &gt;, + /// &gt;=, &lt;, &lt;=, between, and have the same behavior + /// as they would in a KQL query. + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets the value for the operator to function over. This can + /// be a number (e.g., &gt; 100), a string (timestamp &gt;= + /// '2017-09-01') or array of values. + /// + [JsonProperty(PropertyName = "value")] + public object Value { get; set; } + + /// + /// Gets or sets when filtering over custom dimensions, this key will + /// be used as the name of the custom dimension. + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs similarity index 52% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs index 6499270222b3..1a73a04e91af 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs @@ -8,37 +8,33 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Microsoft.Rest; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// A query response. + /// Response containing operationId for a specific purge action. /// - /// - /// Contains the tables, columns & rows resulting from a query. - /// - public partial class QueryResults + public partial class ComponentPurgeResponse { /// - /// Initializes a new instance of the QueryResults class. + /// Initializes a new instance of the ComponentPurgeResponse class. /// - public QueryResults() + public ComponentPurgeResponse() { CustomInit(); } /// - /// Initializes a new instance of the QueryResults class. + /// Initializes a new instance of the ComponentPurgeResponse class. /// - /// The list of tables, columns and rows. - public QueryResults(IList tables) + /// Id to use when querying for status for a + /// particular purge operation. + public ComponentPurgeResponse(string operationId) { - Tables = tables; + OperationId = operationId; CustomInit(); } @@ -48,10 +44,11 @@ public QueryResults(IList
tables) partial void CustomInit(); /// - /// Gets or sets the list of tables, columns and rows. + /// Gets or sets id to use when querying for status for a particular + /// purge operation. /// - [JsonProperty(PropertyName = "tables")] - public IList
Tables { get; set; } + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; set; } /// /// Validate the object. @@ -61,19 +58,9 @@ public QueryResults(IList
tables) /// public virtual void Validate() { - if (Tables == null) + if (OperationId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Tables"); - } - if (Tables != null) - { - foreach (var element in Tables) - { - if (element != null) - { - element.Validate(); - } - } + throw new ValidationException(ValidationRules.CannotBeNull, "OperationId"); } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs new file mode 100644 index 000000000000..a5be50fb1bdd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response containing status for a specific purge operation. + /// + public partial class ComponentPurgeStatusResponse + { + /// + /// Initializes a new instance of the ComponentPurgeStatusResponse + /// class. + /// + public ComponentPurgeStatusResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentPurgeStatusResponse + /// class. + /// + /// Status of the operation represented by the + /// requested Id. Possible values include: 'pending', + /// 'completed' + public ComponentPurgeStatusResponse(string status) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the operation represented by the requested + /// Id. Possible values include: 'pending', 'completed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs new file mode 100644 index 000000000000..55614a169114 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class ComponentsResource : IResource + { + /// + /// Initializes a new instance of the ComponentsResource class. + /// + public ComponentsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentsResource class. + /// + /// Resource location + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + public ComponentsResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs deleted file mode 100644 index cae8a394487d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Error details. - /// - public partial class ErrorDetail - { - /// - /// Initializes a new instance of the ErrorDetail class. - /// - public ErrorDetail() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorDetail class. - /// - /// The error's code. - /// A human readable error message. - /// Indicates which property in the request is - /// responsible for the error. - /// Indicates which value in 'target' is - /// responsible for the error. - /// Indicates resources which were responsible - /// for the error. - public ErrorDetail(string code, string message, string target = default(string), string value = default(string), IList resources = default(IList), object additionalProperties = default(object)) - { - Code = code; - Message = message; - Target = target; - Value = value; - Resources = resources; - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the error's code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a human readable error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; 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 indicates which value in 'target' is responsible for - /// the error. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets indicates resources which were responsible for the - /// error. - /// - [JsonProperty(PropertyName = "resources")] - public IList Resources { get; set; } - - /// - /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - if (Message == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Message"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs new file mode 100644 index 000000000000..b17d0fb7ef8f --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error Field contract. + /// + public partial class ErrorFieldContract + { + /// + /// Initializes a new instance of the ErrorFieldContract class. + /// + public ErrorFieldContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorFieldContract class. + /// + /// Property level error code. + /// Human-readable representation of + /// property-level error. + /// Property name. + public ErrorFieldContract(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 or sets property level error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets human-readable representation of property-level error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets property name. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs deleted file mode 100644 index d3b389d18f10..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The code and message for an error. - /// - public partial class ErrorInfo - { - /// - /// Initializes a new instance of the ErrorInfo class. - /// - public ErrorInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorInfo class. - /// - /// A machine readable error code. - /// A human readable error message. - /// error details. - /// Inner error details if they exist. - public ErrorInfo(string code, string message, IList details = default(IList), ErrorInfo innererror = default(ErrorInfo), object additionalProperties = default(object)) - { - Code = code; - Message = message; - Details = details; - Innererror = innererror; - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a machine readable error code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a human readable error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - /// - /// Gets or sets inner error details if they exist. - /// - [JsonProperty(PropertyName = "innererror")] - public ErrorInfo Innererror { get; set; } - - /// - /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - if (Message == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Message"); - } - if (Details != null) - { - foreach (var element in Details) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Innererror != null) - { - Innererror.Validate(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs index 843ea17a4381..61da390886a7 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs @@ -8,18 +8,15 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// Error details. + /// Error response indicates Insights service is not able to process the + /// incoming request. The reason is provided in the error message. /// - /// - /// Contains details when the response code indicates an error. - /// public partial class ErrorResponse { /// @@ -33,10 +30,13 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// The error details. - public ErrorResponse(ErrorInfo error) + /// Error code. + /// Error message indicating why the operation + /// failed. + public ErrorResponse(string code = default(string), string message = default(string)) { - Error = error; + Code = code; + Message = message; CustomInit(); } @@ -46,27 +46,16 @@ public ErrorResponse(ErrorInfo error) partial void CustomInit(); /// - /// Gets or sets the error details. + /// Gets or sets error code. /// - [JsonProperty(PropertyName = "error")] - public ErrorInfo Error { get; set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } /// - /// Validate the object. + /// Gets or sets error message indicating why the operation failed. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Error == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Error"); - } - if (Error != null) - { - Error.Validate(); - } - } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs index d4570b52c567..494ab6ae4f2c 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs @@ -8,7 +8,7 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Microsoft.Rest; diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs deleted file mode 100644 index 1f52b80aa438..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for EventType. - /// - public static class EventType - { - public const string All = "$all"; - public const string Traces = "traces"; - public const string CustomEvents = "customEvents"; - public const string PageViews = "pageViews"; - public const string BrowserTimings = "browserTimings"; - public const string Requests = "requests"; - public const string Dependencies = "dependencies"; - public const string Exceptions = "exceptions"; - public const string AvailabilityResults = "availabilityResults"; - public const string PerformanceCounters = "performanceCounters"; - public const string CustomMetrics = "customMetrics"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs deleted file mode 100644 index 5d871ba17974..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// AI related application info for an event result - /// - public partial class EventsAiInfo - { - /// - /// Initializes a new instance of the EventsAiInfo class. - /// - public EventsAiInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAiInfo class. - /// - /// iKey of the app - /// Name of the application - /// ID of the application - /// SDK version of the application - public EventsAiInfo(string iKey = default(string), string appName = default(string), string appId = default(string), string sdkVersion = default(string)) - { - IKey = iKey; - AppName = appName; - AppId = appId; - SdkVersion = sdkVersion; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets iKey of the app - /// - [JsonProperty(PropertyName = "iKey")] - public string IKey { get; set; } - - /// - /// Gets or sets name of the application - /// - [JsonProperty(PropertyName = "appName")] - public string AppName { get; set; } - - /// - /// Gets or sets ID of the application - /// - [JsonProperty(PropertyName = "appId")] - public string AppId { get; set; } - - /// - /// Gets or sets SDK version of the application - /// - [JsonProperty(PropertyName = "sdkVersion")] - public string SdkVersion { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs deleted file mode 100644 index 0aac297d7413..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The availability result info - /// - public partial class EventsAvailabilityResultInfo - { - /// - /// Initializes a new instance of the EventsAvailabilityResultInfo - /// class. - /// - public EventsAvailabilityResultInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAvailabilityResultInfo - /// class. - /// - /// The name of the availability result - /// Indicates if the availability result was - /// successful - /// The duration of the availability - /// result - /// The performance bucket of the - /// availability result - /// The message of the availability - /// result - /// The location of the availability - /// result - /// The ID of the availability result - /// The size of the availability result - public EventsAvailabilityResultInfo(string name = default(string), string success = default(string), long? duration = default(long?), string performanceBucket = default(string), string message = default(string), string location = default(string), string id = default(string), string size = default(string)) - { - Name = name; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - Message = message; - Location = location; - Id = id; - Size = size; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the availability result - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets indicates if the availability result was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the availability result - /// - [JsonProperty(PropertyName = "duration")] - public long? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the availability result - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the message of the availability result - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the location of the availability result - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the ID of the availability result - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the size of the availability result - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs deleted file mode 100644 index 0dc6ebc3ac6f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An availability result result - /// - [Newtonsoft.Json.JsonObject("availabilityResult")] - public partial class EventsAvailabilityResultResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsAvailabilityResultResult - /// class. - /// - public EventsAvailabilityResultResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAvailabilityResultResult - /// class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsAvailabilityResultResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsAvailabilityResultInfo availabilityResult = default(EventsAvailabilityResultInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - AvailabilityResult = availabilityResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "availabilityResult")] - public EventsAvailabilityResultInfo AvailabilityResult { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs deleted file mode 100644 index a0e771b11ddb..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The browser timing information - /// - public partial class EventsBrowserTimingInfo - { - /// - /// Initializes a new instance of the EventsBrowserTimingInfo class. - /// - public EventsBrowserTimingInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsBrowserTimingInfo class. - /// - /// The path of the URL - /// The host of the URL - /// The name of the page - /// The url of the page - /// The total duration of the load - /// The performance bucket of the - /// load - /// The network duration of the - /// load - /// The send duration of the load - /// The receive duration of the - /// load - /// The processing duration of the - /// load - public EventsBrowserTimingInfo(string urlPath = default(string), string urlHost = default(string), string name = default(string), string url = default(string), long? totalDuration = default(long?), string performanceBucket = default(string), long? networkDuration = default(long?), long? sendDuration = default(long?), long? receiveDuration = default(long?), long? processingDuration = default(long?)) - { - UrlPath = urlPath; - UrlHost = urlHost; - Name = name; - Url = url; - TotalDuration = totalDuration; - PerformanceBucket = performanceBucket; - NetworkDuration = networkDuration; - SendDuration = sendDuration; - ReceiveDuration = receiveDuration; - ProcessingDuration = processingDuration; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the path of the URL - /// - [JsonProperty(PropertyName = "urlPath")] - public string UrlPath { get; set; } - - /// - /// Gets or sets the host of the URL - /// - [JsonProperty(PropertyName = "urlHost")] - public string UrlHost { get; set; } - - /// - /// Gets or sets the name of the page - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the url of the page - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets the total duration of the load - /// - [JsonProperty(PropertyName = "totalDuration")] - public long? TotalDuration { get; set; } - - /// - /// Gets or sets the performance bucket of the load - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the network duration of the load - /// - [JsonProperty(PropertyName = "networkDuration")] - public long? NetworkDuration { get; set; } - - /// - /// Gets or sets the send duration of the load - /// - [JsonProperty(PropertyName = "sendDuration")] - public long? SendDuration { get; set; } - - /// - /// Gets or sets the receive duration of the load - /// - [JsonProperty(PropertyName = "receiveDuration")] - public long? ReceiveDuration { get; set; } - - /// - /// Gets or sets the processing duration of the load - /// - [JsonProperty(PropertyName = "processingDuration")] - public long? ProcessingDuration { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs deleted file mode 100644 index 4f1009a32542..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A browser timing result - /// - [Newtonsoft.Json.JsonObject("browserTiming")] - public partial class EventsBrowserTimingResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsBrowserTimingResult class. - /// - public EventsBrowserTimingResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsBrowserTimingResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsBrowserTimingResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsBrowserTimingInfo browserTiming = default(EventsBrowserTimingInfo), EventsClientPerformanceInfo clientPerformance = default(EventsClientPerformanceInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - BrowserTiming = browserTiming; - ClientPerformance = clientPerformance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "browserTiming")] - public EventsBrowserTimingInfo BrowserTiming { get; set; } - - /// - /// - [JsonProperty(PropertyName = "clientPerformance")] - public EventsClientPerformanceInfo ClientPerformance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs deleted file mode 100644 index 6858451c96a8..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Client info for an event result - /// - public partial class EventsClientInfo - { - /// - /// Initializes a new instance of the EventsClientInfo class. - /// - public EventsClientInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsClientInfo class. - /// - /// Model of the client - /// Operating system of the client - /// Type of the client - /// Browser of the client - /// IP address of the client - /// City of the client - /// State or province of the - /// client - /// Country or region of the - /// client - public EventsClientInfo(string model = default(string), string os = default(string), string type = default(string), string browser = default(string), string ip = default(string), string city = default(string), string stateOrProvince = default(string), string countryOrRegion = default(string)) - { - Model = model; - Os = os; - Type = type; - Browser = browser; - Ip = ip; - City = city; - StateOrProvince = stateOrProvince; - CountryOrRegion = countryOrRegion; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets model of the client - /// - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - - /// - /// Gets or sets operating system of the client - /// - [JsonProperty(PropertyName = "os")] - public string Os { get; set; } - - /// - /// Gets or sets type of the client - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets browser of the client - /// - [JsonProperty(PropertyName = "browser")] - public string Browser { get; set; } - - /// - /// Gets or sets IP address of the client - /// - [JsonProperty(PropertyName = "ip")] - public string Ip { get; set; } - - /// - /// Gets or sets city of the client - /// - [JsonProperty(PropertyName = "city")] - public string City { get; set; } - - /// - /// Gets or sets state or province of the client - /// - [JsonProperty(PropertyName = "stateOrProvince")] - public string StateOrProvince { get; set; } - - /// - /// Gets or sets country or region of the client - /// - [JsonProperty(PropertyName = "countryOrRegion")] - public string CountryOrRegion { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs deleted file mode 100644 index da37f8475c6d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Cloud info for an event result - /// - public partial class EventsCloudInfo - { - /// - /// Initializes a new instance of the EventsCloudInfo class. - /// - public EventsCloudInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCloudInfo class. - /// - /// Role name of the cloud - /// Role instance of the cloud - public EventsCloudInfo(string roleName = default(string), string roleInstance = default(string)) - { - RoleName = roleName; - RoleInstance = roleInstance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets role name of the cloud - /// - [JsonProperty(PropertyName = "roleName")] - public string RoleName { get; set; } - - /// - /// Gets or sets role instance of the cloud - /// - [JsonProperty(PropertyName = "roleInstance")] - public string RoleInstance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs deleted file mode 100644 index 5d8c33e7c31b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom event result - /// - [Newtonsoft.Json.JsonObject("customEvent")] - public partial class EventsCustomEventResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsCustomEventResult class. - /// - public EventsCustomEventResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomEventResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsCustomEventResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsCustomEventInfo customEvent = default(EventsCustomEventInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - CustomEvent = customEvent; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "customEvent")] - public EventsCustomEventInfo CustomEvent { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs deleted file mode 100644 index fc99acc002c0..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The custom metric info - /// - public partial class EventsCustomMetricInfo - { - /// - /// Initializes a new instance of the EventsCustomMetricInfo class. - /// - public EventsCustomMetricInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomMetricInfo class. - /// - /// The name of the custom metric - /// The value of the custom metric - /// The sum of the custom metric - /// The count of the custom metric - /// The minimum value of the custom - /// metric - /// The maximum value of the custom - /// metric - /// The standard deviation of the custom - /// metric - public EventsCustomMetricInfo(string name = default(string), double? value = default(double?), double? valueSum = default(double?), int? valueCount = default(int?), double? valueMin = default(double?), double? valueMax = default(double?), double? valueStdDev = default(double?)) - { - Name = name; - Value = value; - ValueSum = valueSum; - ValueCount = valueCount; - ValueMin = valueMin; - ValueMax = valueMax; - ValueStdDev = valueStdDev; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the custom metric - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the value of the custom metric - /// - [JsonProperty(PropertyName = "value")] - public double? Value { get; set; } - - /// - /// Gets or sets the sum of the custom metric - /// - [JsonProperty(PropertyName = "valueSum")] - public double? ValueSum { get; set; } - - /// - /// Gets or sets the count of the custom metric - /// - [JsonProperty(PropertyName = "valueCount")] - public int? ValueCount { get; set; } - - /// - /// Gets or sets the minimum value of the custom metric - /// - [JsonProperty(PropertyName = "valueMin")] - public double? ValueMin { get; set; } - - /// - /// Gets or sets the maximum value of the custom metric - /// - [JsonProperty(PropertyName = "valueMax")] - public double? ValueMax { get; set; } - - /// - /// Gets or sets the standard deviation of the custom metric - /// - [JsonProperty(PropertyName = "valueStdDev")] - public double? ValueStdDev { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs deleted file mode 100644 index 9d7379f5e15d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom metric result - /// - [Newtonsoft.Json.JsonObject("customMetric")] - public partial class EventsCustomMetricResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsCustomMetricResult class. - /// - public EventsCustomMetricResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomMetricResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsCustomMetricResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsCustomMetricInfo customMetric = default(EventsCustomMetricInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - CustomMetric = customMetric; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "customMetric")] - public EventsCustomMetricInfo CustomMetric { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs deleted file mode 100644 index 27fe20462c70..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The dependency info - /// - public partial class EventsDependencyInfo - { - /// - /// Initializes a new instance of the EventsDependencyInfo class. - /// - public EventsDependencyInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsDependencyInfo class. - /// - /// The target of the dependency - /// The data of the dependency - /// Indicates if the dependency was - /// successful - /// The duration of the dependency - /// The performance bucket of the - /// dependency - /// The result code of the dependency - /// The type of the dependency - /// The name of the dependency - /// The ID of the dependency - public EventsDependencyInfo(string target = default(string), string data = default(string), string success = default(string), long? duration = default(long?), string performanceBucket = default(string), string resultCode = default(string), string type = default(string), string name = default(string), string id = default(string)) - { - Target = target; - Data = data; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - ResultCode = resultCode; - Type = type; - Name = name; - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the target of the dependency - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// Gets or sets the data of the dependency - /// - [JsonProperty(PropertyName = "data")] - public string Data { get; set; } - - /// - /// Gets or sets indicates if the dependency was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the dependency - /// - [JsonProperty(PropertyName = "duration")] - public long? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the dependency - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the result code of the dependency - /// - [JsonProperty(PropertyName = "resultCode")] - public string ResultCode { get; set; } - - /// - /// Gets or sets the type of the dependency - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the name of the dependency - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the ID of the dependency - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs deleted file mode 100644 index d18cdef03e7a..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A dependency result - /// - [Newtonsoft.Json.JsonObject("dependency")] - public partial class EventsDependencyResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsDependencyResult class. - /// - public EventsDependencyResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsDependencyResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsDependencyResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsDependencyInfo dependency = default(EventsDependencyInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Dependency = dependency; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "dependency")] - public EventsDependencyInfo Dependency { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs deleted file mode 100644 index f86799dd812d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Exception details - /// - public partial class EventsExceptionDetail - { - /// - /// Initializes a new instance of the EventsExceptionDetail class. - /// - public EventsExceptionDetail() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionDetail class. - /// - /// The severity level of the exception - /// detail - /// The outer ID of the exception detail - /// The message of the exception detail - /// The type of the exception detail - /// The ID of the exception detail - /// The parsed stack - public EventsExceptionDetail(string severityLevel = default(string), string outerId = default(string), string message = default(string), string type = default(string), string id = default(string), IList parsedStack = default(IList)) - { - SeverityLevel = severityLevel; - OuterId = outerId; - Message = message; - Type = type; - Id = id; - ParsedStack = parsedStack; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the severity level of the exception detail - /// - [JsonProperty(PropertyName = "severityLevel")] - public string SeverityLevel { get; set; } - - /// - /// Gets or sets the outer ID of the exception detail - /// - [JsonProperty(PropertyName = "outerId")] - public string OuterId { get; set; } - - /// - /// Gets or sets the message of the exception detail - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the type of the exception detail - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the ID of the exception detail - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the parsed stack - /// - [JsonProperty(PropertyName = "parsedStack")] - public IList ParsedStack { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs deleted file mode 100644 index 4a2d29bc027c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A parsed stack entry - /// - public partial class EventsExceptionDetailsParsedStack - { - /// - /// Initializes a new instance of the EventsExceptionDetailsParsedStack - /// class. - /// - public EventsExceptionDetailsParsedStack() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionDetailsParsedStack - /// class. - /// - /// The assembly of the stack entry - /// The method of the stack entry - /// The level of the stack entry - /// The line of the stack entry - public EventsExceptionDetailsParsedStack(string assembly = default(string), string method = default(string), long? level = default(long?), long? line = default(long?)) - { - Assembly = assembly; - Method = method; - Level = level; - Line = line; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the assembly of the stack entry - /// - [JsonProperty(PropertyName = "assembly")] - public string Assembly { get; set; } - - /// - /// Gets or sets the method of the stack entry - /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } - - /// - /// Gets or sets the level of the stack entry - /// - [JsonProperty(PropertyName = "level")] - public long? Level { get; set; } - - /// - /// Gets or sets the line of the stack entry - /// - [JsonProperty(PropertyName = "line")] - public long? Line { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs deleted file mode 100644 index 95e1131bd001..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The exception info - /// - public partial class EventsExceptionInfo - { - /// - /// Initializes a new instance of the EventsExceptionInfo class. - /// - public EventsExceptionInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionInfo class. - /// - /// The severity level of the - /// exception - /// The problem ID of the exception - /// Indicates where the exception was handled - /// at - /// The assembly which threw the - /// exception - /// The method that threw the exception - /// The message of the exception - /// The type of the exception - /// The outer type of the exception - /// The outer method of the exception - /// The outer assmebly of the - /// exception - /// The outer message of the - /// exception - /// The inner most type of the - /// exception - /// The inner most message of the - /// exception - /// The inner most method of the - /// exception - /// The inner most assembly of the - /// exception - /// The details of the exception - public EventsExceptionInfo(int? severityLevel = default(int?), string problemId = default(string), string handledAt = default(string), string assembly = default(string), string method = default(string), string message = default(string), string type = default(string), string outerType = default(string), string outerMethod = default(string), string outerAssembly = default(string), string outerMessage = default(string), string innermostType = default(string), string innermostMessage = default(string), string innermostMethod = default(string), string innermostAssembly = default(string), IList details = default(IList)) - { - SeverityLevel = severityLevel; - ProblemId = problemId; - HandledAt = handledAt; - Assembly = assembly; - Method = method; - Message = message; - Type = type; - OuterType = outerType; - OuterMethod = outerMethod; - OuterAssembly = outerAssembly; - OuterMessage = outerMessage; - InnermostType = innermostType; - InnermostMessage = innermostMessage; - InnermostMethod = innermostMethod; - InnermostAssembly = innermostAssembly; - Details = details; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the severity level of the exception - /// - [JsonProperty(PropertyName = "severityLevel")] - public int? SeverityLevel { get; set; } - - /// - /// Gets or sets the problem ID of the exception - /// - [JsonProperty(PropertyName = "problemId")] - public string ProblemId { get; set; } - - /// - /// Gets or sets indicates where the exception was handled at - /// - [JsonProperty(PropertyName = "handledAt")] - public string HandledAt { get; set; } - - /// - /// Gets or sets the assembly which threw the exception - /// - [JsonProperty(PropertyName = "assembly")] - public string Assembly { get; set; } - - /// - /// Gets or sets the method that threw the exception - /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } - - /// - /// Gets or sets the message of the exception - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the type of the exception - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the outer type of the exception - /// - [JsonProperty(PropertyName = "outerType")] - public string OuterType { get; set; } - - /// - /// Gets or sets the outer method of the exception - /// - [JsonProperty(PropertyName = "outerMethod")] - public string OuterMethod { get; set; } - - /// - /// Gets or sets the outer assmebly of the exception - /// - [JsonProperty(PropertyName = "outerAssembly")] - public string OuterAssembly { get; set; } - - /// - /// Gets or sets the outer message of the exception - /// - [JsonProperty(PropertyName = "outerMessage")] - public string OuterMessage { get; set; } - - /// - /// Gets or sets the inner most type of the exception - /// - [JsonProperty(PropertyName = "innermostType")] - public string InnermostType { get; set; } - - /// - /// Gets or sets the inner most message of the exception - /// - [JsonProperty(PropertyName = "innermostMessage")] - public string InnermostMessage { get; set; } - - /// - /// Gets or sets the inner most method of the exception - /// - [JsonProperty(PropertyName = "innermostMethod")] - public string InnermostMethod { get; set; } - - /// - /// Gets or sets the inner most assembly of the exception - /// - [JsonProperty(PropertyName = "innermostAssembly")] - public string InnermostAssembly { get; set; } - - /// - /// Gets or sets the details of the exception - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs deleted file mode 100644 index e4d5764de21c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An exception result - /// - [Newtonsoft.Json.JsonObject("exception")] - public partial class EventsExceptionResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsExceptionResult class. - /// - public EventsExceptionResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsExceptionResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsExceptionInfo exception = default(EventsExceptionInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Exception = exception; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "exception")] - public EventsExceptionInfo Exception { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs deleted file mode 100644 index 64928c4ea818..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Operation info for an event result - /// - public partial class EventsOperationInfo - { - /// - /// Initializes a new instance of the EventsOperationInfo class. - /// - public EventsOperationInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsOperationInfo class. - /// - /// Name of the operation - /// ID of the operation - /// Parent ID of the operation - /// Synthetic source of the - /// operation - public EventsOperationInfo(string name = default(string), string id = default(string), string parentId = default(string), string syntheticSource = default(string)) - { - Name = name; - Id = id; - ParentId = parentId; - SyntheticSource = syntheticSource; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the operation - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets ID of the operation - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets parent ID of the operation - /// - [JsonProperty(PropertyName = "parentId")] - public string ParentId { get; set; } - - /// - /// Gets or sets synthetic source of the operation - /// - [JsonProperty(PropertyName = "syntheticSource")] - public string SyntheticSource { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs deleted file mode 100644 index eadd40831e56..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The page view information - /// - public partial class EventsPageViewInfo - { - /// - /// Initializes a new instance of the EventsPageViewInfo class. - /// - public EventsPageViewInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPageViewInfo class. - /// - /// The name of the page - /// The URL of the page - /// The duration of the page view - /// The performance bucket of the page - /// view - public EventsPageViewInfo(string name = default(string), string url = default(string), string duration = default(string), string performanceBucket = default(string)) - { - Name = name; - Url = url; - Duration = duration; - PerformanceBucket = performanceBucket; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the page - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URL of the page - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets the duration of the page view - /// - [JsonProperty(PropertyName = "duration")] - public string Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the page view - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs deleted file mode 100644 index 0ec11c2dbd6b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A page view result - /// - [Newtonsoft.Json.JsonObject("pageView")] - public partial class EventsPageViewResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsPageViewResult class. - /// - public EventsPageViewResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPageViewResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsPageViewResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsPageViewInfo pageView = default(EventsPageViewInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - PageView = pageView; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "pageView")] - public EventsPageViewInfo PageView { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs deleted file mode 100644 index 9ed4ad144c40..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The performance counter info - /// - public partial class EventsPerformanceCounterInfo - { - /// - /// Initializes a new instance of the EventsPerformanceCounterInfo - /// class. - /// - public EventsPerformanceCounterInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPerformanceCounterInfo - /// class. - /// - /// The value of the performance counter - /// The name of the performance counter - /// The category of the performance - /// counter - /// The counter of the performance - /// counter - /// The instance name of the performance - /// counter - /// The instance of the performance - /// counter - public EventsPerformanceCounterInfo(double? value = default(double?), string name = default(string), string category = default(string), string counter = default(string), string instanceName = default(string), string instance = default(string)) - { - Value = value; - Name = name; - Category = category; - Counter = counter; - InstanceName = instanceName; - Instance = instance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the value of the performance counter - /// - [JsonProperty(PropertyName = "value")] - public double? Value { get; set; } - - /// - /// Gets or sets the name of the performance counter - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the category of the performance counter - /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } - - /// - /// Gets or sets the counter of the performance counter - /// - [JsonProperty(PropertyName = "counter")] - public string Counter { get; set; } - - /// - /// Gets or sets the instance name of the performance counter - /// - [JsonProperty(PropertyName = "instanceName")] - public string InstanceName { get; set; } - - /// - /// Gets or sets the instance of the performance counter - /// - [JsonProperty(PropertyName = "instance")] - public string Instance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs deleted file mode 100644 index ff6c0e98fa1d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A performance counter result - /// - [Newtonsoft.Json.JsonObject("performanceCounter")] - public partial class EventsPerformanceCounterResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsPerformanceCounterResult - /// class. - /// - public EventsPerformanceCounterResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPerformanceCounterResult - /// class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsPerformanceCounterResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsPerformanceCounterInfo performanceCounter = default(EventsPerformanceCounterInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - PerformanceCounter = performanceCounter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "performanceCounter")] - public EventsPerformanceCounterInfo PerformanceCounter { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs deleted file mode 100644 index ca053cd89d3f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The request info - /// - public partial class EventsRequestInfo - { - /// - /// Initializes a new instance of the EventsRequestInfo class. - /// - public EventsRequestInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsRequestInfo class. - /// - /// The name of the request - /// The URL of the request - /// Indicates if the request was - /// successful - /// The duration of the request - /// The performance bucket of the - /// request - /// The result code of the request - /// The source of the request - /// The ID of the request - public EventsRequestInfo(string name = default(string), string url = default(string), string success = default(string), double? duration = default(double?), string performanceBucket = default(string), string resultCode = default(string), string source = default(string), string id = default(string)) - { - Name = name; - Url = url; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - ResultCode = resultCode; - Source = source; - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the request - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URL of the request - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets indicates if the request was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the request - /// - [JsonProperty(PropertyName = "duration")] - public double? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the request - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the result code of the request - /// - [JsonProperty(PropertyName = "resultCode")] - public string ResultCode { get; set; } - - /// - /// Gets or sets the source of the request - /// - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - - /// - /// Gets or sets the ID of the request - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs deleted file mode 100644 index 822223ed9e90..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A request result - /// - [Newtonsoft.Json.JsonObject("request")] - public partial class EventsRequestResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsRequestResult class. - /// - public EventsRequestResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsRequestResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsRequestResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsRequestInfo request = default(EventsRequestInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Request = request; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "request")] - public EventsRequestInfo Request { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs deleted file mode 100644 index 8df84051c7de..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Events query result data. - /// - [Newtonsoft.Json.JsonObject("eventsResultData")] - public partial class EventsResultData - { - /// - /// Initializes a new instance of the EventsResultData class. - /// - public EventsResultData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsResultData class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsResultData(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo)) - { - Id = id; - Count = count; - Timestamp = timestamp; - CustomDimensions = customDimensions; - CustomMeasurements = customMeasurements; - Operation = operation; - Session = session; - User = user; - Cloud = cloud; - Ai = ai; - Application = application; - Client = client; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the unique ID for this event. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets count of the event - /// - [JsonProperty(PropertyName = "count")] - public long? Count { get; set; } - - /// - /// Gets or sets timestamp of the event - /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; set; } - - /// - /// Gets or sets custom dimensions of the event - /// - [JsonProperty(PropertyName = "customDimensions")] - public EventsResultDataCustomDimensions CustomDimensions { get; set; } - - /// - /// Gets or sets custom measurements of the event - /// - [JsonProperty(PropertyName = "customMeasurements")] - public EventsResultDataCustomMeasurements CustomMeasurements { get; set; } - - /// - /// Gets or sets operation info of the event - /// - [JsonProperty(PropertyName = "operation")] - public EventsOperationInfo Operation { get; set; } - - /// - /// Gets or sets session info of the event - /// - [JsonProperty(PropertyName = "session")] - public EventsSessionInfo Session { get; set; } - - /// - /// Gets or sets user info of the event - /// - [JsonProperty(PropertyName = "user")] - public EventsUserInfo User { get; set; } - - /// - /// Gets or sets cloud info of the event - /// - [JsonProperty(PropertyName = "cloud")] - public EventsCloudInfo Cloud { get; set; } - - /// - /// Gets or sets AI info of the event - /// - [JsonProperty(PropertyName = "ai")] - public EventsAiInfo Ai { get; set; } - - /// - /// Gets or sets application info of the event - /// - [JsonProperty(PropertyName = "application")] - public EventsApplicationInfo Application { get; set; } - - /// - /// Gets or sets client info of the event - /// - [JsonProperty(PropertyName = "client")] - public EventsClientInfo Client { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs deleted file mode 100644 index 4c3d89f90d69..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An events query result. - /// - public partial class EventsResults - { - /// - /// Initializes a new instance of the EventsResults class. - /// - public EventsResults() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsResults class. - /// - /// OData context metadata endpoint for this - /// response - /// OData messages for this response. - /// Contents of the events query result. - public EventsResults(string odatacontext = default(string), IList aimessages = default(IList), IList value = default(IList)) - { - Odatacontext = odatacontext; - Aimessages = aimessages; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets oData context metadata endpoint for this response - /// - [JsonProperty(PropertyName = "@odata.context")] - public string Odatacontext { get; set; } - - /// - /// Gets or sets oData messages for this response. - /// - [JsonProperty(PropertyName = "@ai.messages")] - public IList Aimessages { get; set; } - - /// - /// Gets or sets contents of the events query result. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs deleted file mode 100644 index 901cd594a5e9..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A trace result - /// - [Newtonsoft.Json.JsonObject("trace")] - public partial class EventsTraceResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsTraceResult class. - /// - public EventsTraceResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsTraceResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsTraceResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsTraceInfo trace = default(EventsTraceInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Trace = trace; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "trace")] - public EventsTraceInfo Trace { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs deleted file mode 100644 index 2414f185dac9..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// User info for an event result - /// - public partial class EventsUserInfo - { - /// - /// Initializes a new instance of the EventsUserInfo class. - /// - public EventsUserInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsUserInfo class. - /// - /// ID of the user - /// Account ID of the user - /// Authenticated ID of the user - public EventsUserInfo(string id = default(string), string accountId = default(string), string authenticatedId = default(string)) - { - Id = id; - AccountId = accountId; - AuthenticatedId = authenticatedId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ID of the user - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets account ID of the user - /// - [JsonProperty(PropertyName = "accountId")] - public string AccountId { get; set; } - - /// - /// Gets or sets authenticated ID of the user - /// - [JsonProperty(PropertyName = "authenticatedId")] - public string AuthenticatedId { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs new file mode 100644 index 000000000000..ebbba70acb19 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs @@ -0,0 +1,28 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for FavoriteSourceType. + /// + public static class FavoriteSourceType + { + public const string Retention = "retention"; + public const string Notebook = "notebook"; + public const string Sessions = "sessions"; + public const string Events = "events"; + public const string Userflows = "userflows"; + public const string Funnel = "funnel"; + public const string Impact = "impact"; + public const string Segmentation = "segmentation"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs new file mode 100644 index 000000000000..3693183a0855 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for FavoriteType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum FavoriteType + { + [EnumMember(Value = "shared")] + Shared, + [EnumMember(Value = "user")] + User + } + internal static class FavoriteTypeEnumExtension + { + internal static string ToSerializedValue(this FavoriteType? value) + { + return value == null ? null : ((FavoriteType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this FavoriteType value) + { + switch( value ) + { + case FavoriteType.Shared: + return "shared"; + case FavoriteType.User: + return "user"; + } + return null; + } + + internal static FavoriteType? ParseFavoriteType(this string value) + { + switch( value ) + { + case "shared": + return FavoriteType.Shared; + case "user": + return FavoriteType.User; + } + return null; + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs new file mode 100644 index 000000000000..f16f6c5caf29 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for FlowType. + /// + public static class FlowType + { + public const string Bluefield = "Bluefield"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs new file mode 100644 index 000000000000..cdf083b22996 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Inner error + /// + public partial class InnerError + { + /// + /// Initializes a new instance of the InnerError class. + /// + public InnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerError class. + /// + /// Provides correlation for + /// request + /// Request time + public InnerError(string diagnosticcontext = default(string), System.DateTime? time = default(System.DateTime?)) + { + Diagnosticcontext = diagnosticcontext; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets provides correlation for request + /// + [JsonProperty(PropertyName = "diagnosticcontext")] + public string Diagnosticcontext { get; set; } + + /// + /// Gets or sets request time + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs new file mode 100644 index 000000000000..d71e2c9644be --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemScope. + /// + public static class ItemScope + { + public const string Shared = "shared"; + public const string User = "user"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs new file mode 100644 index 000000000000..ad0a1c470d92 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemScopePath. + /// + public static class ItemScopePath + { + public const string AnalyticsItems = "analyticsItems"; + public const string MyanalyticsItems = "myanalyticsItems"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.cs new file mode 100644 index 000000000000..401e7582c5af --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemType. + /// + public static class ItemType + { + public const string Query = "query"; + public const string Function = "function"; + public const string Folder = "folder"; + public const string Recent = "recent"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs new file mode 100644 index 000000000000..9e22126acc72 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemTypeParameter. + /// + public static class ItemTypeParameter + { + public const string None = "none"; + public const string Query = "query"; + public const string Function = "function"; + public const string Folder = "folder"; + public const string Recent = "recent"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs new file mode 100644 index 000000000000..ed5c5d2cf6ad --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs @@ -0,0 +1,67 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains a sourceId and workbook resource id to link two resources. + /// + public partial class LinkProperties + { + /// + /// Initializes a new instance of the LinkProperties class. + /// + public LinkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinkProperties class. + /// + /// The source Azure resource id + /// The workbook Azure resource id + /// The category of workbook + public LinkProperties(string sourceId = default(string), string targetId = default(string), string category = default(string)) + { + SourceId = sourceId; + TargetId = targetId; + Category = category; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source Azure resource id + /// + [JsonProperty(PropertyName = "sourceId")] + public string SourceId { get; set; } + + /// + /// Gets or sets the workbook Azure resource id + /// + [JsonProperty(PropertyName = "targetId")] + public string TargetId { get; set; } + + /// + /// Gets or sets the category of workbook + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs deleted file mode 100644 index ff8f0db4fd0c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for MetricId. - /// - public static class MetricId - { - public const string RequestsCount = "requests/count"; - public const string RequestsDuration = "requests/duration"; - public const string RequestsFailed = "requests/failed"; - public const string UsersCount = "users/count"; - public const string UsersAuthenticated = "users/authenticated"; - public const string PageViewsCount = "pageViews/count"; - public const string PageViewsDuration = "pageViews/duration"; - public const string ClientProcessingDuration = "client/processingDuration"; - public const string ClientReceiveDuration = "client/receiveDuration"; - public const string ClientNetworkDuration = "client/networkDuration"; - public const string ClientSendDuration = "client/sendDuration"; - public const string ClientTotalDuration = "client/totalDuration"; - public const string DependenciesCount = "dependencies/count"; - public const string DependenciesFailed = "dependencies/failed"; - public const string DependenciesDuration = "dependencies/duration"; - public const string ExceptionsCount = "exceptions/count"; - public const string ExceptionsBrowser = "exceptions/browser"; - public const string ExceptionsServer = "exceptions/server"; - public const string SessionsCount = "sessions/count"; - public const string PerformanceCountersRequestExecutionTime = "performanceCounters/requestExecutionTime"; - public const string PerformanceCountersRequestsPerSecond = "performanceCounters/requestsPerSecond"; - public const string PerformanceCountersRequestsInQueue = "performanceCounters/requestsInQueue"; - public const string PerformanceCountersMemoryAvailableBytes = "performanceCounters/memoryAvailableBytes"; - public const string PerformanceCountersExceptionsPerSecond = "performanceCounters/exceptionsPerSecond"; - public const string PerformanceCountersProcessCpuPercentage = "performanceCounters/processCpuPercentage"; - public const string PerformanceCountersProcessIOBytesPerSecond = "performanceCounters/processIOBytesPerSecond"; - public const string PerformanceCountersProcessPrivateBytes = "performanceCounters/processPrivateBytes"; - public const string PerformanceCountersProcessorCpuPercentage = "performanceCounters/processorCpuPercentage"; - public const string AvailabilityResultsAvailabilityPercentage = "availabilityResults/availabilityPercentage"; - public const string AvailabilityResultsDuration = "availabilityResults/duration"; - public const string BillingTelemetryCount = "billing/telemetryCount"; - public const string CustomEventsCount = "customEvents/count"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs deleted file mode 100644 index 7e069eb4ec04..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A metric request - /// - public partial class MetricsPostBodySchema - { - /// - /// Initializes a new instance of the MetricsPostBodySchema class. - /// - public MetricsPostBodySchema() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsPostBodySchema class. - /// - /// An identifier for this query. Must be unique - /// within the post body of the request. This identifier will be the - /// 'id' property of the response object representing this - /// query. - /// The parameters for a single metrics - /// query - public MetricsPostBodySchema(string id, MetricsPostBodySchemaParameters parameters) - { - Id = id; - Parameters = parameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an identifier for this query. Must be unique within - /// the post body of the request. This identifier will be the 'id' - /// property of the response object representing this query. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the parameters for a single metrics query - /// - [JsonProperty(PropertyName = "parameters")] - public MetricsPostBodySchemaParameters Parameters { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Parameters"); - } - if (Parameters != null) - { - Parameters.Validate(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs deleted file mode 100644 index 0d1b62589f4a..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The parameters for a single metrics query - /// - public partial class MetricsPostBodySchemaParameters - { - /// - /// Initializes a new instance of the MetricsPostBodySchemaParameters - /// class. - /// - public MetricsPostBodySchemaParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsPostBodySchemaParameters - /// class. - /// - /// Possible values include: 'requests/count', - /// 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', - /// 'client/totalDuration', 'dependencies/count', - /// 'dependencies/failed', 'dependencies/duration', 'exceptions/count', - /// 'exceptions/browser', 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - public MetricsPostBodySchemaParameters(string metricId, string timespan = default(string), IList aggregation = default(IList), System.TimeSpan? interval = default(System.TimeSpan?), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string)) - { - MetricId = metricId; - Timespan = timespan; - Aggregation = aggregation; - Interval = interval; - Segment = segment; - Top = top; - Orderby = orderby; - Filter = filter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'requests/count', - /// 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', - /// 'client/totalDuration', 'dependencies/count', - /// 'dependencies/failed', 'dependencies/duration', 'exceptions/count', - /// 'exceptions/browser', 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - [JsonProperty(PropertyName = "metricId")] - public string MetricId { get; set; } - - /// - /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } - - /// - /// - [JsonProperty(PropertyName = "aggregation")] - public IList Aggregation { get; set; } - - /// - /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// - [JsonProperty(PropertyName = "segment")] - public IList Segment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "top")] - public int? Top { get; set; } - - /// - /// - [JsonProperty(PropertyName = "orderby")] - public string Orderby { get; set; } - - /// - /// - [JsonProperty(PropertyName = "filter")] - public string Filter { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MetricId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricId"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs deleted file mode 100644 index 1c05fcdb2b77..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A metric result data. - /// - public partial class MetricsResultInfo - { - /// - /// Initializes a new instance of the MetricsResultInfo class. - /// - public MetricsResultInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsResultInfo class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Start time of the metric. - /// Start time of the metric. - /// The interval used to segment the metric - /// data. - /// Segmented metric data (if - /// segmented). - public MetricsResultInfo(IDictionary additionalProperties = default(IDictionary), System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), System.TimeSpan? interval = default(System.TimeSpan?), IList segments = default(IList)) - { - AdditionalProperties = additionalProperties; - Start = start; - End = end; - Interval = interval; - Segments = segments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets start time of the metric. - /// - [JsonProperty(PropertyName = "start")] - public System.DateTime? Start { get; set; } - - /// - /// Gets or sets start time of the metric. - /// - [JsonProperty(PropertyName = "end")] - public System.DateTime? End { get; set; } - - /// - /// Gets or sets the interval used to segment the metric data. - /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// Gets or sets segmented metric data (if segmented). - /// - [JsonProperty(PropertyName = "segments")] - public IList Segments { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs deleted file mode 100644 index 873e368e9c45..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for MetricsSegment. - /// - public static class MetricsSegment - { - public const string ApplicationBuild = "applicationBuild"; - public const string ApplicationVersion = "applicationVersion"; - public const string AuthenticatedOrAnonymousTraffic = "authenticatedOrAnonymousTraffic"; - public const string Browser = "browser"; - public const string BrowserVersion = "browserVersion"; - public const string City = "city"; - public const string CloudRoleName = "cloudRoleName"; - public const string CloudServiceName = "cloudServiceName"; - public const string Continent = "continent"; - public const string CountryOrRegion = "countryOrRegion"; - public const string DeploymentId = "deploymentId"; - public const string DeploymentUnit = "deploymentUnit"; - public const string DeviceType = "deviceType"; - public const string Environment = "environment"; - public const string HostingLocation = "hostingLocation"; - public const string InstanceName = "instanceName"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs deleted file mode 100644 index ee67de58eb8f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A metric segment - /// - public partial class MetricsSegmentInfo - { - /// - /// Initializes a new instance of the MetricsSegmentInfo class. - /// - public MetricsSegmentInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsSegmentInfo class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Start time of the metric segment (only when an - /// interval was specified). - /// Start time of the metric segment (only when an - /// interval was specified). - /// Segmented metric data (if further - /// segmented). - public MetricsSegmentInfo(IDictionary additionalProperties = default(IDictionary), System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), IList segments = default(IList)) - { - AdditionalProperties = additionalProperties; - Start = start; - End = end; - Segments = segments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets start time of the metric segment (only when an - /// interval was specified). - /// - [JsonProperty(PropertyName = "start")] - public System.DateTime? Start { get; set; } - - /// - /// Gets or sets start time of the metric segment (only when an - /// interval was specified). - /// - [JsonProperty(PropertyName = "end")] - public System.DateTime? End { get; set; } - - /// - /// Gets or sets segmented metric data (if further segmented). - /// - [JsonProperty(PropertyName = "segments")] - public IList Segments { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs similarity index 53% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs index 6e64adf4efa7..4a28c2e8724a 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs @@ -8,36 +8,35 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// A table column. + /// CDN REST API operation /// - /// - /// A column in a table. - /// - public partial class Column + public partial class Operation { /// - /// Initializes a new instance of the Column class. + /// Initializes a new instance of the Operation class. /// - public Column() + public Operation() { CustomInit(); } /// - /// Initializes a new instance of the Column class. + /// Initializes a new instance of the Operation class. /// - /// The name of this column. - /// The data type of this column. - public Column(string name = default(string), string type = default(string)) + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) { Name = name; - Type = type; + Display = display; CustomInit(); } @@ -47,16 +46,16 @@ public Column() partial void CustomInit(); /// - /// Gets or sets the name of this column. + /// Gets or sets operation name: {provider}/{resource}/{operation} /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// - /// Gets or sets the data type of this column. + /// Gets or sets the object that represents the operation. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..60452c458c9f --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.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.ApplicationInsights.Management.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.Cdn + /// Resource on which the operation is + /// performed: Profile, endpoint, etc. + /// 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 or sets service provider: Microsoft.Cdn + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed: Profile, + /// endpoint, etc. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation type: Read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..b4a80108bd88 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/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.ApplicationInsights.Management.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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..bfbe0bc45ecd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.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.ApplicationInsights.Management.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 Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs new file mode 100644 index 000000000000..0d19db6cc161 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for PurgeState. + /// + public static class PurgeState + { + public const string Pending = "pending"; + public const string Completed = "completed"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs deleted file mode 100644 index 10fe2636ceee..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The Analytics query. Learn more about the [Analytics query - /// syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) - /// - public partial class QueryBody - { - /// - /// Initializes a new instance of the QueryBody class. - /// - public QueryBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryBody class. - /// - /// The query to execute. - /// Optional. The timespan over which to query - /// data. This is an ISO8601 time period value. This timespan is - /// applied in addition to any that are specified in the query - /// expression. - /// A list of Application IDs for - /// cross-application queries. - public QueryBody(string query, string timespan = default(string), IList applications = default(IList)) - { - Query = query; - Timespan = timespan; - Applications = applications; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the query to execute. - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets optional. The timespan over which to query data. This - /// is an ISO8601 time period value. This timespan is applied in - /// addition to any that are specified in the query expression. - /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } - - /// - /// Gets or sets a list of Application IDs for cross-application - /// queries. - /// - [JsonProperty(PropertyName = "applications")] - public IList Applications { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Query == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Query"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs new file mode 100644 index 000000000000..f660747e7420 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for RequestSource. + /// + public static class RequestSource + { + public const string Rest = "rest"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs new file mode 100644 index 000000000000..aa9e3c156fcd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for SharedTypeKind. + /// + public static class SharedTypeKind + { + public const string User = "user"; + public const string Shared = "shared"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs deleted file mode 100644 index b6f5f206255b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// 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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A query response table. - /// - /// - /// Contains the columns and rows for one table in a query response. - /// - public partial class Table - { - /// - /// Initializes a new instance of the Table class. - /// - public Table() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Table class. - /// - /// The name of the table. - /// The list of columns in this table. - /// The resulting rows from this query. - public Table(string name, IList columns, IList> rows) - { - Name = name; - Columns = columns; - Rows = rows; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the table. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the list of columns in this table. - /// - [JsonProperty(PropertyName = "columns")] - public IList Columns { get; set; } - - /// - /// Gets or sets the resulting rows from this query. - /// - [JsonProperty(PropertyName = "rows")] - public IList> Rows { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Columns == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Columns"); - } - if (Rows == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rows"); - } - } - } -} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs similarity index 52% rename from sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs index 19f258e077c3..748400d45cc7 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs @@ -8,7 +8,7 @@ // regenerated. // -namespace Microsoft.Azure.Management.IotHub.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Collections; @@ -16,28 +16,26 @@ namespace Microsoft.Azure.Management.IotHub.Models using System.Linq; /// - /// The device streams properties of iothub. + /// A container holding only the Tags for a resource, allowing the user to + /// update the tags on a WebTest instance. /// - public partial class IotHubPropertiesDeviceStreams + public partial class TagsResource { /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. + /// Initializes a new instance of the TagsResource class. /// - public IotHubPropertiesDeviceStreams() + public TagsResource() { CustomInit(); } /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. + /// Initializes a new instance of the TagsResource class. /// - /// List of Device Streams - /// Endpoints. - public IotHubPropertiesDeviceStreams(IList streamingEndpoints = default(IList)) + /// Resource tags + public TagsResource(IDictionary tags = default(IDictionary)) { - StreamingEndpoints = streamingEndpoints; + Tags = tags; CustomInit(); } @@ -47,10 +45,10 @@ public IotHubPropertiesDeviceStreams() partial void CustomInit(); /// - /// Gets or sets list of Device Streams Endpoints. + /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "streamingEndpoints")] - public IList StreamingEndpoints { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs new file mode 100644 index 000000000000..79165da65619 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs @@ -0,0 +1,200 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights web test definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class WebTest : WebtestsResource + { + /// + /// Initializes a new instance of the WebTest class. + /// + public WebTest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebTest class. + /// + /// Resource location + /// Unique ID of this WebTest. This is + /// typically the same value as the Name field. + /// User defined name if this + /// WebTest. + /// The kind of web test this is, valid + /// choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// A list of where to physically run the tests + /// from to give global coverage for accessibility of your + /// application. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// The kind of web test that this web test watches. + /// Choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// Purpose/user defined descriptive test for + /// this WebTest. + /// Is the test actively being monitored. + /// Interval in seconds between test runs for + /// this WebTest. Default value is 300. + /// Seconds until this WebTest will timeout and + /// fail. Default value is 30. + /// Allow for retries should this WebTest + /// fail. + /// An XML configuration specification for + /// a WebTest. + /// Current state of this component, + /// whether or not is has been provisioned within the resource group it + /// is defined. Users cannot change this value but are able to read + /// from it. Values will include Succeeded, Deploying, Canceled, and + /// Failed. + public WebTest(string location, string syntheticMonitorId, string webTestName, WebTestKind webTestKind, IList locations, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), WebTestKind? kind = default(WebTestKind?), string description = default(string), bool? enabled = default(bool?), int? frequency = default(int?), int? timeout = default(int?), bool? retryEnabled = default(bool?), WebTestPropertiesConfiguration configuration = default(WebTestPropertiesConfiguration), string provisioningState = default(string)) + : base(location, id, name, type, tags) + { + Kind = kind; + SyntheticMonitorId = syntheticMonitorId; + WebTestName = webTestName; + Description = description; + Enabled = enabled; + Frequency = frequency; + Timeout = timeout; + WebTestKind = webTestKind; + RetryEnabled = retryEnabled; + Locations = locations; + Configuration = configuration; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of web test that this web test watches. + /// Choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// + [JsonProperty(PropertyName = "kind")] + public WebTestKind? Kind { get; set; } + + /// + /// Gets or sets unique ID of this WebTest. This is typically the same + /// value as the Name field. + /// + [JsonProperty(PropertyName = "properties.SyntheticMonitorId")] + public string SyntheticMonitorId { get; set; } + + /// + /// Gets or sets user defined name if this WebTest. + /// + [JsonProperty(PropertyName = "properties.Name")] + public string WebTestName { get; set; } + + /// + /// Gets or sets purpose/user defined descriptive test for this + /// WebTest. + /// + [JsonProperty(PropertyName = "properties.Description")] + public string Description { get; set; } + + /// + /// Gets or sets is the test actively being monitored. + /// + [JsonProperty(PropertyName = "properties.Enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets interval in seconds between test runs for this + /// WebTest. Default value is 300. + /// + [JsonProperty(PropertyName = "properties.Frequency")] + public int? Frequency { get; set; } + + /// + /// Gets or sets seconds until this WebTest will timeout and fail. + /// Default value is 30. + /// + [JsonProperty(PropertyName = "properties.Timeout")] + public int? Timeout { get; set; } + + /// + /// Gets or sets the kind of web test this is, valid choices are ping + /// and multistep. Possible values include: 'ping', 'multistep' + /// + [JsonProperty(PropertyName = "properties.Kind")] + public WebTestKind WebTestKind { get; set; } + + /// + /// Gets or sets allow for retries should this WebTest fail. + /// + [JsonProperty(PropertyName = "properties.RetryEnabled")] + public bool? RetryEnabled { get; set; } + + /// + /// Gets or sets a list of where to physically run the tests from to + /// give global coverage for accessibility of your application. + /// + [JsonProperty(PropertyName = "properties.Locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets an XML configuration specification for a WebTest. + /// + [JsonProperty(PropertyName = "properties.Configuration")] + public WebTestPropertiesConfiguration Configuration { get; set; } + + /// + /// Gets current state of this component, whether or not is has been + /// provisioned within the resource group it is defined. Users cannot + /// change this value but are able to read from it. Values will include + /// Succeeded, Deploying, Canceled, and Failed. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (SyntheticMonitorId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SyntheticMonitorId"); + } + if (WebTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WebTestName"); + } + if (Locations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs similarity index 52% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs index f7f0cdffafc4..62c4065a616d 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs @@ -8,32 +8,33 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// Custom dimensions of the event + /// Geo-physical location to run a web test from. You must specify one or + /// more locations for the test to run from. /// - public partial class EventsResultDataCustomDimensions + public partial class WebTestGeolocation { /// - /// Initializes a new instance of the EventsResultDataCustomDimensions - /// class. + /// Initializes a new instance of the WebTestGeolocation class. /// - public EventsResultDataCustomDimensions() + public WebTestGeolocation() { CustomInit(); } /// - /// Initializes a new instance of the EventsResultDataCustomDimensions - /// class. + /// Initializes a new instance of the WebTestGeolocation class. /// - public EventsResultDataCustomDimensions(object additionalProperties = default(object)) + /// Location ID for the webtest to run + /// from. + public WebTestGeolocation(string location = default(string)) { - AdditionalProperties = additionalProperties; + Location = location; CustomInit(); } @@ -43,9 +44,10 @@ public EventsResultDataCustomDimensions() partial void CustomInit(); /// + /// Gets or sets location ID for the webtest to run from. /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } + [JsonProperty(PropertyName = "Id")] + public string Location { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs new file mode 100644 index 000000000000..07afe0084b30 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for WebTestKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum WebTestKind + { + [EnumMember(Value = "ping")] + Ping, + [EnumMember(Value = "multistep")] + Multistep + } + internal static class WebTestKindEnumExtension + { + internal static string ToSerializedValue(this WebTestKind? value) + { + return value == null ? null : ((WebTestKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this WebTestKind value) + { + switch( value ) + { + case WebTestKind.Ping: + return "ping"; + case WebTestKind.Multistep: + return "multistep"; + } + return null; + } + + internal static WebTestKind? ParseWebTestKind(this string value) + { + switch( value ) + { + case "ping": + return WebTestKind.Ping; + case "multistep": + return WebTestKind.Multistep; + } + return null; + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs new file mode 100644 index 000000000000..82adbd44dd34 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An XML configuration specification for a WebTest. + /// + public partial class WebTestPropertiesConfiguration + { + /// + /// Initializes a new instance of the WebTestPropertiesConfiguration + /// class. + /// + public WebTestPropertiesConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebTestPropertiesConfiguration + /// class. + /// + /// The XML specification of a WebTest to run + /// against an application. + public WebTestPropertiesConfiguration(string webTest = default(string)) + { + WebTest = webTest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the XML specification of a WebTest to run against an + /// application. + /// + [JsonProperty(PropertyName = "WebTest")] + public string WebTest { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs new file mode 100644 index 000000000000..e7b5a24a74ed --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class WebtestsResource : IResource + { + /// + /// Initializes a new instance of the WebtestsResource class. + /// + public WebtestsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebtestsResource class. + /// + /// Resource location + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + public WebtestsResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs new file mode 100644 index 000000000000..8e8a500cfd9d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Work item configuration associated with an application insights + /// resource. + /// + public partial class WorkItemConfiguration + { + /// + /// Initializes a new instance of the WorkItemConfiguration class. + /// + public WorkItemConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemConfiguration class. + /// + /// Connector identifier where work item is + /// created + /// Configuration friendly name + /// Boolean value indicating whether + /// configuration is default + /// Unique Id for work item + /// Serialized JSON object for detailed + /// properties + public WorkItemConfiguration(string connectorId = default(string), string configDisplayName = default(string), bool? isDefault = default(bool?), string id = default(string), string configProperties = default(string)) + { + ConnectorId = connectorId; + ConfigDisplayName = configDisplayName; + IsDefault = isDefault; + Id = id; + ConfigProperties = configProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets connector identifier where work item is created + /// + [JsonProperty(PropertyName = "ConnectorId")] + public string ConnectorId { get; set; } + + /// + /// Gets or sets configuration friendly name + /// + [JsonProperty(PropertyName = "ConfigDisplayName")] + public string ConfigDisplayName { get; set; } + + /// + /// Gets or sets boolean value indicating whether configuration is + /// default + /// + [JsonProperty(PropertyName = "IsDefault")] + public bool? IsDefault { get; set; } + + /// + /// Gets or sets unique Id for work item + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "ConfigProperties")] + public string ConfigProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs new file mode 100644 index 000000000000..b20a34449024 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error associated with trying to get work item configuration or + /// configurations + /// + public partial class WorkItemConfigurationError + { + /// + /// Initializes a new instance of the WorkItemConfigurationError class. + /// + public WorkItemConfigurationError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemConfigurationError class. + /// + /// Error detail code and explanation + /// Error message + public WorkItemConfigurationError(string code = default(string), string message = default(string), InnerError innererror = default(InnerError)) + { + Code = code; + Message = message; + Innererror = innererror; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error detail code and explanation + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs new file mode 100644 index 000000000000..d804d471e0d7 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with + /// WorkItemConfigurationError information. + /// + public partial class WorkItemConfigurationErrorException : 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 WorkItemConfigurationError Body { get; set; } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + public WorkItemConfigurationErrorException() + { + } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + /// The exception message. + public WorkItemConfigurationErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + /// The exception message. + /// Inner exception. + public WorkItemConfigurationErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs new file mode 100644 index 000000000000..c91b8774a5eb --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Work item configuration creation payload + /// + public partial class WorkItemCreateConfiguration + { + /// + /// Initializes a new instance of the WorkItemCreateConfiguration + /// class. + /// + public WorkItemCreateConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemCreateConfiguration + /// class. + /// + /// Unique connector id + /// Serialized JSON object for + /// detailed properties + /// Boolean indicating validate only + /// Custom work item + /// properties + public WorkItemCreateConfiguration(string connectorId = default(string), string connectorDataConfiguration = default(string), bool? validateOnly = default(bool?), IDictionary workItemProperties = default(IDictionary)) + { + ConnectorId = connectorId; + ConnectorDataConfiguration = connectorDataConfiguration; + ValidateOnly = validateOnly; + WorkItemProperties = workItemProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique connector id + /// + [JsonProperty(PropertyName = "ConnectorId")] + public string ConnectorId { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "ConnectorDataConfiguration")] + public string ConnectorDataConfiguration { get; set; } + + /// + /// Gets or sets boolean indicating validate only + /// + [JsonProperty(PropertyName = "ValidateOnly")] + public bool? ValidateOnly { get; set; } + + /// + /// Gets or sets custom work item properties + /// + [JsonProperty(PropertyName = "WorkItemProperties")] + public IDictionary WorkItemProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs new file mode 100644 index 000000000000..d4a10828ffc5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs @@ -0,0 +1,201 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights workbook definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class Workbook : WorkbookResource + { + /// + /// Initializes a new instance of the Workbook class. + /// + public Workbook() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workbook class. + /// + /// The user-defined name of the + /// workbook. + /// Configuration of this particular + /// workbook. Configuration data is a string containing valid + /// JSON + /// Internally assigned unique id of the + /// workbook definition. + /// Enum indicating if this workbook + /// definition is owned by a specific user or is shared between all + /// users with access to the Application Insights component. Possible + /// values include: 'user', 'shared' + /// Workbook category, as defined by the user at + /// creation time. + /// Unique user id of the specific user that owns + /// this workbook. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource location + /// Resource tags + /// The kind of workbook. Choices are user and + /// shared. Possible values include: 'user', 'shared' + /// This instance's version of the data model. + /// This can change as new features are added that can be marked + /// workbook. + /// Date and time in UTC of the last + /// modification that was made to this workbook definition. + /// A list of 0 or more tags that are + /// associated with this workbook definition + /// Optional resourceId for a source + /// resource. + public Workbook(string workbookName, string serializedData, string workbookId, string sharedTypeKind, string category, string userId, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string kind = default(string), string version = default(string), string timeModified = default(string), IList workbookTags = default(IList), string sourceResourceId = default(string)) + : base(id, name, type, location, tags) + { + Kind = kind; + WorkbookName = workbookName; + SerializedData = serializedData; + Version = version; + WorkbookId = workbookId; + SharedTypeKind = sharedTypeKind; + TimeModified = timeModified; + Category = category; + WorkbookTags = workbookTags; + UserId = userId; + SourceResourceId = sourceResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of workbook. Choices are user and shared. + /// Possible values include: 'user', 'shared' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the user-defined name of the workbook. + /// + [JsonProperty(PropertyName = "properties.name")] + public string WorkbookName { get; set; } + + /// + /// Gets or sets configuration of this particular workbook. + /// Configuration data is a string containing valid JSON + /// + [JsonProperty(PropertyName = "properties.serializedData")] + public string SerializedData { get; set; } + + /// + /// Gets or sets this instance's version of the data model. This can + /// change as new features are added that can be marked workbook. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets internally assigned unique id of the workbook + /// definition. + /// + [JsonProperty(PropertyName = "properties.workbookId")] + public string WorkbookId { get; set; } + + /// + /// Gets or sets enum indicating if this workbook definition is owned + /// by a specific user or is shared between all users with access to + /// the Application Insights component. Possible values include: + /// 'user', 'shared' + /// + [JsonProperty(PropertyName = "properties.kind")] + public string SharedTypeKind { get; set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this workbook definition. + /// + [JsonProperty(PropertyName = "properties.timeModified")] + public string TimeModified { get; private set; } + + /// + /// Gets or sets workbook category, as defined by the user at creation + /// time. + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; set; } + + /// + /// Gets or sets a list of 0 or more tags that are associated with this + /// workbook definition + /// + [JsonProperty(PropertyName = "properties.tags")] + public IList WorkbookTags { get; set; } + + /// + /// Gets or sets unique user id of the specific user that owns this + /// workbook. + /// + [JsonProperty(PropertyName = "properties.userId")] + public string UserId { get; set; } + + /// + /// Gets or sets optional resourceId for a source resource. + /// + [JsonProperty(PropertyName = "properties.sourceResourceId")] + public string SourceResourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WorkbookName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkbookName"); + } + if (SerializedData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SerializedData"); + } + if (WorkbookId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkbookId"); + } + if (SharedTypeKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SharedTypeKind"); + } + if (Category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Category"); + } + if (UserId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UserId"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs new file mode 100644 index 000000000000..ee0478def290 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error message body that will indicate why the operation failed. + /// + public partial class WorkbookError + { + /// + /// Initializes a new instance of the WorkbookError class. + /// + public WorkbookError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkbookError class. + /// + /// Service-defined error code. This code serves as + /// a sub-status for the HTTP error code specified in the + /// response. + /// Human-readable representation of the + /// error. + /// The list of invalid fields send in request, + /// in case of validation error. + public WorkbookError(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service-defined error code. This code serves as a + /// sub-status for the HTTP error code specified in the response. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets human-readable representation of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the list of invalid fields send in request, in case of + /// validation error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs new file mode 100644 index 000000000000..5cc227dbc9e4 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with WorkbookError + /// information. + /// + public partial class WorkbookErrorException : 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 WorkbookError Body { get; set; } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + public WorkbookErrorException() + { + } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + /// The exception message. + public WorkbookErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + /// The exception message. + /// Inner exception. + public WorkbookErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs new file mode 100644 index 000000000000..5cba7bcd9e3e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class WorkbookResource : IResource + { + /// + /// Initializes a new instance of the WorkbookResource class. + /// + public WorkbookResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkbookResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource location + /// Resource tags + public WorkbookResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs new file mode 100644 index 000000000000..2e469050f442 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs @@ -0,0 +1,397 @@ +// +// 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.ApplicationInsights.Management +{ + 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(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Lists all of the available insights 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"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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.Insights/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 insights 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..75d869166e9b --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/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.ApplicationInsights.Management +{ + 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 insights 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 insights 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 insights 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 insights 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs new file mode 100644 index 000000000000..ed242de42dc2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs @@ -0,0 +1,765 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ProactiveDetectionConfigurationsOperations operations. + /// + internal partial class ProactiveDetectionConfigurationsOperations : IServiceOperations, IProactiveDetectionConfigurationsOperations + { + /// + /// Initializes a new instance of the ProactiveDetectionConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProactiveDetectionConfigurationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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; + } + + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (configurationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("configurationId", configurationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{ConfigurationId}", System.Uri.EscapeDataString(configurationId)); + 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 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; + } + + /// + /// Update the ProactiveDetection configuration for this configuration id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (configurationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationId"); + } + if (proactiveDetectionProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proactiveDetectionProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("configurationId", configurationId); + tracingParameters.Add("proactiveDetectionProperties", proactiveDetectionProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{ConfigurationId}", System.Uri.EscapeDataString(configurationId)); + 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(proactiveDetectionProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(proactiveDetectionProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..26a34263ada5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs @@ -0,0 +1,173 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProactiveDetectionConfigurationsOperations. + /// + public static partial class ProactiveDetectionConfigurationsOperationsExtensions + { + /// + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IList List(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + public static ApplicationInsightsComponentProactiveDetectionConfiguration Get(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId) + { + return operations.GetAsync(resourceGroupName, resourceName, configurationId).GetAwaiter().GetResult(); + } + + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, configurationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. + /// + public static ApplicationInsightsComponentProactiveDetectionConfiguration Update(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties).GetAwaiter().GetResult(); + } + + /// + /// Update the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs deleted file mode 100644 index b056b6b2d48c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// 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.ApplicationInsights.Query -{ - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for QueryOperations. - /// - public static partial class QueryOperationsExtensions - { - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - public static QueryResults Execute(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList applications = default(IList)) - { - return operations.ExecuteAsync(appId, query, timespan, applications).GetAwaiter().GetResult(); - } - - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList applications = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExecuteWithHttpMessagesAsync(appId, query, timespan, applications, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs deleted file mode 100644 index 690be7cf7f1f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs +++ /dev/null @@ -1,29 +0,0 @@ - -// -// 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.ApplicationInsights.Query -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_ApplicationInsightsDataClient - { - get - { - return new Tuple[] - { - new Tuple("ApplicationInsightsDataClient", "Events", "v1"), - new Tuple("ApplicationInsightsDataClient", "Metrics", "v1"), - new Tuple("ApplicationInsightsDataClient", "Query", "v1"), - }.AsEnumerable(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs new file mode 100644 index 000000000000..7913ef24174c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs @@ -0,0 +1,42 @@ + +// +// 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.ApplicationInsights.Management +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ApplicationInsightsManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Insights", "APIKeys", "2015-05-01"), + new Tuple("Insights", "Annotations", "2015-05-01"), + new Tuple("Insights", "ComponentAvailableFeatures", "2015-05-01"), + new Tuple("Insights", "ComponentCurrentBillingFeatures", "2015-05-01"), + new Tuple("Insights", "ComponentFeatureCapabilities", "2015-05-01"), + new Tuple("Insights", "ComponentQuotaStatus", "2015-05-01"), + new Tuple("Insights", "Components", "2015-05-01"), + new Tuple("Insights", "ExportConfigurations", "2015-05-01"), + new Tuple("Insights", "Favorites", "2015-05-01"), + new Tuple("Insights", "Operations", "2015-05-01"), + new Tuple("Insights", "ProactiveDetectionConfigurations", "2015-05-01"), + new Tuple("Insights", "WebTests", "2015-05-01"), + new Tuple("Insights", "WorkItemConfigurations", "2015-05-01"), + new Tuple("Insights", "webTestLocations", "2015-05-01"), + new Tuple("insights", "AnalyticsItems", "2015-05-01"), + new Tuple("insights", "Workbooks", "2015-05-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs new file mode 100644 index 000000000000..3e417f85e638 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs @@ -0,0 +1,280 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WebTestLocationsOperations operations. + /// + internal partial class WebTestLocationsOperations : IServiceOperations, IWebTestLocationsOperations + { + /// + /// Initializes a new instance of the WebTestLocationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WebTestLocationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs new file mode 100644 index 000000000000..ab7e4e9f97bc --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WebTestLocationsOperations. + /// + public static partial class WebTestLocationsOperationsExtensions + { + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IWebTestLocationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWebTestLocationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs new file mode 100644 index 000000000000..ed5eededf6d6 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs @@ -0,0 +1,2123 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WebTestsOperations operations. + /// + internal partial class WebTestsOperations : IServiceOperations, IWebTestsOperations + { + /// + /// Initializes a new instance of the WebTestsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WebTestsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 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; + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest 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> GetWithHttpMessagesAsync(string resourceGroupName, string webTestName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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 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 Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + /// + /// 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 resourceGroupName, string webTestName, WebTest webTestDefinition, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + if (webTestDefinition == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestDefinition"); + } + if (webTestDefinition != null) + { + webTestDefinition.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + tracingParameters.Add("webTestDefinition", webTestDefinition); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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(webTestDefinition != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(webTestDefinition, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + TagsResource webTestTags = new TagsResource(); + if (tags != null) + { + webTestTags.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + tracingParameters.Add("webTestTags", webTestTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(webTestTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(webTestTags, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// 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 resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests").ToString(); + _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 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; + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByComponentWithHttpMessagesAsync(string componentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (componentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "componentName"); + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("componentName", componentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByComponent", 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.Insights/components/{componentName}/webtests").ToString(); + _url = _url.Replace("{componentName}", System.Uri.EscapeDataString(componentName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 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; + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// 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>> ListByComponentNextWithHttpMessagesAsync(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, "ListByComponentNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs new file mode 100644 index 000000000000..8bb6c1710157 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs @@ -0,0 +1,410 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WebTestsOperations. + /// + public static partial class WebTestsOperationsExtensions + { + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IWebTestsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWebTestsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + public static WebTest Get(this IWebTestsOperations operations, string resourceGroupName, string webTestName) + { + return operations.GetAsync(resourceGroupName, webTestName).GetAwaiter().GetResult(); + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, webTestName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + public static WebTest CreateOrUpdate(this IWebTestsOperations operations, string resourceGroupName, string webTestName, WebTest webTestDefinition) + { + return operations.CreateOrUpdateAsync(resourceGroupName, webTestName, webTestDefinition).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, WebTest webTestDefinition, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, webTestName, webTestDefinition, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + public static WebTest UpdateTags(this IWebTestsOperations operations, string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, webTestName, tags).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, webTestName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + public static void Delete(this IWebTestsOperations operations, string resourceGroupName, string webTestName) + { + operations.DeleteAsync(resourceGroupName, webTestName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, webTestName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IWebTestsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWebTestsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByComponent(this IWebTestsOperations operations, string componentName, string resourceGroupName) + { + return operations.ListByComponentAsync(componentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByComponentAsync(this IWebTestsOperations operations, string componentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByComponentWithHttpMessagesAsync(componentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByComponentNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListByComponentNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByComponentNextAsync(this IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByComponentNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs new file mode 100644 index 000000000000..71caa7caf5e3 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs @@ -0,0 +1,1439 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WorkItemConfigurationsOperations operations. + /// + internal partial class WorkItemConfigurationsOperations : IServiceOperations, IWorkItemConfigurationsOperations + { + /// + /// Initializes a new instance of the WorkItemConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkItemConfigurationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 WorkItemConfigurationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkItemConfigurationError _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; + } + + /// + /// Create a work item configuration for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigurationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigurationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigurationProperties", workItemConfigurationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Insights/components/{resourceName}/WorkItemConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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("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(workItemConfigurationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workItemConfigurationProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetDefaultWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDefault", 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.Insights/components/{resourceName}/DefaultWorkItemConfig").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 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; + } + + /// + /// Delete a work item configuration of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// 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 resourceGroupName, string resourceName, string workItemConfigId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// 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> GetItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetItem", 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.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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 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; + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + /// + /// 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> UpdateItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + if (workItemConfigurationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigurationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + tracingParameters.Add("workItemConfigurationProperties", workItemConfigurationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateItem", 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.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(workItemConfigurationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workItemConfigurationProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..9e27b35b09e1 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs @@ -0,0 +1,306 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkItemConfigurationsOperations. + /// + public static partial class WorkItemConfigurationsOperationsExtensions + { + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + public static WorkItemConfiguration Create(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, workItemConfigurationProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigurationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static WorkItemConfiguration GetDefault(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetDefaultAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetDefaultAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDefaultWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a work item configuration of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + public static void Delete(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId) + { + operations.DeleteAsync(resourceGroupName, resourceName, workItemConfigId).GetAwaiter().GetResult(); + } + + /// + /// Delete a work item configuration of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + public static WorkItemConfiguration GetItem(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId) + { + return operations.GetItemAsync(resourceGroupName, resourceName, workItemConfigId).GetAwaiter().GetResult(); + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// The cancellation token. + /// + public static async Task GetItemAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetItemWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + public static WorkItemConfiguration UpdateItem(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) + { + return operations.UpdateItemAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties).GetAwaiter().GetResult(); + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateItemAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateItemWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs new file mode 100644 index 000000000000..05f28e66b81a --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs @@ -0,0 +1,1204 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WorkbooksOperations operations. + /// + internal partial class WorkbooksOperations : IServiceOperations, IWorkbooksOperations + { + /// + /// Initializes a new instance of the WorkbooksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkbooksOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "category"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("category", category); + tracingParameters.Add("tags", tags); + tracingParameters.Add("canFetchContent", canFetchContent); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (category != null) + { + _queryParameters.Add(string.Format("category={0}", System.Uri.EscapeDataString(category))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(string.Join(",", tags)))); + } + if (canFetchContent != null) + { + _queryParameters.Add(string.Format("canFetchContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(canFetchContent, Client.SerializationSettings).Trim('"')))); + } + 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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; + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").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 (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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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; + } + + /// + /// Delete a workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// 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 resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").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 (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 != 201 && (int)_statusCode != 204) + { + var ex = new WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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; + } + + /// + /// Create a new workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// 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 resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (workbookProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workbookProperties"); + } + if (workbookProperties != null) + { + workbookProperties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workbookProperties", workbookProperties); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").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 (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(workbookProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workbookProperties, 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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; + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (workbookProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workbookProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workbookProperties", workbookProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").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 (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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(workbookProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workbookProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs new file mode 100644 index 000000000000..d249300d42f0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs @@ -0,0 +1,252 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkbooksOperations. + /// + public static partial class WorkbooksOperationsExtensions + { + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + public static IEnumerable ListByResourceGroup(this IWorkbooksOperations operations, string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, category, tags, canFetchContent).GetAwaiter().GetResult(); + } + + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWorkbooksOperations operations, string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, category, tags, canFetchContent, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static Workbook Get(this IWorkbooksOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static void Delete(this IWorkbooksOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a new workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + public static Workbook CreateOrUpdate(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, workbookProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a new workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, workbookProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + public static Workbook Update(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, workbookProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, workbookProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs index ab7abf8e6217..c504661a385e 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs @@ -41,6 +41,6 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs similarity index 59% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs rename to sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs index 5d2eca4c2bc6..3ffcb68ab59b 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs @@ -8,28 +8,31 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Attestation.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// A metric result. + /// List of supported operations. /// - public partial class MetricsResult + public partial class OperationList { /// - /// Initializes a new instance of the MetricsResult class. + /// Initializes a new instance of the OperationList class. /// - public MetricsResult() + public OperationList() { CustomInit(); } /// - /// Initializes a new instance of the MetricsResult class. + /// Initializes a new instance of the OperationList class. /// - public MetricsResult(MetricsResultInfo value = default(MetricsResultInfo)) + /// List of supported operations. + public OperationList(IList value = default(IList)) { Value = value; CustomInit(); @@ -41,9 +44,10 @@ public MetricsResult() partial void CustomInit(); /// + /// Gets or sets list of supported operations. /// [JsonProperty(PropertyName = "value")] - public MetricsResultInfo Value { get; set; } + public IList Value { get; set; } } } diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs index d8efd6c507a6..01412dc4fd9c 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs @@ -68,7 +68,7 @@ internal Operations(AttestationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -181,7 +181,7 @@ internal Operations(AttestationManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -194,7 +194,7 @@ internal Operations(AttestationManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs index 7b482b509c0f..b0654baf1691 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Attestation using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -29,7 +27,7 @@ public static partial class OperationsExtensions /// /// The operations group for this extension method. /// - public static IEnumerable List(this IOperations operations) + public static OperationList List(this IOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } @@ -43,7 +41,7 @@ public static IEnumerable List(this IOperations operations /// /// The cancellation token. /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs index 8a7744bc37a7..d73cbdde8c92 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs @@ -24,16 +24,5 @@ public static IEnumerable> ApiInfo_AttestationMana }.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/attestation/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "76c353d92b8037fe1e02c36deeb06d78d284e5d7"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs similarity index 73% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs index be4285fadbe6..39dd36a238d1 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs @@ -8,14 +8,14 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.Billing { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -23,12 +23,12 @@ namespace Microsoft.Azure.ApplicationInsights.Query using System.Threading.Tasks; /// - /// QueryOperations operations. + /// AddressOperations operations. /// - public partial class QueryOperations : IServiceOperations, IQueryOperations + internal partial class AddressOperations : IServiceOperations, IAddressOperations { /// - /// Initializes a new instance of the QueryOperations class. + /// Initializes a new instance of the AddressOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ public partial class QueryOperations : IServiceOperations /// Thrown when a required parameter is null /// - public QueryOperations(ApplicationInsightsDataClient client) + internal AddressOperations(BillingManagementClient client) { if (client == null) { @@ -46,32 +46,14 @@ public QueryOperations(ApplicationInsightsDataClient client) } /// - /// Gets a reference to the ApplicationInsightsDataClient + /// Gets a reference to the BillingManagementClient /// - public ApplicationInsightsDataClient Client { get; private set; } + public BillingManagementClient Client { get; private set; } /// - /// Execute an Analytics query + /// Validates the address. /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. + /// /// /// /// Headers that will be added to request. @@ -94,22 +76,15 @@ public QueryOperations(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ExecuteWithHttpMessagesAsync(string appId, string query, string timespan = default(string), IList applications = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); - } - if (query == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "query"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - QueryBody body = new QueryBody(); - if (query != null || timespan != null || applications != null) + if (address == null) { - body.Query = query; - body.Timespan = timespan; - body.Applications = applications; + throw new ValidationException(ValidationRules.CannotBeNull, "address"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -118,21 +93,40 @@ public QueryOperations(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("body", body); + tracingParameters.Add("address", address); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/query").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/validateAddress").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("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) @@ -149,9 +143,9 @@ public QueryOperations(ApplicationInsightsDataClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(address != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(address, 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"); } @@ -205,16 +199,20 @@ public QueryOperations(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs new file mode 100644 index 000000000000..c0e8399bdcc2 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs @@ -0,0 +1,57 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AddressOperations. + /// + public static partial class AddressOperationsExtensions + { + /// + /// Validates the address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) + { + return operations.ValidateAsync(address).GetAwaiter().GetResult(); + } + + /// + /// Validates the address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ValidateAsync(this IAddressOperations operations, AddressDetails address, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs index b7bfd8dccd11..355ab9591a9b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs @@ -80,7 +80,7 @@ internal AgreementsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -100,7 +100,7 @@ internal AgreementsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs index 2657b2b3af17..459d37367761 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class AgreementsOperationsExtensions /// /// May be used to expand the participants. /// - public static AgreementListResult ListByBillingAccountName(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) + public static AgreementListResult ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static partial class AgreementsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs index 1d076d68748b..8a5b15e33c05 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs @@ -54,7 +54,7 @@ internal BillingAccountsOperations(BillingManagementClient client) /// Lists all billing accounts for a user which he has access to. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// Headers that will be added to request. @@ -233,7 +233,7 @@ internal BillingAccountsOperations(BillingManagementClient client) /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// Headers that will be added to request. @@ -411,5 +411,563 @@ internal BillingAccountsOperations(BillingManagementClient client) return _result; } + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// billing Account Id. + /// + /// + /// 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>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermission", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + 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 update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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 != 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// 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>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(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, "ListInvoiceSectionsByCreateSubscriptionPermissionNext", 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/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs index ba67081d8381..3b10056f15e8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class BillingAccountsOperationsExtensions /// The operations group for this extension method. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// public static BillingAccountListResult List(this IBillingAccountsOperations operations, string expand = default(string)) { @@ -42,7 +42,7 @@ public static partial class BillingAccountsOperationsExtensions /// The operations group for this extension method. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// The cancellation token. @@ -65,7 +65,7 @@ public static partial class BillingAccountsOperationsExtensions /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) { @@ -82,7 +82,7 @@ public static partial class BillingAccountsOperationsExtensions /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// The cancellation token. @@ -95,5 +95,153 @@ public static partial class BillingAccountsOperationsExtensions } } + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + public static IPage ListInvoiceSectionsByCreateSubscriptionPermission(this IBillingAccountsOperations operations, string billingAccountName) + { + return operations.ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(this IBillingAccountsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInvoiceSectionsByCreateSubscriptionPermissionNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all invoice sections with create subscription permission for a user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(this IBillingAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs index c1d0683efb03..ff06f40bc480 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs @@ -49,7 +49,7 @@ public partial class BillingManagementClient : ServiceClient /// Version of the API to be used with the client request. The current version - /// is 2018-11-01-preview. + /// is 2019-10-01-preview. /// public string ApiVersion { get; private set; } @@ -86,6 +86,11 @@ public partial class BillingManagementClient : ServiceClient public virtual IPaymentMethodsOperations PaymentMethods { get; private set; } + /// + /// Gets the IAddressOperations. + /// + public virtual IAddressOperations Address { get; private set; } + /// /// Gets the IAvailableBalancesOperations. /// @@ -96,45 +101,55 @@ public partial class BillingManagementClient : ServiceClient public virtual IBillingProfilesOperations BillingProfiles { get; private set; } + /// + /// Gets the ICustomersOperations. + /// + public virtual ICustomersOperations Customers { get; private set; } + /// /// Gets the IInvoiceSectionsOperations. /// public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; } /// - /// Gets the IDepartmentsOperations. + /// Gets the IBillingPermissionsOperations. /// - public virtual IDepartmentsOperations Departments { get; private set; } + public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } /// - /// Gets the IEnrollmentAccountsOperations. + /// Gets the IBillingSubscriptionsOperations. /// - public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } + public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } /// - /// Gets the IInvoicesOperations. + /// Gets the IProductsOperations. /// - public virtual IInvoicesOperations Invoices { get; private set; } + public virtual IProductsOperations Products { get; private set; } /// - /// Gets the IPriceSheetOperations. + /// Gets the ITransactionsOperations. /// - public virtual IPriceSheetOperations PriceSheet { get; private set; } + public virtual ITransactionsOperations Transactions { get; private set; } /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IDepartmentsOperations. /// - public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } + public virtual IDepartmentsOperations Departments { get; private set; } /// - /// Gets the IProductsOperations. + /// Gets the IEnrollmentAccountsOperations. /// - public virtual IProductsOperations Products { get; private set; } + public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } /// - /// Gets the ITransactionsOperations. + /// Gets the IInvoicesOperations. /// - public virtual ITransactionsOperations Transactions { get; private set; } + public virtual IInvoicesOperations Invoices { get; private set; } + + /// + /// Gets the IPriceSheetOperations. + /// + public virtual IPriceSheetOperations PriceSheet { get; private set; } /// /// Gets the IPoliciesOperations. @@ -151,6 +166,16 @@ public partial class BillingManagementClient : ServiceClient public virtual ITransfersOperations Transfers { get; private set; } + /// + /// Gets the IPartnerTransfersOperations. + /// + public virtual IPartnerTransfersOperations PartnerTransfers { get; private set; } + + /// + /// Gets the IPartnerTransfersTransfersOperations. + /// + public virtual IPartnerTransfersTransfersOperations PartnerTransfersTransfers { get; private set; } + /// /// Gets the IRecipientTransfersOperations. /// @@ -161,11 +186,6 @@ public partial class BillingManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } - /// - /// Gets the IBillingPermissionsOperations. - /// - public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } - /// /// Gets the IBillingRoleDefinitionsOperations. /// @@ -181,6 +201,11 @@ public partial class BillingManagementClient : ServiceClient public virtual IAgreementsOperations Agreements { get; private set; } + /// + /// Gets the ILineOfCreditsOperations. + /// + public virtual ILineOfCreditsOperations LineOfCredits { get; private set; } + /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -424,27 +449,32 @@ private void Initialize() { BillingAccounts = new BillingAccountsOperations(this); PaymentMethods = new PaymentMethodsOperations(this); + Address = new AddressOperations(this); AvailableBalances = new AvailableBalancesOperations(this); BillingProfiles = new BillingProfilesOperations(this); + Customers = new CustomersOperations(this); InvoiceSections = new InvoiceSectionsOperations(this); + BillingPermissions = new BillingPermissionsOperations(this); + BillingSubscriptions = new BillingSubscriptionsOperations(this); + Products = new ProductsOperations(this); + Transactions = new TransactionsOperations(this); Departments = new DepartmentsOperations(this); EnrollmentAccounts = new EnrollmentAccountsOperations(this); Invoices = new InvoicesOperations(this); PriceSheet = new PriceSheetOperations(this); - BillingSubscriptions = new BillingSubscriptionsOperations(this); - Products = new ProductsOperations(this); - Transactions = new TransactionsOperations(this); Policies = new PoliciesOperations(this); BillingProperty = new BillingPropertyOperations(this); Transfers = new TransfersOperations(this); + PartnerTransfers = new PartnerTransfersOperations(this); + PartnerTransfersTransfers = new PartnerTransfersTransfersOperations(this); RecipientTransfers = new RecipientTransfersOperations(this); Operations = new Operations(this); - BillingPermissions = new BillingPermissionsOperations(this); BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); Agreements = new AgreementsOperations(this); + LineOfCredits = new LineOfCreditsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-11-01-preview"; + ApiVersion = "2019-10-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs index 1018381b8005..391530e8e167 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs @@ -50,6 +50,192 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// billing Account Id. + /// + /// + /// Customer 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", 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}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + 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 billing permissions for the caller under a billing account. /// @@ -100,7 +286,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -233,6 +419,9 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -257,7 +446,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -267,6 +456,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -279,14 +472,16 @@ internal BillingPermissionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", 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.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions").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 (Client.ApiVersion != null) @@ -414,7 +609,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// billing Account Id. @@ -471,7 +666,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } // 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}/providers/Microsoft.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs index a6b04a53d5e7..1367a626c59d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs @@ -21,6 +21,46 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class BillingPermissionsOperationsExtensions { + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + public static BillingPermissionsListResult ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) + { + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// The cancellation token. + /// + public static async Task ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists all billing permissions for the caller under a billing account. /// @@ -64,12 +104,15 @@ public static BillingPermissionsListResult ListByBillingAccount(this IBillingPer /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionsAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -81,22 +124,25 @@ public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPe /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// The operations group for this extension method. @@ -113,7 +159,7 @@ public static BillingPermissionsListResult ListByBillingProfile(this IBillingPer } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// The operations group for this extension method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs index 9eece86c0e50..061988d6dd62 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs @@ -80,7 +80,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -100,7 +100,7 @@ internal BillingProfilesOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -429,6 +429,31 @@ internal BillingProfilesOperations(BillingManagementClient client) return _result; } + /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// The operation to update a billing profile. /// @@ -439,7 +464,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The headers that will be added to request. @@ -454,6 +479,219 @@ internal BillingProfilesOperations(BillingManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // 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("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + 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 != 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 update a billing profile. /// @@ -464,7 +702,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// Headers that will be added to request. @@ -535,7 +773,7 @@ internal BillingProfilesOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs index 7d9e353cfb46..a38bc7332d4e 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class BillingProfilesOperationsExtensions /// /// May be used to expand the invoiceSections. /// - public static BillingProfileListResult ListByBillingAccountName(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) + public static BillingProfileListResult ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static partial class BillingProfilesOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -107,6 +107,52 @@ public static partial class BillingProfilesOperationsExtensions } } + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + public static BillingProfile Create(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters) + { + return operations.CreateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// The operation to update a billing profile. /// @@ -120,7 +166,7 @@ public static partial class BillingProfilesOperationsExtensions /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// public static BillingProfile Update(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) { @@ -140,7 +186,7 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The cancellation token. @@ -153,6 +199,52 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, } } + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + public static BillingProfile BeginCreate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters) + { + return operations.BeginCreateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// The operation to update a billing profile. /// @@ -166,7 +258,7 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// public static BillingProfile BeginUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) { @@ -186,7 +278,7 @@ public static BillingProfile BeginUpdate(this IBillingProfilesOperations operati /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The cancellation token. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs index beaef84cd1f6..32e94e50b9d5 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs @@ -52,7 +52,7 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// Get billing property by subscription Id. - /// + /// /// /// /// Headers that will be added to request. @@ -97,7 +97,7 @@ internal BillingPropertyOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs index 1cd9c6c24a44..99b7476e92a2 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class BillingPropertyOperationsExtensions { /// /// Get billing property by subscription Id. - /// + /// /// /// /// The operations group for this extension method. @@ -35,7 +35,7 @@ public static BillingProperty Get(this IBillingPropertyOperations operations) /// /// Get billing property by subscription Id. - /// + /// /// /// /// The operations group for this extension method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs index ad2df2ce0444..5375183fd3b5 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs @@ -108,7 +108,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -266,7 +266,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -290,11 +290,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -428,6 +428,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -455,7 +458,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -465,6 +468,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -481,15 +488,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", 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.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").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)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -623,6 +632,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -650,7 +662,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -660,6 +672,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -676,15 +692,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", 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.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").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)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -845,7 +863,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -874,11 +892,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", 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}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); @@ -1040,7 +1058,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1069,11 +1087,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", 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}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); @@ -1229,7 +1247,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1248,11 +1266,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1385,6 +1403,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -1406,7 +1427,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByBillingAccountWithHttpMessagesAsync(string billingAccountName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1416,7 +1437,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1427,11 +1451,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1570,6 +1594,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -1594,7 +1621,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1604,6 +1631,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -1616,14 +1647,16 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", 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.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments").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 (Client.ApiVersion != null) @@ -1756,9 +1789,15 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -1780,7 +1819,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1790,11 +1829,18 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1803,15 +1849,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByInvoiceSection", 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.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment").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 (Client.ApiVersion != null) @@ -1974,7 +2022,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1998,11 +2046,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", 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}/providers/Microsoft.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); @@ -2139,6 +2187,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -2160,7 +2211,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -2174,7 +2225,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2186,11 +2240,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByBillingProfile", 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}/providers/Microsoft.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs index c4067a9f8cd3..cb60a1654a81 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs @@ -73,9 +73,9 @@ public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignm /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) { - return operations.DeleteByBillingAccountNameAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -93,9 +93,9 @@ public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -110,15 +110,18 @@ public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRole /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role assignment id. /// - public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName) + public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) { - return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -130,6 +133,9 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -139,9 +145,9 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// The cancellation token. /// - public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -156,15 +162,18 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) { - return operations.DeleteByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -176,6 +185,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -185,9 +197,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -208,9 +220,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// role assignment id. /// - public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -231,9 +243,9 @@ public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAss /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -254,9 +266,9 @@ public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAss /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { - return operations.DeleteByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -277,9 +289,9 @@ public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -294,9 +306,9 @@ public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRole /// /// billing Account Id. /// - public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + public static BillingRoleAssignmentListResult ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// @@ -311,9 +323,9 @@ public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -328,9 +340,12 @@ public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBil /// /// billing Account Id. /// - public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, BillingRoleAssignmentPayload parameters) { - return operations.AddByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.AddByBillingAccountAsync(billingAccountName, parameters).GetAwaiter().GetResult(); } /// @@ -342,12 +357,15 @@ public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBill /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByBillingAccountWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -362,12 +380,15 @@ public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingRoleAssignmentListResult ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -379,15 +400,18 @@ public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -402,12 +426,18 @@ public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters) { - return operations.AddByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.AddByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -419,15 +449,21 @@ public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -445,9 +481,9 @@ public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBill /// /// Billing Profile Id. /// - public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + public static BillingRoleAssignmentListResult ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -465,9 +501,9 @@ public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -485,9 +521,12 @@ public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBil /// /// Billing Profile Id. /// - public static BillingRoleAssignmentListResult AddByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters) { - return operations.AddByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.AddByBillingProfileAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); } /// @@ -502,12 +541,15 @@ public static BillingRoleAssignmentListResult AddByBillingProfileName(this IBill /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs index 3388eb2759da..db1c6fc46e7f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs @@ -80,7 +80,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -104,11 +104,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); List _queryParameters = new List(); @@ -242,6 +242,9 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -269,7 +272,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -279,6 +282,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -295,15 +302,17 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", 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.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}").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)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); List _queryParameters = new List(); @@ -464,7 +473,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -493,11 +502,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", 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}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); @@ -653,7 +662,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -672,11 +681,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -809,6 +818,9 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -833,7 +845,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -843,6 +855,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -855,14 +871,16 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", 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.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions").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 (Client.ApiVersion != null) @@ -1019,7 +1037,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1043,11 +1061,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", 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}/providers/Microsoft.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs index cb1c83e8c923..10e68be3ec67 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class BillingRoleDefinitionsOperationsExtensions /// /// role definition id. /// - public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) { - return operations.GetByBillingAccountNameAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -70,15 +70,18 @@ public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDef /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role definition id. /// - public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) { - return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -90,6 +93,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -99,9 +105,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -122,9 +128,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// role definition id. /// - public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -145,9 +151,9 @@ public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -162,9 +168,9 @@ public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDef /// /// billing Account Id. /// - public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName) + public static BillingRoleDefinitionListResult ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// @@ -179,9 +185,9 @@ public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -196,12 +202,15 @@ public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingRoleDefinitionListResult ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -213,15 +222,18 @@ public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -239,9 +251,9 @@ public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBil /// /// Billing Profile Id. /// - public static BillingRoleDefinitionListResult ListByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + public static BillingRoleDefinitionListResult ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -259,9 +271,9 @@ public static BillingRoleDefinitionListResult ListByBillingProfileName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs index 08090ecc3117..fa77fa944c0a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs @@ -51,12 +51,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) public BillingManagementClient Client { get; private set; } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// Headers that will be added to request. /// @@ -78,12 +81,16 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, 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 (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -96,13 +103,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -196,7 +205,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -209,7 +218,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -229,14 +238,17 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. /// /// /// /// billing Account Id. /// - /// - /// Billing Profile Id. + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. /// /// /// Headers that will be added to request. @@ -259,15 +271,19 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (billingProfileName == null) + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); } if (Client.ApiVersion == null) { @@ -281,15 +297,17 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", 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}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -383,7 +401,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -396,7 +414,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -416,15 +434,12 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscription by invoice section name. - /// + /// Lists billing subscriptions by billing account name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// /// /// Headers that will be added to request. /// @@ -446,16 +461,12 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, 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 (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -468,15 +479,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", 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}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -570,7 +579,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -583,7 +592,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -603,17 +612,14 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Get a single billing subscription by name. - /// + /// Lists billing subscriptions by billing profile name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// - /// - /// Billing Subscription Id. + /// + /// Billing Profile Id. /// /// /// Headers that will be added to request. @@ -636,19 +642,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, 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 (billingSubscriptionName == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } if (Client.ApiVersion == null) { @@ -662,17 +664,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", 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}/billingSubscriptions/{billingSubscriptionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -766,7 +766,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -779,7 +779,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -799,50 +799,18 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Transfers the subscription from one invoice section to another within a - /// billing account. + /// Lists billing subscription by invoice section name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// - /// - /// Billing Subscription Id. - /// - /// - /// Parameters supplied to the Transfer Billing Subscription operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginTransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Transfers the subscription from one invoice section to another within a - /// billing account. - /// - /// - /// billing Account Id. + /// + /// Billing Profile Id. /// /// /// InvoiceSection Id. /// - /// - /// Billing Subscription Id. - /// - /// - /// Parameters supplied to the Transfer Billing Subscription operation. - /// /// /// Headers that will be added to request. /// @@ -864,23 +832,23 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (invoiceSectionName == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - if (billingSubscriptionName == null) + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - if (parameters == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -890,19 +858,22 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginTransfer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", 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}/billingSubscriptions/{billingSubscriptionName}/transfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").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)); - _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); 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); @@ -910,7 +881,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -941,12 +912,6 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) // 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) { @@ -967,7 +932,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -997,7 +962,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1010,7 +975,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1022,19 +987,6 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) 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); @@ -1043,8 +995,848 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscriptions by billing account name. - /// + /// Get a single billing subscription by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// 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 billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, 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 (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + 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.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}").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)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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; + } + + /// + /// Transfers the subscription from one invoice section to another within a + /// billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Parameters supplied to the Transfer Billing Subscription 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> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, 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 (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // 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("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ValidateTransfer", 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}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility").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)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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("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(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) + { + 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; + } + + /// + /// Transfers the subscription from one invoice section to another within a + /// billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription 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> BeginTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, 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 (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // 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("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTransfer", 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}/billingSubscriptions/{billingSubscriptionName}/transfer").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)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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("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(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 != 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; + } + + /// + /// Lists billing subscription by customer id. + /// + /// + /// + /// 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>> ListByCustomerNextWithHttpMessagesAsync(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, "ListByCustomerNext", 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 billing subscriptions by billing account name. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1070,7 +1862,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1085,7 +1877,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1179,7 +1971,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1192,7 +1984,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs index b0c9011256f2..e4cc2f127fb0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Billing public static partial class BillingSubscriptionsOperationsExtensions { /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -31,13 +31,16 @@ public static partial class BillingSubscriptionsOperationsExtensions /// /// billing Account Id. /// - public static IPage ListByBillingAccountName(this IBillingSubscriptionsOperations operations, string billingAccountName) + /// + /// Customer name. + /// + public static IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -46,19 +49,43 @@ public static IPage ListByBillingAccountName(this IB /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. + /// + public static BillingSubscription GetByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, string billingSubscriptionName) + { + return operations.GetByCustomerAsync(billingAccountName, customerName, billingSubscriptionName).GetAwaiter().GetResult(); + } + + /// + /// Get a single billing subscription by id. /// /// /// @@ -67,17 +94,80 @@ public static IPage ListByBillingAccountName(this IB /// /// billing Account Id. /// + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. + /// + /// + /// The cancellation token. + /// + public static async Task GetByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + public static IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing profile name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// /// /// Billing Profile Id. /// - public static BillingSubscriptionsListResult ListByBillingProfileName(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) + public static BillingSubscriptionsListResult ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// Lists billing subscriptions by billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -91,9 +181,9 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -101,7 +191,7 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -109,17 +199,20 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingSubscriptionsListResult ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -127,15 +220,18 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -143,7 +239,7 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// Get a single billing subscription by name. - /// + /// /// /// /// The operations group for this extension method. @@ -151,20 +247,23 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Billing Subscription Id. /// - public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName) + public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName).GetAwaiter().GetResult(); } /// /// Get a single billing subscription by name. - /// + /// /// /// /// The operations group for this extension method. @@ -172,6 +271,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -181,9 +283,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// The cancellation token. /// - public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -199,6 +301,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -206,11 +311,11 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// - public static TransferBillingSubscriptionResult Transfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + public static TransferBillingSubscriptionResult Transfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return operations.TransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + return operations.TransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); } /// @@ -223,6 +328,67 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription operation. + /// + /// + /// The cancellation token. + /// + public static async Task TransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Parameters supplied to the Transfer Billing Subscription operation. + /// + public static ValidateSubscriptionTransferEligibilityResult ValidateTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + { + return operations.ValidateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -235,9 +401,9 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// The cancellation token. /// - public static async Task TransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidateTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -253,6 +419,9 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -260,11 +429,11 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// - public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return operations.BeginTransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + return operations.BeginTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); } /// @@ -277,6 +446,9 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -284,21 +456,21 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// /// /// The cancellation token. /// - public static async Task BeginTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginTransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -307,13 +479,13 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + public static IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -325,9 +497,45 @@ public static IPage ListByBillingAccountNameNext(thi /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs new file mode 100644 index 000000000000..828e3e65281b --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs @@ -0,0 +1,989 @@ +// +// 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.Billing +{ + 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; + + /// + /// CustomersOperations operations. + /// + internal partial class CustomersOperations : IServiceOperations, ICustomersOperations + { + /// + /// Initializes a new instance of the CustomersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // 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("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", 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}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + 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 customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", 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").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + 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 a customer by its id. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// 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 billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // 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("expand", expand); + 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.Billing/billingAccounts/{billingAccountName}/customers/{customerName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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 customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// 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>> ListByBillingProfileNextWithHttpMessagesAsync(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, "ListByBillingProfileNext", 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 customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// 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>> ListByBillingAccountNextWithHttpMessagesAsync(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, "ListByBillingAccountNext", 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/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs new file mode 100644 index 000000000000..e047020c0811 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs @@ -0,0 +1,257 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CustomersOperations. + /// + public static partial class CustomersOperationsExtensions + { + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + public static IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string)) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, filter, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + public static IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string filter = default(string), string skiptoken = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, filter, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string filter = default(string), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a customer by its id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a customer by its id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs similarity index 60% rename from sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs index 51922ed73101..0497e1cfd7e9 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs @@ -1,10 +1,14 @@ // +// 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.HealthcareApis +namespace Microsoft.Azure.Management.Billing { using Microsoft.Rest; using Microsoft.Rest.Azure; @@ -15,18 +19,14 @@ namespace Microsoft.Azure.Management.HealthcareApis using System.Threading.Tasks; /// - /// MoveResourcesStatusOperations operations. + /// AddressOperations operations. /// - public partial interface IMoveResourcesStatusOperations + public partial interface IAddressOperations { /// - /// Get the operation result for a long running move operation. + /// Validates the address. /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. + /// /// /// /// The headers that will be added to request. @@ -34,7 +34,7 @@ public partial interface IMoveResourcesStatusOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -43,6 +43,6 @@ public partial interface IMoveResourcesStatusOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs index ad1ad24644a8..8857e689506b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs @@ -47,7 +47,7 @@ public partial interface IAgreementsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the agreement by name. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs index b35c31c7891e..7db9787b2ba7 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs @@ -27,7 +27,8 @@ public partial interface IBillingAccountsOperations /// Lists all billing accounts for a user which he has access to. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and + /// billingProfiles. /// /// /// The headers that will be added to request. @@ -52,7 +53,8 @@ public partial interface IBillingAccountsOperations /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and + /// billingProfiles. /// /// /// The headers that will be added to request. @@ -70,5 +72,103 @@ public partial interface IBillingAccountsOperations /// Thrown when a required parameter is null /// Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all invoice sections with create subscription permission for + /// a user. + /// + /// + /// billing Account Id. + /// + /// + /// 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>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all invoice sections with create subscription permission for + /// a user. + /// + /// + /// 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>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs index 1a737016940c..171f2c18de7a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs @@ -43,7 +43,7 @@ public partial interface IBillingManagementClient : System.IDisposable /// /// Version of the API to be used with the client request. The current - /// version is 2018-11-01-preview. + /// version is 2019-10-01-preview. /// string ApiVersion { get; } @@ -81,6 +81,11 @@ public partial interface IBillingManagementClient : System.IDisposable /// IPaymentMethodsOperations PaymentMethods { get; } + /// + /// Gets the IAddressOperations. + /// + IAddressOperations Address { get; } + /// /// Gets the IAvailableBalancesOperations. /// @@ -91,45 +96,55 @@ public partial interface IBillingManagementClient : System.IDisposable /// IBillingProfilesOperations BillingProfiles { get; } + /// + /// Gets the ICustomersOperations. + /// + ICustomersOperations Customers { get; } + /// /// Gets the IInvoiceSectionsOperations. /// IInvoiceSectionsOperations InvoiceSections { get; } /// - /// Gets the IDepartmentsOperations. + /// Gets the IBillingPermissionsOperations. /// - IDepartmentsOperations Departments { get; } + IBillingPermissionsOperations BillingPermissions { get; } /// - /// Gets the IEnrollmentAccountsOperations. + /// Gets the IBillingSubscriptionsOperations. /// - IEnrollmentAccountsOperations EnrollmentAccounts { get; } + IBillingSubscriptionsOperations BillingSubscriptions { get; } /// - /// Gets the IInvoicesOperations. + /// Gets the IProductsOperations. /// - IInvoicesOperations Invoices { get; } + IProductsOperations Products { get; } /// - /// Gets the IPriceSheetOperations. + /// Gets the ITransactionsOperations. /// - IPriceSheetOperations PriceSheet { get; } + ITransactionsOperations Transactions { get; } /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IDepartmentsOperations. /// - IBillingSubscriptionsOperations BillingSubscriptions { get; } + IDepartmentsOperations Departments { get; } /// - /// Gets the IProductsOperations. + /// Gets the IEnrollmentAccountsOperations. /// - IProductsOperations Products { get; } + IEnrollmentAccountsOperations EnrollmentAccounts { get; } /// - /// Gets the ITransactionsOperations. + /// Gets the IInvoicesOperations. /// - ITransactionsOperations Transactions { get; } + IInvoicesOperations Invoices { get; } + + /// + /// Gets the IPriceSheetOperations. + /// + IPriceSheetOperations PriceSheet { get; } /// /// Gets the IPoliciesOperations. @@ -146,6 +161,16 @@ public partial interface IBillingManagementClient : System.IDisposable /// ITransfersOperations Transfers { get; } + /// + /// Gets the IPartnerTransfersOperations. + /// + IPartnerTransfersOperations PartnerTransfers { get; } + + /// + /// Gets the IPartnerTransfersTransfersOperations. + /// + IPartnerTransfersTransfersOperations PartnerTransfersTransfers { get; } + /// /// Gets the IRecipientTransfersOperations. /// @@ -156,11 +181,6 @@ public partial interface IBillingManagementClient : System.IDisposable /// IOperations Operations { get; } - /// - /// Gets the IBillingPermissionsOperations. - /// - IBillingPermissionsOperations BillingPermissions { get; } - /// /// Gets the IBillingRoleDefinitionsOperations. /// @@ -176,5 +196,10 @@ public partial interface IBillingManagementClient : System.IDisposable /// IAgreementsOperations Agreements { get; } + /// + /// Gets the ILineOfCreditsOperations. + /// + ILineOfCreditsOperations LineOfCredits { get; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs index e0157246a966..13d471c026ea 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs @@ -23,6 +23,31 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface IBillingPermissionsOperations { + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// billing Account Id. + /// + /// + /// Customer 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all billing permissions for the caller under a billing /// account. @@ -52,6 +77,9 @@ public partial interface IBillingPermissionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -70,10 +98,9 @@ public partial interface IBillingPermissionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists all billingPermissions for the caller has for a billing - /// account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// billing Account Id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs index 6ea9e0f19913..370ead878038 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs @@ -48,7 +48,7 @@ public partial interface IBillingProfilesOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the billing profile by id. /// @@ -78,6 +78,34 @@ public partial interface IBillingProfilesOperations /// Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to update a billing profile. /// /// @@ -87,7 +115,8 @@ public partial interface IBillingProfilesOperations /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile + /// operation. /// /// /// The headers that will be added to request. @@ -106,6 +135,34 @@ public partial interface IBillingProfilesOperations /// Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to update a billing profile. /// /// @@ -115,7 +172,8 @@ public partial interface IBillingProfilesOperations /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile + /// operation. /// /// /// The headers that will be added to request. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs index 0c8a4329431b..71374d3abd1b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs @@ -25,7 +25,7 @@ public partial interface IBillingPropertyOperations { /// /// Get billing property by subscription Id. - /// + /// /// /// /// The headers that will be added to request. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs index e8dd336ace8a..dfd967c25418 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs @@ -72,13 +72,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignment for the caller on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -100,13 +103,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the role assignment on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -128,7 +134,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignment for the caller on the Billing Profile /// @@ -156,7 +162,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the role assignment on this Billing Profile /// @@ -184,7 +190,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the Billing Account /// @@ -206,13 +212,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a billing account. /// /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -228,13 +237,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByBillingAccountWithHttpMessagesAsync(string billingAccountName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -253,16 +265,22 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a invoice Section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -278,7 +296,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the Billing Profile /// @@ -303,7 +321,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a billing profile. /// @@ -313,6 +331,9 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -328,6 +349,6 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs index 332b767d96dd..6de9603a2bcb 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs @@ -47,13 +47,16 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the role definition for a role /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -75,7 +78,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the role definition for a role /// @@ -103,7 +106,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for a billing account /// @@ -125,13 +128,16 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for an invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -150,7 +156,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for a Billing Profile /// @@ -175,6 +181,6 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs index ca05ab3286ca..6f0f5e80e8ac 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs @@ -24,12 +24,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingSubscriptionsOperations { /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// The headers that will be added to request. /// @@ -45,14 +48,66 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. + /// + /// + /// 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing profile name. + /// + /// + /// + /// billing Account Id. + /// /// /// Billing Profile Id. /// @@ -71,14 +126,17 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -97,14 +155,17 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a single billing subscription by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -126,7 +187,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Transfers the subscription from one invoice section to another /// within a billing account. @@ -134,6 +195,45 @@ public partial interface IBillingSubscriptionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription + /// 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> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates the transfer of billing subscriptions across invoice + /// sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -158,7 +258,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Transfers the subscription from one invoice section to another /// within a billing account. @@ -166,6 +266,9 @@ public partial interface IBillingSubscriptionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -173,7 +276,8 @@ public partial interface IBillingSubscriptionsOperations /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription + /// operation. /// /// /// The headers that will be added to request. @@ -190,9 +294,9 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -213,6 +317,29 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// 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>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs new file mode 100644 index 000000000000..127391a15393 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs @@ -0,0 +1,168 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CustomersOperations operations. + /// + public partial interface ICustomersOperations + { + /// + /// Lists customers by billing profile which the current user can work + /// with on-behalf of a partner. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a customer by its id. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// 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 billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers by billing profile which the current user can work + /// with on-behalf of a partner. + /// + /// + /// 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>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// 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>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs index bd865c95b006..6fe7878c3644 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs @@ -29,33 +29,8 @@ public partial interface IInvoiceSectionsOperations /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The operation to create a InvoiceSection. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -72,10 +47,9 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists all invoice sections under a billing profile for a user which - /// he has access to. + /// Get the InvoiceSection by id. /// /// /// billing Account Id. @@ -83,31 +57,8 @@ public partial interface IInvoiceSectionsOperations /// /// Billing Profile Id. /// - /// - /// 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> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all invoiceSections with create subscription permission for a - /// user. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. + /// + /// InvoiceSection Id. /// /// /// The headers that will be added to request. @@ -124,18 +75,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -152,18 +106,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a InvoiceSection. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -180,13 +137,16 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Elevates the caller's access to match their billing profile access. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -202,15 +162,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -227,18 +193,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a InvoiceSection. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -255,6 +224,6 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs index 20a9710d6e67..92881627e14e 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs @@ -50,7 +50,7 @@ public partial interface IInvoicesOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List of invoices for a billing profile. /// @@ -109,6 +109,6 @@ public partial interface IInvoicesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs new file mode 100644 index 000000000000..ba1c6ac5edbf --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs @@ -0,0 +1,90 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LineOfCreditsOperations operations. + /// + public partial interface ILineOfCreditsOperations + { + /// + /// Get the current line of credit. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.cs new file mode 100644 index 000000000000..12424f279f60 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PartnerTransfersOperations operations. + /// + public partial interface IPartnerTransfersOperations + { + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + /// + /// 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> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer 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 billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer 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> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs new file mode 100644 index 000000000000..257b82644cfd --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs @@ -0,0 +1,77 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PartnerTransfersTransfersOperations operations. + /// + public partial interface IPartnerTransfersTransfersOperations + { + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer 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>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// 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/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs index 3436d0cc3003..ed7a123da510 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs @@ -25,7 +25,7 @@ public partial interface IPaymentMethodsOperations { /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// billing Account Id. @@ -45,10 +45,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// billing Account Id. @@ -71,10 +71,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -94,10 +94,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -117,6 +117,6 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingProfileNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs index 093508b3467a..ce73bd4c9303 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs @@ -26,7 +26,7 @@ public partial interface IPoliciesOperations /// /// The policy for a given billing account name and billing profile /// name. - /// + /// /// /// /// billing Account Id. @@ -49,7 +49,7 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a policy. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs index 4dbbea4a1d6f..d86f10588980 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs @@ -27,10 +27,38 @@ public partial interface IPriceSheetOperations /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// 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> DownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -47,15 +75,43 @@ public partial interface IPriceSheetOperations /// /// Thrown when a required parameter is null /// - Task> DownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// 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> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -72,6 +128,6 @@ public partial interface IPriceSheetOperations /// /// Thrown when a required parameter is null /// - Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginDownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs index 772e45896fea..b6be7ff53256 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs @@ -23,9 +23,70 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface IProductsOperations { + /// + /// Lists products by customer id. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', + /// 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + /// 'ne', 'or', or 'not'. Tag filter is a key value pair string where + /// key and value is separated by a colon (:). + /// + /// + /// 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a customer's product by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + /// + /// 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by billing account name. - /// + /// /// /// /// billing Account Id. @@ -51,14 +112,17 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -83,14 +147,17 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a single product by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -112,13 +179,16 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to transfer a Product to another invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -143,19 +213,24 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Cancel auto renew for product by product id and billing account - /// name + /// Validates the transfer of products across invoice sections. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// /// Invoice Id. /// - /// - /// Update auto renew request parameters. + /// + /// Parameters supplied to the Transfer Products operation. /// /// /// The headers that will be added to request. @@ -172,7 +247,7 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancel auto renew for product by product id and invoice section /// name @@ -180,6 +255,9 @@ public partial interface IProductsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -204,10 +282,10 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by billing account name. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -227,6 +305,6 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs index bf6c68b38fd2..814c7e69e1e6 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs @@ -29,8 +29,8 @@ public partial interface IRecipientTransfersOperations /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// The headers that will be added to request. @@ -47,7 +47,33 @@ public partial interface IRecipientTransfersOperations /// /// Thrown when a required parameter is null /// - Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates if the products can be transferred in the context of the + /// given transfer name. + /// + /// + /// Transfer Name. + /// + /// + /// Parameters supplied to validate the transfer. + /// + /// + /// 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> ValidateWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Declines the transfer with given transfer Id. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs index c4c94779273c..6d4fe16f1332 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs @@ -23,10 +23,49 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface ITransactionsOperations { + /// + /// Lists the transactions by customer id for given start date and end + /// date. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports + /// 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. Tag filter is a key value pair string + /// where key and value is separated by a colon (:). + /// + /// + /// 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>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing account name for given start and /// end date. - /// + /// /// /// /// billing Account Id. @@ -58,11 +97,11 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing profile name for given start date /// and end date. - /// + /// /// /// /// billing Account Id. @@ -97,15 +136,18 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by invoice section name for given start date /// and end date. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -136,11 +178,70 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the transaction. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// 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 billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the transactions by customer id for given start date and end + /// date. + /// + /// + /// + /// 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>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing account name for given start and /// end date. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -160,6 +261,6 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs index 32cf8b3bff6b..181fdf9757ef 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs @@ -29,11 +29,14 @@ public partial interface ITransfersOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// The headers that will be added to request. @@ -50,13 +53,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> InitiateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the transfer details for given transfer Id. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -78,13 +84,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancels the transfer for given transfer Id. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -106,13 +115,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> CancelWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all transfer's details initiated from given invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -131,7 +143,7 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all transfer's details initiated from given invoice section. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs index 578c38188985..4812e4c4443d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs @@ -56,214 +56,6 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("expand", expand); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", 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").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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 a InvoiceSection. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. - /// - /// - /// billing Account Id. - /// /// /// Billing Profile Id. /// @@ -288,7 +80,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -312,7 +104,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -445,13 +237,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// Lists all invoiceSections with create subscription permission for a user. + /// Get the InvoiceSection by id. /// /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. /// /// /// Headers that will be added to request. @@ -474,7 +269,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -484,6 +279,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -492,23 +295,22 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("expand", expand); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCreateSubscriptionPermission", tracingParameters); + 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.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").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 (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -597,7 +399,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -610,7 +412,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -630,197 +432,31 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// - /// Headers that will be added to request. + /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - // 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("expand", expand); - 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.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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; + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -829,11 +465,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -841,10 +480,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -854,6 +493,9 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -875,12 +517,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, 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"); @@ -893,14 +539,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ElevateToBillingProfile", 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}/elevate").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/elevate").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 (_queryParameters.Count > 0) @@ -1006,13 +654,19 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// Headers that will be added to request. @@ -1035,7 +689,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1045,6 +699,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { 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 (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -1057,14 +719,18 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").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 (Client.ApiVersion != null) { @@ -1077,7 +743,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1215,11 +881,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// Headers that will be added to request. @@ -1242,7 +911,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1252,6 +921,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -1268,6 +941,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1275,8 +949,9 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } // 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}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").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 (Client.ApiVersion != null) @@ -1290,7 +965,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs index 1de0c2211554..4052f5850ba4 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs @@ -30,12 +30,12 @@ public static partial class InvoiceSectionsOperationsExtensions /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Billing Profile Id. /// - public static InvoiceSectionListResult ListByBillingAccountName(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string)) + public static InvoiceSectionListResult ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -47,63 +47,22 @@ public static partial class InvoiceSectionsOperationsExtensions /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// The cancellation token. - /// - public static async Task ListByBillingAccountNameAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The operation to create a InvoiceSection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. - /// - public static InvoiceSection Create(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters) - { - return operations.CreateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a InvoiceSection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task CreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. + /// Get the InvoiceSection by id. /// /// /// The operations group for this extension method. @@ -114,14 +73,16 @@ public static InvoiceSection Create(this IInvoiceSectionsOperations operations, /// /// Billing Profile Id. /// - public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + /// + /// InvoiceSection Id. + /// + public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. + /// Get the InvoiceSection by id. /// /// /// The operations group for this extension method. @@ -132,59 +93,22 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// Billing Profile Id. /// - /// - /// The cancellation token. - /// - public static async Task ListByBillingProfileNameAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all invoiceSections with create subscription permission for a user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. - /// - public static InvoiceSectionListResult ListByCreateSubscriptionPermission(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string)) - { - return operations.ListByCreateSubscriptionPermissionAsync(billingAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// Lists all invoiceSections with create subscription permission for a user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. + /// + /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByCreateSubscriptionPermissionAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -192,19 +116,22 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, string expand = default(string)) + public static InvoiceSection Create(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters) { - return operations.GetAsync(billingAccountName, invoiceSectionName, expand).GetAwaiter().GetResult(); + return operations.CreateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -212,18 +139,21 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -238,15 +168,18 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection Update(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters) + public static InvoiceSection Update(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return operations.UpdateAsync(billingAccountName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -258,18 +191,21 @@ public static InvoiceSection Update(this IInvoiceSectionsOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -284,12 +220,15 @@ public static InvoiceSection Update(this IInvoiceSectionsOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static void ElevateToBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName) + public static void ElevateToBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - operations.ElevateToBillingProfileAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + operations.ElevateToBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -301,19 +240,22 @@ public static void ElevateToBillingProfile(this IInvoiceSectionsOperations opera /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ElevateToBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ElevateToBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ElevateToBillingProfileWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ElevateToBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -321,16 +263,22 @@ public static void ElevateToBillingProfile(this IInvoiceSectionsOperations opera /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters) + public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters) { - return operations.BeginCreateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + return operations.BeginCreateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -338,15 +286,21 @@ public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task BeginCreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -361,15 +315,18 @@ public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters) + public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return operations.BeginUpdateAsync(billingAccountName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -381,18 +338,21 @@ public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs index 67850201bfbf..4dd00b21b1b9 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs @@ -83,7 +83,7 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -112,7 +112,7 @@ internal InvoicesOperations(BillingManagementClient client) tracingParameters.Add("periodStartDate", periodStartDate); tracingParameters.Add("periodEndDate", periodEndDate); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -494,7 +494,7 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -624,7 +624,7 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -637,7 +637,7 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs index 78ac2e59664b..550178ea1e1a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs @@ -36,9 +36,9 @@ public static partial class InvoicesOperationsExtensions /// /// Invoice period end date. /// - public static InvoiceListResult ListByBillingAccountName(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) + public static InvoiceListResult ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) { - return operations.ListByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); } /// @@ -59,9 +59,9 @@ public static InvoiceListResult ListByBillingAccountName(this IInvoicesOperation /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -134,7 +134,7 @@ public static InvoiceListResult ListByBillingProfile(this IInvoicesOperations op /// /// Invoice Id. /// - public static InvoiceSummary Get(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName) + public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { return operations.GetAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } @@ -157,7 +157,7 @@ public static InvoiceSummary Get(this IInvoicesOperations operations, string bil /// /// The cancellation token. /// - public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs new file mode 100644 index 000000000000..68d32a7ccb16 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs @@ -0,0 +1,446 @@ +// +// 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.Billing +{ + 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; + + /// + /// LineOfCreditsOperations operations. + /// + internal partial class LineOfCreditsOperations : IServiceOperations, ILineOfCreditsOperations + { + /// + /// Initializes a new instance of the LineOfCreditsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LineOfCreditsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Get the current line of credit. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default").ToString(); + _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; + } + + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default").ToString(); + _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("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 != 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; + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs new file mode 100644 index 000000000000..748cf35fc8fa --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs @@ -0,0 +1,121 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LineOfCreditsOperations. + /// + public static partial class LineOfCreditsOperationsExtensions + { + /// + /// Get the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + public static LineOfCredit Get(this ILineOfCreditsOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILineOfCreditsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + public static LineOfCredit Update(this ILineOfCreditsOperations operations, LineOfCredit parameters) + { + return operations.UpdateAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILineOfCreditsOperations operations, LineOfCredit parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + public static LineOfCredit BeginUpdate(this ILineOfCreditsOperations operations, LineOfCredit parameters) + { + return operations.BeginUpdateAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ILineOfCreditsOperations operations, LineOfCredit parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs similarity index 86% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs index 1dc77e0f9a1a..82031e2a89f4 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs @@ -16,18 +16,18 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Address details. /// - public partial class Address + public partial class AddressDetails { /// - /// Initializes a new instance of the Address class. + /// Initializes a new instance of the AddressDetails class. /// - public Address() + public AddressDetails() { CustomInit(); } /// - /// Initializes a new instance of the Address class. + /// Initializes a new instance of the AddressDetails class. /// /// First Name. /// Last Name. @@ -40,7 +40,7 @@ public Address() /// Country code uses ISO2, 2-digit /// format. /// Address Postal Code. - public Address(string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine1 = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string region = default(string), string country = default(string), string postalCode = default(string)) + public AddressDetails(string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine1 = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string region = default(string), string country = default(string), string postalCode = default(string)) { FirstName = firstName; LastName = lastName; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.cs new file mode 100644 index 000000000000..41d215933e7e --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.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.Billing.Models +{ + + /// + /// Defines values for AddressValidationStatus. + /// + public static class AddressValidationStatus + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.cs new file mode 100644 index 000000000000..69fd15d0737a --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.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.Billing.Models +{ + + /// + /// Defines values for AgreementType. + /// + public static class AgreementType + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string EnterpriseAgreement = "EnterpriseAgreement"; + public const string MicrosoftOnlineServicesProgram = "MicrosoftOnlineServicesProgram"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs index 49d2c7a5582b..c82d4c302b30 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs @@ -50,10 +50,10 @@ public Amount() public string Currency { get; private set; } /// - /// Gets amount value. + /// Gets or sets amount value. /// [JsonProperty(PropertyName = "value")] - public double? Value { get; private set; } + public double? Value { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs similarity index 75% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs index fae4b953ef60..0c6c4ae3a058 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs @@ -14,24 +14,24 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Details about the enabled azure sku. + /// Details about the azure plan. /// - public partial class EnabledAzureSKUs + public partial class AzurePlan { /// - /// Initializes a new instance of the EnabledAzureSKUs class. + /// Initializes a new instance of the AzurePlan class. /// - public EnabledAzureSKUs() + public AzurePlan() { CustomInit(); } /// - /// Initializes a new instance of the EnabledAzureSKUs class. + /// Initializes a new instance of the AzurePlan class. /// /// The sku id. /// The sku description. - public EnabledAzureSKUs(string skuId = default(string), string skuDescription = default(string)) + public AzurePlan(string skuId = default(string), string skuDescription = default(string)) { SkuId = skuId; SkuDescription = skuDescription; @@ -44,10 +44,10 @@ public EnabledAzureSKUs() partial void CustomInit(); /// - /// Gets the sku id. + /// Gets or sets the sku id. /// [JsonProperty(PropertyName = "skuId")] - public string SkuId { get; private set; } + public string SkuId { get; set; } /// /// Gets the sku description. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs index 8a12514385a0..b45f714a6d00 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs @@ -38,15 +38,13 @@ public BillingAccount() /// Resource name. /// Resource type. /// The billing account name. - /// The billing account Type. Possible values - /// include: 'Organization', 'Enrollment' /// The address associated with billing /// account. - /// Company Name. - /// Country Name. - /// The invoice sections associated to - /// the billing account. By default this is not populated, unless it's - /// specified in $expand. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' /// The billing profiles associated to /// the billing account. By default this is not populated, unless it's /// specified in $expand. @@ -57,22 +55,19 @@ public BillingAccount() /// enrollment. /// The accounts associated to the /// enrollment. - /// Specifies whether the user has read - /// access on billing account. - public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string accountType = default(string), Address address = default(Address), string company = default(string), string country = default(string), IList invoiceSections = default(IList), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) + /// Organization id. + public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), AddressDetails address = default(AddressDetails), string agreementType = default(string), string customerType = default(string), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), string organizationId = default(string)) : base(id, name, type) { DisplayName = displayName; - AccountType = accountType; Address = address; - Company = company; - Country = country; - InvoiceSections = invoiceSections; + AgreementType = agreementType; + CustomerType = customerType; BillingProfiles = billingProfiles; EnrollmentDetails = enrollmentDetails; Departments = departments; EnrollmentAccounts = enrollmentAccounts; - HasReadAccess = hasReadAccess; + OrganizationId = organizationId; CustomInit(); } @@ -87,38 +82,26 @@ public BillingAccount() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; private set; } - /// - /// Gets the billing account Type. Possible values include: - /// 'Organization', 'Enrollment' - /// - [JsonProperty(PropertyName = "properties.accountType")] - public string AccountType { get; private set; } - /// /// Gets or sets the address associated with billing account. /// [JsonProperty(PropertyName = "properties.address")] - public Address Address { get; set; } + public AddressDetails Address { get; set; } /// - /// Gets company Name. + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' /// - [JsonProperty(PropertyName = "properties.company")] - public string Company { get; private set; } + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } /// - /// Gets country Name. - /// - [JsonProperty(PropertyName = "properties.country")] - public string Country { get; private set; } - - /// - /// Gets or sets the invoice sections associated to the billing - /// account. By default this is not populated, unless it's specified in - /// $expand. + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' /// - [JsonProperty(PropertyName = "properties.invoiceSections")] - public IList InvoiceSections { get; set; } + [JsonProperty(PropertyName = "properties.customerType")] + public string CustomerType { get; private set; } /// /// Gets or sets the billing profiles associated to the billing @@ -148,10 +131,10 @@ public BillingAccount() public IList EnrollmentAccounts { get; set; } /// - /// Gets specifies whether the user has read access on billing account. + /// Gets organization id. /// - [JsonProperty(PropertyName = "properties.hasReadAccess")] - public bool? HasReadAccess { get; private set; } + [JsonProperty(PropertyName = "properties.organizationId")] + public string OrganizationId { get; private set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs new file mode 100644 index 000000000000..5caf62f1da02 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs @@ -0,0 +1,138 @@ +// +// 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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request properties of the billing account that can be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingAccountUpdateRequest + { + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + public BillingAccountUpdateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + /// The billing account name. + /// The address associated with billing + /// account. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' + /// The billing profiles associated to + /// the billing account. By default this is not populated, unless it's + /// specified in $expand. + /// The details about the associated + /// legacy enrollment. By default this is not populated, unless it's + /// specified in $expand. + /// The departments associated to the + /// enrollment. + /// The accounts associated to the + /// enrollment. + /// Organization id. + public BillingAccountUpdateRequest(string displayName = default(string), AddressDetails address = default(AddressDetails), string agreementType = default(string), string customerType = default(string), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), string organizationId = default(string)) + { + DisplayName = displayName; + Address = address; + AgreementType = agreementType; + CustomerType = customerType; + BillingProfiles = billingProfiles; + EnrollmentDetails = enrollmentDetails; + Departments = departments; + EnrollmentAccounts = enrollmentAccounts; + OrganizationId = organizationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the billing account name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets the address associated with billing account. + /// + [JsonProperty(PropertyName = "properties.address")] + public AddressDetails Address { get; set; } + + /// + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' + /// + [JsonProperty(PropertyName = "properties.customerType")] + public string CustomerType { get; private set; } + + /// + /// Gets or sets the billing profiles associated to the billing + /// account. By default this is not populated, unless it's specified in + /// $expand. + /// + [JsonProperty(PropertyName = "properties.billingProfiles")] + public IList BillingProfiles { get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default + /// this is not populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails { get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.departments")] + public IList Departments { get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public IList EnrollmentAccounts { get; set; } + + /// + /// Gets organization id. + /// + [JsonProperty(PropertyName = "properties.organizationId")] + public string OrganizationId { get; private set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs index 38424b54e002..a1408e2c7373 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs @@ -33,7 +33,7 @@ public BillingPermissionsListResult() /// Initializes a new instance of the BillingPermissionsListResult /// class. /// - /// The list OF billingPermissions a caller has on + /// The list of billingPermissions a caller has on /// a billing account. public BillingPermissionsListResult(IList value = default(IList)) { @@ -47,7 +47,7 @@ public BillingPermissionsListResult() partial void CustomInit(); /// - /// Gets the list OF billingPermissions a caller has on a billing + /// Gets the list of billingPermissions a caller has on a billing /// account. /// [JsonProperty(PropertyName = "value")] diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs index 04f9ea67f8c2..2dc671dc0b30 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs @@ -42,26 +42,23 @@ public BillingProfile() /// Billing address. /// If the billing profile is opted in /// to receive invoices via email. - /// Is OMS bootstrapped billing - /// profile. /// Invoice day. /// The currency associated with the billing /// profile. - /// Information about the - /// product. + /// Information about the enabled azure + /// plans. /// The invoice sections associated to /// the billing profile. - public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), Address address = default(Address), bool? invoiceEmailOptIn = default(bool?), bool? isClassic = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzureSKUs = default(IList), IList invoiceSections = default(IList)) + public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails address = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzurePlans = default(IList), IList invoiceSections = default(IList)) : base(id, name, type) { DisplayName = displayName; PoNumber = poNumber; Address = address; InvoiceEmailOptIn = invoiceEmailOptIn; - IsClassic = isClassic; InvoiceDay = invoiceDay; Currency = currency; - EnabledAzureSKUs = enabledAzureSKUs; + EnabledAzurePlans = enabledAzurePlans; InvoiceSections = invoiceSections; CustomInit(); } @@ -87,7 +84,7 @@ public BillingProfile() /// Gets or sets billing address. /// [JsonProperty(PropertyName = "properties.address")] - public Address Address { get; set; } + public AddressDetails Address { get; set; } /// /// Gets if the billing profile is opted in to receive invoices via @@ -96,12 +93,6 @@ public BillingProfile() [JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] public bool? InvoiceEmailOptIn { get; private set; } - /// - /// Gets is OMS bootstrapped billing profile. - /// - [JsonProperty(PropertyName = "properties.isClassic")] - public bool? IsClassic { get; private set; } - /// /// Gets invoice day. /// @@ -115,10 +106,10 @@ public BillingProfile() public string Currency { get; private set; } /// - /// Gets or sets information about the product. + /// Gets or sets information about the enabled azure plans. /// - [JsonProperty(PropertyName = "properties.enabledAzureSKUs")] - public IList EnabledAzureSKUs { get; set; } + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } /// /// Gets or sets the invoice sections associated to the billing diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs new file mode 100644 index 000000000000..3286aade2336 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs @@ -0,0 +1,90 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request parameters for creating a new billing profile. + /// + public partial class BillingProfileCreationRequest + { + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + public BillingProfileCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + /// The billing profile name. + /// Purchase order number. + /// Billing address. + /// If the billing profile is opted in + /// to receive invoices via email. + /// Enabled azure plans for this + /// billing profile. + public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails address = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), IList enabledAzurePlans = default(IList)) + { + DisplayName = displayName; + PoNumber = poNumber; + Address = address; + InvoiceEmailOptIn = invoiceEmailOptIn; + EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the billing profile name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets purchase order number. + /// + [JsonProperty(PropertyName = "poNumber")] + public string PoNumber { get; set; } + + /// + /// Gets or sets billing address. + /// + [JsonProperty(PropertyName = "address")] + public AddressDetails Address { get; set; } + + /// + /// Gets or sets if the billing profile is opted in to receive invoices + /// via email. + /// + [JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn { get; set; } + + /// + /// Gets or sets enabled azure plans for this billing profile. + /// + [JsonProperty(PropertyName = "enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.cs new file mode 100644 index 000000000000..c5888737ec7d --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class BillingProfilesCreateHeaders + { + /// + /// Initializes a new instance of the BillingProfilesCreateHeaders + /// class. + /// + public BillingProfilesCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfilesCreateHeaders + /// class. + /// + /// Location URI to poll for result + /// Recommends the retryable time after + /// receiving this. + public BillingProfilesCreateHeaders(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 location URI to poll for result + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommends the retryable time after receiving this. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs index 899f2827f887..088d08242916 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs @@ -37,27 +37,30 @@ public BillingProperty() /// Resource type. /// Billing tenant Id. /// Billing account Id. - /// Billing account name. + /// Billing account display + /// name. /// Billing profile Id. - /// Billing profile name. + /// Billing profile display + /// name. /// Cost center name. /// Invoice Section Id. - /// Invoice Section name. + /// Invoice Section display + /// name. /// Product Id. /// Product name. /// SKU Id. /// SKU description. - public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountName = default(string), string billingProfileId = default(string), string billingProfileName = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) : base(id, name, type) { BillingTenantId = billingTenantId; BillingAccountId = billingAccountId; - BillingAccountName = billingAccountName; + BillingAccountDisplayName = billingAccountDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; CostCenter = costCenter; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; ProductId = productId; ProductName = productName; SkuId = skuId; @@ -83,10 +86,10 @@ public BillingProperty() public string BillingAccountId { get; private set; } /// - /// Gets billing account name. + /// Gets billing account display name. /// - [JsonProperty(PropertyName = "properties.billingAccountName")] - public string BillingAccountName { get; private set; } + [JsonProperty(PropertyName = "properties.billingAccountDisplayName")] + public string BillingAccountDisplayName { get; private set; } /// /// Gets billing profile Id. @@ -95,10 +98,10 @@ public BillingProperty() public string BillingProfileId { get; private set; } /// - /// Gets billing profile name. + /// Gets billing profile display name. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } /// /// Gets cost center name. @@ -113,10 +116,10 @@ public BillingProperty() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice Section name. + /// Gets invoice Section display name. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets product Id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs index 9fc63badaf94..74d64a4af330 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs @@ -33,12 +33,12 @@ public BillingRoleAssignmentPayload() /// /// The user's principal id that the role /// gets assigned to - /// The role definition + /// The role definition /// id - public BillingRoleAssignmentPayload(string principalId = default(string), string billingRoleDefinitionName = default(string)) + public BillingRoleAssignmentPayload(string principalId = default(string), string billingRoleDefinitionId = default(string)) { PrincipalId = principalId; - BillingRoleDefinitionName = billingRoleDefinitionName; + BillingRoleDefinitionId = billingRoleDefinitionId; CustomInit(); } @@ -48,16 +48,16 @@ public BillingRoleAssignmentPayload() partial void CustomInit(); /// - /// Gets the user's principal id that the role gets assigned to + /// Gets or sets the user's principal id that the role gets assigned to /// [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; private set; } + public string PrincipalId { get; set; } /// - /// Gets the role definition id + /// Gets or sets the role definition id /// - [JsonProperty(PropertyName = "billingRoleDefinitionName")] - public string BillingRoleDefinitionName { get; private set; } + [JsonProperty(PropertyName = "billingRoleDefinitionId")] + public string BillingRoleDefinitionId { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs index 1ab8f7a72fef..1d8e57c0f051 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs @@ -38,7 +38,7 @@ public BillingRoleDefinition() /// Resource name. /// Resource type. /// The role description - /// The list OF billingPermissions a caller has on + /// The list of billingPermissions a caller has on /// a billing account. /// The name of the role public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), IList value = default(IList), string roleName = default(string)) @@ -62,7 +62,7 @@ public BillingRoleDefinition() public string Description { get; private set; } /// - /// Gets the list OF billingPermissions a caller has on a billing + /// Gets the list of billingPermissions a caller has on a billing /// account. /// [JsonProperty(PropertyName = "properties.permissions.value")] diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs similarity index 62% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs index af34cba8b4b7..0d8e1dc1a2cc 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A billing Subscription summary resource. + /// A billing Subscription resource. /// [Rest.Serialization.JsonTransformation] - public partial class BillingSubscriptionSummary : Resource + public partial class BillingSubscription : Resource { /// - /// Initializes a new instance of the BillingSubscriptionSummary class. + /// Initializes a new instance of the BillingSubscription class. /// - public BillingSubscriptionSummary() + public BillingSubscription() { CustomInit(); } /// - /// Initializes a new instance of the BillingSubscriptionSummary class. + /// Initializes a new instance of the BillingSubscription class. /// /// Resource Id. /// Resource name. @@ -44,15 +44,20 @@ public BillingSubscriptionSummary() /// Month to date charges. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. + /// Reseller for this subscription. /// The sku id. /// The sku description. - public BillingSubscriptionSummary(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileName = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string skuId = default(string), string skuDescription = default(string)) + public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) : base(id, name, type) { DisplayName = displayName; @@ -61,9 +66,12 @@ public BillingSubscriptionSummary() LastMonthCharges = lastMonthCharges; MonthToDateCharges = monthToDateCharges; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + Reseller = reseller; SkuId = skuId; SkuDescription = skuDescription; CustomInit(); @@ -112,10 +120,22 @@ public BillingSubscriptionSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } /// /// Gets invoice section id to which this product belongs. @@ -124,10 +144,16 @@ public BillingSubscriptionSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets reseller for this subscription. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } /// /// Gets or sets the sku id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs index 4b5829c166b0..65f02e801fef 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing billing subscriptions summary. + /// Result of listing billing subscriptions. /// public partial class BillingSubscriptionsListResult { @@ -33,11 +33,10 @@ public BillingSubscriptionsListResult() /// Initializes a new instance of the BillingSubscriptionsListResult /// class. /// - /// The list of billing subscriptions - /// summary. + /// The list of billing subscriptions. /// The link (url) to the next page of /// results. - public BillingSubscriptionsListResult(IList value = default(IList), string nextLink = default(string)) + public BillingSubscriptionsListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -50,10 +49,10 @@ public BillingSubscriptionsListResult() partial void CustomInit(); /// - /// Gets the list of billing subscriptions summary. + /// Gets the list of billing subscriptions. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs index 582e08544f7f..253d7ba5b08d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs @@ -34,13 +34,10 @@ public BillingSubscriptionsTransferHeaders() /// Location URI to poll for result. /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public BillingSubscriptionsTransferHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public BillingSubscriptionsTransferHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -61,11 +58,5 @@ public BillingSubscriptionsTransferHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.cs new file mode 100644 index 000000000000..89c7ab63b4cf --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A partner's customer. + /// + [Rest.Serialization.JsonTransformation] + public partial class Customer : Resource + { + /// + /// Initializes a new instance of the Customer class. + /// + public Customer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Customer class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the customer. + /// Information about the + /// product. + /// The resellers which are allowed to provide + /// service to this customer. + public Customer(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList enabledAzurePlans = default(IList), IList resellers = default(IList)) + : base(id, name, type) + { + DisplayName = displayName; + EnabledAzurePlans = enabledAzurePlans; + Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the customer. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets information about the product. + /// + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + /// + /// Gets or sets the resellers which are allowed to provide service to + /// this customer. + /// + [JsonProperty(PropertyName = "properties.resellers")] + public IList Resellers { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.cs new file mode 100644 index 000000000000..f3aa34eb0848 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.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.Billing.Models +{ + + /// + /// Defines values for CustomerType. + /// + public static class CustomerType + { + public const string Enterprise = "Enterprise"; + public const string Individual = "Individual"; + public const string Partner = "Partner"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs similarity index 83% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs index f91a65dcf1cb..36f973b7dd43 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs @@ -16,23 +16,23 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// The properties of the invoice download. /// - public partial class DownloadProperties + public partial class Document { /// - /// Initializes a new instance of the DownloadProperties class. + /// Initializes a new instance of the Document class. /// - public DownloadProperties() + public Document() { CustomInit(); } /// - /// Initializes a new instance of the DownloadProperties class. + /// Initializes a new instance of the Document class. /// /// Document type. Possible values include: /// 'Invoice', 'VoidNote', 'Receipt', 'CreditNote' /// Document URL. - public DownloadProperties(string kind = default(string), string url = default(string)) + public Document(string kind = default(string), string url = default(string)) { Kind = kind; Url = url; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.cs new file mode 100644 index 000000000000..6a75ed670068 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.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.Billing.Models +{ + + /// + /// Defines values for DocumentType. + /// + public static class DocumentType + { + public const string Invoice = "Invoice"; + public const string VoidNote = "VoidNote"; + public const string Receipt = "Receipt"; + public const string CreditNote = "CreditNote"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs index a16b7c341e08..00b981362f05 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs @@ -32,14 +32,13 @@ public InitiateTransferRequest() /// /// Initializes a new instance of the InitiateTransferRequest class. /// - /// Target Usage context for devTest - /// subscriptions. /// Email Id of recipient for /// transfer. - public InitiateTransferRequest(string billingProfileId = default(string), string recipientEmailId = default(string)) + /// Optional reseller Id for transfer. + public InitiateTransferRequest(string recipientEmailId = default(string), string resellerId = default(string)) { - BillingProfileId = billingProfileId; RecipientEmailId = recipientEmailId; + ResellerId = resellerId; CustomInit(); } @@ -48,17 +47,17 @@ public InitiateTransferRequest() /// partial void CustomInit(); - /// - /// Gets or sets target Usage context for devTest subscriptions. - /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; set; } - /// /// Gets or sets email Id of recipient for transfer. /// [JsonProperty(PropertyName = "properties.recipientEmailId")] public string RecipientEmailId { get; set; } + /// + /// Gets or sets optional reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs similarity index 73% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs index ffd2e631cc45..21725e4db657 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs @@ -21,18 +21,18 @@ namespace Microsoft.Azure.Management.Billing.Models /// An invoice resource. /// [Rest.Serialization.JsonTransformation] - public partial class InvoiceSummary : Resource + public partial class Invoice : Resource { /// - /// Initializes a new instance of the InvoiceSummary class. + /// Initializes a new instance of the Invoice class. /// - public InvoiceSummary() + public Invoice() { CustomInit(); } /// - /// Initializes a new instance of the InvoiceSummary class. + /// Initializes a new instance of the Invoice class. /// /// Resource Id. /// Resource name. @@ -50,14 +50,14 @@ public InvoiceSummary() /// period. /// The billing profile id this invoice /// belongs to. - /// The profile name this invoice - /// belongs to. + /// The billing profile display + /// name this invoice belongs to. /// The purchase identifier for the /// invoice. - /// List of document urls available to - /// download including invoice and tax documents. + /// List of documents available to download + /// including invoice and tax documents. /// List of payments. - public InvoiceSummary(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount billedAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileName = default(string), string purchaseOrderNumber = default(string), IList documentUrls = default(IList), IList payments = default(IList)) + public Invoice(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount billedAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), IList documents = default(IList), IList payments = default(IList)) : base(id, name, type) { DueDate = dueDate; @@ -68,9 +68,9 @@ public InvoiceSummary() InvoicePeriodStartDate = invoicePeriodStartDate; InvoicePeriodEndDate = invoicePeriodEndDate; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; PurchaseOrderNumber = purchaseOrderNumber; - DocumentUrls = documentUrls; + Documents = documents; Payments = payments; CustomInit(); } @@ -130,10 +130,10 @@ public InvoiceSummary() public string BillingProfileId { get; private set; } /// - /// Gets the profile name this invoice belongs to. + /// Gets the billing profile display name this invoice belongs to. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } /// /// Gets the purchase identifier for the invoice. @@ -142,11 +142,11 @@ public InvoiceSummary() public string PurchaseOrderNumber { get; private set; } /// - /// Gets list of document urls available to download including invoice - /// and tax documents. + /// Gets list of documents available to download including invoice and + /// tax documents. /// - [JsonProperty(PropertyName = "properties.documentUrls")] - public IList DocumentUrls { get; private set; } + [JsonProperty(PropertyName = "properties.documents")] + public IList Documents { get; private set; } /// /// Gets list of payments. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs index 3d3d9d8b41ae..29686c43e46f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs @@ -34,7 +34,7 @@ public InvoiceListResult() /// The list of invoices. /// The link (url) to the next page of /// results. - public InvoiceListResult(IList value = default(IList), string nextLink = default(string)) + public InvoiceListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -50,7 +50,7 @@ public InvoiceListResult() /// Gets the list of invoices. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs index 2c83b9f016f6..7d0e4e64e6d7 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Billing.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -38,13 +36,10 @@ public InvoiceSection() /// Resource name. /// Resource type. /// The name of the InvoiceSection. - /// The billing profiles associated to - /// the billing account. - public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList billingProfiles = default(IList)) + public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string)) : base(id, name, type) { DisplayName = displayName; - BillingProfiles = billingProfiles; CustomInit(); } @@ -59,12 +54,5 @@ public InvoiceSection() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the billing profiles associated to the billing - /// account. - /// - [JsonProperty(PropertyName = "properties.billingProfiles")] - public IList BillingProfiles { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs similarity index 57% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs index 0d524e480a90..63666bada0da 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs @@ -11,33 +11,30 @@ namespace Microsoft.Azure.Management.Billing.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// The properties of an InvoiceSection. /// - public partial class InvoiceSectionProperties + public partial class InvoiceSectionCreationRequest { /// - /// Initializes a new instance of the InvoiceSectionProperties class. + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. /// - public InvoiceSectionProperties() + public InvoiceSectionCreationRequest() { CustomInit(); } /// - /// Initializes a new instance of the InvoiceSectionProperties class. + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. /// /// The name of the InvoiceSection. - /// The billing profiles associated to - /// the billing account. - public InvoiceSectionProperties(string displayName = default(string), IList billingProfiles = default(IList)) + public InvoiceSectionCreationRequest(string displayName = default(string)) { DisplayName = displayName; - BillingProfiles = billingProfiles; CustomInit(); } @@ -52,12 +49,5 @@ public InvoiceSectionProperties() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the billing profiles associated to the billing - /// account. - /// - [JsonProperty(PropertyName = "billingProfiles")] - public IList BillingProfiles { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionWithCreateSubPermission.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionWithCreateSubPermission.cs new file mode 100644 index 000000000000..bb5db3d7a271 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionWithCreateSubPermission.cs @@ -0,0 +1,91 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Invoice section properties with create subscription permission. + /// + public partial class InvoiceSectionWithCreateSubPermission + { + /// + /// Initializes a new instance of the + /// InvoiceSectionWithCreateSubPermission class. + /// + public InvoiceSectionWithCreateSubPermission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InvoiceSectionWithCreateSubPermission class. + /// + /// Invoice Section Id. + /// Invoice Section display + /// name. + /// Billing profile Id. + /// Billing profile display + /// name. + /// Enabled azure plans for the + /// associated billing profile. + public InvoiceSectionWithCreateSubPermission(string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), IList enabledAzurePlans = default(IList)) + { + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets invoice Section Id. + /// + [JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets invoice Section display name. + /// + [JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets billing profile Id. + /// + [JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets billing profile display name. + /// + [JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets or sets enabled azure plans for the associated billing + /// profile. + /// + [JsonProperty(PropertyName = "enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs index 035ba83f811e..347073d3b7c4 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs @@ -34,13 +34,10 @@ public InvoiceSectionsCreateHeaders() /// Location URI to poll for result /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public InvoiceSectionsCreateHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public InvoiceSectionsCreateHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -61,11 +58,5 @@ public InvoiceSectionsCreateHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.cs new file mode 100644 index 000000000000..3ed93022c055 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.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.Billing.Models +{ + + /// + /// Defines values for InvoiceStatus. + /// + public static class InvoiceStatus + { + public const string PastDue = "PastDue"; + public const string Due = "Due"; + public const string Paid = "Paid"; + public const string Void = "Void"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs new file mode 100644 index 000000000000..69722dbd5433 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs @@ -0,0 +1,85 @@ +// +// 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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Line of credit resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class LineOfCredit : Resource + { + /// + /// Initializes a new instance of the LineOfCredit class. + /// + public LineOfCredit() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineOfCredit class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The current credit limit. + /// The reason for the line of credit status when + /// not approved. + /// Remaining balance. + /// The line of credit status. Possible values + /// include: 'Approved', 'Rejected' + public LineOfCredit(string id = default(string), string name = default(string), string type = default(string), Amount creditLimit = default(Amount), string reason = default(string), Amount remainingBalance = default(Amount), string status = default(string)) + : base(id, name, type) + { + CreditLimit = creditLimit; + Reason = reason; + RemainingBalance = remainingBalance; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current credit limit. + /// + [JsonProperty(PropertyName = "properties.creditLimit")] + public Amount CreditLimit { get; set; } + + /// + /// Gets the reason for the line of credit status when not approved. + /// + [JsonProperty(PropertyName = "properties.reason")] + public string Reason { get; private set; } + + /// + /// Gets remaining balance. + /// + [JsonProperty(PropertyName = "properties.remainingBalance")] + public Amount RemainingBalance { get; private set; } + + /// + /// Gets or sets the line of credit status. Possible values include: + /// 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.cs new file mode 100644 index 000000000000..11328f1778e5 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class LineOfCreditsUpdateHeaders + { + /// + /// Initializes a new instance of the LineOfCreditsUpdateHeaders class. + /// + public LineOfCreditsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineOfCreditsUpdateHeaders class. + /// + /// Location URI to poll for result. + /// Recommends the retryable time after + /// receiving this. + public LineOfCreditsUpdateHeaders(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 location URI to poll for result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommends the retryable time after receiving this. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.cs new file mode 100644 index 000000000000..b9b51871a589 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.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.Billing.Models +{ + + /// + /// Defines values for MarketplacePurchasesPolicy. + /// + public static class MarketplacePurchasesPolicy + { + public const string AllAllowed = "AllAllowed"; + public const string FreeAllowed = "FreeAllowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs deleted file mode 100644 index 26a84a70ab38..000000000000 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// 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.Billing.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// status of the Billing POST/PUT operation. - /// - public partial class OperationStatus - { - /// - /// Initializes a new instance of the OperationStatus class. - /// - public OperationStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatus class. - /// - /// The operation Id. - /// Status of the pending operation - /// Status Detail of the pending - /// operation - public OperationStatus(string id = default(string), string status = default(string), string statusDetail = default(string)) - { - Id = id; - Status = status; - StatusDetail = statusDetail; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the operation Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets or sets status of the pending operation - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets status Detail of the pending operation - /// - [JsonProperty(PropertyName = "statusDetail")] - public string StatusDetail { get; set; } - - } -} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs index 5cf71f943c91..02fb87d8c3d0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs @@ -38,10 +38,10 @@ public PaymentMethod() /// Payment method type. Possible /// values include: 'Credits', 'ChequeWire' /// Details about the payment method. - /// Expiration date. + /// Expiration month and year. /// The currency associated with the payment /// method. - public PaymentMethod(string id = default(string), string name = default(string), string type = default(string), string paymentMethodType = default(string), string details = default(string), System.DateTime? expiration = default(System.DateTime?), string currency = default(string)) + public PaymentMethod(string id = default(string), string name = default(string), string type = default(string), string paymentMethodType = default(string), string details = default(string), string expiration = default(string), string currency = default(string)) : base(id, name, type) { PaymentMethodType = paymentMethodType; @@ -70,10 +70,10 @@ public PaymentMethod() public string Details { get; private set; } /// - /// Gets expiration date. + /// Gets expiration month and year. /// [JsonProperty(PropertyName = "properties.expiration")] - public System.DateTime? Expiration { get; private set; } + public string Expiration { get; private set; } /// /// Gets the currency associated with the payment method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs index 1e3f633436fe..85de382160ac 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs @@ -35,18 +35,20 @@ public Policy() /// Resource Id. /// Resource name. /// Resource type. - /// The - /// marketplacePurchasesAllowed flag. - /// The - /// reservationPurchasesAllowed flag. - /// The - /// subscriptionOwnerCanViewCharges flag. - public Policy(string id = default(string), string name = default(string), string type = default(string), bool? marketplacePurchasesAllowed = default(bool?), bool? reservationPurchasesAllowed = default(bool?), bool? subscriptionOwnerCanViewCharges = default(bool?)) + /// The marketplace purchases are + /// free, allowed or not allowed. Possible values include: + /// 'AllAllowed', 'FreeAllowed', 'NotAllowed' + /// The reservation purchases + /// allowed or not. Possible values include: 'Allowed', + /// 'NotAllowed' + /// Who can view charges. Possible values + /// include: 'None', 'SubscriptionOwner' + public Policy(string id = default(string), string name = default(string), string type = default(string), string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) : base(id, name, type) { - MarketplacePurchasesAllowed = marketplacePurchasesAllowed; - ReservationPurchasesAllowed = reservationPurchasesAllowed; - SubscriptionOwnerCanViewCharges = subscriptionOwnerCanViewCharges; + MarketplacePurchases = marketplacePurchases; + ReservationPurchases = reservationPurchases; + ViewCharges = viewCharges; CustomInit(); } @@ -56,22 +58,26 @@ public Policy() partial void CustomInit(); /// - /// Gets or sets the marketplacePurchasesAllowed flag. + /// Gets or sets the marketplace purchases are free, allowed or not + /// allowed. Possible values include: 'AllAllowed', 'FreeAllowed', + /// 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.marketplacePurchasesAllowed")] - public bool? MarketplacePurchasesAllowed { get; set; } + [JsonProperty(PropertyName = "properties.marketplacePurchases")] + public string MarketplacePurchases { get; set; } /// - /// Gets or sets the reservationPurchasesAllowed flag. + /// Gets or sets the reservation purchases allowed or not. Possible + /// values include: 'Allowed', 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.reservationPurchasesAllowed")] - public bool? ReservationPurchasesAllowed { get; set; } + [JsonProperty(PropertyName = "properties.reservationPurchases")] + public string ReservationPurchases { get; set; } /// - /// Gets or sets the subscriptionOwnerCanViewCharges flag. + /// Gets or sets who can view charges. Possible values include: 'None', + /// 'SubscriptionOwner' /// - [JsonProperty(PropertyName = "properties.subscriptionOwnerCanViewCharges")] - public bool? SubscriptionOwnerCanViewCharges { get; set; } + [JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs new file mode 100644 index 000000000000..47a7dd2a5b11 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs @@ -0,0 +1,74 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for DownloadByBillingProfile operation. + /// + public partial class PriceSheetDownloadByBillingProfileHeaders + { + /// + /// Initializes a new instance of the + /// PriceSheetDownloadByBillingProfileHeaders class. + /// + public PriceSheetDownloadByBillingProfileHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PriceSheetDownloadByBillingProfileHeaders 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. + /// The operation entity Id GUID. + public PriceSheetDownloadByBillingProfileHeaders(string location = default(string), string retryAfter = default(string), string oDataEntityId = default(string)) + { + Location = location; + RetryAfter = retryAfter; + ODataEntityId = oDataEntityId; + 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 string RetryAfter { get; set; } + + /// + /// Gets or sets the operation entity Id GUID. + /// + [JsonProperty(PropertyName = "OData-EntityId")] + public string ODataEntityId { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs index d01435a680a8..29f758def14c 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs @@ -34,15 +34,11 @@ public PriceSheetDownloadHeaders() /// The amount of delay to use while the /// status of the operation is checked. The value is expressed in /// seconds. - /// To get the progress of the - /// operation, call GET operation on the URL in Azure-AsyncOperation - /// header field. /// The operation entity Id GUID. - public PriceSheetDownloadHeaders(string location = default(string), string retryAfter = default(string), string azureAsyncOperation = default(string), string oDataEntityId = default(string)) + public PriceSheetDownloadHeaders(string location = default(string), string retryAfter = default(string), string oDataEntityId = default(string)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; ODataEntityId = oDataEntityId; CustomInit(); } @@ -66,13 +62,6 @@ public PriceSheetDownloadHeaders() [JsonProperty(PropertyName = "Retry-After")] public string RetryAfter { get; set; } - /// - /// Gets or sets to get the progress of the operation, call GET - /// operation on the URL in Azure-AsyncOperation header field. - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - /// /// Gets or sets the operation entity Id GUID. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs similarity index 68% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs index 7b824db3a0c1..8303f5c9e9a6 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A product summary resource. + /// A product resource. /// [Rest.Serialization.JsonTransformation] - public partial class ProductSummary : Resource + public partial class Product : Resource { /// - /// Initializes a new instance of the ProductSummary class. + /// Initializes a new instance of the Product class. /// - public ProductSummary() + public Product() { CustomInit(); } /// - /// Initializes a new instance of the ProductSummary class. + /// Initializes a new instance of the Product class. /// /// Resource Id. /// Resource name. @@ -54,13 +54,18 @@ public ProductSummary() /// Parent Product Id. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. - public ProductSummary(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string availabilityId = default(string), string parentProductId = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string billingProfileId = default(string), string billingProfileName = default(string)) + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. + /// Reseller for this product. + public Product(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string availabilityId = default(string), string parentProductId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), Reseller reseller = default(Reseller)) : base(id, name, type) { DisplayName = displayName; @@ -78,9 +83,12 @@ public ProductSummary() AvailabilityId = availabilityId; ParentProductId = parentProductId; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; + Reseller = reseller; CustomInit(); } @@ -183,10 +191,10 @@ public ProductSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets billing Profile id to which this product belongs. @@ -195,10 +203,28 @@ public ProductSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } + + /// + /// Gets reseller for this product. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs new file mode 100644 index 000000000000..b2aa3eff7e27 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ProductTransferValidationErrorCode. + /// + public static class ProductTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string ProductNotActive = "ProductNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string ProductTypeNotSupported = "ProductTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + public const string OneTimePurchaseProductTransferNotAllowed = "OneTimePurchaseProductTransferNotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs index f32c04aec14b..90a6ed7c54f0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs @@ -16,8 +16,8 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing products summary. It contains a list of available - /// products summaries in reverse chronological order by purchase date. + /// Result of listing products. It contains a list of available products + /// summaries in reverse chronological order by purchase date. /// public partial class ProductsListResult { @@ -32,10 +32,10 @@ public ProductsListResult() /// /// Initializes a new instance of the ProductsListResult class. /// - /// The list of products summary. + /// The list of products. /// The link (url) to the next page of /// results. - public ProductsListResult(IList value = default(IList), string nextLink = default(string)) + public ProductsListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -48,10 +48,10 @@ public ProductsListResult() partial void CustomInit(); /// - /// Gets the list of products summary. + /// Gets the list of products. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs index d0cadf2b0d55..2440f6d2f2f0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs @@ -32,13 +32,10 @@ public ProductsTransferHeaders() /// Location URI to poll for result /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public ProductsTransferHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public ProductsTransferHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -59,11 +56,5 @@ public ProductsTransferHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs index a451ae984fb1..c4dddcb9ca96 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs @@ -45,13 +45,17 @@ public RecipientTransferDetails() /// transfer. /// Email Id of initiator of /// transfer. + /// Reseller Id for transfer. + /// Reseller name for transfer. + /// Customer type of the + /// initiator. /// Email Id who user canceled the /// transfer. /// Transfer last modification /// time. /// Detailed transfer /// status. - public RecipientTransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), IList allowedProductType = default(IList), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) + public RecipientTransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), IList allowedProductType = default(IList), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string resellerId = default(string), string resellerName = default(string), string initiatorCustomerType = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) { CreationTime = creationTime; ExpirationTime = expirationTime; @@ -59,6 +63,9 @@ public RecipientTransferDetails() TransferStatus = transferStatus; RecipientEmailId = recipientEmailId; InitiatorEmailId = initiatorEmailId; + ResellerId = resellerId; + ResellerName = resellerName; + InitiatorCustomerType = initiatorCustomerType; CanceledBy = canceledBy; LastModifiedTime = lastModifiedTime; DetailedTransferStatus = detailedTransferStatus; @@ -108,6 +115,24 @@ public RecipientTransferDetails() [JsonProperty(PropertyName = "properties.initiatorEmailId")] public string InitiatorEmailId { get; private set; } + /// + /// Gets reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets reseller name for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerName")] + public string ResellerName { get; private set; } + + /// + /// Gets customer type of the initiator. + /// + [JsonProperty(PropertyName = "properties.initiatorCustomerType")] + public string InitiatorCustomerType { get; private set; } + /// /// Gets email Id who user canceled the transfer. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.cs new file mode 100644 index 000000000000..5efc6c6fcde2 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details about a reseller. + /// + public partial class Reseller + { + /// + /// Initializes a new instance of the Reseller class. + /// + public Reseller() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Reseller class. + /// + /// The reseller id. + /// A description of the reseller. + public Reseller(string resellerId = default(string), string description = default(string)) + { + ResellerId = resellerId; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reseller id. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets a description of the reseller. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.cs new file mode 100644 index 000000000000..a41293d8b273 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.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.Billing.Models +{ + + /// + /// Defines values for ReservationPurchasesPolicy. + /// + public static class ReservationPurchasesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.cs new file mode 100644 index 000000000000..c0910b803733 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.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.Billing.Models +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs new file mode 100644 index 000000000000..128d487ef129 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs @@ -0,0 +1,28 @@ +// +// 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.Billing.Models +{ + + /// + /// Defines values for SubscriptionTransferValidationErrorCode. + /// + public static class SubscriptionTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string SubscriptionNotActive = "SubscriptionNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string SubscriptionTypeNotSupported = "SubscriptionTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs similarity index 70% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs index 97e3617a5a09..41adddc53bee 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A reservation transaction summary resource. + /// A reservation transaction resource. /// [Rest.Serialization.JsonTransformation] - public partial class TransactionsSummary : Resource + public partial class Transaction : Resource { /// - /// Initializes a new instance of the TransactionsSummary class. + /// Initializes a new instance of the Transaction class. /// - public TransactionsSummary() + public Transaction() { CustomInit(); } /// - /// Initializes a new instance of the TransactionsSummary class. + /// Initializes a new instance of the Transaction class. /// /// Resource Id. /// Resource name. @@ -53,15 +53,19 @@ public TransactionsSummary() /// Purchase quantity. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. /// The subscription id. /// The subscription name. - public TransactionsSummary(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string billingProfileId = default(string), string billingProfileName = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) + public Transaction(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) : base(id, name, type) { Kind = kind; @@ -77,9 +81,11 @@ public TransactionsSummary() TransactionAmount = transactionAmount; Quantity = quantity; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; SubscriptionId = subscriptionId; SubscriptionName = subscriptionName; CustomInit(); @@ -171,10 +177,10 @@ public TransactionsSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets billing Profile id to which this product belongs. @@ -183,10 +189,22 @@ public TransactionsSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } /// /// Gets the subscription id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs similarity index 70% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs index 0698ce1fb2e6..b38f7aa05616 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs @@ -16,26 +16,25 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing reservation transactions summary. + /// Result of listing reservation transactions. /// - public partial class TransactionsListResult + public partial class TransactionListResult { /// - /// Initializes a new instance of the TransactionsListResult class. + /// Initializes a new instance of the TransactionListResult class. /// - public TransactionsListResult() + public TransactionListResult() { CustomInit(); } /// - /// Initializes a new instance of the TransactionsListResult class. + /// Initializes a new instance of the TransactionListResult class. /// - /// The list of reservation transactions - /// summary. + /// The list of reservation transactions. /// The link (url) to the next page of /// results. - public TransactionsListResult(IList value = default(IList), string nextLink = default(string)) + public TransactionListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -48,10 +47,10 @@ public TransactionsListResult() partial void CustomInit(); /// - /// Gets the list of reservation transactions summary. + /// Gets the list of reservation transactions. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs index 73356f7165b6..caee5a03f332 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs @@ -36,9 +36,12 @@ public TransferBillingSubscriptionRequest() /// /// The destination invoice /// section id. - public TransferBillingSubscriptionRequest(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferBillingSubscriptionRequest(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -53,5 +56,11 @@ public TransferBillingSubscriptionRequest() [JsonProperty(PropertyName = "properties.destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "properties.destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs index 1de9174f58fd..c441d309ce65 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs @@ -33,9 +33,12 @@ public TransferBillingSubscriptionRequestProperties() /// /// The destination invoice /// section id. - public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -50,5 +53,11 @@ public TransferBillingSubscriptionRequestProperties() [JsonProperty(PropertyName = "destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs index ea1d76fa501e..293d805691c8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs @@ -38,6 +38,11 @@ public TransferDetails() /// Transfer expiration time. /// Target invoice section Id. /// Target billing account Id. + /// Reseller Id for transfer. + /// Reseller name for transfer. + /// Customer type of the + /// initiator. + /// Target billing profile Id. /// Overall transfer status. Possible /// values include: 'Pending', 'InProgress', 'Completed', /// 'CompletedWithErrors', 'Failed', 'Canceled', 'Declined' @@ -51,12 +56,16 @@ public TransferDetails() /// time. /// Detailed transfer /// status. - public TransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), string invoiceSectionId = default(string), string billingAccountId = default(string), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) + public TransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), string invoiceSectionId = default(string), string billingAccountId = default(string), string resellerId = default(string), string resellerName = default(string), string initiatorCustomerType = default(string), string billingProfileId = default(string), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) { CreationTime = creationTime; ExpirationTime = expirationTime; InvoiceSectionId = invoiceSectionId; BillingAccountId = billingAccountId; + ResellerId = resellerId; + ResellerName = resellerName; + InitiatorCustomerType = initiatorCustomerType; + BillingProfileId = billingProfileId; TransferStatus = transferStatus; RecipientEmailId = recipientEmailId; InitiatorEmailId = initiatorEmailId; @@ -95,6 +104,30 @@ public TransferDetails() [JsonProperty(PropertyName = "properties.billingAccountId")] public string BillingAccountId { get; private set; } + /// + /// Gets reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets reseller name for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerName")] + public string ResellerName { get; private set; } + + /// + /// Gets customer type of the initiator. + /// + [JsonProperty(PropertyName = "properties.initiatorCustomerType")] + public string InitiatorCustomerType { get; private set; } + + /// + /// Gets target billing profile Id. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + /// /// Gets overall transfer status. Possible values include: 'Pending', /// 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs index dab785ca787c..76f21e33a9eb 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs @@ -31,11 +31,14 @@ public TransferProductRequestProperties() /// Initializes a new instance of the TransferProductRequestProperties /// class. /// - /// Destination invoice + /// The destination invoice /// section id. - public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -45,10 +48,16 @@ public TransferProductRequestProperties() partial void CustomInit(); /// - /// Gets or sets destination invoice section id. + /// Gets or sets the destination invoice section id. /// [JsonProperty(PropertyName = "destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs similarity index 84% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs index 7df5ea8e5aca..d30e817542b0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs @@ -19,23 +19,21 @@ namespace Microsoft.Azure.Management.Billing.Models /// Summary of cancel product operation /// [Rest.Serialization.JsonTransformation] - public partial class UpdateAutoRenewOperationSummary + public partial class UpdateAutoRenewOperation { /// - /// Initializes a new instance of the UpdateAutoRenewOperationSummary - /// class. + /// Initializes a new instance of the UpdateAutoRenewOperation class. /// - public UpdateAutoRenewOperationSummary() + public UpdateAutoRenewOperation() { CustomInit(); } /// - /// Initializes a new instance of the UpdateAutoRenewOperationSummary - /// class. + /// Initializes a new instance of the UpdateAutoRenewOperation class. /// /// The end date of this asset - public UpdateAutoRenewOperationSummary(System.DateTime? endDate = default(System.DateTime?)) + public UpdateAutoRenewOperation(System.DateTime? endDate = default(System.DateTime?)) { EndDate = endDate; CustomInit(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs new file mode 100644 index 000000000000..076c6728e33d --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs @@ -0,0 +1,72 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the address validation + /// + public partial class ValidateAddressResponse + { + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + public ValidateAddressResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + /// status of the address validation. Possible + /// values include: 'Valid', 'Invalid' + /// list of suggested + /// addresses. + /// Validation error message. + public ValidateAddressResponse(string status = default(string), IList suggestedAddresses = default(IList), string validationMessage = default(string)) + { + Status = status; + SuggestedAddresses = suggestedAddresses; + ValidationMessage = validationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the address validation. Possible values + /// include: 'Valid', 'Invalid' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets list of suggested addresses. + /// + [JsonProperty(PropertyName = "suggestedAddresses")] + public IList SuggestedAddresses { get; set; } + + /// + /// Gets or sets validation error message. + /// + [JsonProperty(PropertyName = "validationMessage")] + public string ValidationMessage { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.cs new file mode 100644 index 000000000000..6d06b5bcc559 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + public ValidateProductTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateProductTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.cs new file mode 100644 index 000000000000..20546dd70c0f --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + public ValidateProductTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + /// Specifies whether the transfer is + /// eligible or not. + /// Validation error details. + public ValidateProductTransferEligibilityResult(bool? isTransferEligible = default(bool?), ValidateProductTransferEligibilityError errorDetails = default(ValidateProductTransferEligibilityError)) + { + IsTransferEligible = isTransferEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [JsonProperty(PropertyName = "isTransferEligible")] + public bool? IsTransferEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateProductTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs new file mode 100644 index 000000000000..93b4696ea517 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the transfer eligibility validation + /// + public partial class ValidateSubscriptionTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + public ValidateSubscriptionTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateSubscriptionTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs new file mode 100644 index 000000000000..d467475793ba --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the transfer eligibility validation. + /// + public partial class ValidateSubscriptionTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + public ValidateSubscriptionTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + /// Specifies whether the transfer is + /// eligible or not. + /// Validation error details. + public ValidateSubscriptionTransferEligibilityResult(bool? isTransferEligible = default(bool?), ValidateSubscriptionTransferEligibilityError errorDetails = default(ValidateSubscriptionTransferEligibilityError)) + { + IsTransferEligible = isTransferEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [JsonProperty(PropertyName = "isTransferEligible")] + public bool? IsTransferEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateSubscriptionTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferListResponse.cs similarity index 55% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferListResponse.cs index 2f7b3ae2ade9..3315764c903f 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferListResponse.cs @@ -8,7 +8,7 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Billing.Models { using Newtonsoft.Json; using System.Collections; @@ -16,25 +16,27 @@ namespace Microsoft.Azure.ApplicationInsights.Query.Models using System.Linq; /// - /// An event query result. + /// Result of transfer validation. /// - public partial class EventsResult + public partial class ValidateTransferListResponse { /// - /// Initializes a new instance of the EventsResult class. + /// Initializes a new instance of the ValidateTransferListResponse + /// class. /// - public EventsResult() + public ValidateTransferListResponse() { CustomInit(); } /// - /// Initializes a new instance of the EventsResult class. + /// Initializes a new instance of the ValidateTransferListResponse + /// class. /// - /// OData messages for this response. - public EventsResult(IList aimessages = default(IList), EventsResultData value = default(EventsResultData)) + /// The list of transfer validation + /// results. + public ValidateTransferListResponse(IList value = default(IList)) { - Aimessages = aimessages; Value = value; CustomInit(); } @@ -45,15 +47,10 @@ public EventsResult() partial void CustomInit(); /// - /// Gets or sets oData messages for this response. - /// - [JsonProperty(PropertyName = "@ai.messages")] - public IList Aimessages { get; set; } - - /// + /// Gets the list of transfer validation results. /// [JsonProperty(PropertyName = "value")] - public EventsResultData Value { get; set; } + public IList Value { get; private set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferResponse.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferResponse.cs new file mode 100644 index 000000000000..e5ff705c05b1 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateTransferResponse.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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Transfer validation response. + /// + [Rest.Serialization.JsonTransformation] + public partial class ValidateTransferResponse + { + /// + /// Initializes a new instance of the ValidateTransferResponse class. + /// + public ValidateTransferResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateTransferResponse class. + /// + /// The status of validation + /// The product id for which this result + /// applies. + /// Array of validation results. + public ValidateTransferResponse(string status = default(string), string productId = default(string), IList results = default(IList)) + { + Status = status; + ProductId = productId; + Results = results; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status of validation + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the product id for which this result applies. + /// + [JsonProperty(PropertyName = "properties.productId")] + public string ProductId { get; private set; } + + /// + /// Gets or sets array of validation results. + /// + [JsonProperty(PropertyName = "properties.results")] + public IList Results { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidationResultProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidationResultProperties.cs new file mode 100644 index 000000000000..5f59a5f39c39 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidationResultProperties.cs @@ -0,0 +1,67 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the validation result. + /// + public partial class ValidationResultProperties + { + /// + /// Initializes a new instance of the ValidationResultProperties class. + /// + public ValidationResultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidationResultProperties class. + /// + /// Result Level. + /// Result Code. + /// The validation message. + public ValidationResultProperties(string level = default(string), string code = default(string), string message = default(string)) + { + Level = level; + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets result Level. + /// + [JsonProperty(PropertyName = "level")] + public string Level { get; private set; } + + /// + /// Gets result Code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the validation message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.cs new file mode 100644 index 000000000000..7b579b67e345 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.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.Billing.Models +{ + + /// + /// Defines values for ViewChargesPolicy. + /// + public static class ViewChargesPolicy + { + public const string None = "None"; + public const string SubscriptionOwner = "SubscriptionOwner"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs similarity index 66% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs index 74ceeca5567c..84085899e0d6 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs @@ -8,14 +8,14 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.Billing { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -23,12 +23,12 @@ namespace Microsoft.Azure.ApplicationInsights.Query using System.Threading.Tasks; /// - /// Metrics operations. + /// PartnerTransfersOperations operations. /// - public partial class Metrics : IServiceOperations, IMetrics + internal partial class PartnerTransfersOperations : IServiceOperations, IPartnerTransfersOperations { /// - /// Initializes a new instance of the Metrics class. + /// Initializes a new instance of the PartnerTransfersOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ public partial class Metrics : IServiceOperations /// /// Thrown when a required parameter is null /// - public Metrics(ApplicationInsightsDataClient client) + internal PartnerTransfersOperations(BillingManagementClient client) { if (client == null) { @@ -46,82 +46,24 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Gets a reference to the ApplicationInsightsDataClient + /// Gets a reference to the BillingManagementClient /// - public ApplicationInsightsDataClient Client { get; private set; } + public BillingManagementClient Client { get; private set; } /// - /// Retrieve metric data + /// Initiates the request to transfer the legacy subscriptions or RIs. /// - /// - /// Gets metric values for a single metric - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// billing Account Id. /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' + /// + /// Billing Profile Id. /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. + /// + /// Customer name. /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. + /// + /// Parameters supplied to initiate the transfer. /// /// /// Headers that will be added to request. @@ -144,29 +86,23 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (metricId == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "metricId"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - if (aggregation != null) + if (customerName == null) { - if (aggregation.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "aggregation", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); } - if (segment != null) + if (parameters == null) { - if (segment.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "segment", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -175,62 +111,42 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("metricId", metricId); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("interval", interval); - tracingParameters.Add("aggregation", aggregation); - tracingParameters.Add("segment", segment); - tracingParameters.Add("top", top); - tracingParameters.Add("orderby", orderby); - tracingParameters.Add("filter", filter); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Initiate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics/{metricId}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{metricId}", System.Uri.EscapeDataString(metricId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/initiateTransfer").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (interval != null) - { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - } - if (aggregation != null) - { - _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(string.Join(",", aggregation)))); - } - if (segment != null) - { - _queryParameters.Add(string.Format("segment={0}", System.Uri.EscapeDataString(string.Join(",", segment)))); - } - if (top != null) - { - _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (orderby != null) - { - _queryParameters.Add(string.Format("orderby={0}", System.Uri.EscapeDataString(orderby))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("filter={0}", System.Uri.EscapeDataString(filter))); - } if (_queryParameters.Count > 0) { - _url += "?" + string.Join("&", _queryParameters); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _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) @@ -247,6 +163,12 @@ public Metrics(ApplicationInsightsDataClient client) // 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) { @@ -297,16 +219,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -326,17 +252,19 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Retrieve metric data + /// Gets the transfer details for given transfer Id. /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// - /// - /// The batched metrics query. + /// + /// Customer name. + /// + /// + /// Transfer Name. /// /// /// Headers that will be added to request. @@ -359,25 +287,23 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetMultipleWithHttpMessagesAsync(string appId, IList body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (body == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - if (body != null) + if (customerName == null) { - foreach (var element in body) - { - if (element != null) - { - element.Validate(); - } - } + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (transferName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -386,21 +312,43 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("body", body); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMultiple", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); + 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("POST"); + _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) @@ -417,12 +365,6 @@ public Metrics(ApplicationInsightsDataClient client) // 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) { @@ -473,16 +415,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -502,14 +448,19 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Retrieve metric metatadata + /// Cancels the transfer for given transfer Id. /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. /// /// /// Headers that will be added to request. @@ -532,11 +483,23 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (transferName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -545,20 +508,43 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMetadata", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics/metadata").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); + 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.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) @@ -625,16 +611,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs new file mode 100644 index 000000000000..8860052a15e9 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs @@ -0,0 +1,181 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PartnerTransfersOperations. + /// + public static partial class PartnerTransfersOperationsExtensions + { + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + public static TransferDetails Initiate(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters) + { + return operations.InitiateAsync(billingAccountName, billingProfileName, customerName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + /// + /// The cancellation token. + /// + public static async Task InitiateAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + public static TransferDetails Get(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName) + { + return operations.GetAsync(billingAccountName, billingProfileName, customerName, transferName).GetAwaiter().GetResult(); + } + + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, transferName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + public static TransferDetails Cancel(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName) + { + return operations.CancelAsync(billingAccountName, billingProfileName, customerName, transferName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, transferName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs new file mode 100644 index 000000000000..76b9b237a451 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs @@ -0,0 +1,409 @@ +// +// 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.Billing +{ + 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; + + /// + /// PartnerTransfersTransfersOperations operations. + /// + internal partial class PartnerTransfersTransfersOperations : IServiceOperations, IPartnerTransfersTransfersOperations + { + /// + /// Initializes a new instance of the PartnerTransfersTransfersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PartnerTransfersTransfersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer 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>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, 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 (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // 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("customerName", customerName); + 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.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + 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 transfer's details initiated from given invoice section. + /// + /// + /// 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/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.cs new file mode 100644 index 000000000000..92744de0099d --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PartnerTransfersTransfersOperations. + /// + public static partial class PartnerTransfersTransfersOperationsExtensions + { + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + public static IPage List(this IPartnerTransfersTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName) + { + return operations.ListAsync(billingAccountName, billingProfileName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPartnerTransfersTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPartnerTransfersTransfersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// 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 IPartnerTransfersTransfersOperations 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/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs index 374230e3d8d2..e624b752ef7a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs @@ -52,7 +52,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// billing Account Id. @@ -78,7 +78,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -97,7 +97,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -230,7 +230,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// billing Account Id. @@ -259,7 +259,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -283,7 +283,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -417,7 +417,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -443,7 +443,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -458,7 +458,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -586,7 +586,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -612,7 +612,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -627,7 +627,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs index f68d86f732f4..8f13960e5ac3 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class PaymentMethodsOperationsExtensions { /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -31,14 +31,14 @@ public static partial class PaymentMethodsOperationsExtensions /// /// billing Account Id. /// - public static IPage ListByBillingAccountName(this IPaymentMethodsOperations operations, string billingAccountName) + public static IPage ListByBillingAccount(this IPaymentMethodsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -49,9 +49,9 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IPaymentMethodsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this IPaymentMethodsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -59,7 +59,7 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -70,14 +70,14 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// Billing Profile Id. /// - public static IPage ListByBillingProfileName(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName) + public static IPage ListByBillingProfile(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -91,9 +91,9 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// The cancellation token. /// - public static async Task> ListByBillingProfileNameAsync(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingProfileAsync(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -101,7 +101,7 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -109,14 +109,14 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IPaymentMethodsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this IPaymentMethodsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -127,9 +127,9 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -137,7 +137,7 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -145,14 +145,14 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingProfileNameNext(this IPaymentMethodsOperations operations, string nextPageLink) + public static IPage ListByBillingProfileNext(this IPaymentMethodsOperations operations, string nextPageLink) { - return operations.ListByBillingProfileNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -163,9 +163,9 @@ public static IPage ListByBillingProfileNameNext(this IPaymentMet /// /// The cancellation token. /// - public static async Task> ListByBillingProfileNameNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingProfileNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs index 0e0efa6ab96f..85836ea30bec 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs @@ -52,7 +52,7 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// billing Account Id. @@ -81,7 +81,7 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -105,7 +105,7 @@ internal PoliciesOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs index 15938b36e44c..7ac8cdb86572 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class PoliciesOperationsExtensions { /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -34,14 +34,14 @@ public static partial class PoliciesOperationsExtensions /// /// Billing Profile Id. /// - public static Policy GetByBillingProfileName(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) + public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -55,9 +55,9 @@ public static Policy GetByBillingProfileName(this IPoliciesOperations operations /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs index 1169c16a7a45..73c97053b8c6 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs @@ -54,10 +54,35 @@ internal PriceSheetOperations(BillingManagementClient client) /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -65,10 +90,10 @@ internal PriceSheetOperations(BillingManagementClient client) /// /// The cancellation token. /// - public async Task> DownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(billingAccountName, invoiceName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -76,10 +101,13 @@ internal PriceSheetOperations(BillingManagementClient client) /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// /// /// Headers that will be added to request. @@ -102,7 +130,7 @@ internal PriceSheetOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -112,6 +140,10 @@ internal PriceSheetOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); @@ -124,14 +156,16 @@ internal PriceSheetOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceName", invoiceName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDownload", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/pricesheet/default/download").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -271,5 +305,204 @@ internal PriceSheetOperations(BillingManagementClient client) return _result; } + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// 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> BeginDownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadByBillingProfile", 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}/pricesheet/default/download").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + 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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new 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; + } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs index 44adaa29634e..a1be5f407ad0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs @@ -28,14 +28,17 @@ public static partial class PriceSheetOperationsExtensions /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// - public static DownloadUrl Download(this IPriceSheetOperations operations, string billingAccountName, string invoiceName) + public static DownloadUrl Download(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { - return operations.DownloadAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + return operations.DownloadAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } /// @@ -45,17 +48,60 @@ public static DownloadUrl Download(this IPriceSheetOperations operations, string /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + public static DownloadUrl DownloadByBillingProfile(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName) + { + return operations.DownloadByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task DownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DownloadByBillingProfileAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DownloadWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -68,14 +114,17 @@ public static DownloadUrl Download(this IPriceSheetOperations operations, string /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// - public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, string billingAccountName, string invoiceName) + public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { - return operations.BeginDownloadAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + return operations.BeginDownloadAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } /// @@ -85,17 +134,60 @@ public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, s /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + public static DownloadUrl BeginDownloadByBillingProfile(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName) + { + return operations.BeginDownloadByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task BeginDownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDownloadByBillingProfileAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginDownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs index f6745ea37bcc..7ad32db0d2a8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs @@ -50,9 +50,403 @@ internal ProductsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists products by customer id. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string filter = default(string), 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 (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("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", 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}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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; + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + /// + /// 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string productName, 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 (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", 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}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + 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 products by billing account name. - /// + /// /// /// /// billing Account Id. @@ -84,7 +478,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -104,7 +498,7 @@ internal ProductsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -207,7 +601,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -220,7 +614,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -241,11 +635,14 @@ internal ProductsOperations(BillingManagementClient client) /// /// Lists products by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -276,12 +673,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), 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"); @@ -298,15 +699,17 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", 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}/products").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products").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 (Client.ApiVersion != null) @@ -439,11 +842,14 @@ internal ProductsOperations(BillingManagementClient client) /// /// Get a single product by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -471,12 +877,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, 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"); @@ -497,6 +907,7 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -504,8 +915,9 @@ internal ProductsOperations(BillingManagementClient client) } // 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}/products/{productName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}").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)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -601,7 +1013,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -614,7 +1026,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -639,6 +1051,9 @@ internal ProductsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -669,12 +1084,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, 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"); @@ -699,6 +1118,7 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("parameters", parameters); @@ -707,8 +1127,9 @@ internal ProductsOperations(BillingManagementClient client) } // 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}/products/{productName}/transfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer").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)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -810,7 +1231,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -823,7 +1244,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -856,16 +1277,22 @@ internal ProductsOperations(BillingManagementClient client) } /// - /// Cancel auto renew for product by product id and billing account name + /// Validates the transfer of products across invoice sections. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// /// Invoice Id. /// - /// - /// Update auto renew request parameters. + /// + /// Parameters supplied to the Transfer Products operation. /// /// /// Headers that will be added to request. @@ -888,23 +1315,27 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (productName == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - if (Client.ApiVersion == null) + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - if (body == null) + if (productName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -914,21 +1345,21 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); - tracingParameters.Add("body", body); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ValidateTransfer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility").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)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); 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); @@ -967,9 +1398,9 @@ internal ProductsOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _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"); } @@ -1023,7 +1454,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1036,7 +1467,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1061,6 +1492,9 @@ internal ProductsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -1091,12 +1525,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest 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"); @@ -1121,16 +1559,18 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByInvoiceSection", 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}/products/{productName}/updateAutoRenew").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew").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)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -1232,7 +1672,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1245,7 +1685,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1266,7 +1706,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// Lists products by billing account name. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1292,7 +1732,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1307,7 +1747,7 @@ internal ProductsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1401,7 +1841,7 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1414,7 +1854,7 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs index d8574bf10be0..d01234b0c380 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs @@ -21,9 +21,111 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class ProductsOperationsExtensions { + /// + /// Lists products by customer id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + public static ProductsListResult ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName, string filter = default(string)) + { + return operations.ListByCustomerAsync(billingAccountName, customerName, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists products by customer id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async Task ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + public static Product GetByCustomer(this IProductsOperations operations, string billingAccountName, string customerName, string productName) + { + return operations.GetByCustomerAsync(billingAccountName, customerName, productName).GetAwaiter().GetResult(); + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task GetByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, productName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -37,14 +139,14 @@ public static partial class ProductsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static IPage ListByBillingAccountName(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + public static IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, filter).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); } /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -61,9 +163,9 @@ public static partial class ProductsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -71,7 +173,7 @@ public static partial class ProductsOperationsExtensions /// /// Lists products by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -79,6 +181,9 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -88,14 +193,14 @@ public static partial class ProductsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static ProductsListResult ListByInvoiceSectionName(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string filter = default(string)) + public static ProductsListResult ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, filter).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); } /// /// Lists products by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -103,6 +208,9 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -115,9 +223,9 @@ public static partial class ProductsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -125,7 +233,7 @@ public static partial class ProductsOperationsExtensions /// /// Get a single product by name. - /// + /// /// /// /// The operations group for this extension method. @@ -133,20 +241,23 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Invoice Id. /// - public static ProductSummary Get(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName) + public static Product Get(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, productName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).GetAwaiter().GetResult(); } /// /// Get a single product by name. - /// + /// /// /// /// The operations group for this extension method. @@ -154,6 +265,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -163,9 +277,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// The cancellation token. /// - public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,6 +294,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -189,9 +306,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// Parameters supplied to the Transfer Product operation. /// - public static ProductSummary Transfer(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) + public static Product Transfer(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) { - return operations.TransferAsync(billingAccountName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); + return operations.TransferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); } /// @@ -203,6 +320,9 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -215,16 +335,16 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// The cancellation token. /// - public static async Task TransferAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task TransferAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Cancel auto renew for product by product id and billing account name + /// Validates the transfer of products across invoice sections. /// /// /// The operations group for this extension method. @@ -232,19 +352,25 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// /// Invoice Id. /// - /// - /// Update auto renew request parameters. + /// + /// Parameters supplied to the Transfer Products operation. /// - public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountName(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body) + public static ValidateProductTransferEligibilityResult ValidateTransfer(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) { - return operations.UpdateAutoRenewByBillingAccountNameAsync(billingAccountName, productName, body).GetAwaiter().GetResult(); + return operations.ValidateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); } /// - /// Cancel auto renew for product by product id and billing account name + /// Validates the transfer of products across invoice sections. /// /// /// The operations group for this extension method. @@ -252,18 +378,24 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// /// Invoice Id. /// - /// - /// Update auto renew request parameters. + /// + /// Parameters supplied to the Transfer Products operation. /// /// /// The cancellation token. /// - public static async Task UpdateAutoRenewByBillingAccountNameAsync(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidateTransferAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(billingAccountName, productName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -278,6 +410,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -287,9 +422,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// Update auto renew request parameters. /// - public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionName(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body) + public static UpdateAutoRenewOperation UpdateAutoRenewByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body) { - return operations.UpdateAutoRenewByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, productName, body).GetAwaiter().GetResult(); + return operations.UpdateAutoRenewByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, body).GetAwaiter().GetResult(); } /// @@ -301,6 +436,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -313,9 +451,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// The cancellation token. /// - public static async Task UpdateAutoRenewByInvoiceSectionNameAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAutoRenewByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -323,7 +461,7 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -331,14 +469,14 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IProductsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -349,9 +487,9 @@ public static IPage ListByBillingAccountNameNext(this IProductsO /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs index 379141cc8125..a37dd849bf00 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs @@ -56,8 +56,8 @@ internal RecipientTransfersOperations(BillingManagementClient client) /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// Headers that will be added to request. @@ -80,15 +80,15 @@ internal RecipientTransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (transferName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); } - if (body == null) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -98,7 +98,7 @@ internal RecipientTransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("transferName", transferName); - tracingParameters.Add("body", body); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Accept", tracingParameters); } @@ -145,9 +145,9 @@ internal RecipientTransfersOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _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"); } @@ -233,6 +233,190 @@ internal RecipientTransfersOperations(BillingManagementClient client) return _result; } + /// + /// Validates if the products can be transferred in the context of the given + /// transfer name. + /// + /// + /// Transfer Name. + /// + /// + /// Parameters supplied to validate the transfer. + /// + /// + /// 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> ValidateWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (transferName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("transferName", transferName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/transfers/{transferName}/validateTransfer").ToString(); + _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); + 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("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(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) + { + 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; + } + /// /// Declines the transfer with given transfer Id. /// @@ -448,7 +632,7 @@ internal RecipientTransfersOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/transfers/{transferName}/").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/transfers/{transferName}").ToString(); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); if (_queryParameters.Count > 0) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs index bd0c5678ac0a..f12f304aba5f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs @@ -30,12 +30,12 @@ public static partial class RecipientTransfersOperationsExtensions /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// - public static RecipientTransferDetails Accept(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest body) + public static RecipientTransferDetails Accept(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters) { - return operations.AcceptAsync(transferName, body).GetAwaiter().GetResult(); + return operations.AcceptAsync(transferName, parameters).GetAwaiter().GetResult(); } /// @@ -47,15 +47,57 @@ public static RecipientTransferDetails Accept(this IRecipientTransfersOperations /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// The cancellation token. /// - public static async Task AcceptAsync(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AcceptAsync(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AcceptWithHttpMessagesAsync(transferName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AcceptWithHttpMessagesAsync(transferName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates if the products can be transferred in the context of the given + /// transfer name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Transfer Name. + /// + /// + /// Parameters supplied to validate the transfer. + /// + public static ValidateTransferListResponse Validate(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters) + { + return operations.ValidateAsync(transferName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates if the products can be transferred in the context of the given + /// transfer name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Transfer Name. + /// + /// + /// Parameters supplied to validate the transfer. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateAsync(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(transferName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs index ea1bcebcf0bd..df921c36912f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs @@ -19,27 +19,32 @@ public static IEnumerable> ApiInfo_BillingManageme { return new Tuple[] { - new Tuple("Billing", "Agreements", "2018-11-01-preview"), - new Tuple("Billing", "AvailableBalances", "2018-11-01-preview"), - new Tuple("Billing", "BillingAccounts", "2018-11-01-preview"), - new Tuple("Billing", "BillingPermissions", "2018-11-01-preview"), - new Tuple("Billing", "BillingProfiles", "2018-11-01-preview"), - new Tuple("Billing", "BillingProperty", "2018-11-01-preview"), - new Tuple("Billing", "BillingRoleAssignments", "2018-11-01-preview"), - new Tuple("Billing", "BillingRoleDefinitions", "2018-11-01-preview"), - new Tuple("Billing", "BillingSubscriptions", "2018-11-01-preview"), - new Tuple("Billing", "Departments", "2018-11-01-preview"), - new Tuple("Billing", "EnrollmentAccounts", "2018-11-01-preview"), - new Tuple("Billing", "InvoiceSections", "2018-11-01-preview"), - new Tuple("Billing", "Invoices", "2018-11-01-preview"), - new Tuple("Billing", "Operations", "2018-11-01-preview"), - new Tuple("Billing", "PaymentMethods", "2018-11-01-preview"), - new Tuple("Billing", "Policies", "2018-11-01-preview"), - new Tuple("Billing", "PriceSheet", "2018-11-01-preview"), - new Tuple("Billing", "Products", "2018-11-01-preview"), - new Tuple("Billing", "RecipientTransfers", "2018-11-01-preview"), - new Tuple("Billing", "Transactions", "2018-11-01-preview"), - new Tuple("Billing", "Transfers", "2018-11-01-preview"), + new Tuple("Billing", "Address", "2019-10-01-preview"), + new Tuple("Billing", "Agreements", "2019-10-01-preview"), + new Tuple("Billing", "AvailableBalances", "2019-10-01-preview"), + new Tuple("Billing", "BillingAccounts", "2019-10-01-preview"), + new Tuple("Billing", "BillingPermissions", "2019-10-01-preview"), + new Tuple("Billing", "BillingProfiles", "2019-10-01-preview"), + new Tuple("Billing", "BillingProperty", "2019-10-01-preview"), + new Tuple("Billing", "BillingRoleAssignments", "2019-10-01-preview"), + new Tuple("Billing", "BillingRoleDefinitions", "2019-10-01-preview"), + new Tuple("Billing", "BillingSubscriptions", "2019-10-01-preview"), + new Tuple("Billing", "Customers", "2019-10-01-preview"), + new Tuple("Billing", "Departments", "2019-10-01-preview"), + new Tuple("Billing", "EnrollmentAccounts", "2019-10-01-preview"), + new Tuple("Billing", "InvoiceSections", "2019-10-01-preview"), + new Tuple("Billing", "Invoices", "2019-10-01-preview"), + new Tuple("Billing", "LineOfCredits", "2019-10-01-preview"), + new Tuple("Billing", "Operations", "2019-10-01-preview"), + new Tuple("Billing", "PartnerTransfers", "2019-10-01-preview"), + new Tuple("Billing", "PartnerTransfersTransfers", "2019-10-01-preview"), + new Tuple("Billing", "PaymentMethods", "2019-10-01-preview"), + new Tuple("Billing", "Policies", "2019-10-01-preview"), + new Tuple("Billing", "PriceSheet", "2019-10-01-preview"), + new Tuple("Billing", "Products", "2019-10-01-preview"), + new Tuple("Billing", "RecipientTransfers", "2019-10-01-preview"), + new Tuple("Billing", "Transactions", "2019-10-01-preview"), + new Tuple("Billing", "Transfers", "2019-10-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs index 15c25c43a851..af4f49332675 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs @@ -50,10 +50,232 @@ internal TransactionsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// 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>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (startDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "startDate"); + } + if (endDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endDate"); + } + // 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("startDate", startDate); + tracingParameters.Add("endDate", endDate); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", 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}/transactions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// billing Account Id. @@ -91,7 +313,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -121,7 +343,7 @@ internal TransactionsOperations(BillingManagementClient client) tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -232,7 +454,7 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -245,7 +467,7 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -267,7 +489,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// billing Account Id. @@ -308,7 +530,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -343,7 +565,7 @@ internal TransactionsOperations(BillingManagementClient client) tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -455,7 +677,7 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -468,7 +690,7 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -490,11 +712,14 @@ internal TransactionsOperations(BillingManagementClient client) /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -531,12 +756,16 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), 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"); @@ -561,17 +790,19 @@ internal TransactionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("startDate", startDate); tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", 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}/transactions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions").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 (Client.ApiVersion != null) @@ -678,7 +909,7 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -691,7 +922,7 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -711,9 +942,398 @@ internal TransactionsOperations(BillingManagementClient client) } /// - /// Lists the transactions by billing account name for given start and end - /// date. - /// + /// Get the transaction. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// 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 billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, 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 (transactionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transactionName"); + } + if (startDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "startDate"); + } + if (endDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endDate"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("transactionName", transactionName); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); + 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.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions/{transactionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{transactionName}", System.Uri.EscapeDataString(transactionName)); + List _queryParameters = new List(); + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } + 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 the transactions by customer id for given start date and end date. + /// + /// + /// + /// 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>> ListByCustomerNextWithHttpMessagesAsync(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, "ListByCustomerNext", 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 the transactions by billing account name for given start and end + /// date. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -739,7 +1359,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -754,7 +1374,7 @@ internal TransactionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -848,7 +1468,7 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -861,7 +1481,7 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs index b688c5fd9120..c94b794fd62b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs @@ -21,10 +21,76 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class TransactionsOperationsExtensions { + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + public static IPage ListByCustomer(this ITransactionsOperations operations, string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string)) + { + return operations.ListByCustomerAsync(billingAccountName, customerName, startDate, endDate, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerAsync(this ITransactionsOperations operations, string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -44,15 +110,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static IPage ListByBillingAccountName(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string)) + public static IPage ListByBillingAccount(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -75,9 +141,9 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -86,7 +152,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -109,15 +175,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static TransactionsListResult ListByBillingProfileName(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string)) + public static TransactionListResult ListByBillingProfile(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -143,9 +209,9 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -154,7 +220,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -162,6 +228,9 @@ public static partial class TransactionsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -177,15 +246,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static TransactionsListResult ListByInvoiceSectionName(this ITransactionsOperations operations, string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string)) + public static TransactionListResult ListByInvoiceSection(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -193,6 +262,9 @@ public static partial class TransactionsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -211,9 +283,105 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the transaction. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + public static Transaction Get(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate) + { + return operations.GetAsync(billingAccountName, billingProfileName, transactionName, startDate, endDate).GetAwaiter().GetResult(); + } + + /// + /// Get the transaction. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, transactionName, startDate, endDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCustomerNext(this ITransactionsOperations operations, string nextPageLink) + { + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -222,7 +390,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -230,15 +398,15 @@ public static partial class TransactionsOperationsExtensions /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this ITransactionsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this ITransactionsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -249,9 +417,9 @@ public static IPage ListByBillingAccountNameNext(this ITran /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs index 9bd562f3cebd..7a42f150f109 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs @@ -56,11 +56,14 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// Headers that will be added to request. @@ -83,19 +86,23 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> InitiateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, 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) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -105,15 +112,17 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("body", body); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Initiate", 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}/initiateTransfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/initiateTransfer").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 (_queryParameters.Count > 0) @@ -154,9 +163,9 @@ internal TransfersOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _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"); } @@ -248,6 +257,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -275,12 +287,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, 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"); @@ -297,6 +313,7 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -304,8 +321,9 @@ internal TransfersOperations(BillingManagementClient client) } // 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}/transfers/{transferName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").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)); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); @@ -435,6 +453,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -462,12 +483,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CancelWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, 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"); @@ -484,6 +509,7 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -491,8 +517,9 @@ internal TransfersOperations(BillingManagementClient client) } // 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}/transfers/{transferName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").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)); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); @@ -622,6 +649,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -646,12 +676,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, 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"); @@ -664,14 +698,16 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); 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.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers").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 (_queryParameters.Count > 0) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs index fc89c4ca02b4..3b529a83a0c3 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs @@ -30,15 +30,18 @@ public static partial class TransfersOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// - public static TransferDetails Initiate(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, InitiateTransferRequest body) + public static TransferDetails Initiate(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters) { - return operations.InitiateAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.InitiateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -50,18 +53,21 @@ public static TransferDetails Initiate(this ITransfersOperations operations, str /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// The cancellation token. /// - public static async Task InitiateAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -76,15 +82,18 @@ public static TransferDetails Initiate(this ITransfersOperations operations, str /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Transfer Name. /// - public static TransferDetails Get(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName) + public static TransferDetails Get(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, transferName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).GetAwaiter().GetResult(); } /// @@ -96,6 +105,9 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -105,9 +117,9 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// The cancellation token. /// - public static async Task GetAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -122,15 +134,18 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Transfer Name. /// - public static TransferDetails Cancel(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName) + public static TransferDetails Cancel(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName) { - return operations.CancelAsync(billingAccountName, invoiceSectionName, transferName).GetAwaiter().GetResult(); + return operations.CancelAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).GetAwaiter().GetResult(); } /// @@ -142,6 +157,9 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -151,9 +169,9 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// The cancellation token. /// - public static async Task CancelAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CancelAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -168,12 +186,15 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static IPage List(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName) + public static IPage List(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -185,15 +206,18 @@ public static IPage List(this ITransfersOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs index 2edc49a15405..758347f418a3 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs @@ -24,9 +24,7 @@ namespace Microsoft.Azure.Management.Cdn using System.Threading.Tasks; /// - /// Use these APIs to manage Azure CDN resources through the Azure Resource - /// Manager. You must make sure that requests made to these resources are - /// secure. + /// Cdn Management Client /// public partial class CdnManagementClient : ServiceClient, ICdnManagementClient, IAzureClient { diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs index 6d6bfba89212..3e0151ba28af 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs @@ -20,9 +20,7 @@ namespace Microsoft.Azure.Management.Cdn using System.Threading.Tasks; /// - /// Use these APIs to manage Azure CDN resources through the Azure Resource - /// Manager. You must make sure that requests made to these resources are - /// secure. + /// Cdn Management Client /// public partial interface ICdnManagementClient : System.IDisposable { diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Sku.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Sku.cs index 28a9e8be7c78..8aadf3029ce4 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Sku.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Sku.cs @@ -32,8 +32,8 @@ public Sku() /// /// Name of the pricing tier. Possible values /// include: 'Standard_Verizon', 'Premium_Verizon', 'Custom_Verizon', - /// 'Standard_Akamai', 'Standard_ChinaCdn', 'Premium_ChinaCdn', - /// 'Standard_Microsoft' + /// 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft', + /// 'Premium_ChinaCdn' public Sku(string name = default(string)) { Name = name; @@ -48,8 +48,8 @@ public Sku() /// /// Gets or sets name of the pricing tier. Possible values include: /// 'Standard_Verizon', 'Premium_Verizon', 'Custom_Verizon', - /// 'Standard_Akamai', 'Standard_ChinaCdn', 'Premium_ChinaCdn', - /// 'Standard_Microsoft' + /// 'Standard_Akamai', 'Standard_ChinaCdn', 'Standard_Microsoft', + /// 'Premium_ChinaCdn' /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/SkuName.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/SkuName.cs index a39197b12a1d..8e2227754cdc 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/SkuName.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/SkuName.cs @@ -21,7 +21,7 @@ public static class SkuName public const string CustomVerizon = "Custom_Verizon"; public const string StandardAkamai = "Standard_Akamai"; public const string StandardChinaCdn = "Standard_ChinaCdn"; - public const string PremiumChinaCdn = "Premium_ChinaCdn"; public const string StandardMicrosoft = "Standard_Microsoft"; + public const string PremiumChinaCdn = "Premium_ChinaCdn"; } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRedirectActionParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRedirectActionParameters.cs index ffd2e579e00e..04b45bdfe52b 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRedirectActionParameters.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRedirectActionParameters.cs @@ -42,7 +42,7 @@ public UrlRedirectActionParameters() /// empty and must start with /. Leave empty to use the incoming path /// as destination path. /// Host to redirect. Leave empty to use - /// use the incoming host as the destination host. + /// the incoming host as the destination host. /// The set of query strings to be /// placed in the redirect URL. Setting this value would replace any /// existing query string; leave empty to preserve the incoming query @@ -100,8 +100,8 @@ static UrlRedirectActionParameters() public string CustomPath { get; set; } /// - /// Gets or sets host to redirect. Leave empty to use use the incoming - /// host as the destination host. + /// Gets or sets host to redirect. Leave empty to use the incoming host + /// as the destination host. /// [JsonProperty(PropertyName = "customHostname")] public string CustomHostname { get; set; } diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs index 7faff410cf95..ffe7811c27c8 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.CognitiveServices using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Cognitive Services Management Client @@ -375,5 +377,210 @@ private void Initialize() DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Check whether a domain is available. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the 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> CheckDomainAvailabilityWithHttpMessagesAsync(string subdomainName, string type, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (subdomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subdomainName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + CheckDomainAvailabilityParameter parameters = new CheckDomainAvailabilityParameter(); + if (subdomainName != null || type != null) + { + parameters.SubdomainName = subdomainName; + parameters.Type = type; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckDomainAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs new file mode 100644 index 000000000000..a92a604ee2ee --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs @@ -0,0 +1,65 @@ +// +// 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.CognitiveServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CognitiveServicesManagementClient. + /// + public static partial class CognitiveServicesManagementClientExtensions + { + /// + /// Check whether a domain is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + public static CheckDomainAvailabilityResult CheckDomainAvailability(this ICognitiveServicesManagementClient operations, string subdomainName, string type) + { + return operations.CheckDomainAvailabilityAsync(subdomainName, type).GetAwaiter().GetResult(); + } + + /// + /// Check whether a domain is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task CheckDomainAvailabilityAsync(this ICognitiveServicesManagementClient operations, string subdomainName, string type, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckDomainAvailabilityWithHttpMessagesAsync(subdomainName, type, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs index 6e897bac33a1..9229ed9da261 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.CognitiveServices using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Cognitive Services Management Client @@ -90,5 +94,22 @@ public partial interface ICognitiveServicesManagementClient : System.IDisposable /// ICheckSkuAvailabilityOperations CheckSkuAvailability { get; } + /// + /// Check whether a domain is available. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CheckDomainAvailabilityWithHttpMessagesAsync(string subdomainName, string type, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs similarity index 51% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs rename to sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs index 4854ca18c285..2fc0681513a9 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs @@ -8,34 +8,36 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.CognitiveServices.Models { using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; - public partial class MetricsResultsItem + /// + /// Check Domain availability parameter. + /// + public partial class CheckDomainAvailabilityParameter { /// - /// Initializes a new instance of the MetricsResultsItem class. + /// Initializes a new instance of the CheckDomainAvailabilityParameter + /// class. /// - public MetricsResultsItem() + public CheckDomainAvailabilityParameter() { CustomInit(); } /// - /// Initializes a new instance of the MetricsResultsItem class. + /// Initializes a new instance of the CheckDomainAvailabilityParameter + /// class. /// - /// The specified ID for this metric. - /// The HTTP status code of this metric - /// query. - /// The results of this metric query. - public MetricsResultsItem(string id, int status, MetricsResult body) + /// The subdomain name to use. + /// The Type of the resource. + public CheckDomainAvailabilityParameter(string subdomainName, string type) { - Id = id; - Status = status; - Body = body; + SubdomainName = subdomainName; + Type = type; CustomInit(); } @@ -45,22 +47,16 @@ public MetricsResultsItem(string id, int status, MetricsResult body) partial void CustomInit(); /// - /// Gets or sets the specified ID for this metric. + /// Gets or sets the subdomain name to use. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "subdomainName")] + public string SubdomainName { get; set; } /// - /// Gets or sets the HTTP status code of this metric query. + /// Gets or sets the Type of the resource. /// - [JsonProperty(PropertyName = "status")] - public int Status { get; set; } - - /// - /// Gets or sets the results of this metric query. - /// - [JsonProperty(PropertyName = "body")] - public MetricsResult Body { get; set; } + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } /// /// Validate the object. @@ -70,13 +66,13 @@ public MetricsResultsItem(string id, int status, MetricsResult body) /// public virtual void Validate() { - if (Id == null) + if (SubdomainName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + throw new ValidationException(ValidationRules.CannotBeNull, "SubdomainName"); } - if (Body == null) + if (Type == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Body"); + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); } } } diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs new file mode 100644 index 000000000000..7582f4616c84 --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.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.CognitiveServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Check Domain availability result. + /// + public partial class CheckDomainAvailabilityResult + { + /// + /// Initializes a new instance of the CheckDomainAvailabilityResult + /// class. + /// + public CheckDomainAvailabilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckDomainAvailabilityResult + /// class. + /// + /// Indicates the given SKU is + /// available or not. + /// Reason why the SKU is not available. + /// The subdomain name to use. + /// The Type of the resource. + public CheckDomainAvailabilityResult(bool? isSubdomainAvailable = default(bool?), string reason = default(string), string subdomainName = default(string), string type = default(string)) + { + IsSubdomainAvailable = isSubdomainAvailable; + Reason = reason; + SubdomainName = subdomainName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates the given SKU is available or not. + /// + [JsonProperty(PropertyName = "isSubdomainAvailable")] + public bool? IsSubdomainAvailable { get; set; } + + /// + /// Gets or sets reason why the SKU is not available. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// Gets or sets the subdomain name to use. + /// + [JsonProperty(PropertyName = "subdomainName")] + public string SubdomainName { get; set; } + + /// + /// Gets or sets the Type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IPRule.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs similarity index 100% rename from sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IPRule.cs rename to sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs index 230a99061186..48cf31a0e168 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs @@ -20,22 +20,12 @@ public static IEnumerable> ApiInfo_CognitiveServic return new Tuple[] { new Tuple("CognitiveServices", "Accounts", "2017-04-18"), + new Tuple("CognitiveServices", "CheckDomainAvailability", "2017-04-18"), new Tuple("CognitiveServices", "CheckSkuAvailability", "2017-04-18"), new Tuple("CognitiveServices", "Operations", "2017-04-18"), new Tuple("CognitiveServices", "ResourceSkus", "2017-04-18"), }.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/cognitiveservices/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Github\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "f58c2f349207bda6f5ca4c010dd7f56c38ddb70e"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs new file mode 100644 index 000000000000..894e661e2ff5 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/ScaleInPolicy.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a scale-in policy for a virtual machine scale set. + /// + public partial class ScaleInPolicy + { + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + public ScaleInPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleInPolicy class. + /// + /// The rules to be followed when scaling-in a + /// virtual machine scale set. <br><br> Possible values + /// are: <br><br> **Default** When a virtual machine scale + /// set is scaled in, the scale set will first be balanced across zones + /// if it is a zonal scale set. Then, it will be balanced across Fault + /// Domains as far as possible. Within each Fault Domain, the virtual + /// machines chosen for removal will be the newest ones that are not + /// protected from scale-in. <br><br> **OldestVM** When a + /// virtual machine scale set is being scaled-in, the oldest virtual + /// machines that are not protected from scale-in will be chosen for + /// removal. For zonal virtual machine scale sets, the scale set will + /// first be balanced across zones. Within each zone, the oldest + /// virtual machines that are not protected will be chosen for removal. + /// <br><br> **NewestVM** When a virtual machine scale set + /// is being scaled-in, the newest virtual machines that are not + /// protected from scale-in will be chosen for removal. For zonal + /// virtual machine scale sets, the scale set will first be balanced + /// across zones. Within each zone, the newest virtual machines that + /// are not protected will be chosen for removal. + /// <br><br> + public ScaleInPolicy(IList rules = default(IList)) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rules to be followed when scaling-in a virtual + /// machine scale set. &lt;br&gt;&lt;br&gt; Possible + /// values are: &lt;br&gt;&lt;br&gt; **Default** When a + /// virtual machine scale set is scaled in, the scale set will first be + /// balanced across zones if it is a zonal scale set. Then, it will be + /// balanced across Fault Domains as far as possible. Within each Fault + /// Domain, the virtual machines chosen for removal will be the newest + /// ones that are not protected from scale-in. + /// &lt;br&gt;&lt;br&gt; **OldestVM** When a virtual + /// machine scale set is being scaled-in, the oldest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the oldest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; **NewestVM** When a virtual + /// machine scale set is being scaled-in, the newest virtual machines + /// that are not protected from scale-in will be chosen for removal. + /// For zonal virtual machine scale sets, the scale set will first be + /// balanced across zones. Within each zone, the newest virtual + /// machines that are not protected will be chosen for removal. + /// &lt;br&gt;&lt;br&gt; + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs index b72fa2db6acf..9564720813b1 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSet.cs @@ -78,10 +78,13 @@ public VirtualMachineScaleSet() /// Virtual Machine Scale Set. For instance: whether the Virtual /// Machines have the capability to support attaching managed data /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. /// The identity of the virtual machine scale /// set, if configured. /// The virtual machine scale set zones. - public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList)) + public VirtualMachineScaleSet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetVMProfile virtualMachineProfile = default(VirtualMachineScaleSetVMProfile), string provisioningState = default(string), bool? overprovision = default(bool?), bool? doNotRunExtensionsOnOverprovisionedVMs = default(bool?), string uniqueId = default(string), bool? singlePlacementGroup = default(bool?), bool? zoneBalance = default(bool?), int? platformFaultDomainCount = default(int?), SubResource proximityPlacementGroup = default(SubResource), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity), IList zones = default(IList)) : base(location, id, name, type, tags) { Sku = sku; @@ -97,6 +100,7 @@ public VirtualMachineScaleSet() PlatformFaultDomainCount = platformFaultDomainCount; ProximityPlacementGroup = proximityPlacementGroup; AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; Identity = identity; Zones = zones; CustomInit(); @@ -205,6 +209,14 @@ public VirtualMachineScaleSet() [JsonProperty(PropertyName = "properties.additionalCapabilities")] public AdditionalCapabilities AdditionalCapabilities { get; set; } + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + /// /// Gets or sets the identity of the virtual machine scale set, if /// configured. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs new file mode 100644 index 000000000000..bbe4bf22bc33 --- /dev/null +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetScaleInRules.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Compute.Models +{ + + /// + /// Defines values for VirtualMachineScaleSetScaleInRules. + /// + public static class VirtualMachineScaleSetScaleInRules + { + public const string Default = "Default"; + public const string OldestVM = "OldestVM"; + public const string NewestVM = "NewestVM"; + } +} diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs index 0f18654a4461..266834c34d7b 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs @@ -53,9 +53,12 @@ public VirtualMachineScaleSetUpdate() /// Virtual Machine Scale Set. For instance: whether the Virtual /// Machines have the capability to support attaching managed data /// disks with UltraSSD_LRS storage account type. + /// Specifies the scale-in policy that + /// decides which virtual machines are chosen for removal when a + /// Virtual Machine Scale Set is scaled-in. /// The identity of the virtual machine scale /// set, if configured. - public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) + public VirtualMachineScaleSetUpdate(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Plan plan = default(Plan), UpgradePolicy upgradePolicy = default(UpgradePolicy), VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile = default(VirtualMachineScaleSetUpdateVMProfile), bool? overprovision = default(bool?), bool? singlePlacementGroup = default(bool?), AdditionalCapabilities additionalCapabilities = default(AdditionalCapabilities), ScaleInPolicy scaleInPolicy = default(ScaleInPolicy), VirtualMachineScaleSetIdentity identity = default(VirtualMachineScaleSetIdentity)) : base(tags) { Sku = sku; @@ -65,6 +68,7 @@ public VirtualMachineScaleSetUpdate() Overprovision = overprovision; SinglePlacementGroup = singlePlacementGroup; AdditionalCapabilities = additionalCapabilities; + ScaleInPolicy = scaleInPolicy; Identity = identity; CustomInit(); } @@ -123,6 +127,14 @@ public VirtualMachineScaleSetUpdate() [JsonProperty(PropertyName = "properties.additionalCapabilities")] public AdditionalCapabilities AdditionalCapabilities { get; set; } + /// + /// Gets or sets specifies the scale-in policy that decides which + /// virtual machines are chosen for removal when a Virtual Machine + /// Scale Set is scaled-in. + /// + [JsonProperty(PropertyName = "properties.scaleInPolicy")] + public ScaleInPolicy ScaleInPolicy { get; set; } + /// /// Gets or sets the identity of the virtual machine scale set, if /// configured. diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs index e8ef6710bfa7..92e16cbf4f6d 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -49,16 +49,5 @@ public static IEnumerable> ApiInfo_ComputeManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\hylee-sdk\\avset\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "6359c5dac93947b24007afd9c569e23e92848ea5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs index b8f5a8bb5e92..4c7b96c11a2b 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs @@ -96,6 +96,16 @@ public partial class ContainerRegistryManagementClient : ServiceClient public virtual ITasksOperations Tasks { get; private set; } + /// + /// Gets the IScopeMapsOperations. + /// + public virtual IScopeMapsOperations ScopeMaps { get; private set; } + + /// + /// Gets the ITokensOperations. + /// + public virtual ITokensOperations Tokens { get; private set; } + /// /// Initializes a new instance of the ContainerRegistryManagementClient class. /// @@ -343,6 +353,8 @@ private void Initialize() Webhooks = new WebhooksOperations(this); Runs = new RunsOperations(this); Tasks = new TasksOperations(this); + ScopeMaps = new ScopeMapsOperations(this); + Tokens = new TokensOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs index e245c6061829..915fb7d07773 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs @@ -93,5 +93,15 @@ public partial interface IContainerRegistryManagementClient : System.IDisposable /// ITasksOperations Tasks { get; } + /// + /// Gets the IScopeMapsOperations. + /// + IScopeMapsOperations ScopeMaps { get; } + + /// + /// Gets the ITokensOperations. + /// + ITokensOperations Tokens { get; } + } } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IRegistriesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IRegistriesOperations.cs index 4c90452f8283..f9726c7e19ea 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IRegistriesOperations.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IRegistriesOperations.cs @@ -367,6 +367,35 @@ public partial interface IRegistriesOperations /// System.Threading.Tasks.Task> GetBuildSourceUploadUrlWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GenerateCredentialsWithHttpMessagesAsync(string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Copies an image to this container registry from the specified /// container registry. /// @@ -506,6 +535,35 @@ public partial interface IRegistriesOperations /// System.Threading.Tasks.Task> BeginScheduleRunWithHttpMessagesAsync(string resourceGroupName, string registryName, RunRequest runRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginGenerateCredentialsWithHttpMessagesAsync(string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists all the container registries under the specified resource /// group. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IScopeMapsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IScopeMapsOperations.cs new file mode 100644 index 000000000000..582dbe5cba91 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IScopeMapsOperations.cs @@ -0,0 +1,305 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// ScopeMapsOperations operations. + /// + public partial interface IScopeMapsOperations + { + /// + /// Gets the properties of the specified scope map. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a scope map for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a scope map for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITokensOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITokensOperations.cs new file mode 100644 index 000000000000..54ea4e6b411e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITokensOperations.cs @@ -0,0 +1,285 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// TokensOperations operations. + /// + public partial interface ITokensOperations + { + /// + /// Gets the properties of the specified token. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a token for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a token from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a token with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a token for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a token from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a token with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsParameters.cs new file mode 100644 index 000000000000..5a9f7fb746f4 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsParameters.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters used to generate credentials for a specified token or + /// user of a container registry. + /// + public partial class GenerateCredentialsParameters + { + /// + /// Initializes a new instance of the GenerateCredentialsParameters + /// class. + /// + public GenerateCredentialsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateCredentialsParameters + /// class. + /// + /// The resource ID of the token for which + /// credentials have to be generated. + /// The expiry date of the generated credentials + /// after which the credentials become invalid. + /// Specifies name of the password which should be + /// regenerated if any -- password or password2. Possible values + /// include: 'password1', 'password2' + public GenerateCredentialsParameters(string tokenId = default(string), System.DateTime? expiry = default(System.DateTime?), string name = default(string)) + { + TokenId = tokenId; + Expiry = expiry; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the token for which credentials + /// have to be generated. + /// + [JsonProperty(PropertyName = "tokenId")] + public string TokenId { get; set; } + + /// + /// Gets or sets the expiry date of the generated credentials after + /// which the credentials become invalid. + /// + [JsonProperty(PropertyName = "expiry")] + public System.DateTime? Expiry { get; set; } + + /// + /// Gets or sets specifies name of the password which should be + /// regenerated if any -- password or password2. Possible values + /// include: 'password1', 'password2' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsResult.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsResult.cs new file mode 100644 index 000000000000..054a3ea3eabd --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/GenerateCredentialsResult.cs @@ -0,0 +1,63 @@ +// +// 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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response from the GenerateCredentials operation. + /// + public partial class GenerateCredentialsResult + { + /// + /// Initializes a new instance of the GenerateCredentialsResult class. + /// + public GenerateCredentialsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GenerateCredentialsResult class. + /// + /// The username for a container + /// registry. + /// The list of passwords for a container + /// registry. + public GenerateCredentialsResult(string username = default(string), IList passwords = default(IList)) + { + Username = username; + Passwords = passwords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the username for a container registry. + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets the list of passwords for a container registry. + /// + [JsonProperty(PropertyName = "passwords")] + public IList Passwords { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs index fd6a6d21b2cd..b38c70091a26 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models using System.Linq; /// - /// The definition of Azure Monitoring metrics list. + /// The definition of Azure Monitoring list. /// public partial class OperationServiceSpecificationDefinition { diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs index 49d723eea4d7..945796749110 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs @@ -59,7 +59,7 @@ public Registry() /// registry. /// The policies for a container /// registry. - public Registry(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string loginServer = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string), Status status = default(Status), bool? adminUserEnabled = default(bool?), StorageAccountProperties storageAccount = default(StorageAccountProperties), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies)) + public Registry(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string loginServer = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string), Status1 status = default(Status1), bool? adminUserEnabled = default(bool?), StorageAccountProperties storageAccount = default(StorageAccountProperties), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies)) : base(location, id, name, type, tags) { Sku = sku; @@ -110,7 +110,7 @@ public Registry() /// was called. /// [JsonProperty(PropertyName = "properties.status")] - public Status Status { get; private set; } + public Status1 Status { get; private set; } /// /// Gets or sets the value that indicates whether the admin user is diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs index 09cca0fdaf99..974768be0afd 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs @@ -46,7 +46,7 @@ public Replication() /// 'Canceled' /// The status of the replication at the time the /// operation was called. - public Replication(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), Status status = default(Status)) + public Replication(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), Status1 status = default(Status1)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; @@ -72,7 +72,7 @@ public Replication() /// called. /// [JsonProperty(PropertyName = "properties.status")] - public Status Status { get; private set; } + public Status1 Status { get; private set; } /// /// Validate the object. diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs index 3d10bdffaa32..5e3f5459d802 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs @@ -29,8 +29,8 @@ public RetentionPolicy() /// /// Initializes a new instance of the RetentionPolicy class. /// - /// The number of days to retain manifest before it - /// expires. + /// The number of days to retain an untagged + /// manifest after which it gets purged. /// The timestamp when the policy was /// last updated. /// The value that indicates whether the policy is @@ -50,8 +50,8 @@ public RetentionPolicy() partial void CustomInit(); /// - /// Gets or sets the number of days to retain manifest before it - /// expires. + /// Gets or sets the number of days to retain an untagged manifest + /// after which it gets purged. /// [JsonProperty(PropertyName = "days")] public int? Days { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMap.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMap.cs new file mode 100644 index 000000000000..9e642969f3b0 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMap.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An object that represents a scope map for a container registry. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScopeMap : ProxyResource + { + /// + /// Initializes a new instance of the ScopeMap class. + /// + public ScopeMap() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScopeMap class. + /// + /// The list of scoped permissions for registry + /// artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The user friendly description of the + /// scope map. + /// The type of the scope map. E.g. BuildIn + /// scope map. + /// The creation date of scope map. + /// Provisioning state of the resource. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed', 'Canceled' + public ScopeMap(IList actions, string id = default(string), string name = default(string), string type = default(string), string description = default(string), string scopeMapType = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string)) + : base(id, name, type) + { + Description = description; + ScopeMapType = scopeMapType; + CreationDate = creationDate; + ProvisioningState = provisioningState; + Actions = actions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the user friendly description of the scope map. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets the type of the scope map. E.g. BuildIn scope map. + /// + [JsonProperty(PropertyName = "properties.type")] + public string ScopeMapType { get; private set; } + + /// + /// Gets the creation date of scope map. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets provisioning state of the resource. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Actions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Actions"); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMapUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMapUpdateParameters.cs new file mode 100644 index 000000000000..da1b18ca66b1 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ScopeMapUpdateParameters.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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties for updating the scope map. + /// + [Rest.Serialization.JsonTransformation] + public partial class ScopeMapUpdateParameters + { + /// + /// Initializes a new instance of the ScopeMapUpdateParameters class. + /// + public ScopeMapUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScopeMapUpdateParameters class. + /// + /// The user friendly description of the + /// scope map. + /// The list of scope permissions for registry + /// artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + public ScopeMapUpdateParameters(string description = default(string), IList actions = default(IList)) + { + Description = description; + Actions = actions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the user friendly description of the scope map. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status.cs index 41032fd63519..895cf1073cf2 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status.cs @@ -10,62 +10,13 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models { - using Newtonsoft.Json; - using System.Linq; /// - /// The status of an Azure resource at the time the operation was called. + /// Defines values for Status. /// - public partial class Status + public static class Status { - /// - /// Initializes a new instance of the Status class. - /// - public Status() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Status class. - /// - /// The short label for the status. - /// The detailed message for the status, - /// including alerts and error messages. - /// The timestamp when the status was changed - /// to the current value. - public Status(string displayStatus = default(string), string message = default(string), System.DateTime? timestamp = default(System.DateTime?)) - { - DisplayStatus = displayStatus; - Message = message; - Timestamp = timestamp; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the short label for the status. - /// - [JsonProperty(PropertyName = "displayStatus")] - public string DisplayStatus { get; private set; } - - /// - /// Gets the detailed message for the status, including alerts and - /// error messages. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } - - /// - /// Gets the timestamp when the status was changed to the current - /// value. - /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; private set; } - + public const string Enabled = "enabled"; + public const string Disabled = "disabled"; } } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status1.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status1.cs new file mode 100644 index 000000000000..3035c46f3cc6 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Status1.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The status of an Azure resource at the time the operation was called. + /// + public partial class Status1 + { + /// + /// Initializes a new instance of the Status1 class. + /// + public Status1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Status1 class. + /// + /// The short label for the status. + /// The detailed message for the status, + /// including alerts and error messages. + /// The timestamp when the status was changed + /// to the current value. + public Status1(string displayStatus = default(string), string message = default(string), System.DateTime? timestamp = default(System.DateTime?)) + { + DisplayStatus = displayStatus; + Message = message; + Timestamp = timestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the short label for the status. + /// + [JsonProperty(PropertyName = "displayStatus")] + public string DisplayStatus { get; private set; } + + /// + /// Gets the detailed message for the status, including alerts and + /// error messages. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the timestamp when the status was changed to the current + /// value. + /// + [JsonProperty(PropertyName = "timestamp")] + public System.DateTime? Timestamp { get; private set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Token.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Token.cs new file mode 100644 index 000000000000..941327d5cc1e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Token.cs @@ -0,0 +1,110 @@ +// +// 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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object that represents a token for a container registry. + /// + [Rest.Serialization.JsonTransformation] + public partial class Token : ProxyResource + { + /// + /// Initializes a new instance of the Token class. + /// + public Token() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Token class. + /// + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The creation date of scope map. + /// Provisioning state of the resource. + /// Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed', 'Canceled' + /// The resource ID of the scope map to which + /// the token will be associated with. + /// The user/group/application object ID for + /// which the token has to be created. + /// The credentials that can be used for + /// authenticating the token. + /// The status of the token example enabled or + /// disabled. Possible values include: 'enabled', 'disabled' + public Token(string id = default(string), string name = default(string), string type = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string), string scopeMapId = default(string), string objectId = default(string), TokenCredentialsProperties credentials = default(TokenCredentialsProperties), string status = default(string)) + : base(id, name, type) + { + CreationDate = creationDate; + ProvisioningState = provisioningState; + ScopeMapId = scopeMapId; + ObjectId = objectId; + Credentials = credentials; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the creation date of scope map. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets provisioning state of the resource. Possible values include: + /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the resource ID of the scope map to which the token + /// will be associated with. + /// + [JsonProperty(PropertyName = "properties.scopeMapId")] + public string ScopeMapId { get; set; } + + /// + /// Gets or sets the user/group/application object ID for which the + /// token has to be created. + /// + [JsonProperty(PropertyName = "properties.objectId")] + public string ObjectId { get; set; } + + /// + /// Gets or sets the credentials that can be used for authenticating + /// the token. + /// + [JsonProperty(PropertyName = "properties.credentials")] + public TokenCredentialsProperties Credentials { get; set; } + + /// + /// Gets or sets the status of the token example enabled or disabled. + /// Possible values include: 'enabled', 'disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificate.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificate.cs new file mode 100644 index 000000000000..58d68a397323 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificate.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a certificate used for authenticating a token. + /// + public partial class TokenCertificate + { + /// + /// Initializes a new instance of the TokenCertificate class. + /// + public TokenCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TokenCertificate class. + /// + /// Possible values include: 'certificate1', + /// 'certificate2' + /// The expiry datetime of the + /// certificate. + /// The thumbprint of the certificate. + /// Base 64 encoded string of the + /// public certificate1 in PEM format that will be used for + /// authenticating the token. + public TokenCertificate(string name = default(string), System.DateTime? expiry = default(System.DateTime?), string thumbprint = default(string), string encodedPemCertificate = default(string)) + { + Name = name; + Expiry = expiry; + Thumbprint = thumbprint; + EncodedPemCertificate = encodedPemCertificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'certificate1', + /// 'certificate2' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the expiry datetime of the certificate. + /// + [JsonProperty(PropertyName = "expiry")] + public System.DateTime? Expiry { get; set; } + + /// + /// Gets or sets the thumbprint of the certificate. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Gets or sets base 64 encoded string of the public certificate1 in + /// PEM format that will be used for authenticating the token. + /// + [JsonProperty(PropertyName = "encodedPemCertificate")] + public string EncodedPemCertificate { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificateName.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificateName.cs new file mode 100644 index 000000000000..a975121ef70d --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCertificateName.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.ContainerRegistry.Models +{ + + /// + /// Defines values for TokenCertificateName. + /// + public static class TokenCertificateName + { + public const string Certificate1 = "certificate1"; + public const string Certificate2 = "certificate2"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCredentialsProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCredentialsProperties.cs new file mode 100644 index 000000000000..c87fbb8cb1e8 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenCredentialsProperties.cs @@ -0,0 +1,58 @@ +// +// 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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties of the credentials that can be used for authenticating + /// the token. + /// + public partial class TokenCredentialsProperties + { + /// + /// Initializes a new instance of the TokenCredentialsProperties class. + /// + public TokenCredentialsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TokenCredentialsProperties class. + /// + public TokenCredentialsProperties(IList certificates = default(IList), IList passwords = default(IList)) + { + Certificates = certificates; + Passwords = passwords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "certificates")] + public IList Certificates { get; set; } + + /// + /// + [JsonProperty(PropertyName = "passwords")] + public IList Passwords { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPassword.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPassword.cs new file mode 100644 index 000000000000..172f1b05324e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPassword.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The password that will be used for authenticating the token of a + /// container registry. + /// + public partial class TokenPassword + { + /// + /// Initializes a new instance of the TokenPassword class. + /// + public TokenPassword() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TokenPassword class. + /// + /// The password created datetime of the + /// password. + /// The expiry datetime of the password. + /// The password name "password" or "password2". + /// Possible values include: 'password1', 'password2' + /// The password value. + public TokenPassword(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expiry = default(System.DateTime?), string name = default(string), string value = default(string)) + { + CreationTime = creationTime; + Expiry = expiry; + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the password created datetime of the password. + /// + [JsonProperty(PropertyName = "creationTime")] + public System.DateTime? CreationTime { get; set; } + + /// + /// Gets or sets the expiry datetime of the password. + /// + [JsonProperty(PropertyName = "expiry")] + public System.DateTime? Expiry { get; set; } + + /// + /// Gets or sets the password name "password" or "password2". Possible + /// values include: 'password1', 'password2' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the password value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPasswordName.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPasswordName.cs new file mode 100644 index 000000000000..78d44e77dc4d --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenPasswordName.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.ContainerRegistry.Models +{ + + /// + /// Defines values for TokenPasswordName. + /// + public static class TokenPasswordName + { + public const string Password1 = "password1"; + public const string Password2 = "password2"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenUpdateParameters.cs new file mode 100644 index 000000000000..d79f50445396 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TokenUpdateParameters.cs @@ -0,0 +1,76 @@ +// +// 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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters for updating a token. + /// + [Rest.Serialization.JsonTransformation] + public partial class TokenUpdateParameters + { + /// + /// Initializes a new instance of the TokenUpdateParameters class. + /// + public TokenUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TokenUpdateParameters class. + /// + /// The resource ID of the scope map to which + /// the token will be associated with. + /// The status of the token example enabled or + /// disabled. Possible values include: 'enabled', 'disabled' + /// The credentials that can be used for + /// authenticating the token. + public TokenUpdateParameters(string scopeMapId = default(string), string status = default(string), TokenCredentialsProperties credentials = default(TokenCredentialsProperties)) + { + ScopeMapId = scopeMapId; + Status = status; + Credentials = credentials; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the scope map to which the token + /// will be associated with. + /// + [JsonProperty(PropertyName = "properties.scopeMapId")] + public string ScopeMapId { get; set; } + + /// + /// Gets or sets the status of the token example enabled or disabled. + /// Possible values include: 'enabled', 'disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the credentials that can be used for authenticating + /// the token. + /// + [JsonProperty(PropertyName = "properties.credentials")] + public TokenCredentialsProperties Credentials { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperations.cs index c0a558dd88c0..8d91323a4ddf 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperations.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperations.cs @@ -1848,6 +1848,31 @@ internal RegistriesOperations(ContainerRegistryManagementClient client) return _result; } + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> GenerateCredentialsWithHttpMessagesAsync(string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGenerateCredentialsWithHttpMessagesAsync(resourceGroupName, registryName, generateCredentialsParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Copies an image to this container registry from the specified container /// registry. @@ -2989,6 +3014,236 @@ internal RegistriesOperations(ContainerRegistryManagementClient client) return _result; } + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginGenerateCredentialsWithHttpMessagesAsync(string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (generateCredentialsParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "generateCredentialsParameters"); + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("generateCredentialsParameters", generateCredentialsParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGenerateCredentials", 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.ContainerRegistry/registries/{registryName}/generateCredentials").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + 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(generateCredentialsParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateCredentialsParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists all the container registries under the specified resource group. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperationsExtensions.cs index f9e010d7e7fe..0ccdac3dfc8b 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperationsExtensions.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/RegistriesOperationsExtensions.cs @@ -554,6 +554,52 @@ public static SourceUploadDefinition GetBuildSourceUploadUrl(this IRegistriesOpe } } + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + public static GenerateCredentialsResult GenerateCredentials(this IRegistriesOperations operations, string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters) + { + return operations.GenerateCredentialsAsync(resourceGroupName, registryName, generateCredentialsParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateCredentialsAsync(this IRegistriesOperations operations, string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateCredentialsWithHttpMessagesAsync(resourceGroupName, registryName, generateCredentialsParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Copies an image to this container registry from the specified container /// registry. @@ -778,6 +824,52 @@ public static Run BeginScheduleRun(this IRegistriesOperations operations, string } } + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + public static GenerateCredentialsResult BeginGenerateCredentials(this IRegistriesOperations operations, string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters) + { + return operations.BeginGenerateCredentialsAsync(resourceGroupName, registryName, generateCredentialsParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate keys for a token of a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The parameters for generating credentials. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginGenerateCredentialsAsync(this IRegistriesOperations operations, string resourceGroupName, string registryName, GenerateCredentialsParameters generateCredentialsParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGenerateCredentialsWithHttpMessagesAsync(resourceGroupName, registryName, generateCredentialsParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists all the container registries under the specified resource group. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperations.cs new file mode 100644 index 000000000000..4a0e0b6ddd9f --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperations.cs @@ -0,0 +1,1554 @@ +// +// 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.ContainerRegistry +{ + 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; + + /// + /// ScopeMapsOperations operations. + /// + internal partial class ScopeMapsOperations : IServiceOperations, IScopeMapsOperations + { + /// + /// Initializes a new instance of the ScopeMapsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ScopeMapsOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the properties of the specified scope map. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (scopeMapName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeMapName"); + } + if (scopeMapName != null) + { + if (scopeMapName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "scopeMapName", 50); + } + if (scopeMapName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "scopeMapName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scopeMapName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "scopeMapName", "^[a-zA-Z0-9-]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("scopeMapName", scopeMapName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{scopeMapName}", System.Uri.EscapeDataString(scopeMapName)); + 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 a scope map for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, actions, description, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, description, actions, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + 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 a scope map for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (scopeMapName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeMapName"); + } + if (scopeMapName != null) + { + if (scopeMapName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "scopeMapName", 50); + } + if (scopeMapName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "scopeMapName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scopeMapName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "scopeMapName", "^[a-zA-Z0-9-]*$"); + } + } + if (actions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actions"); + } + string apiVersion = "2019-05-01-preview"; + ScopeMap scopeMapCreateParameters = new ScopeMap(); + if (description != null || actions != null) + { + scopeMapCreateParameters.Description = description; + scopeMapCreateParameters.Actions = actions; + } + // 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("registryName", registryName); + tracingParameters.Add("scopeMapName", scopeMapName); + tracingParameters.Add("scopeMapCreateParameters", scopeMapCreateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{scopeMapName}", System.Uri.EscapeDataString(scopeMapName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(scopeMapCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(scopeMapCreateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (scopeMapName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeMapName"); + } + if (scopeMapName != null) + { + if (scopeMapName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "scopeMapName", 50); + } + if (scopeMapName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "scopeMapName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scopeMapName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "scopeMapName", "^[a-zA-Z0-9-]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("scopeMapName", scopeMapName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{scopeMapName}", System.Uri.EscapeDataString(scopeMapName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// 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 System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (scopeMapName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopeMapName"); + } + if (scopeMapName != null) + { + if (scopeMapName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "scopeMapName", 50); + } + if (scopeMapName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "scopeMapName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(scopeMapName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "scopeMapName", "^[a-zA-Z0-9-]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + ScopeMapUpdateParameters scopeMapUpdateParameters = new ScopeMapUpdateParameters(); + if (description != null || actions != null) + { + scopeMapUpdateParameters.Description = description; + scopeMapUpdateParameters.Actions = actions; + } + // 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("registryName", registryName); + tracingParameters.Add("scopeMapName", scopeMapName); + tracingParameters.Add("scopeMapUpdateParameters", scopeMapUpdateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{scopeMapName}", System.Uri.EscapeDataString(scopeMapName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(scopeMapUpdateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(scopeMapUpdateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperationsExtensions.cs new file mode 100644 index 000000000000..b16e7809db5f --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ScopeMapsOperationsExtensions.cs @@ -0,0 +1,480 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// Extension methods for ScopeMapsOperations. + /// + public static partial class ScopeMapsOperationsExtensions + { + /// + /// Gets the properties of the specified scope map. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + public static ScopeMap Get(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName) + { + return operations.GetAsync(resourceGroupName, registryName, scopeMapName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified scope map. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a scope map for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + public static ScopeMap Create(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string)) + { + return operations.CreateAsync(resourceGroupName, registryName, scopeMapName, actions, description).GetAwaiter().GetResult(); + } + + /// + /// Creates a scope map for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, actions, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + public static void Delete(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName) + { + operations.DeleteAsync(resourceGroupName, registryName, scopeMapName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + public static ScopeMap Update(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList)) + { + return operations.UpdateAsync(resourceGroupName, registryName, scopeMapName, description, actions).GetAwaiter().GetResult(); + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, description, actions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this IScopeMapsOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a scope map for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + public static ScopeMap BeginCreate(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string)) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, scopeMapName, actions, description).GetAwaiter().GetResult(); + } + + /// + /// Creates a scope map for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The list of scoped permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, IList actions, string description = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, actions, description, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + public static void BeginDelete(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, scopeMapName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a scope map from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + public static ScopeMap BeginUpdate(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList)) + { + return operations.BeginUpdateAsync(resourceGroupName, registryName, scopeMapName, description, actions).GetAwaiter().GetResult(); + } + + /// + /// Updates a scope map with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the scope map. + /// + /// + /// The user friendly description of the scope map. + /// + /// + /// The list of scope permissions for registry artifacts. + /// E.g. repositories/repository-name/pull, + /// repositories/repository-name/delete + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IScopeMapsOperations operations, string resourceGroupName, string registryName, string scopeMapName, string description = default(string), IList actions = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, scopeMapName, description, actions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IScopeMapsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the scope maps for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IScopeMapsOperations 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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs index 3d8804e0c1f3..c3869abaf775 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs @@ -21,10 +21,13 @@ public static IEnumerable> ApiInfo_ContainerRegist { new Tuple("ContainerRegistry", "Operations", "2019-05-01"), new Tuple("ContainerRegistry", "Registries", "2019-05-01"), + new Tuple("ContainerRegistry", "Registries", "2019-05-01-preview"), new Tuple("ContainerRegistry", "Registries", "2019-06-01-preview"), new Tuple("ContainerRegistry", "Replications", "2019-05-01"), new Tuple("ContainerRegistry", "Runs", "2019-06-01-preview"), + new Tuple("ContainerRegistry", "ScopeMaps", "2019-05-01-preview"), new Tuple("ContainerRegistry", "Tasks", "2019-06-01-preview"), + new Tuple("ContainerRegistry", "Tokens", "2019-05-01-preview"), new Tuple("ContainerRegistry", "Webhooks", "2019-05-01"), }.AsEnumerable(); } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperations.cs new file mode 100644 index 000000000000..02b13a6f7ee1 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperations.cs @@ -0,0 +1,1526 @@ +// +// 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.ContainerRegistry +{ + 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; + + /// + /// TokensOperations operations. + /// + internal partial class TokensOperations : IServiceOperations, ITokensOperations + { + /// + /// Initializes a new instance of the TokensOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TokensOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the properties of the specified token. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (tokenName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenName"); + } + if (tokenName != null) + { + if (tokenName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "tokenName", 50); + } + if (tokenName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "tokenName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(tokenName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "tokenName", "^[a-zA-Z0-9-]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("tokenName", tokenName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{tokenName}", System.Uri.EscapeDataString(tokenName)); + 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 a token for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenCreateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenUpdateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + 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 a token for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (tokenName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenName"); + } + if (tokenName != null) + { + if (tokenName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "tokenName", 50); + } + if (tokenName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "tokenName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(tokenName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "tokenName", "^[a-zA-Z0-9-]*$"); + } + } + if (tokenCreateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenCreateParameters"); + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("tokenName", tokenName); + tracingParameters.Add("tokenCreateParameters", tokenCreateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{tokenName}", System.Uri.EscapeDataString(tokenName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(tokenCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tokenCreateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (tokenName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenName"); + } + if (tokenName != null) + { + if (tokenName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "tokenName", 50); + } + if (tokenName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "tokenName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(tokenName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "tokenName", "^[a-zA-Z0-9-]*$"); + } + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("tokenName", tokenName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{tokenName}", System.Uri.EscapeDataString(tokenName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, 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 (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (tokenName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenName"); + } + if (tokenName != null) + { + if (tokenName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "tokenName", 50); + } + if (tokenName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "tokenName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(tokenName, "^[a-zA-Z0-9-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "tokenName", "^[a-zA-Z0-9-]*$"); + } + } + if (tokenUpdateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tokenUpdateParameters"); + } + string apiVersion = "2019-05-01-preview"; + // 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("registryName", registryName); + tracingParameters.Add("tokenName", tokenName); + tracingParameters.Add("tokenUpdateParameters", tokenUpdateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{tokenName}", System.Uri.EscapeDataString(tokenName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(tokenUpdateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tokenUpdateParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperationsExtensions.cs new file mode 100644 index 000000000000..1624952dc581 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TokensOperationsExtensions.cs @@ -0,0 +1,438 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + + /// + /// Extension methods for TokensOperations. + /// + public static partial class TokensOperationsExtensions + { + /// + /// Gets the properties of the specified token. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + public static Token Get(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName) + { + return operations.GetAsync(resourceGroupName, registryName, tokenName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified token. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a token for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + public static Token Create(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters) + { + return operations.CreateAsync(resourceGroupName, registryName, tokenName, tokenCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a token for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + public static void Delete(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName) + { + operations.DeleteAsync(resourceGroupName, registryName, tokenName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + public static Token Update(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters) + { + return operations.UpdateAsync(resourceGroupName, registryName, tokenName, tokenUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this ITokensOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ITokensOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a token for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + public static Token BeginCreate(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, tokenName, tokenCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a token for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for creating a token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, Token tokenCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + public static void BeginDelete(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, tokenName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a token from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + public static Token BeginUpdate(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, registryName, tokenName, tokenUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a token with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the token. + /// + /// + /// The parameters for updating a token. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this ITokensOperations operations, string resourceGroupName, string registryName, string tokenName, TokenUpdateParameters tokenUpdateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, tokenName, tokenUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ITokensOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the tokens for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ITokensOperations 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs index 50bf7e4b6b92..1d911abb78e4 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,463 @@ 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. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(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, "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}/agentPools/{agentPoolName}/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)); + _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; + } + /// /// Creates or updates an agent pool. /// @@ -644,7 +1101,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 +1351,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs index 333bc9802a1a..e9bab4e54b14 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,112 @@ 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. + /// + /// + /// The name of the agent pool. + /// + public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + return operations.GetAvailableAgentPoolVersionsAsync(resourceGroupName, resourceName, agentPoolName).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 name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAvailableAgentPoolVersionsAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAvailableAgentPoolVersionsWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates an agent pool. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs index b8ec9621329d..564aab684620 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs @@ -735,7 +735,7 @@ internal ContainerServicesOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs index fe31c66be91b..e496ec668ace 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,69 @@ 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 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates an agent pool. /// /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs index b42496c1c241..f4c6fb41f833 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs @@ -84,7 +84,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -278,7 +278,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -496,7 +496,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -723,7 +723,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -945,7 +945,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1165,7 +1165,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1385,7 +1385,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1756,7 +1756,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2003,7 +2003,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; TagsObject parameters = new TagsObject(); if (tags != null) { @@ -2231,7 +2231,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2441,7 +2441,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2658,7 +2658,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs index 62d800ddd453..17ca5dc61071 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs @@ -123,7 +123,17 @@ public AgentPool() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) : base(id, name, type) { Count = count; @@ -139,6 +149,10 @@ public AgentPool() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -291,6 +305,35 @@ public AgentPool() [JsonProperty(PropertyName = "properties.availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "properties.enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "properties.scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "properties.scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "properties.nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs new file mode 100644 index 000000000000..aef063574593 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available versions for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolAvailableVersions + { + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + public AgentPoolAvailableVersions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + /// Id of the agent pool available versions. + /// Name of the agent pool available + /// versions. + /// Type of the agent pool available + /// versions. + /// List of versions available for + /// agent pool. + public AgentPoolAvailableVersions(string id = default(string), string name = default(string), string type = default(string), IList agentPoolVersions = default(IList)) + { + Id = id; + Name = name; + Type = type; + AgentPoolVersions = agentPoolVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool available versions. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool available versions. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool available versions. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets list of versions available for agent pool. + /// + [JsonProperty(PropertyName = "properties.agentPoolVersions")] + public IList AgentPoolVersions { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs new file mode 100644 index 000000000000..8642c1dbda4c --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem + { + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + /// Whether this version is the default + /// agent pool version. + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(bool? defaultProperty = default(bool?), string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + DefaultProperty = defaultProperty; + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether this version is the default agent pool + /// version. + /// + [JsonProperty(PropertyName = "default")] + public bool? DefaultProperty { get; set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs new file mode 100644 index 000000000000..7e876988de79 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available upgrades for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolUpgradeProfile + { + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + public AgentPoolUpgradeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// OsType to be used to specify os type. Choose + /// from Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// Id of the agent pool upgrade profile. + /// Name of the agent pool upgrade profile. + /// Type of the agent pool upgrade profile. + /// List of orchestrator types and versions + /// available for upgrade. + public AgentPoolUpgradeProfile(string kubernetesVersion, string osType, string id = default(string), string name = default(string), string type = default(string), IList upgrades = default(IList)) + { + Id = id; + Name = name; + Type = type; + KubernetesVersion = kubernetesVersion; + OsType = osType; + Upgrades = upgrades; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "properties.kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets osType to be used to specify os type. Choose from + /// Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets list of orchestrator types and versions available for + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.upgrades")] + public IList Upgrades { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KubernetesVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KubernetesVersion"); + } + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs new file mode 100644 index 000000000000..e449e974e445 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + { + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + public AgentPoolUpgradeProfilePropertiesUpgradesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 311110d17c1a..0d1e3604982b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -51,7 +51,9 @@ public ContainerServiceNetworkProfile() /// ranges or the Kubernetes service address range. /// The load balancer sku for the managed /// cluster. Possible values include: 'standard', 'basic' - public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string)) + /// Profile of the cluster load + /// balancer. + public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile)) { NetworkPlugin = networkPlugin; NetworkPolicy = networkPolicy; @@ -60,6 +62,7 @@ public ContainerServiceNetworkProfile() DnsServiceIP = dnsServiceIP; DockerBridgeCidr = dockerBridgeCidr; LoadBalancerSku = loadBalancerSku; + LoadBalancerProfile = loadBalancerProfile; CustomInit(); } @@ -119,6 +122,12 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "loadBalancerSku")] public string LoadBalancerSku { get; set; } + /// + /// Gets or sets profile of the cluster load balancer. + /// + [JsonProperty(PropertyName = "loadBalancerProfile")] + public ManagedClusterLoadBalancerProfile LoadBalancerProfile { get; set; } + /// /// Validate the object. /// @@ -155,6 +164,10 @@ public virtual void Validate() throw new ValidationException(ValidationRules.Pattern, "DockerBridgeCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); } } + if (LoadBalancerProfile != null) + { + LoadBalancerProfile.Validate(); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs index 7a4181186b42..7fa8fc43785a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs @@ -69,11 +69,11 @@ public ManagedCluster() /// configuration. /// Profile of Azure Active Directory /// configuration. - /// (PREVIEW) Authorized IP - /// Ranges to kubernetes API server. + /// Access profile for managed + /// cluster API server. /// The identity of the managed cluster, if /// configured. - public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), IList apiServerAuthorizedIPRanges = default(IList), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) + public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; @@ -91,7 +91,7 @@ public ManagedCluster() EnablePodSecurityPolicy = enablePodSecurityPolicy; NetworkProfile = networkProfile; AadProfile = aadProfile; - ApiServerAuthorizedIPRanges = apiServerAuthorizedIPRanges; + ApiServerAccessProfile = apiServerAccessProfile; Identity = identity; CustomInit(); } @@ -201,11 +201,10 @@ public ManagedCluster() public ManagedClusterAADProfile AadProfile { get; set; } /// - /// Gets or sets (PREVIEW) Authorized IP Ranges to kubernetes API - /// server. + /// Gets or sets access profile for managed cluster API server. /// - [JsonProperty(PropertyName = "properties.apiServerAuthorizedIPRanges")] - public IList ApiServerAuthorizedIPRanges { get; set; } + [JsonProperty(PropertyName = "properties.apiServerAccessProfile")] + public ManagedClusterAPIServerAccessProfile ApiServerAccessProfile { get; set; } /// /// Gets or sets the identity of the managed cluster, if configured. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs new file mode 100644 index 000000000000..a950f33365d1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access profile for managed cluster API server. + /// + public partial class ManagedClusterAPIServerAccessProfile + { + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + public ManagedClusterAPIServerAccessProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + /// Authorized IP Ranges to kubernetes + /// API server. + /// Whether to create the cluster as + /// a private cluster or not. + public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?)) + { + AuthorizedIPRanges = authorizedIPRanges; + EnablePrivateCluster = enablePrivateCluster; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorized IP Ranges to kubernetes API server. + /// + [JsonProperty(PropertyName = "authorizedIPRanges")] + public IList AuthorizedIPRanges { get; set; } + + /// + /// Gets or sets whether to create the cluster as a private cluster or + /// not. + /// + [JsonProperty(PropertyName = "enablePrivateCluster")] + public bool? EnablePrivateCluster { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 357545428fe3..107edfb3be3d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -120,8 +120,18 @@ public ManagedClusterAgentPoolProfile() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) - : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) + : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones, enableNodePublicIP, scaleSetPriority, scaleSetEvictionPolicy, nodeTaints) { Name = name; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index 6e86f0cc9df6..a99b90999b08 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -118,7 +118,17 @@ public ManagedClusterAgentPoolProfileProperties() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) { Count = count; VmSize = vmSize; @@ -133,6 +143,10 @@ public ManagedClusterAgentPoolProfileProperties() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -285,6 +299,35 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs new file mode 100644 index 000000000000..2c9728a8cd0d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of the managed cluster load balancer + /// + public partial class ManagedClusterLoadBalancerProfile + { + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + public ManagedClusterLoadBalancerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + /// Desired managed outbound IPs for + /// the cluster load balancer. + /// Desired outbound IP Prefix + /// resources for the cluster load balancer. + /// Desired outbound IP resources for the + /// cluster load balancer. + /// The effective outbound IP + /// resources of the cluster load balancer. + public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList)) + { + ManagedOutboundIPs = managedOutboundIPs; + OutboundIPPrefixes = outboundIPPrefixes; + OutboundIPs = outboundIPs; + EffectiveOutboundIPs = effectiveOutboundIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired managed outbound IPs for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "managedOutboundIPs")] + public ManagedClusterLoadBalancerProfileManagedOutboundIPs ManagedOutboundIPs { get; set; } + + /// + /// Gets or sets desired outbound IP Prefix resources for the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "outboundIPPrefixes")] + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes OutboundIPPrefixes { get; set; } + + /// + /// Gets or sets desired outbound IP resources for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "outboundIPs")] + public ManagedClusterLoadBalancerProfileOutboundIPs OutboundIPs { get; set; } + + /// + /// Gets or sets the effective outbound IP resources of the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "effectiveOutboundIPs")] + public IList EffectiveOutboundIPs { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedOutboundIPs != null) + { + ManagedOutboundIPs.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs new file mode 100644 index 000000000000..d72f7f793e37 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Desired managed outbound IPs for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileManagedOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + /// Desired number of outbound IP created/managed + /// by Azure for the cluster load balancer. Allowed values must be in + /// the range of 1 to 100 (inclusive). The default value is 1. + public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?)) + { + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired number of outbound IP created/managed by Azure + /// for the cluster load balancer. Allowed values must be in the range + /// of 1 to 100 (inclusive). The default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Count > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Count", 100); + } + if (Count < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs new file mode 100644 index 000000000000..e4220de6974b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + /// A list of public IP prefix + /// resources. + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes = default(IList)) + { + PublicIPPrefixes = publicIPPrefixes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP prefix resources. + /// + [JsonProperty(PropertyName = "publicIPPrefixes")] + public IList PublicIPPrefixes { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs new file mode 100644 index 000000000000..8c6863afa7cb --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + /// A list of public IP resources. + public ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs = default(IList)) + { + PublicIPs = publicIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP resources. + /// + [JsonProperty(PropertyName = "publicIPs")] + public IList PublicIPs { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs similarity index 65% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs rename to sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs index 2ef24da78661..d272c94add12 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs @@ -8,29 +8,29 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ContainerService.Models { using Newtonsoft.Json; using System.Linq; /// - /// Session info for an event result + /// A reference to an Azure resource. /// - public partial class EventsSessionInfo + public partial class ResourceReference { /// - /// Initializes a new instance of the EventsSessionInfo class. + /// Initializes a new instance of the ResourceReference class. /// - public EventsSessionInfo() + public ResourceReference() { CustomInit(); } /// - /// Initializes a new instance of the EventsSessionInfo class. + /// Initializes a new instance of the ResourceReference class. /// - /// ID of the session - public EventsSessionInfo(string id = default(string)) + /// The fully qualified Azure resource id. + public ResourceReference(string id = default(string)) { Id = id; CustomInit(); @@ -42,7 +42,7 @@ public EventsSessionInfo() partial void CustomInit(); /// - /// Gets or sets ID of the session + /// Gets or sets the fully qualified Azure resource id. /// [JsonProperty(PropertyName = "id")] public string Id { get; set; } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs new file mode 100644 index 000000000000..25bd3db49c44 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetEvictionPolicy. + /// + public static class ScaleSetEvictionPolicy + { + public const string Delete = "Delete"; + public const string Deallocate = "Deallocate"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs new file mode 100644 index 000000000000..5edcae14e830 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetPriority. + /// + public static class ScaleSetPriority + { + public const string Low = "Low"; + public const string Regular = "Regular"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs index ec90823197fa..33c25ec737fe 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ContainerServiceClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs index e35757d72020..2330060e78a7 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs @@ -19,12 +19,12 @@ public static IEnumerable> ApiInfo_ContainerServic { return new Tuple[] { - new Tuple("ContainerService", "AgentPools", "2019-04-01"), + new Tuple("ContainerService", "AgentPools", "2019-08-01"), new Tuple("ContainerService", "ContainerServices", "2017-07-01"), - new Tuple("ContainerService", "ContainerServices", "2019-04-01"), - new Tuple("ContainerService", "ManagedClusters", "2019-04-01"), + new Tuple("ContainerService", "ContainerServices", "2019-08-01"), + new Tuple("ContainerService", "ManagedClusters", "2019-08-01"), new Tuple("ContainerService", "OpenShiftManagedClusters", "2019-04-30"), - new Tuple("ContainerService", "Operations", "2019-04-01"), + new Tuple("ContainerService", "Operations", "2019-08-01"), }.AsEnumerable(); } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs index e33e68d2d6aa..eb02c8389215 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs @@ -463,6 +463,8 @@ private void Initialize() DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("authorizationType")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("authorizationType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); CustomInitialize(); diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs index 292beff96033..1ac3e9ad74f8 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDatabricksLinkedService.cs @@ -51,42 +51,61 @@ public AzureDatabricksLinkedService() /// Parameters for linked service. /// List of tags that can be used for /// describing the linked service. - /// The id of an existing cluster that - /// will be used for all runs of this job. Type: string (or Expression + /// The id of an existing interactive + /// cluster that will be used for all runs of this activity. Type: + /// string (or Expression with resultType string). + /// The id of an existing instance pool + /// that will be used for all runs of this activity. Type: string (or + /// Expression with resultType string). + /// If not using an existing + /// interactive cluster, this specifies the Spark version of a new job + /// cluster or instance pool nodes created for each run of this + /// activity. Required if instancePoolId is specified. Type: string (or + /// Expression with resultType string). + /// If not using an existing + /// interactive cluster, this specifies the number of worker nodes to + /// use for the new job cluster or instance pool. For new job clusters, + /// this a string-formatted Int32, like '1' means numOfWorker is 1 or + /// '1:10' means auto-scale from 1 (min) to 10 (max). For instance + /// pools, this is a string-formatted Int32, and can only specify a + /// fixed number of worker nodes, such as '2'. Required if + /// newClusterVersion is specified. Type: string (or Expression with + /// resultType string). + /// The node type of the new job + /// cluster. This property is required if newClusterVersion is + /// specified and instancePoolId is not specified. If instancePoolId is + /// specified, this property is ignored. Type: string (or Expression /// with resultType string). - /// The Spark version of new cluster. - /// Type: string (or Expression with resultType string). - /// Number of worker nodes that new - /// cluster should have. A string formatted Int32, like '1' means - /// numOfWorker is 1 or '1:10' means auto-scale from 1 as min and 10 as - /// max. Type: string (or Expression with resultType string). - /// The node types of new cluster. - /// Type: string (or Expression with resultType string). /// A set of optional, user-specified /// Spark configuration key-value pairs. /// A set of optional, /// user-specified Spark environment variables key-value pairs. /// Additional tags for cluster - /// resources. + /// resources. This property is ignored in instance pool + /// configurations. /// The driver node type for the - /// new cluster. Type: string (or Expression with resultType + /// new job cluster. This property is ignored in instance pool + /// configurations. Type: string (or Expression with resultType /// string). /// User-defined initialization /// scripts for the new cluster. Type: array of strings (or Expression /// with resultType array of strings). /// Enable the elastic disk - /// on the new cluster. Type: boolean (or Expression with resultType + /// on the new cluster. This property is now ignored, and takes the + /// default elastic disk behavior in Databricks (elastic disks are + /// always enabled). Type: boolean (or Expression with resultType /// boolean). /// The encrypted credential used for /// authentication. Credentials are encrypted using the integration /// runtime credential manager. Type: string (or Expression with /// resultType string). - public AzureDatabricksLinkedService(object domain, SecretBase accessToken, IDictionary additionalProperties = default(IDictionary), IntegrationRuntimeReference connectVia = default(IntegrationRuntimeReference), string description = default(string), IDictionary parameters = default(IDictionary), IList annotations = default(IList), object existingClusterId = default(object), object newClusterVersion = default(object), object newClusterNumOfWorker = default(object), object newClusterNodeType = default(object), IDictionary newClusterSparkConf = default(IDictionary), IDictionary newClusterSparkEnvVars = default(IDictionary), IDictionary newClusterCustomTags = default(IDictionary), object newClusterDriverNodeType = default(object), object newClusterInitScripts = default(object), object newClusterEnableElasticDisk = default(object), object encryptedCredential = default(object)) + public AzureDatabricksLinkedService(object domain, SecretBase accessToken, IDictionary additionalProperties = default(IDictionary), IntegrationRuntimeReference connectVia = default(IntegrationRuntimeReference), string description = default(string), IDictionary parameters = default(IDictionary), IList annotations = default(IList), object existingClusterId = default(object), object instancePoolId = default(object), object newClusterVersion = default(object), object newClusterNumOfWorker = default(object), object newClusterNodeType = default(object), IDictionary newClusterSparkConf = default(IDictionary), IDictionary newClusterSparkEnvVars = default(IDictionary), IDictionary newClusterCustomTags = default(IDictionary), object newClusterDriverNodeType = default(object), object newClusterInitScripts = default(object), object newClusterEnableElasticDisk = default(object), object encryptedCredential = default(object)) : base(additionalProperties, connectVia, description, parameters, annotations) { Domain = domain; AccessToken = accessToken; ExistingClusterId = existingClusterId; + InstancePoolId = instancePoolId; NewClusterVersion = newClusterVersion; NewClusterNumOfWorker = newClusterNumOfWorker; NewClusterNodeType = newClusterNodeType; @@ -122,32 +141,49 @@ public AzureDatabricksLinkedService() public SecretBase AccessToken { get; set; } /// - /// Gets or sets the id of an existing cluster that will be used for - /// all runs of this job. Type: string (or Expression with resultType - /// string). + /// Gets or sets the id of an existing interactive cluster that will be + /// used for all runs of this activity. Type: string (or Expression + /// with resultType string). /// [JsonProperty(PropertyName = "typeProperties.existingClusterId")] public object ExistingClusterId { get; set; } /// - /// Gets or sets the Spark version of new cluster. Type: string (or - /// Expression with resultType string). + /// Gets or sets the id of an existing instance pool that will be used + /// for all runs of this activity. Type: string (or Expression with + /// resultType string). + /// + [JsonProperty(PropertyName = "typeProperties.instancePoolId")] + public object InstancePoolId { get; set; } + + /// + /// Gets or sets if not using an existing interactive cluster, this + /// specifies the Spark version of a new job cluster or instance pool + /// nodes created for each run of this activity. Required if + /// instancePoolId is specified. Type: string (or Expression with + /// resultType string). /// [JsonProperty(PropertyName = "typeProperties.newClusterVersion")] public object NewClusterVersion { get; set; } /// - /// Gets or sets number of worker nodes that new cluster should have. A - /// string formatted Int32, like '1' means numOfWorker is 1 or '1:10' - /// means auto-scale from 1 as min and 10 as max. Type: string (or - /// Expression with resultType string). + /// Gets or sets if not using an existing interactive cluster, this + /// specifies the number of worker nodes to use for the new job cluster + /// or instance pool. For new job clusters, this a string-formatted + /// Int32, like '1' means numOfWorker is 1 or '1:10' means auto-scale + /// from 1 (min) to 10 (max). For instance pools, this is a + /// string-formatted Int32, and can only specify a fixed number of + /// worker nodes, such as '2'. Required if newClusterVersion is + /// specified. Type: string (or Expression with resultType string). /// [JsonProperty(PropertyName = "typeProperties.newClusterNumOfWorker")] public object NewClusterNumOfWorker { get; set; } /// - /// Gets or sets the node types of new cluster. Type: string (or - /// Expression with resultType string). + /// Gets or sets the node type of the new job cluster. This property is + /// required if newClusterVersion is specified and instancePoolId is + /// not specified. If instancePoolId is specified, this property is + /// ignored. Type: string (or Expression with resultType string). /// [JsonProperty(PropertyName = "typeProperties.newClusterNodeType")] public object NewClusterNodeType { get; set; } @@ -167,13 +203,15 @@ public AzureDatabricksLinkedService() public IDictionary NewClusterSparkEnvVars { get; set; } /// - /// Gets or sets additional tags for cluster resources. + /// Gets or sets additional tags for cluster resources. This property + /// is ignored in instance pool configurations. /// [JsonProperty(PropertyName = "typeProperties.newClusterCustomTags")] public IDictionary NewClusterCustomTags { get; set; } /// - /// Gets or sets the driver node type for the new cluster. Type: string + /// Gets or sets the driver node type for the new job cluster. This + /// property is ignored in instance pool configurations. Type: string /// (or Expression with resultType string). /// [JsonProperty(PropertyName = "typeProperties.newClusterDriverNodeType")] @@ -188,7 +226,9 @@ public AzureDatabricksLinkedService() public object NewClusterInitScripts { get; set; } /// - /// Gets or sets enable the elastic disk on the new cluster. Type: + /// Gets or sets enable the elastic disk on the new cluster. This + /// property is now ignored, and takes the default elastic disk + /// behavior in Databricks (elastic disks are always enabled). Type: /// boolean (or Expression with resultType boolean). /// [JsonProperty(PropertyName = "typeProperties.newClusterEnableElasticDisk")] diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs new file mode 100644 index 000000000000..5f3386bbedc7 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs @@ -0,0 +1,126 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Trigger that allows the referenced pipeline to depend on other pipeline + /// runs based on runDimension Name/Value pairs. Upstream pipelines should + /// declare the same runDimension Name and their runs should have the + /// values for those runDimensions. The referenced pipeline run would be + /// triggered if the values for the runDimension match for all upstream + /// pipeline runs. + /// + [Rest.Serialization.JsonTransformation] + public partial class ChainingTrigger : Trigger + { + /// + /// Initializes a new instance of the ChainingTrigger class. + /// + public ChainingTrigger() + { + Pipeline = new TriggerPipelineReference(); + CustomInit(); + } + + /// + /// Initializes a new instance of the ChainingTrigger class. + /// + /// Pipeline for which runs are created when all + /// upstream pipelines complete successfully. + /// Upstream Pipelines. + /// Run Dimension property that needs to be + /// emitted by upstream pipelines. + /// Unmatched properties from the + /// message are deserialized this collection + /// Trigger description. + /// Indicates if trigger is running or not. + /// Updated when Start/Stop APIs are called on the Trigger. Possible + /// values include: 'Started', 'Stopped', 'Disabled' + /// List of tags that can be used for + /// describing the trigger. + public ChainingTrigger(TriggerPipelineReference pipeline, IList dependsOn, string runDimension, IDictionary additionalProperties = default(IDictionary), string description = default(string), string runtimeState = default(string), IList annotations = default(IList)) + : base(additionalProperties, description, runtimeState, annotations) + { + Pipeline = pipeline; + DependsOn = dependsOn; + RunDimension = runDimension; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets pipeline for which runs are created when all upstream + /// pipelines complete successfully. + /// + [JsonProperty(PropertyName = "pipeline")] + public TriggerPipelineReference Pipeline { get; set; } + + /// + /// Gets or sets upstream Pipelines. + /// + [JsonProperty(PropertyName = "typeProperties.dependsOn")] + public IList DependsOn { get; set; } + + /// + /// Gets or sets run Dimension property that needs to be emitted by + /// upstream pipelines. + /// + [JsonProperty(PropertyName = "typeProperties.runDimension")] + public string RunDimension { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Pipeline == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Pipeline"); + } + if (DependsOn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DependsOn"); + } + if (RunDimension == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RunDimension"); + } + if (Pipeline != null) + { + Pipeline.Validate(); + } + if (DependsOn != null) + { + foreach (var element in DependsOn) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CmdkeySetup.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CmdkeySetup.cs new file mode 100644 index 000000000000..45d119702566 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CmdkeySetup.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The custom setup of running cmdkey commands. + /// + [Rest.Serialization.JsonTransformation] + public partial class CmdkeySetup : CustomSetupBase + { + /// + /// Initializes a new instance of the CmdkeySetup class. + /// + public CmdkeySetup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CmdkeySetup class. + /// + /// The server name of data source + /// access. + /// The user name of data source access. + /// The password of data source access. + public CmdkeySetup(object targetName, object userName, SecretBase password) + { + TargetName = targetName; + UserName = userName; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the server name of data source access. + /// + [JsonProperty(PropertyName = "typeProperties.targetName")] + public object TargetName { get; set; } + + /// + /// Gets or sets the user name of data source access. + /// + [JsonProperty(PropertyName = "typeProperties.userName")] + public object UserName { get; set; } + + /// + /// Gets or sets the password of data source access. + /// + [JsonProperty(PropertyName = "typeProperties.password")] + public SecretBase Password { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TargetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetName"); + } + if (UserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); + } + if (Password == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Password"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ComponentSetup.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ComponentSetup.cs new file mode 100644 index 000000000000..ac77e7b741ae --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ComponentSetup.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.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The custom setup of installing 3rd party components. + /// + [Rest.Serialization.JsonTransformation] + public partial class ComponentSetup : CustomSetupBase + { + /// + /// Initializes a new instance of the ComponentSetup class. + /// + public ComponentSetup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentSetup class. + /// + /// The name of the 3rd party + /// component. + /// The license key to activate the + /// component. + public ComponentSetup(string componentName, SecretBase licenseKey) + { + ComponentName = componentName; + LicenseKey = licenseKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the 3rd party component. + /// + [JsonProperty(PropertyName = "typeProperties.componentName")] + public string ComponentName { get; set; } + + /// + /// Gets or sets the license key to activate the component. + /// + [JsonProperty(PropertyName = "typeProperties.licenseKey")] + public SecretBase LicenseKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ComponentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ComponentName"); + } + if (LicenseKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LicenseKey"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CustomSetupBase.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CustomSetupBase.cs new file mode 100644 index 000000000000..eb4d7b084004 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/CustomSetupBase.cs @@ -0,0 +1,35 @@ +// +// 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.DataFactory.Models +{ + using System.Linq; + + /// + /// The base definition of the custom setup. + /// + public partial class CustomSetupBase + { + /// + /// Initializes a new instance of the CustomSetupBase class. + /// + public CustomSetupBase() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EnvironmentVariableSetup.cs new file mode 100644 index 000000000000..f5845ebf762b --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/EnvironmentVariableSetup.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.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The custom setup of setting environment variable. + /// + [Rest.Serialization.JsonTransformation] + public partial class EnvironmentVariableSetup : CustomSetupBase + { + /// + /// Initializes a new instance of the EnvironmentVariableSetup class. + /// + public EnvironmentVariableSetup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentVariableSetup class. + /// + /// The name of the environment + /// variable. + /// The value of the environment + /// variable. + public EnvironmentVariableSetup(string variableName, string variableValue) + { + VariableName = variableName; + VariableValue = variableValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the environment variable. + /// + [JsonProperty(PropertyName = "typeProperties.variableName")] + public string VariableName { get; set; } + + /// + /// Gets or sets the value of the environment variable. + /// + [JsonProperty(PropertyName = "typeProperties.variableValue")] + public string VariableValue { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VariableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VariableName"); + } + if (VariableValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VariableValue"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs index cd1b8b9fc3af..ce973fd96ae6 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/IntegrationRuntimeSsisProperties.cs @@ -46,7 +46,9 @@ public IntegrationRuntimeSsisProperties() /// managed dedicated integration runtime. /// The edition for the SSIS Integration Runtime. /// Possible values include: 'Standard', 'Enterprise' - public IntegrationRuntimeSsisProperties(IDictionary additionalProperties = default(IDictionary), IntegrationRuntimeSsisCatalogInfo catalogInfo = default(IntegrationRuntimeSsisCatalogInfo), string licenseType = default(string), IntegrationRuntimeCustomSetupScriptProperties customSetupScriptProperties = default(IntegrationRuntimeCustomSetupScriptProperties), IntegrationRuntimeDataProxyProperties dataProxyProperties = default(IntegrationRuntimeDataProxyProperties), string edition = default(string)) + /// Custom setup without + /// script properties for a SSIS integration runtime. + public IntegrationRuntimeSsisProperties(IDictionary additionalProperties = default(IDictionary), IntegrationRuntimeSsisCatalogInfo catalogInfo = default(IntegrationRuntimeSsisCatalogInfo), string licenseType = default(string), IntegrationRuntimeCustomSetupScriptProperties customSetupScriptProperties = default(IntegrationRuntimeCustomSetupScriptProperties), IntegrationRuntimeDataProxyProperties dataProxyProperties = default(IntegrationRuntimeDataProxyProperties), string edition = default(string), IList expressCustomSetupProperties = default(IList)) { AdditionalProperties = additionalProperties; CatalogInfo = catalogInfo; @@ -54,6 +56,7 @@ public IntegrationRuntimeSsisProperties() CustomSetupScriptProperties = customSetupScriptProperties; DataProxyProperties = dataProxyProperties; Edition = edition; + ExpressCustomSetupProperties = expressCustomSetupProperties; CustomInit(); } @@ -104,6 +107,13 @@ public IntegrationRuntimeSsisProperties() [JsonProperty(PropertyName = "edition")] public string Edition { get; set; } + /// + /// Gets or sets custom setup without script properties for a SSIS + /// integration runtime. + /// + [JsonProperty(PropertyName = "expressCustomSetupProperties")] + public IList ExpressCustomSetupProperties { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs index 1116608ddbf4..a76dbc6d1004 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.DataFactory.Models using System.Linq; /// - /// A copy activity source for an Office365 service. + /// A copy activity source for an Office 365 service. /// public partial class Office365Source : CopySource { @@ -55,7 +55,11 @@ public Office365Source() /// End time of the requested range for this /// dataset. Type: string (or Expression with resultType /// string). - public Office365Source(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object allowedGroups = default(object), object userScopeFilterUri = default(object), object dateFilterColumn = default(object), object startTime = default(object), object endTime = default(object)) + /// The columns to be read out from the + /// Office 365 table. Type: array of objects (or Expression with + /// resultType array of objects). Example: [ { "name": "Id" }, { + /// "name": "CreatedDateTime" } ] + public Office365Source(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object allowedGroups = default(object), object userScopeFilterUri = default(object), object dateFilterColumn = default(object), object startTime = default(object), object endTime = default(object), object outputColumns = default(object)) : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections) { AllowedGroups = allowedGroups; @@ -63,6 +67,7 @@ public Office365Source() DateFilterColumn = dateFilterColumn; StartTime = startTime; EndTime = endTime; + OutputColumns = outputColumns; CustomInit(); } @@ -108,5 +113,14 @@ public Office365Source() [JsonProperty(PropertyName = "endTime")] public object EndTime { get; set; } + /// + /// Gets or sets the columns to be read out from the Office 365 table. + /// Type: array of objects (or Expression with resultType array of + /// objects). Example: [ { "name": "Id" }, { "name": "CreatedDateTime" + /// } ] + /// + [JsonProperty(PropertyName = "outputColumns")] + public object OutputColumns { get; set; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs new file mode 100644 index 000000000000..ab3d94b1cc48 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.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.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ORC dataset. + /// + [Newtonsoft.Json.JsonObject("Orc")] + [Rest.Serialization.JsonTransformation] + public partial class OrcDataset : Dataset + { + /// + /// Initializes a new instance of the OrcDataset class. + /// + public OrcDataset() + { + LinkedServiceName = new LinkedServiceReference(); + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcDataset class. + /// + /// Linked service reference. + /// The location of the ORC data + /// storage. + /// Unmatched properties from the + /// message are deserialized this collection + /// Dataset description. + /// Columns that define the structure of the + /// dataset. Type: array (or Expression with resultType array), + /// itemType: DatasetDataElement. + /// Columns that define the physical type schema + /// of the dataset. Type: array (or Expression with resultType array), + /// itemType: DatasetSchemaDataElement. + /// Parameters for dataset. + /// List of tags that can be used for + /// describing the Dataset. + /// The folder that this Dataset is in. If not + /// specified, Dataset will appear at the root level. + public OrcDataset(LinkedServiceReference linkedServiceName, DatasetLocation location, IDictionary additionalProperties = default(IDictionary), string description = default(string), object structure = default(object), object schema = default(object), IDictionary parameters = default(IDictionary), IList annotations = default(IList), DatasetFolder folder = default(DatasetFolder)) + : base(linkedServiceName, additionalProperties, description, structure, schema, parameters, annotations, folder) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location of the ORC data storage. + /// + [JsonProperty(PropertyName = "typeProperties.location")] + public DatasetLocation Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + if (Location != null) + { + Location.Validate(); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs new file mode 100644 index 000000000000..0eb07d896d9e --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A copy activity ORC sink. + /// + public partial class OrcSink : CopySink + { + /// + /// Initializes a new instance of the OrcSink class. + /// + public OrcSink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcSink class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Write batch size. Type: integer (or + /// Expression with resultType integer), minimum: 0. + /// Write batch timeout. Type: string + /// (or Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// Sink retry count. Type: integer (or + /// Expression with resultType integer). + /// Sink retry wait. Type: string (or + /// Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// The maximum concurrent + /// connection count for the sink data store. Type: integer (or + /// Expression with resultType integer). + /// ORC store settings. + public OrcSink(IDictionary additionalProperties = default(IDictionary), object writeBatchSize = default(object), object writeBatchTimeout = default(object), object sinkRetryCount = default(object), object sinkRetryWait = default(object), object maxConcurrentConnections = default(object), StoreWriteSettings storeSettings = default(StoreWriteSettings)) + : base(additionalProperties, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections) + { + StoreSettings = storeSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ORC store settings. + /// + [JsonProperty(PropertyName = "storeSettings")] + public StoreWriteSettings StoreSettings { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs new file mode 100644 index 000000000000..6a3f09c364bd --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs @@ -0,0 +1,77 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A copy activity ORC source. + /// + public partial class OrcSource : CopySource + { + /// + /// Initializes a new instance of the OrcSource class. + /// + public OrcSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcSource class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Source retry count. Type: integer + /// (or Expression with resultType integer). + /// Source retry wait. Type: string (or + /// Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// The maximum concurrent + /// connection count for the source data store. Type: integer (or + /// Expression with resultType integer). + /// ORC store settings. + public OrcSource(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), StoreReadSettings storeSettings = default(StoreReadSettings)) + : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections) + { + StoreSettings = storeSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ORC store settings. + /// + [JsonProperty(PropertyName = "storeSettings")] + public StoreReadSettings StoreSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs index 4c376ee88166..71b481d9e008 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs @@ -48,9 +48,10 @@ public PipelineResource() /// pipeline. /// List of tags that can be used for /// describing the Pipeline. + /// Dimensions emitted by Pipeline. /// The folder that this Pipeline is in. If not /// specified, Pipeline will appear at the root level. - public PipelineResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary additionalProperties = default(IDictionary), string description = default(string), IList activities = default(IList), IDictionary parameters = default(IDictionary), IDictionary variables = default(IDictionary), int? concurrency = default(int?), IList annotations = default(IList), PipelineFolder folder = default(PipelineFolder)) + public PipelineResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary additionalProperties = default(IDictionary), string description = default(string), IList activities = default(IList), IDictionary parameters = default(IDictionary), IDictionary variables = default(IDictionary), int? concurrency = default(int?), IList annotations = default(IList), IDictionary runDimensions = default(IDictionary), PipelineFolder folder = default(PipelineFolder)) : base(id, name, type, etag) { AdditionalProperties = additionalProperties; @@ -60,6 +61,7 @@ public PipelineResource() Variables = variables; Concurrency = concurrency; Annotations = annotations; + RunDimensions = runDimensions; Folder = folder; CustomInit(); } @@ -113,6 +115,12 @@ public PipelineResource() [JsonProperty(PropertyName = "properties.annotations")] public IList Annotations { get; set; } + /// + /// Gets or sets dimensions emitted by Pipeline. + /// + [JsonProperty(PropertyName = "properties.runDimensions")] + public IDictionary RunDimensions { get; set; } + /// /// Gets or sets the folder that this Pipeline is in. If not specified, /// Pipeline will appear at the root level. diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs index 7210c76a29e6..f1d431a01efa 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs @@ -41,6 +41,8 @@ public PipelineRun() /// The pipeline name. /// The full or partial list of parameter /// name, value pair used in the pipeline run. + /// Run dimensions emitted by Pipeline + /// run. /// Entity that started the pipeline /// run. /// The last updated timestamp for the @@ -52,7 +54,7 @@ public PipelineRun() /// The duration of a pipeline run. /// The status of a pipeline run. /// The message from a pipeline run. - public PipelineRun(IDictionary additionalProperties = default(IDictionary), string runId = default(string), string runGroupId = default(string), bool? isLatest = default(bool?), string pipelineName = default(string), IDictionary parameters = default(IDictionary), PipelineRunInvokedBy invokedBy = default(PipelineRunInvokedBy), System.DateTime? lastUpdated = default(System.DateTime?), System.DateTime? runStart = default(System.DateTime?), System.DateTime? runEnd = default(System.DateTime?), int? durationInMs = default(int?), string status = default(string), string message = default(string)) + public PipelineRun(IDictionary additionalProperties = default(IDictionary), string runId = default(string), string runGroupId = default(string), bool? isLatest = default(bool?), string pipelineName = default(string), IDictionary parameters = default(IDictionary), IDictionary runDimensions = default(IDictionary), PipelineRunInvokedBy invokedBy = default(PipelineRunInvokedBy), System.DateTime? lastUpdated = default(System.DateTime?), System.DateTime? runStart = default(System.DateTime?), System.DateTime? runEnd = default(System.DateTime?), int? durationInMs = default(int?), string status = default(string), string message = default(string)) { AdditionalProperties = additionalProperties; RunId = runId; @@ -60,6 +62,7 @@ public PipelineRun() IsLatest = isLatest; PipelineName = pipelineName; Parameters = parameters; + RunDimensions = runDimensions; InvokedBy = invokedBy; LastUpdated = lastUpdated; RunStart = runStart; @@ -115,6 +118,12 @@ public PipelineRun() [JsonProperty(PropertyName = "parameters")] public IDictionary Parameters { get; private set; } + /// + /// Gets run dimensions emitted by Pipeline run. + /// + [JsonProperty(PropertyName = "runDimensions")] + public IDictionary RunDimensions { get; private set; } + /// /// Gets entity that started the pipeline run. /// diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SsisPackageLocation.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SSISPackageLocation.cs similarity index 100% rename from sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SsisPackageLocation.cs rename to sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SSISPackageLocation.cs diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs index 8ec466fcd6e5..5e9e585d51f8 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs @@ -44,7 +44,11 @@ public TriggerRun() /// trigger run. Name, value pair depends on type of trigger. /// List of pipeline name and run Id /// triggered by the trigger run. - public TriggerRun(IDictionary additionalProperties = default(IDictionary), string triggerRunId = default(string), string triggerName = default(string), string triggerType = default(string), System.DateTime? triggerRunTimestamp = default(System.DateTime?), string status = default(string), string message = default(string), IDictionary properties = default(IDictionary), IDictionary triggeredPipelines = default(IDictionary)) + /// Run dimension for which trigger was + /// fired. + /// Status of the upstream + /// pipelines. + public TriggerRun(IDictionary additionalProperties = default(IDictionary), string triggerRunId = default(string), string triggerName = default(string), string triggerType = default(string), System.DateTime? triggerRunTimestamp = default(System.DateTime?), string status = default(string), string message = default(string), IDictionary properties = default(IDictionary), IDictionary triggeredPipelines = default(IDictionary), IDictionary runDimension = default(IDictionary), IDictionary dependencyStatus = default(IDictionary)) { AdditionalProperties = additionalProperties; TriggerRunId = triggerRunId; @@ -55,6 +59,8 @@ public TriggerRun() Message = message; Properties = properties; TriggeredPipelines = triggeredPipelines; + RunDimension = runDimension; + DependencyStatus = dependencyStatus; CustomInit(); } @@ -120,5 +126,17 @@ public TriggerRun() [JsonProperty(PropertyName = "triggeredPipelines")] public IDictionary TriggeredPipelines { get; private set; } + /// + /// Gets run dimension for which trigger was fired. + /// + [JsonProperty(PropertyName = "runDimension")] + public IDictionary RunDimension { get; private set; } + + /// + /// Gets status of the upstream pipelines. + /// + [JsonProperty(PropertyName = "dependencyStatus")] + public IDictionary DependencyStatus { get; private set; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs index 6c4f6b0598b1..afb3bebe6aa9 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs @@ -36,16 +36,5 @@ public static IEnumerable> ApiInfo_DataFactoryMana }.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/datafactory/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --tag=package-2018-06 --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "fb8f078deac2367f3dbcfbd8a542c77083c28a5b"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs index c5d90965e6b4..5da100b5b861 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs @@ -442,6 +442,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 namespace. Once created, this namespace's /// resource manifest is immutable. This operation is idempotent. /// @@ -560,5 +585,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/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs index c62283f38142..b9d7e86c02d0 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs @@ -3161,6 +3161,219 @@ internal NamespacesOperations(EventHubManagementClient 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.EventHub/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 namespace. Once created, this namespace's resource /// manifest is immutable. This operation is idempotent. @@ -4109,5 +4322,173 @@ internal NamespacesOperations(EventHubManagementClient 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/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs index 26e4b04409d5..409eed350c43 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs @@ -701,6 +701,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 namespace. Once created, this namespace's resource /// manifest is immutable. This operation is idempotent. @@ -892,5 +932,39 @@ public static IPage ListAuthorizationRulesNext(this INamespac } } + /// + /// 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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs index b905761494d8..91fcce4aeb28 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs @@ -52,7 +52,7 @@ public partial class HealthcareApisManagementClient : ServiceClient - /// The version of the API. + /// Client Api Version. /// public string ApiVersion { get; private set; } @@ -334,7 +334,7 @@ private void Initialize() Operations = new Operations(this); OperationResults = new OperationResultsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-08-20-preview"; + ApiVersion = "2019-09-16"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs index 19b39d21a6c6..0582aaf46518 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs @@ -46,7 +46,7 @@ public partial interface IHealthcareApisManagementClient : System.IDisposable string SubscriptionId { get; set; } /// - /// The version of the API. + /// Client Api Version. /// string ApiVersion { get; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs deleted file mode 100644 index ba45d3bb6023..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// 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.HealthcareApis.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Input values. - /// - public partial class MoveResourcesParameters - { - /// - /// Initializes a new instance of the MoveResourcesParameters class. - /// - public MoveResourcesParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MoveResourcesParameters class. - /// - /// The target subscription to move - /// resources to. - /// The target resource group to - /// move resources to. - /// The list of resources to - /// move. - public MoveResourcesParameters(string targetSubscriptionId, string targetResourceGroupName, IList resourceIdsToMove) - { - TargetSubscriptionId = targetSubscriptionId; - TargetResourceGroupName = targetResourceGroupName; - ResourceIdsToMove = resourceIdsToMove; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the target subscription to move resources to. - /// - [JsonProperty(PropertyName = "targetSubscriptionId")] - public string TargetSubscriptionId { get; set; } - - /// - /// Gets or sets the target resource group to move resources to. - /// - [JsonProperty(PropertyName = "targetResourceGroupName")] - public string TargetResourceGroupName { get; set; } - - /// - /// Gets or sets the list of resources to move. - /// - [JsonProperty(PropertyName = "resourceIdsToMove")] - public IList ResourceIdsToMove { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TargetSubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetSubscriptionId"); - } - if (TargetResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceGroupName"); - } - if (ResourceIdsToMove == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceIdsToMove"); - } - if (ResourceIdsToMove != null) - { - if (ResourceIdsToMove.Count > 250) - { - throw new ValidationException(ValidationRules.MaxItems, "ResourceIdsToMove", 250); - } - if (ResourceIdsToMove.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "ResourceIdsToMove", 1); - } - } - } - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs index 849a717cd55d..f01af7e84f4f 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs @@ -33,9 +33,8 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// The kind of the service. Possible values + /// include: 'fhir', 'fhir-Stu3', 'fhir-R4' /// The resource location. /// The resource identifier. /// The resource name. @@ -79,9 +78,8 @@ public Resource() public string Type { get; private set; } /// - /// Gets or sets the kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// Gets or sets the kind of the service. Possible values include: + /// 'fhir', 'fhir-Stu3', 'fhir-R4' /// [JsonProperty(PropertyName = "kind")] public Kind Kind { get; set; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs index e9f4d4139b57..2628f7272561 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs @@ -30,8 +30,8 @@ public ServiceAccessPolicyEntry() /// /// Initializes a new instance of the ServiceAccessPolicyEntry class. /// - /// An object ID that is allowed access to the - /// FHIR service. + /// An Azure AD object ID (User or Apps) that is + /// allowed access to the FHIR service. public ServiceAccessPolicyEntry(string objectId) { ObjectId = objectId; @@ -44,8 +44,8 @@ public ServiceAccessPolicyEntry(string objectId) partial void CustomInit(); /// - /// Gets or sets an object ID that is allowed access to the FHIR - /// service. + /// Gets or sets an Azure AD object ID (User or Apps) that is allowed + /// access to the FHIR service. /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs index 7ff0a2c3ca34..02d27083ac45 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs @@ -31,9 +31,8 @@ public ServicesDescription() /// /// Initializes a new instance of the ServicesDescription class. /// - /// The kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// The kind of the service. Possible values + /// include: 'fhir', 'fhir-Stu3', 'fhir-R4' /// The resource location. /// The resource identifier. /// The resource name. diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs deleted file mode 100644 index 65e0edcd2498..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// 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.HealthcareApis -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MoveResourcesStatusOperations. - /// - public static partial class MoveResourcesStatusOperationsExtensions - { - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - public static object Get(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId) - { - return operations.GetAsync(locationName, operationResultId).GetAwaiter().GetResult(); - } - - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(locationName, operationResultId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs index c9cccf09efb7..c037a4dbe436 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs @@ -82,6 +82,10 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs index 326523891511..5f5cb16bf3f3 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs @@ -65,11 +65,21 @@ internal Operations(HealthcareApisManagementClient client) /// /// 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; diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs index 1b7156ad8962..a0f9f7e31853 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs @@ -19,9 +19,9 @@ public static IEnumerable> ApiInfo_HealthcareApisM { return new Tuple[] { - new Tuple("HealthcareApis", "OperationResults", "2018-08-20-preview"), - new Tuple("HealthcareApis", "Operations", "2018-08-20-preview"), - new Tuple("HealthcareApis", "Services", "2018-08-20-preview"), + new Tuple("HealthcareApis", "OperationResults", "2019-09-16"), + new Tuple("HealthcareApis", "Operations", "2019-09-16"), + new Tuple("HealthcareApis", "Services", "2019-09-16"), }.AsEnumerable(); } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs index 0daea70e3748..5f9a054b8b3c 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs @@ -82,6 +82,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -361,6 +365,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -533,6 +541,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -727,6 +739,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityParameters checkNameAvailabilityInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -920,6 +936,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1169,6 +1189,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1390,6 +1414,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs index 6c2670299f9b..daad14f39f98 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs @@ -24,19 +24,23 @@ namespace Microsoft.Azure.Management.IotHub public partial interface IIotHubOperations { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the + /// value from the secondary location in the locations property. To + /// learn more, see https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// The headers that will be added to request. @@ -52,19 +56,23 @@ public partial interface IIotHubOperations /// Task ManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the + /// value from the secondary location in the locations property. To + /// learn more, see https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// The headers that will be added to request. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs index 460dd9fe79be..d333bdf74b4f 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs @@ -346,7 +346,7 @@ private void Initialize() Certificates = new CertificatesOperations(this); IotHub = new IotHubOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-03-22-preview"; + ApiVersion = "2019-03-22"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs index 7134be018cc5..e560aa78eeb0 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs @@ -51,19 +51,22 @@ internal IotHubOperations(IotHubClient client) public IotHubClient Client { get; private set; } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// The headers that will be added to request. @@ -79,19 +82,22 @@ internal IotHubOperations(IotHubClient client) } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// Headers that will be added to request. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs index 6dbd00354cf6..179cbc75c755 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs @@ -22,22 +22,25 @@ namespace Microsoft.Azure.Management.IotHub public static partial class IotHubOperationsExtensions { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// public static void ManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) { @@ -45,22 +48,25 @@ public static void ManualFailover(this IIotHubOperations operations, string iotH } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// The cancellation token. @@ -71,22 +77,25 @@ public static void ManualFailover(this IIotHubOperations operations, string iotH } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// public static void BeginManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) { @@ -94,22 +103,25 @@ public static void BeginManualFailover(this IIotHubOperations operations, string } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource /// /// /// The cancellation token. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs deleted file mode 100644 index b277ee3a4127..000000000000 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// 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.IotHub.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The properties of an enrichment that your IoT hub applies to messages - /// delivered to endpoints. - /// - public partial class EnrichmentProperties - { - /// - /// Initializes a new instance of the EnrichmentProperties class. - /// - public EnrichmentProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnrichmentProperties class. - /// - /// The key or name for the enrichment - /// property. - /// The value for the enrichment property. - /// The list of endpoints for which the - /// enrichment is applied to the message. - public EnrichmentProperties(string key, string value, IList endpointNames) - { - Key = key; - Value = value; - EndpointNames = endpointNames; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the key or name for the enrichment property. - /// - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - - /// - /// Gets or sets the value for the enrichment property. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the list of endpoints for which the enrichment is - /// applied to the message. - /// - [JsonProperty(PropertyName = "endpointNames")] - public IList EndpointNames { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Key == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Key"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (EndpointNames == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EndpointNames"); - } - if (EndpointNames != null) - { - if (EndpointNames.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "EndpointNames", 1); - } - } - } - } -} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs index 81b9b6254fe0..0adf8e3c46fe 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs @@ -30,9 +30,13 @@ public IotHubLocationDescription() /// /// Initializes a new instance of the IotHubLocationDescription class. /// - /// Azure Geo Regions - /// Specific Role assigned to this location. - /// Possible values include: 'primary', 'secondary' + /// The name of the Azure region + /// The role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the Azure disaster recovery + /// (DR) paired region and also the region where the IoT hub can + /// failover to. Possible values include: 'primary', + /// 'secondary' public IotHubLocationDescription(string location = default(string), string role = default(string)) { Location = location; @@ -46,14 +50,17 @@ public IotHubLocationDescription() partial void CustomInit(); /// - /// Gets or sets azure Geo Regions + /// Gets or sets the name of the Azure region /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// - /// Gets or sets specific Role assigned to this location. Possible - /// values include: 'primary', 'secondary' + /// Gets or sets the role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the Azure disaster recovery + /// (DR) paired region and also the region where the IoT hub can + /// failover to. Possible values include: 'primary', 'secondary' /// [JsonProperty(PropertyName = "role")] public string Role { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs index 77b4a13002f3..bc0a2480a45b 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs @@ -53,14 +53,12 @@ public IotHubProperties() /// If True, file upload /// notifications are enabled. /// IoT hub comments. - /// The device streams properties of - /// iothub. /// The capabilities and features enabled for /// the IoT hub. Possible values include: 'None', /// 'DeviceManagement' /// Primary and secondary location for iot /// hub - public IotHubProperties(IList authorizationPolicies = default(IList), IList ipFilterRules = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), IotHubPropertiesDeviceStreams deviceStreams = default(IotHubPropertiesDeviceStreams), string features = default(string), IList locations = default(IList)) + public IotHubProperties(IList authorizationPolicies = default(IList), IList ipFilterRules = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), string features = default(string), IList locations = default(IList)) { AuthorizationPolicies = authorizationPolicies; IpFilterRules = ipFilterRules; @@ -74,7 +72,6 @@ public IotHubProperties() EnableFileUploadNotifications = enableFileUploadNotifications; CloudToDevice = cloudToDevice; Comments = comments; - DeviceStreams = deviceStreams; Features = features; Locations = locations; CustomInit(); @@ -166,12 +163,6 @@ public IotHubProperties() [JsonProperty(PropertyName = "comments")] public string Comments { get; set; } - /// - /// Gets or sets the device streams properties of iothub. - /// - [JsonProperty(PropertyName = "deviceStreams")] - public IotHubPropertiesDeviceStreams DeviceStreams { get; set; } - /// /// Gets or sets the capabilities and features enabled for the IoT hub. /// Possible values include: 'None', 'DeviceManagement' diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs index 43333e1f9020..1c77b24f666e 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs @@ -42,15 +42,11 @@ public RoutingProperties() /// this property is not set, the messages which do not meet any of the /// conditions specified in the 'routes' section get routed to the /// built-in eventhub endpoint. - /// The list of user-provided enrichments - /// that the IoT hub applies to messages to be delivered to built-in - /// and custom endpoints. See: https://aka.ms/iotmsgenrich - public RoutingProperties(RoutingEndpoints endpoints = default(RoutingEndpoints), IList routes = default(IList), FallbackRouteProperties fallbackRoute = default(FallbackRouteProperties), IList enrichments = default(IList)) + public RoutingProperties(RoutingEndpoints endpoints = default(RoutingEndpoints), IList routes = default(IList), FallbackRouteProperties fallbackRoute = default(FallbackRouteProperties)) { Endpoints = endpoints; Routes = routes; FallbackRoute = fallbackRoute; - Enrichments = enrichments; CustomInit(); } @@ -84,14 +80,6 @@ public RoutingProperties() [JsonProperty(PropertyName = "fallbackRoute")] public FallbackRouteProperties FallbackRoute { get; set; } - /// - /// Gets or sets the list of user-provided enrichments that the IoT hub - /// applies to messages to be delivered to built-in and custom - /// endpoints. See: https://aka.ms/iotmsgenrich - /// - [JsonProperty(PropertyName = "enrichments")] - public IList Enrichments { get; set; } - /// /// Validate the object. /// @@ -114,16 +102,6 @@ public virtual void Validate() { FallbackRoute.Validate(); } - if (Enrichments != null) - { - foreach (var element1 in Enrichments) - { - if (element1 != null) - { - element1.Validate(); - } - } - } } } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs index 8c714a355a2f..ed595d80c15d 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs @@ -19,24 +19,13 @@ public static IEnumerable> ApiInfo_iotHubClient { return new Tuple[] { - new Tuple("Devices", "Certificates", "2019-03-22-preview"), - new Tuple("Devices", "IotHub", "2019-03-22-preview"), - new Tuple("Devices", "IotHubResource", "2019-03-22-preview"), - new Tuple("Devices", "Operations", "2019-03-22-preview"), - new Tuple("Devices", "ResourceProviderCommon", "2019-03-22-preview"), + new Tuple("Devices", "Certificates", "2019-03-22"), + new Tuple("Devices", "IotHub", "2019-03-22"), + new Tuple("Devices", "IotHubResource", "2019-03-22"), + new Tuple("Devices", "Operations", "2019-03-22"), + new Tuple("Devices", "ResourceProviderCommon", "2019-03-22"), }.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/iothub/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "2a65faa9ddbf9970708ba507eeb8071a2d310b57"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs index c10b601772c6..3fdd679fff08 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs @@ -356,7 +356,7 @@ private void Initialize() MountTargets = new MountTargetsOperations(this); Snapshots = new SnapshotsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-06-01"; + ApiVersion = "2019-07-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ExportPolicyRule.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ExportPolicyRule.cs index 20a4bd48bccc..629b0da22af0 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ExportPolicyRule.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ExportPolicyRule.cs @@ -34,18 +34,18 @@ public ExportPolicyRule() /// Read and write access /// Allows CIFS protocol /// Allows NFSv3 protocol - /// Allows NFSv4 protocol + /// Allows NFSv4.1 protocol /// Client ingress specification as comma /// separated string with IPv4 CIDRs, IPv4 host addresses and host /// names - public ExportPolicyRule(int? ruleIndex = default(int?), bool? unixReadOnly = default(bool?), bool? unixReadWrite = default(bool?), bool? cifs = default(bool?), bool? nfsv3 = default(bool?), bool? nfsv4 = default(bool?), string allowedClients = default(string)) + public ExportPolicyRule(int? ruleIndex = default(int?), bool? unixReadOnly = default(bool?), bool? unixReadWrite = default(bool?), bool? cifs = default(bool?), bool? nfsv3 = default(bool?), bool? nfsv41 = default(bool?), string allowedClients = default(string)) { RuleIndex = ruleIndex; UnixReadOnly = unixReadOnly; UnixReadWrite = unixReadWrite; Cifs = cifs; Nfsv3 = nfsv3; - Nfsv4 = nfsv4; + Nfsv41 = nfsv41; AllowedClients = allowedClients; CustomInit(); } @@ -86,10 +86,10 @@ public ExportPolicyRule() public bool? Nfsv3 { get; set; } /// - /// Gets or sets allows NFSv4 protocol + /// Gets or sets allows NFSv4.1 protocol /// - [JsonProperty(PropertyName = "nfsv4")] - public bool? Nfsv4 { get; set; } + [JsonProperty(PropertyName = "nfsv41")] + public bool? Nfsv41 { get; set; } /// /// Gets or sets client ingress specification as comma separated string diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Snapshot.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Snapshot.cs index 63b6e44d25c2..f02a7d4889ca 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Snapshot.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Snapshot.cs @@ -40,9 +40,9 @@ public Snapshot() /// Resource tags /// snapshotId /// fileSystemId - /// name + /// name /// Azure lifecycle management - public Snapshot(string location, string id = default(string), string name = default(string), string type = default(string), object tags = default(object), string snapshotId = default(string), string fileSystemId = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string)) + public Snapshot(string location, string id = default(string), string name = default(string), string type = default(string), object tags = default(object), string snapshotId = default(string), string fileSystemId = default(string), System.DateTime? created = default(System.DateTime?), string provisioningState = default(string)) { Location = location; Id = id; @@ -51,7 +51,7 @@ public Snapshot() Tags = tags; SnapshotId = snapshotId; FileSystemId = fileSystemId; - CreationDate = creationDate; + Created = created; ProvisioningState = provisioningState; CustomInit(); } @@ -115,8 +115,8 @@ public Snapshot() /// /// The creation date of the snapshot /// - [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; private set; } + [JsonProperty(PropertyName = "properties.created")] + public System.DateTime? Created { get; private set; } /// /// Gets azure lifecycle management diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs index 184c9caa6b80..2c8778d68497 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs @@ -19,14 +19,14 @@ public static IEnumerable> ApiInfo_NetAppManagemen { return new Tuple[] { - new Tuple("NetApp", "Accounts", "2019-06-01"), - new Tuple("NetApp", "CheckFilePathAvailability", "2019-06-01"), - new Tuple("NetApp", "CheckNameAvailability", "2019-06-01"), - new Tuple("NetApp", "MountTargets", "2019-06-01"), - new Tuple("NetApp", "Operations", "2019-06-01"), - new Tuple("NetApp", "Pools", "2019-06-01"), - new Tuple("NetApp", "Snapshots", "2019-06-01"), - new Tuple("NetApp", "Volumes", "2019-06-01"), + new Tuple("NetApp", "Accounts", "2019-07-01"), + new Tuple("NetApp", "CheckFilePathAvailability", "2019-07-01"), + new Tuple("NetApp", "CheckNameAvailability", "2019-07-01"), + new Tuple("NetApp", "MountTargets", "2019-07-01"), + new Tuple("NetApp", "Operations", "2019-07-01"), + new Tuple("NetApp", "Pools", "2019-07-01"), + new Tuple("NetApp", "Snapshots", "2019-07-01"), + new Tuple("NetApp", "Volumes", "2019-07-01"), }.AsEnumerable(); } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs index 7aa52a33381d..d6e0a0b50a27 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs @@ -27,7 +27,10 @@ public partial interface IServiceTagsOperations /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a + /// filter based on location, you will get the list of service tags + /// with prefix details across all regions but limited to the cloud + /// that your subscription belongs to). /// /// /// The headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs index 19fcffb4a449..fadd92b8afbd 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs @@ -108,16 +108,5 @@ public static IEnumerable> ApiInfo_NetworkManageme }.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/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Projects\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "9dacca31bc76fc9cc1f59ee62ed1ab1c8f0d61c6"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs index 6addc5e6580d..cb28c68ff4b4 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs @@ -54,7 +54,10 @@ internal ServiceTagsOperations(NetworkManagementClient client) /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// Headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs index d575231bde96..be01db34c7b1 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs @@ -28,7 +28,10 @@ public static partial class ServiceTagsOperationsExtensions /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// public static ServiceTagsListResult List(this IServiceTagsOperations operations, string location) { @@ -42,7 +45,10 @@ public static ServiceTagsListResult List(this IServiceTagsOperations operations, /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// The cancellation token. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs index f95591b8d989..32ba98539261 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs index 24d846de18d7..3b50883f2ef7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs index c2d8a945cae2..b1ac930e2c48 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs index e8f5895d4930..6ffabfd9df99 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs index 3c13cf4563bf..80274c97bc23 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs @@ -1,4 +1,8 @@ // +// 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. @@ -16,7 +20,7 @@ namespace Microsoft.Azure.Management.Peering using System.Threading.Tasks; /// - /// APIs to manage Peering resources through the Azure Resource Manager. + /// Peering Client /// public partial interface IPeeringManagementClient : System.IDisposable { @@ -123,9 +127,11 @@ public partial interface IPeeringManagementClient : System.IDisposable /// Checks if the peering service provider is present within 1000 miles /// of customer's location /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// The headers that will be added to request. @@ -133,7 +139,7 @@ public partial interface IPeeringManagementClient : System.IDisposable /// /// The cancellation token. /// - Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs index 2077c3ff18ce..4542b3a6e069 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs index e0bb14322943..616ef6ce2c7e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs index 9bc4e4b0cdbe..6f7e5fa560af 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs index e3bd51690a9a..9decb2909c55 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -108,7 +112,7 @@ public partial interface IPeeringServicesOperations /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The headers that will be added to request. @@ -125,7 +129,7 @@ public partial interface IPeeringServicesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the peering services under the given subscription and /// resource group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs index 40fb8db251aa..6c0cbd197e7e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -108,7 +112,7 @@ public partial interface IPeeringsOperations /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The headers that will be added to request. @@ -125,7 +129,7 @@ public partial interface IPeeringsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the peerings under the given subscription and resource /// group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs index 34927dc72ef9..63d0f3650045 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs index 3cf31c6319d7..99dd96469659 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs index 078c711c3099..77bb88c6daf6 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs index 040f6fa2d7b4..c661e56575b7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs index 279d48f81376..24ef7f9c760e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs index 6dc947f756bf..854cd63329ab 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs index d9cdbd9ae87a..73d7e8111531 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs index e5d4b5e2f2c2..3aa4fe6dd153 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs index efa35b18bf57..1bf764f9feeb 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs index 3ca527934b09..86a609020e8c 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs index d9eb52c8742b..8754219779a5 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs index cec1576f2c45..9eced8ee065e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs index 060fefabf744..48079d5d03f2 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs index eca74a8f6fdc..557fc135e136 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs index 5ea908359fb6..c665d28486d0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs index 0674d99e0578..2e841e4fef3f 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs index c72c959e4b16..fa055cb03d2a 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs index 50b94fdcbfbc..facd278af481 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs index a13943b92238..0c1e561b991e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs index 3dc6249a7037..b803cb4c26fc 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs index 31a43eb5bbf6..b8592e5aab38 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs index db1031ae4ffe..33b7cb00e7b7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs index bf305d4f172c..af9a12dbcb07 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs index c58f7cf3f9d1..78f94db9d452 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs index 75921877b606..1cf995ef7a57 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs index 0c7d8349c348..69550fa50557 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs index f1992d57fcde..fcac6e70fa33 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs index 220e44d47127..59a0ffd94d52 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs index 7fc0aca62366..39ac553528b1 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs index 7062fb3408d2..6c92dfdd4f26 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs index d1b1f1b65aea..36c2394debe4 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs index f0377d0fcb4a..6c778e77a813 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs index cb0719e21dfd..1cbca93ee403 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs index 5f2706b991d2..6392406fc954 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs index 53e0ea4f61b2..bd6eb6dbdc8b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs index 159af9cfb1cd..93e28e656b91 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs index b46ba7a28c67..f8328bbf9f3b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs index f3f55cdfb29c..e3064128884b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs index 8efa4d2a0583..6b424295f875 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs index 4f32bf3f5a0b..b439bc773f09 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs index b1f34a067265..9d3620d28872 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs index a204164bccda..75afcc848e14 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs index 9f5f1f9845e6..534c008149d3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs index 09d180b51ea1..82442b73bcf3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs index fc3631a057f6..ba14a3a3e681 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs index 40010abb26dd..1e758fcbf8e9 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs index 3bb6e9c51924..8be78042ca7c 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs index 18eb0dbf57d2..a534188bc988 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs index 2aa47f63508e..3944221030e9 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs index 23772b2ae156..98bc7adb7cb0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs index f47f220df1bc..4807bc9742a8 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs index 960bfd99d966..339a6fd5c5ca 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs @@ -1,4 +1,8 @@ // +// 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. @@ -20,7 +24,7 @@ namespace Microsoft.Azure.Management.Peering using System.Threading.Tasks; /// - /// APIs to manage Peering resources through the Azure Resource Manager. + /// Peering Client /// public partial class PeeringManagementClient : ServiceClient, IPeeringManagementClient, IAzureClient { @@ -412,9 +416,11 @@ private void Initialize() /// Checks if the peering service provider is present within 1000 miles of /// customer's location /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// Headers that will be added to request. @@ -437,12 +443,8 @@ private void Initialize() /// /// A response object containing the response body and response headers. /// - public async Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (checkServiceProviderAvailabilityInput == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "checkServiceProviderAvailabilityInput"); - } if (SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); @@ -451,6 +453,12 @@ private void Initialize() { throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); } + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput = new CheckServiceProviderAvailabilityInput(); + if (peeringServiceLocation != null || peeringServiceProvider != null) + { + checkServiceProviderAvailabilityInput.PeeringServiceLocation = peeringServiceLocation; + checkServiceProviderAvailabilityInput.PeeringServiceProvider = peeringServiceProvider; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs index 3cf93b236f66..370b366464d5 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -24,13 +28,15 @@ public static partial class PeeringManagementClientExtensions /// /// The operations group for this extension method. /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation /// - public static string CheckServiceProviderAvailability(this IPeeringManagementClient operations, CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) + /// + /// Gets or sets the PeeringServiceProvider + /// + public static string CheckServiceProviderAvailability(this IPeeringManagementClient operations, string peeringServiceLocation = default(string), string peeringServiceProvider = default(string)) { - return operations.CheckServiceProviderAvailabilityAsync(checkServiceProviderAvailabilityInput).GetAwaiter().GetResult(); + return operations.CheckServiceProviderAvailabilityAsync(peeringServiceLocation, peeringServiceProvider).GetAwaiter().GetResult(); } /// @@ -40,16 +46,18 @@ public static string CheckServiceProviderAvailability(this IPeeringManagementCli /// /// The operations group for this extension method. /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// The cancellation token. /// - public static async Task CheckServiceProviderAvailabilityAsync(this IPeeringManagementClient operations, CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckServiceProviderAvailabilityAsync(this IPeeringManagementClient operations, string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckServiceProviderAvailabilityWithHttpMessagesAsync(checkServiceProviderAvailabilityInput, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckServiceProviderAvailabilityWithHttpMessagesAsync(peeringServiceLocation, peeringServiceProvider, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs index 54ec9fc8aa67..72a7c60090e6 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs index 0d5431799281..1c14bcad8ac4 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs index 84ca6862ec3c..0f23284e10e3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs index 6d797b9a21d8..1c7b121140e3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs index 94e4cba6f4aa..c87dd239921b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs index 3aa3fc54cb62..899a2d16cc37 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs index 5b7cb092a84c..969074805a68 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -648,7 +652,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// Headers that will be added to request. @@ -671,7 +675,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -681,10 +685,6 @@ internal PeeringServicesOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); } - if (tags == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tags"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -693,6 +693,11 @@ internal PeeringServicesOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + ResourceTags tags1 = new ResourceTags(); + if (tags != null) + { + tags1.Tags = tags; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,7 +707,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("peeringServiceName", peeringServiceName); - tracingParameters.Add("tags", tags); + tracingParameters.Add("tags1", tags1); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -755,9 +760,9 @@ internal PeeringServicesOperations(PeeringManagementClient client) // Serialize Request string _requestContent = null; - if(tags != null) + if(tags1 != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags1, 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"); } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs index 135751d7332e..1c2cdfc0be82 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -9,6 +13,8 @@ namespace Microsoft.Azure.Management.Peering using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -160,9 +166,9 @@ public static void Delete(this IPeeringServicesOperations operations, string res /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// - public static PeeringService Update(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, ResourceTags tags) + public static PeeringService Update(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary)) { return operations.UpdateAsync(resourceGroupName, peeringServiceName, tags).GetAwaiter().GetResult(); } @@ -181,12 +187,12 @@ public static PeeringService Update(this IPeeringServicesOperations operations, /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, ResourceTags tags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, peeringServiceName, tags, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs index f500fb867401..05d4c7ccc3ef 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -648,7 +652,7 @@ internal PeeringsOperations(PeeringManagementClient client) /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// Headers that will be added to request. @@ -671,7 +675,7 @@ internal PeeringsOperations(PeeringManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -681,10 +685,6 @@ internal PeeringsOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "peeringName"); } - if (tags == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tags"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -693,6 +693,11 @@ internal PeeringsOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + ResourceTags tags1 = new ResourceTags(); + if (tags != null) + { + tags1.Tags = tags; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,7 +707,7 @@ internal PeeringsOperations(PeeringManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("peeringName", peeringName); - tracingParameters.Add("tags", tags); + tracingParameters.Add("tags1", tags1); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -755,9 +760,9 @@ internal PeeringsOperations(PeeringManagementClient client) // Serialize Request string _requestContent = null; - if(tags != null) + if(tags1 != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags1, 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"); } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs index 67e42c4c8d65..3048ab59ccb8 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -9,6 +13,8 @@ namespace Microsoft.Azure.Management.Peering using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -160,9 +166,9 @@ public static void Delete(this IPeeringsOperations operations, string resourceGr /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// - public static PeeringModel Update(this IPeeringsOperations operations, string resourceGroupName, string peeringName, ResourceTags tags) + public static PeeringModel Update(this IPeeringsOperations operations, string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary)) { return operations.UpdateAsync(resourceGroupName, peeringName, tags).GetAwaiter().GetResult(); } @@ -181,12 +187,12 @@ public static PeeringModel Update(this IPeeringsOperations operations, string re /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPeeringsOperations operations, string resourceGroupName, string peeringName, ResourceTags tags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPeeringsOperations operations, string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, peeringName, tags, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs index 57cb4ff48972..9b5473fe577d 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs index c31750f1b6ab..74671d9b33e0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. 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 000000000000..9343c90ffa9e --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs @@ -0,0 +1,37 @@ + +// +// 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-08-01-preview"), + new Tuple("Peering", "LegacyPeerings", "2019-08-01-preview"), + new Tuple("Peering", "Operations", "2019-08-01-preview"), + new Tuple("Peering", "PeerAsns", "2019-08-01-preview"), + new Tuple("Peering", "PeeringLocations", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServiceLocations", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServicePrefixes", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServiceProviders", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServices", "2019-08-01-preview"), + new Tuple("Peering", "Peerings", "2019-08-01-preview"), + new Tuple("Peering", "Prefixes", "2019-08-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs similarity index 59% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs index 495ea13b6a4c..32f99eec7b49 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs @@ -8,14 +8,14 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.Security { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -23,12 +23,12 @@ namespace Microsoft.Azure.ApplicationInsights.Query using System.Threading.Tasks; /// - /// Events operations. + /// AdaptiveApplicationControlsOperations operations. /// - public partial class Events : IServiceOperations, IEvents + internal partial class AdaptiveApplicationControlsOperations : IServiceOperations, IAdaptiveApplicationControlsOperations { /// - /// Initializes a new instance of the Events class. + /// Initializes a new instance of the AdaptiveApplicationControlsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ public partial class Events : IServiceOperations, /// /// Thrown when a required parameter is null /// - public Events(ApplicationInsightsDataClient client) + internal AdaptiveApplicationControlsOperations(SecurityCenterClient client) { if (client == null) { @@ -46,61 +46,18 @@ public Events(ApplicationInsightsDataClient client) } /// - /// Gets a reference to the ApplicationInsightsDataClient + /// Gets a reference to the SecurityCenterClient /// - public ApplicationInsightsDataClient Client { get; private set; } + public SecurityCenterClient Client { get; private set; } /// - /// Execute OData query + /// Gets a list of application control VM/server groups for the subscription. /// - /// - /// Executes an OData query for events - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// Include the policy rules /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events + /// + /// Return output in a summarized form /// /// /// Headers that will be added to request. @@ -108,7 +65,7 @@ public Events(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -123,16 +80,20 @@ public Events(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByTypeWithHttpMessagesAsync(string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (eventType == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "eventType"); + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } } + string apiVersion = "2015-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -140,70 +101,32 @@ public Events(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("eventType", eventType); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("filter", filter); - tracingParameters.Add("search", search); - tracingParameters.Add("orderby", orderby); - tracingParameters.Add("select", select); - tracingParameters.Add("skip", skip); - tracingParameters.Add("top", top); - tracingParameters.Add("format", format); - tracingParameters.Add("count", count); - tracingParameters.Add("apply", apply); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("includePathRecommendations", includePathRecommendations); + tracingParameters.Add("summary", summary); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByType", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/events/{eventType}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{eventType}", System.Uri.EscapeDataString(eventType)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (search != null) - { - _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); - } - if (orderby != null) - { - _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); - } - if (select != null) - { - _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); - } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (top != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } - if (format != null) + if (includePathRecommendations != null) { - _queryParameters.Add(string.Format("$format={0}", System.Uri.EscapeDataString(format))); + _queryParameters.Add(string.Format("includePathRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includePathRecommendations, Client.SerializationSettings).Trim('"')))); } - if (count != null) + if (summary != null) { - _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); - } - if (apply != null) - { - _queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply))); + _queryParameters.Add(string.Format("summary={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(summary, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { - _url += "?" + string.Join("&", _queryParameters); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -211,6 +134,18 @@ public Events(ApplicationInsightsDataClient client) _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) @@ -249,13 +184,14 @@ public Events(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -265,6 +201,10 @@ public Events(ApplicationInsightsDataClient client) } 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); @@ -277,16 +217,20 @@ public Events(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -306,30 +250,10 @@ public Events(ApplicationInsightsDataClient client) } /// - /// Get an event + /// Gets an application control VM/server group. /// - /// - /// Gets the data for a single event - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. + /// + /// Name of an application control VM/server group /// /// /// Headers that will be added to request. @@ -337,7 +261,7 @@ public Events(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -352,20 +276,28 @@ public Events(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string appId, string eventType, string eventId, string timespan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (eventType == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "eventType"); + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } } - if (eventId == null) + if (Client.AscLocation == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "eventId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); } + if (groupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + } + string apiVersion = "2015-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -373,27 +305,25 @@ public Events(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("eventType", eventType); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("eventId", eventId); + tracingParameters.Add("groupName", groupName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/events/{eventType}/{eventId}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{eventType}", System.Uri.EscapeDataString(eventType)); - _url = _url.Replace("{eventId}", System.Uri.EscapeDataString(eventId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); + _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); List _queryParameters = new List(); - if (timespan != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { - _url += "?" + string.Join("&", _queryParameters); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -401,6 +331,18 @@ public Events(ApplicationInsightsDataClient client) _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) @@ -439,13 +381,14 @@ public Events(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -455,6 +398,10 @@ public Events(ApplicationInsightsDataClient client) } 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); @@ -467,16 +414,20 @@ public Events(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -496,14 +447,13 @@ public Events(ApplicationInsightsDataClient client) } /// - /// Get OData metadata + /// Update an application control VM/server group /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// Name of an application control VM/server group + /// + /// + /// The updated VM/server group data /// /// /// Headers that will be added to request. @@ -511,7 +461,7 @@ public Events(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -526,12 +476,32 @@ public Events(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetOdataMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PutWithHttpMessagesAsync(string groupName, AppWhitelistingPutGroupData body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (Client.AscLocation == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); } + if (groupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + string apiVersion = "2015-06-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -539,20 +509,45 @@ public Events(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); + tracingParameters.Add("groupName", groupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetOdataMetadata", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/events/$metadata").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); + _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); + 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.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) @@ -569,6 +564,12 @@ public Events(ApplicationInsightsDataClient client) // 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) { @@ -591,13 +592,14 @@ public Events(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -607,6 +609,10 @@ public Events(ApplicationInsightsDataClient client) } 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); @@ -619,16 +625,20 @@ public Events(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs new file mode 100644 index 000000000000..853291accad2 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs @@ -0,0 +1,139 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AdaptiveApplicationControlsOperations. + /// + public static partial class AdaptiveApplicationControlsOperationsExtensions + { + /// + /// Gets a list of application control VM/server groups for the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Include the policy rules + /// + /// + /// Return output in a summarized form + /// + public static AppWhitelistingGroups List(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?)) + { + return operations.ListAsync(includePathRecommendations, summary).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of application control VM/server groups for the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Include the policy rules + /// + /// + /// Return output in a summarized form + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(includePathRecommendations, summary, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an application control VM/server group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an application control VM/server group + /// + public static AppWhitelistingGroup Get(this IAdaptiveApplicationControlsOperations operations, string groupName) + { + return operations.GetAsync(groupName).GetAwaiter().GetResult(); + } + + /// + /// Gets an application control VM/server group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an application control VM/server group + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(groupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an application control VM/server group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an application control VM/server group + /// + /// + /// The updated VM/server group data + /// + public static AppWhitelistingGroup Put(this IAdaptiveApplicationControlsOperations operations, string groupName, AppWhitelistingPutGroupData body) + { + return operations.PutAsync(groupName, body).GetAwaiter().GetResult(); + } + + /// + /// Update an application control VM/server group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an application control VM/server group + /// + /// + /// The updated VM/server group data + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, AppWhitelistingPutGroupData body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(groupName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs new file mode 100644 index 000000000000..6e980ad08309 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs @@ -0,0 +1,992 @@ +// +// 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.Security +{ + 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; + + /// + /// DeviceSecurityGroupsOperations operations. + /// + internal partial class DeviceSecurityGroupsOperations : IServiceOperations, IDeviceSecurityGroupsOperations + { + /// + /// Initializes a new instance of the DeviceSecurityGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeviceSecurityGroupsOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// The identifier of the 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>> ListWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); + } + 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("resourceId", resourceId); + 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups").ToString(); + _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId)); + 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; + } + + /// + /// Use this method to get the device security group for the specified IoT Hub + /// resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); + } + if (deviceSecurityGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); + } + 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("resourceId", resourceId); + tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); + 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); + _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId)); + _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); + 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; + } + + /// + /// Use this method to creates or updates the device security group on a + /// specified IoT Hub resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// Security group 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> CreateOrUpdateWithHttpMessagesAsync(string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); + } + if (deviceSecurityGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); + } + if (deviceSecurityGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroup"); + } + 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("resourceId", resourceId); + tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); + tracingParameters.Add("deviceSecurityGroup", deviceSecurityGroup); + 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); + _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId)); + _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(deviceSecurityGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(deviceSecurityGroup, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// User this method to deletes the device security group. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); + } + if (deviceSecurityGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); + } + 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("resourceId", resourceId); + tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); + 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); + _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId)); + _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..455397ad11d5 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs @@ -0,0 +1,230 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeviceSecurityGroupsOperations. + /// + public static partial class DeviceSecurityGroupsOperationsExtensions + { + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + public static IPage List(this IDeviceSecurityGroupsOperations operations, string resourceId) + { + return operations.ListAsync(resourceId).GetAwaiter().GetResult(); + } + + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get the device security group for the specified IoT Hub + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + public static DeviceSecurityGroup Get(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName) + { + return operations.GetAsync(resourceId, deviceSecurityGroupName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the device security group for the specified IoT Hub + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to creates or updates the device security group on a + /// specified IoT Hub resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// Security group object. + /// + public static DeviceSecurityGroup CreateOrUpdate(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup) + { + return operations.CreateOrUpdateAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup).GetAwaiter().GetResult(); + } + + /// + /// Use this method to creates or updates the device security group on a + /// specified IoT Hub resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// Security group object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// User this method to deletes the device security group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + public static void Delete(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName) + { + operations.DeleteAsync(resourceId, deviceSecurityGroupName).GetAwaiter().GetResult(); + } + + /// + /// User this method to deletes the device security group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the device + /// security group is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDeviceSecurityGroupsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Use this method get the list of device security groups for the specified + /// IoT Hub resource. + /// + /// + /// 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 IDeviceSecurityGroupsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.cs new file mode 100644 index 000000000000..1712fb74f5dc --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AdaptiveApplicationControlsOperations operations. + /// + public partial interface IAdaptiveApplicationControlsOperations + { + /// + /// Gets a list of application control VM/server groups for the + /// subscription. + /// + /// + /// Include the policy rules + /// + /// + /// Return output in a summarized form + /// + /// + /// 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(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an application control VM/server group. + /// + /// + /// Name of an application control VM/server group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an application control VM/server group + /// + /// + /// Name of an application control VM/server group + /// + /// + /// The updated VM/server group data + /// + /// + /// 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> PutWithHttpMessagesAsync(string groupName, AppWhitelistingPutGroupData body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.cs new file mode 100644 index 000000000000..b42dcc21b25c --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeviceSecurityGroupsOperations operations. + /// + public partial interface IDeviceSecurityGroupsOperations + { + /// + /// Use this method get the list of device security groups for the + /// specified IoT Hub resource. + /// + /// + /// The identifier of the 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>> ListWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the device security group for the specified + /// IoT Hub resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the + /// device security group is case insensitive. + /// + /// + /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to creates or updates the device security group on + /// a specified IoT Hub resource. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the + /// device security group is case insensitive. + /// + /// + /// Security group 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> CreateOrUpdateWithHttpMessagesAsync(string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// User this method to deletes the device security group. + /// + /// + /// The identifier of the resource. + /// + /// + /// The name of the device security group. Note that the name of the + /// device security group is case insensitive. + /// + /// + /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method get the list of device security groups for the + /// specified IoT Hub resource. + /// + /// + /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.cs new file mode 100644 index 000000000000..77bf28bc2fd7 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotSecuritySolutionAnalyticsOperations operations. + /// + public partial interface IIotSecuritySolutionAnalyticsOperations + { + /// + /// Use this method to get IoT security Analytics metrics in an array. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get IoT Security Analytics metrics. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs new file mode 100644 index 000000000000..bed20a0e02df --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs @@ -0,0 +1,235 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotSecuritySolutionOperations operations. + /// + public partial interface IIotSecuritySolutionOperations + { + /// + /// Use this method to get the list of IoT Security solutions by + /// subscription. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports + /// filtering by iotHubs. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports + /// filtering by iotHubs. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// User this method to get details of a specific IoT Security solution + /// based on solution name + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to create or update yours IoT Security solution + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to update existing IoT Security solution tags or + /// user defined resources. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to delete yours IoT Security solution + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the list of IoT Security solutions by + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs new file mode 100644 index 000000000000..00fba045b9ba --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs @@ -0,0 +1,137 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotSecuritySolutionsAnalyticsAggregatedAlertOperations operations. + /// + public partial interface IIotSecuritySolutionsAnalyticsAggregatedAlertOperations + { + /// + /// Use this method to get the aggregated alert list of yours IoT + /// Security solution. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get a single the aggregated alert of yours IoT + /// Security solution. This aggregation is performed by alert name. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to dismiss an aggregated IoT Security Solution + /// Alert. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// 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 DismissWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the aggregated alert list of yours IoT + /// Security solution. + /// + /// + /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs new file mode 100644 index 000000000000..ef803c0beac5 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs @@ -0,0 +1,111 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotSecuritySolutionsAnalyticsRecommendationOperations operations. + /// + public partial interface IIotSecuritySolutionsAnalyticsRecommendationOperations + { + /// + /// Use this method to get the aggregated security analytics + /// recommendation of yours IoT Security solution. This aggregation is + /// performed by recommendation name. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Name of the recommendation aggregated for this query. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedRecommendationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs index 95aea6ba3ef9..a243ffff64a8 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Security public partial interface IPricingsOperations { /// - /// Security pricing configurations in the subscription + /// Lists Security Center pricing configurations in the subscription. /// /// /// The headers that will be added to request. @@ -43,7 +43,8 @@ public partial interface IPricingsOperations /// Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Security pricing configuration in the subscription + /// Gets a provided Security Center pricing configuration in the + /// subscription. /// /// /// name of the pricing configuration @@ -65,13 +66,18 @@ public partial interface IPricingsOperations /// Task> GetWithHttpMessagesAsync(string pricingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Security pricing configuration in the subscription + /// Updates a provided Security Center pricing configuration in the + /// subscription. /// /// /// name of the pricing configuration /// /// - /// The pricing tier value. Possible values include: 'Free', 'Standard' + /// The pricing tier value. Azure Security Center is provided in two + /// pricing tiers: free and standard, with the standard tier available + /// with a trial period. The standard tier offers advanced security + /// capabilities, while the free tier offers basic security features. + /// Possible values include: 'Free', 'Standard' /// /// /// The headers that will be added to request. diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs index 1748fb8587fb..907fbb65724e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs @@ -91,6 +91,31 @@ public partial interface ISecurityCenterClient : System.IDisposable /// ISettingsOperations Settings { get; } + /// + /// Gets the IDeviceSecurityGroupsOperations. + /// + IDeviceSecurityGroupsOperations DeviceSecurityGroups { get; } + + /// + /// Gets the IIotSecuritySolutionOperations. + /// + IIotSecuritySolutionOperations IotSecuritySolution { get; } + + /// + /// Gets the IIotSecuritySolutionAnalyticsOperations. + /// + IIotSecuritySolutionAnalyticsOperations IotSecuritySolutionAnalytics { get; } + + /// + /// Gets the IIotSecuritySolutionsAnalyticsAggregatedAlertOperations. + /// + IIotSecuritySolutionsAnalyticsAggregatedAlertOperations IotSecuritySolutionsAnalyticsAggregatedAlert { get; } + + /// + /// Gets the IIotSecuritySolutionsAnalyticsRecommendationOperations. + /// + IIotSecuritySolutionsAnalyticsRecommendationOperations IotSecuritySolutionsAnalyticsRecommendation { get; } + /// /// Gets the IAllowedConnectionsOperations. /// @@ -111,6 +136,11 @@ public partial interface ISecurityCenterClient : System.IDisposable /// IJitNetworkAccessPoliciesOperations JitNetworkAccessPolicies { get; } + /// + /// Gets the IAdaptiveApplicationControlsOperations. + /// + IAdaptiveApplicationControlsOperations AdaptiveApplicationControls { get; } + /// /// Gets the ILocationsOperations. /// @@ -176,5 +206,10 @@ public partial interface ISecurityCenterClient : System.IDisposable /// IRegulatoryComplianceAssessmentsOperations RegulatoryComplianceAssessments { get; } + /// + /// Gets the IServerVulnerabilityAssessmentOperations. + /// + IServerVulnerabilityAssessmentOperations ServerVulnerabilityAssessment { get; } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs new file mode 100644 index 000000000000..fac304bd74b5 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs @@ -0,0 +1,155 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerVulnerabilityAssessmentOperations operations. + /// + public partial interface IServerVulnerabilityAssessmentOperations + { + /// + /// Gets a list of server vulnerability assessment onboarding statuses + /// on a given resource. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a server vulnerability assessment onboarding statuses on a + /// given resource. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creating a server vulnerability assessment on a resource, which + /// will onboard a resource for having a vulnerability assessment on it + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Removing server vulnerability assessment from a resource. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs new file mode 100644 index 000000000000..1df2267ad391 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs @@ -0,0 +1,488 @@ +// +// 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.Security +{ + 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; + + /// + /// IotSecuritySolutionAnalyticsOperations operations. + /// + internal partial class IotSecuritySolutionAnalyticsOperations : IServiceOperations, IIotSecuritySolutionAnalyticsOperations + { + /// + /// Initializes a new instance of the IotSecuritySolutionAnalyticsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotSecuritySolutionAnalyticsOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Use this method to get IoT security Analytics metrics in an array. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + 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; + } + + /// + /// Use this method to get IoT Security Analytics metrics. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + 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; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs new file mode 100644 index 000000000000..2276e0e10c62 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs @@ -0,0 +1,109 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotSecuritySolutionAnalyticsOperations. + /// + public static partial class IotSecuritySolutionAnalyticsOperationsExtensions + { + /// + /// Use this method to get IoT security Analytics metrics in an array. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + public static IoTSecuritySolutionAnalyticsModelList List(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName) + { + return operations.ListAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get IoT security Analytics metrics in an array. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get IoT Security Analytics metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + public static IoTSecuritySolutionAnalyticsModel Get(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName) + { + return operations.GetAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get IoT Security Analytics metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs new file mode 100644 index 000000000000..2cff9404992e --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs @@ -0,0 +1,1710 @@ +// +// 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.Security +{ + 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; + + /// + /// IotSecuritySolutionOperations operations. + /// + internal partial class IotSecuritySolutionOperations : IServiceOperations, IIotSecuritySolutionOperations + { + /// + /// Initializes a new instance of the IotSecuritySolutionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotSecuritySolutionOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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; + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + 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("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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; + } + + /// + /// User this method to get details of a specific IoT Security solution based + /// on solution name + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + 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; + } + + /// + /// Use this method to create or update yours IoT Security solution + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// 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 resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + if (iotSecuritySolutionData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotSecuritySolutionData"); + } + if (iotSecuritySolutionData != null) + { + iotSecuritySolutionData.Validate(); + } + 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("solutionName", solutionName); + tracingParameters.Add("iotSecuritySolutionData", iotSecuritySolutionData); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(iotSecuritySolutionData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotSecuritySolutionData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method to update existing IoT Security solution tags or user + /// defined resources. To update other fields use the CreateOrUpdate method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + if (updateIotSecuritySolutionData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateIotSecuritySolutionData"); + } + 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("solutionName", solutionName); + tracingParameters.Add("updateIotSecuritySolutionData", updateIotSecuritySolutionData); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Security/iotSecuritySolutions/{solutionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(updateIotSecuritySolutionData != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateIotSecuritySolutionData, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method to delete yours IoT Security solution + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// 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 resourceGroupName, string solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs new file mode 100644 index 000000000000..b157f32c4211 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs @@ -0,0 +1,358 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotSecuritySolutionOperations. + /// + public static partial class IotSecuritySolutionOperationsExtensions + { + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + public static IPage ListBySubscription(this IIotSecuritySolutionOperations operations, string filter = default(string)) + { + return operations.ListBySubscriptionAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IIotSecuritySolutionOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + public static IPage ListByResourceGroup(this IIotSecuritySolutionOperations operations, string resourceGroupName, string filter = default(string)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, filter).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by + /// iotHubs. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// User this method to get details of a specific IoT Security solution based + /// on solution name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + public static IoTSecuritySolutionModel Get(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName) + { + return operations.GetAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); + } + + /// + /// User this method to get details of a specific IoT Security solution based + /// on solution name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to create or update yours IoT Security solution + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + public static IoTSecuritySolutionModel CreateOrUpdate(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData) + { + return operations.CreateOrUpdateAsync(resourceGroupName, solutionName, iotSecuritySolutionData).GetAwaiter().GetResult(); + } + + /// + /// Use this method to create or update yours IoT Security solution + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, solutionName, iotSecuritySolutionData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to update existing IoT Security solution tags or user + /// defined resources. To update other fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + public static IoTSecuritySolutionModel Update(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) + { + return operations.UpdateAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData).GetAwaiter().GetResult(); + } + + /// + /// Use this method to update existing IoT Security solution tags or user + /// defined resources. To update other fields use the CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The security solution data + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to delete yours IoT Security solution + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + public static void Delete(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName) + { + operations.DeleteAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to delete yours IoT Security solution + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IIotSecuritySolutionOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IIotSecuritySolutionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IIotSecuritySolutionOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list IoT Security solutions organized by + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IIotSecuritySolutionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs new file mode 100644 index 000000000000..68740bdb4a13 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs @@ -0,0 +1,886 @@ +// +// 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.Security +{ + 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; + + /// + /// IotSecuritySolutionsAnalyticsAggregatedAlertOperations operations. + /// + internal partial class IotSecuritySolutionsAnalyticsAggregatedAlertOperations : IServiceOperations, IIotSecuritySolutionsAnalyticsAggregatedAlertOperations + { + /// + /// Initializes a new instance of the IotSecuritySolutionsAnalyticsAggregatedAlertOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotSecuritySolutionsAnalyticsAggregatedAlertOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Use this method to get a single the aggregated alert of yours IoT Security + /// solution. This aggregation is performed by alert name. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + if (aggregatedAlertName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("aggregatedAlertName", aggregatedAlertName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName)); + 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; + } + + /// + /// Use this method to dismiss an aggregated IoT Security Solution Alert. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// 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 DismissWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + if (aggregatedAlertName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("aggregatedAlertName", aggregatedAlertName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Dismiss", 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs new file mode 100644 index 000000000000..bf6dfa202398 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs @@ -0,0 +1,206 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotSecuritySolutionsAnalyticsAggregatedAlertOperations. + /// + public static partial class IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions + { + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + public static IPage List(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, int? top = default(int?)) + { + return operations.ListAsync(resourceGroupName, solutionName, top).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get a single the aggregated alert of yours IoT Security + /// solution. This aggregation is performed by alert name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + public static IoTSecurityAggregatedAlert Get(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName) + { + return operations.GetAsync(resourceGroupName, solutionName, aggregatedAlertName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get a single the aggregated alert of yours IoT Security + /// solution. This aggregation is performed by alert name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedAlertName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to dismiss an aggregated IoT Security Solution Alert. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + public static void Dismiss(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName) + { + operations.DismissAsync(resourceGroupName, solutionName, aggregatedAlertName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to dismiss an aggregated IoT Security Solution Alert. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Identifier of the aggregated alert. + /// + /// + /// The cancellation token. + /// + public static async Task DismissAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DismissWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedAlertName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the aggregated alert list of yours IoT Security + /// solution. + /// + /// + /// 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 IIotSecuritySolutionsAnalyticsAggregatedAlertOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs new file mode 100644 index 000000000000..b64b055e7625 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs @@ -0,0 +1,682 @@ +// +// 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.Security +{ + 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; + + /// + /// IotSecuritySolutionsAnalyticsRecommendationOperations operations. + /// + internal partial class IotSecuritySolutionsAnalyticsRecommendationOperations : IServiceOperations, IIotSecuritySolutionsAnalyticsRecommendationOperations + { + /// + /// Initializes a new instance of the IotSecuritySolutionsAnalyticsRecommendationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotSecuritySolutionsAnalyticsRecommendationOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Use this method to get the aggregated security analytics recommendation of + /// yours IoT Security solution. This aggregation is performed by + /// recommendation name. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Name of the recommendation aggregated for this query. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedRecommendationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + if (aggregatedRecommendationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedRecommendationName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("aggregatedRecommendationName", aggregatedRecommendationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + _url = _url.Replace("{aggregatedRecommendationName}", System.Uri.EscapeDataString(aggregatedRecommendationName)); + 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; + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (solutionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); + } + 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("solutionName", solutionName); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs new file mode 100644 index 000000000000..3fd8c6741346 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs @@ -0,0 +1,163 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotSecuritySolutionsAnalyticsRecommendationOperations. + /// + public static partial class IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions + { + /// + /// Use this method to get the aggregated security analytics recommendation of + /// yours IoT Security solution. This aggregation is performed by + /// recommendation name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Name of the recommendation aggregated for this query. + /// + public static IoTSecurityAggregatedRecommendation Get(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, string aggregatedRecommendationName) + { + return operations.GetAsync(resourceGroupName, solutionName, aggregatedRecommendationName).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the aggregated security analytics recommendation of + /// yours IoT Security solution. This aggregation is performed by + /// recommendation name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Name of the recommendation aggregated for this query. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, string aggregatedRecommendationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedRecommendationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + public static IPage List(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, int? top = default(int?)) + { + return operations.ListAsync(resourceGroupName, solutionName, top).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the IoT Security solution. + /// + /// + /// Number of results to retrieve. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Use this method to get the list of aggregated security analytics + /// recommendations of yours IoT Security solution. + /// + /// + /// 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 IIotSecuritySolutionsAnalyticsRecommendationOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs new file mode 100644 index 000000000000..42ef3fe3761c --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs @@ -0,0 +1,80 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A custom alert rule that checks if a value (depends on the custom alert + /// type) is allowed. + /// + public partial class AllowlistCustomAlertRule : ListCustomAlertRule + { + /// + /// Initializes a new instance of the AllowlistCustomAlertRule class. + /// + public AllowlistCustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AllowlistCustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The values to allow. The format of + /// the values depends on the rule type. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + /// The value type of the items in the list. + /// Possible values include: 'IpCidr', 'String' + public AllowlistCustomAlertRule(bool isEnabled, string ruleType, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) + : base(isEnabled, ruleType, displayName, description, valueType) + { + AllowlistValues = allowlistValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the values to allow. The format of the values depends + /// on the rule type. + /// + [JsonProperty(PropertyName = "allowlistValues")] + public IList AllowlistValues { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (AllowlistValues == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AllowlistValues"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroup.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroup.cs new file mode 100644 index 000000000000..8a42c7fa59bf --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroup.cs @@ -0,0 +1,137 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class AppWhitelistingGroup + { + /// + /// Initializes a new instance of the AppWhitelistingGroup class. + /// + public AppWhitelistingGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppWhitelistingGroup class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Location where the resource is + /// stored + /// Possible values include: 'Audit', + /// 'Enforce' + /// Possible values include: + /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', + /// 'NoStatus' + /// Possible values include: + /// 'Recommended', 'NotRecommended', 'NotAvailable', 'NoStatus' + /// Possible values include: + /// 'Azure_AppLocker', 'Azure_AuditD', 'NonAzure_AppLocker', + /// 'NonAzure_AuditD', 'None' + public AppWhitelistingGroup(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string enforcementMode = default(string), string configurationStatus = default(string), string recommendationStatus = default(string), IList issues = default(IList), string sourceSystem = default(string), IList vmRecommendations = default(IList), IList pathRecommendations = default(IList)) + { + Id = id; + Name = name; + Type = type; + Location = location; + EnforcementMode = enforcementMode; + ConfigurationStatus = configurationStatus; + RecommendationStatus = recommendationStatus; + Issues = issues; + SourceSystem = sourceSystem; + VmRecommendations = vmRecommendations; + PathRecommendations = pathRecommendations; + 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 location where the resource is stored + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets or sets possible values include: 'Audit', 'Enforce' + /// + [JsonProperty(PropertyName = "properties.enforcementMode")] + public string EnforcementMode { get; set; } + + /// + /// Gets or sets possible values include: 'Configured', + /// 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + /// + [JsonProperty(PropertyName = "properties.configurationStatus")] + public string ConfigurationStatus { get; set; } + + /// + /// Gets or sets possible values include: 'Recommended', + /// 'NotRecommended', 'NotAvailable', 'NoStatus' + /// + [JsonProperty(PropertyName = "properties.recommendationStatus")] + public string RecommendationStatus { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.issues")] + public IList Issues { get; set; } + + /// + /// Gets or sets possible values include: 'Azure_AppLocker', + /// 'Azure_AuditD', 'NonAzure_AppLocker', 'NonAzure_AuditD', 'None' + /// + [JsonProperty(PropertyName = "properties.sourceSystem")] + public string SourceSystem { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.vmRecommendations")] + public IList VmRecommendations { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.pathRecommendations")] + public IList PathRecommendations { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroups.cs similarity index 53% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroups.cs index 5319e14b6840..2839ed6c9419 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingGroups.cs @@ -8,31 +8,33 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Security.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Application info for an event result + /// Represents a list of VM/server groups and set of rules that are + /// Recommended by Azure Security Center to be allowed /// - public partial class EventsApplicationInfo + public partial class AppWhitelistingGroups { /// - /// Initializes a new instance of the EventsApplicationInfo class. + /// Initializes a new instance of the AppWhitelistingGroups class. /// - public EventsApplicationInfo() + public AppWhitelistingGroups() { CustomInit(); } /// - /// Initializes a new instance of the EventsApplicationInfo class. + /// Initializes a new instance of the AppWhitelistingGroups class. /// - /// Version of the application - public EventsApplicationInfo(string version = default(string)) + public AppWhitelistingGroups(IList value = default(IList)) { - Version = version; + Value = value; CustomInit(); } @@ -42,10 +44,9 @@ public EventsApplicationInfo() partial void CustomInit(); /// - /// Gets or sets version of the application /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingIssueSummary.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingIssueSummary.cs new file mode 100644 index 000000000000..3036c32344da --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingIssueSummary.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a summary of the alerts of the VM/server group + /// + public partial class AppWhitelistingIssueSummary + { + /// + /// Initializes a new instance of the AppWhitelistingIssueSummary + /// class. + /// + public AppWhitelistingIssueSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppWhitelistingIssueSummary + /// class. + /// + /// Possible values include: 'ViolationsAudited', + /// 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', + /// 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', + /// 'RulesViolatedManually' + /// The number of machines in the VM/server + /// group that have this alert + public AppWhitelistingIssueSummary(string issue = default(string), double? numberOfVms = default(double?)) + { + Issue = issue; + NumberOfVms = numberOfVms; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'ViolationsAudited', + /// 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', + /// 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', + /// 'RulesViolatedManually' + /// + [JsonProperty(PropertyName = "issue")] + public string Issue { get; set; } + + /// + /// Gets or sets the number of machines in the VM/server group that + /// have this alert + /// + [JsonProperty(PropertyName = "numberOfVms")] + public double? NumberOfVms { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingPutGroupData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingPutGroupData.cs new file mode 100644 index 000000000000..996ed88c504f --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AppWhitelistingPutGroupData.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.Security.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The altered data of the recommended VM/server group policy + /// + public partial class AppWhitelistingPutGroupData + { + /// + /// Initializes a new instance of the AppWhitelistingPutGroupData + /// class. + /// + public AppWhitelistingPutGroupData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppWhitelistingPutGroupData + /// class. + /// + /// Possible values include: 'Audit', + /// 'Enforce' + public AppWhitelistingPutGroupData(string enforcementMode = default(string), IList vmRecommendations = default(IList), IList pathRecommendations = default(IList)) + { + EnforcementMode = enforcementMode; + VmRecommendations = vmRecommendations; + PathRecommendations = pathRecommendations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Audit', 'Enforce' + /// + [JsonProperty(PropertyName = "enforcementMode")] + public string EnforcementMode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "vmRecommendations")] + public IList VmRecommendations { get; set; } + + /// + /// + [JsonProperty(PropertyName = "pathRecommendations")] + public IList PathRecommendations { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs new file mode 100644 index 000000000000..2b9dcbd774e8 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs @@ -0,0 +1,91 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A custom alert rule. + /// + public partial class CustomAlertRule + { + /// + /// Initializes a new instance of the CustomAlertRule class. + /// + public CustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + public CustomAlertRule(bool isEnabled, string ruleType, string displayName = default(string), string description = default(string)) + { + DisplayName = displayName; + Description = description; + IsEnabled = isEnabled; + RuleType = ruleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the display name of the custom alert. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the description of the custom alert. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets or sets status of the custom alert. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the type of the custom alert rule. + /// + [JsonProperty(PropertyName = "ruleType")] + public string RuleType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RuleType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleType"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.cs new file mode 100644 index 000000000000..21aee25c6657 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.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.Security.Models +{ + + /// + /// Defines values for DataSource. + /// + public static class DataSource + { + /// + /// Devices twin data + /// + public const string TwinData = "TwinData"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs new file mode 100644 index 000000000000..f122dc8f024f --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs @@ -0,0 +1,80 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A custom alert rule that checks if a value (depends on the custom alert + /// type) is denied. + /// + public partial class DenylistCustomAlertRule : ListCustomAlertRule + { + /// + /// Initializes a new instance of the DenylistCustomAlertRule class. + /// + public DenylistCustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DenylistCustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The values to deny. The format of the + /// values depends on the rule type. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + /// The value type of the items in the list. + /// Possible values include: 'IpCidr', 'String' + public DenylistCustomAlertRule(bool isEnabled, string ruleType, IList denylistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) + : base(isEnabled, ruleType, displayName, description, valueType) + { + DenylistValues = denylistValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the values to deny. The format of the values depends + /// on the rule type. + /// + [JsonProperty(PropertyName = "denylistValues")] + public IList DenylistValues { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (DenylistValues == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DenylistValues"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.cs new file mode 100644 index 000000000000..1c292fc222b8 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The device security group resource + /// + [Rest.Serialization.JsonTransformation] + public partial class DeviceSecurityGroup : Resource + { + /// + /// Initializes a new instance of the DeviceSecurityGroup class. + /// + public DeviceSecurityGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeviceSecurityGroup class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// The list of custom alert threshold + /// rules. + /// The list of custom alert time-window + /// rules. + /// The allow-list custom alert + /// rules. + /// The deny-list custom alert + /// rules. + public DeviceSecurityGroup(string id = default(string), string name = default(string), string type = default(string), IList thresholdRules = default(IList), IList timeWindowRules = default(IList), IList allowlistRules = default(IList), IList denylistRules = default(IList)) + : base(id, name, type) + { + ThresholdRules = thresholdRules; + TimeWindowRules = timeWindowRules; + AllowlistRules = allowlistRules; + DenylistRules = denylistRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of custom alert threshold rules. + /// + [JsonProperty(PropertyName = "properties.thresholdRules")] + public IList ThresholdRules { get; set; } + + /// + /// Gets or sets the list of custom alert time-window rules. + /// + [JsonProperty(PropertyName = "properties.timeWindowRules")] + public IList TimeWindowRules { get; set; } + + /// + /// Gets or sets the allow-list custom alert rules. + /// + [JsonProperty(PropertyName = "properties.allowlistRules")] + public IList AllowlistRules { get; set; } + + /// + /// Gets or sets the deny-list custom alert rules. + /// + [JsonProperty(PropertyName = "properties.denylistRules")] + public IList DenylistRules { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.cs new file mode 100644 index 000000000000..4702716c60b7 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.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.Security.Models +{ + + /// + /// Defines values for ExportData. + /// + public static class ExportData + { + /// + /// Agent raw events + /// + public const string RawEvents = "RawEvents"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs new file mode 100644 index 000000000000..4937b658ffcf --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs @@ -0,0 +1,190 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Security Solution Aggregated Alert information + /// + [Rest.Serialization.JsonTransformation] + public partial class IoTSecurityAggregatedAlert + { + /// + /// Initializes a new instance of the IoTSecurityAggregatedAlert class. + /// + public IoTSecurityAggregatedAlert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecurityAggregatedAlert class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Name of the alert type. + /// Display name of the alert + /// type. + /// Date of detection. + /// Name of the organization that raised the + /// alert. + /// Assessed alert severity. Possible + /// values include: 'Informational', 'Low', 'Medium', 'High' + /// Recommended steps for + /// remediation. + /// Description of the suspected + /// vulnerability and meaning. + /// Number of alerts occurrences within the + /// aggregated time window. + /// Azure resource ID of the + /// resource that received the alerts. + /// The type of the alerted resource (Azure, + /// Non-Azure). + /// IoT Security solution alert + /// response. + /// Log analytics query for getting the + /// list of affected devices/alerts. + public IoTSecurityAggregatedAlert(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string alertType = default(string), string alertDisplayName = default(string), System.DateTime? aggregatedDateUtc = default(System.DateTime?), string vendorName = default(string), string reportedSeverity = default(string), string remediationSteps = default(string), string description = default(string), int? count = default(int?), string effectedResourceType = default(string), string systemSource = default(string), string actionTaken = default(string), string logAnalyticsQuery = default(string)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + AlertType = alertType; + AlertDisplayName = alertDisplayName; + AggregatedDateUtc = aggregatedDateUtc; + VendorName = vendorName; + ReportedSeverity = reportedSeverity; + RemediationSteps = remediationSteps; + Description = description; + Count = count; + EffectedResourceType = effectedResourceType; + SystemSource = systemSource; + ActionTaken = actionTaken; + LogAnalyticsQuery = logAnalyticsQuery; + 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 resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets name of the alert type. + /// + [JsonProperty(PropertyName = "properties.alertType")] + public string AlertType { get; private set; } + + /// + /// Gets display name of the alert type. + /// + [JsonProperty(PropertyName = "properties.alertDisplayName")] + public string AlertDisplayName { get; private set; } + + /// + /// Gets date of detection. + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "properties.aggregatedDateUtc")] + public System.DateTime? AggregatedDateUtc { get; private set; } + + /// + /// Gets name of the organization that raised the alert. + /// + [JsonProperty(PropertyName = "properties.vendorName")] + public string VendorName { get; private set; } + + /// + /// Gets assessed alert severity. Possible values include: + /// 'Informational', 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "properties.reportedSeverity")] + public string ReportedSeverity { get; private set; } + + /// + /// Gets recommended steps for remediation. + /// + [JsonProperty(PropertyName = "properties.remediationSteps")] + public string RemediationSteps { get; private set; } + + /// + /// Gets description of the suspected vulnerability and meaning. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets number of alerts occurrences within the aggregated time + /// window. + /// + [JsonProperty(PropertyName = "properties.count")] + public int? Count { get; private set; } + + /// + /// Gets azure resource ID of the resource that received the alerts. + /// + [JsonProperty(PropertyName = "properties.effectedResourceType")] + public string EffectedResourceType { get; private set; } + + /// + /// Gets the type of the alerted resource (Azure, Non-Azure). + /// + [JsonProperty(PropertyName = "properties.systemSource")] + public string SystemSource { get; private set; } + + /// + /// Gets ioT Security solution alert response. + /// + [JsonProperty(PropertyName = "properties.actionTaken")] + public string ActionTaken { get; private set; } + + /// + /// Gets log analytics query for getting the list of affected + /// devices/alerts. + /// + [JsonProperty(PropertyName = "properties.logAnalyticsQuery")] + public string LogAnalyticsQuery { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs new file mode 100644 index 000000000000..8a9bb666b275 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs @@ -0,0 +1,175 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// IoT Security solution recommendation information. + /// + [Rest.Serialization.JsonTransformation] + public partial class IoTSecurityAggregatedRecommendation + { + /// + /// Initializes a new instance of the + /// IoTSecurityAggregatedRecommendation class. + /// + public IoTSecurityAggregatedRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IoTSecurityAggregatedRecommendation class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// Name of the + /// recommendation. + /// Display name of the + /// recommendation type. + /// Description of the suspected + /// vulnerability and meaning. + /// Recommendation-type + /// GUID. + /// Name of the organization that made the + /// recommendation. + /// Recommended steps for + /// remediation + /// Assessed recommendation severity. + /// Possible values include: 'Informational', 'Low', 'Medium', + /// 'High' + /// Number of healthy devices within the + /// IoT Security solution. + /// Number of unhealthy devices + /// within the IoT Security solution. + /// Log analytics query for getting the + /// list of affected devices/alerts. + public IoTSecurityAggregatedRecommendation(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string recommendationName = default(string), string recommendationDisplayName = default(string), string description = default(string), string recommendationTypeId = default(string), string detectedBy = default(string), string remediationSteps = default(string), string reportedSeverity = default(string), int? healthyDevices = default(int?), int? unhealthyDeviceCount = default(int?), string logAnalyticsQuery = default(string)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + RecommendationName = recommendationName; + RecommendationDisplayName = recommendationDisplayName; + Description = description; + RecommendationTypeId = recommendationTypeId; + DetectedBy = detectedBy; + RemediationSteps = remediationSteps; + ReportedSeverity = reportedSeverity; + HealthyDevices = healthyDevices; + UnhealthyDeviceCount = unhealthyDeviceCount; + LogAnalyticsQuery = logAnalyticsQuery; + 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 resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets name of the recommendation. + /// + [JsonProperty(PropertyName = "properties.recommendationName")] + public string RecommendationName { get; set; } + + /// + /// Gets display name of the recommendation type. + /// + [JsonProperty(PropertyName = "properties.recommendationDisplayName")] + public string RecommendationDisplayName { get; private set; } + + /// + /// Gets description of the suspected vulnerability and meaning. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets recommendation-type GUID. + /// + [JsonProperty(PropertyName = "properties.recommendationTypeId")] + public string RecommendationTypeId { get; private set; } + + /// + /// Gets name of the organization that made the recommendation. + /// + [JsonProperty(PropertyName = "properties.detectedBy")] + public string DetectedBy { get; private set; } + + /// + /// Gets recommended steps for remediation + /// + [JsonProperty(PropertyName = "properties.remediationSteps")] + public string RemediationSteps { get; private set; } + + /// + /// Gets assessed recommendation severity. Possible values include: + /// 'Informational', 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "properties.reportedSeverity")] + public string ReportedSeverity { get; private set; } + + /// + /// Gets number of healthy devices within the IoT Security solution. + /// + [JsonProperty(PropertyName = "properties.healthyDevices")] + public int? HealthyDevices { get; private set; } + + /// + /// Gets number of unhealthy devices within the IoT Security solution. + /// + [JsonProperty(PropertyName = "properties.unhealthyDeviceCount")] + public int? UnhealthyDeviceCount { get; private set; } + + /// + /// Gets log analytics query for getting the list of affected + /// devices/alerts. + /// + [JsonProperty(PropertyName = "properties.logAnalyticsQuery")] + public string LogAnalyticsQuery { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.cs new file mode 100644 index 000000000000..c4a2dece5c37 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Statistical information about the number of alerts per device during + /// last set number of days. + /// + public partial class IoTSecurityAlertedDevice + { + /// + /// Initializes a new instance of the IoTSecurityAlertedDevice class. + /// + public IoTSecurityAlertedDevice() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecurityAlertedDevice class. + /// + /// Device identifier. + /// Number of alerts raised for this + /// device. + public IoTSecurityAlertedDevice(string deviceId = default(string), int? alertsCount = default(int?)) + { + DeviceId = deviceId; + AlertsCount = alertsCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets device identifier. + /// + [JsonProperty(PropertyName = "deviceId")] + public string DeviceId { get; private set; } + + /// + /// Gets number of alerts raised for this device. + /// + [JsonProperty(PropertyName = "alertsCount")] + public int? AlertsCount { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.cs new file mode 100644 index 000000000000..2a3591bb89da --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Statistical information about the number of alerts per alert type + /// during last set number of days + /// + public partial class IoTSecurityDeviceAlert + { + /// + /// Initializes a new instance of the IoTSecurityDeviceAlert class. + /// + public IoTSecurityDeviceAlert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecurityDeviceAlert class. + /// + /// Display name of the alert + /// Assessed Alert severity. Possible + /// values include: 'Informational', 'Low', 'Medium', 'High' + /// Number of alerts raised for this alert + /// type. + public IoTSecurityDeviceAlert(string alertDisplayName = default(string), string reportedSeverity = default(string), int? alertsCount = default(int?)) + { + AlertDisplayName = alertDisplayName; + ReportedSeverity = reportedSeverity; + AlertsCount = alertsCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets display name of the alert + /// + [JsonProperty(PropertyName = "alertDisplayName")] + public string AlertDisplayName { get; private set; } + + /// + /// Gets assessed Alert severity. Possible values include: + /// 'Informational', 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "reportedSeverity")] + public string ReportedSeverity { get; private set; } + + /// + /// Gets number of alerts raised for this alert type. + /// + [JsonProperty(PropertyName = "alertsCount")] + public int? AlertsCount { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.cs new file mode 100644 index 000000000000..fbafa0d2216d --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Statistical information about the number of recommendations per device, + /// per recommendation type. + /// + public partial class IoTSecurityDeviceRecommendation + { + /// + /// Initializes a new instance of the IoTSecurityDeviceRecommendation + /// class. + /// + public IoTSecurityDeviceRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecurityDeviceRecommendation + /// class. + /// + /// Display name of the + /// recommendation. + /// Assessed recommendation severity. + /// Possible values include: 'Informational', 'Low', 'Medium', + /// 'High' + /// Number of devices with this + /// recommendation. + public IoTSecurityDeviceRecommendation(string recommendationDisplayName = default(string), string reportedSeverity = default(string), int? devicesCount = default(int?)) + { + RecommendationDisplayName = recommendationDisplayName; + ReportedSeverity = reportedSeverity; + DevicesCount = devicesCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets display name of the recommendation. + /// + [JsonProperty(PropertyName = "recommendationDisplayName")] + public string RecommendationDisplayName { get; private set; } + + /// + /// Gets assessed recommendation severity. Possible values include: + /// 'Informational', 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "reportedSeverity")] + public string ReportedSeverity { get; private set; } + + /// + /// Gets number of devices with this recommendation. + /// + [JsonProperty(PropertyName = "devicesCount")] + public int? DevicesCount { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs new file mode 100644 index 000000000000..c9573fa848cd --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs @@ -0,0 +1,108 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Security analytics of your IoT Security solution + /// + [Rest.Serialization.JsonTransformation] + public partial class IoTSecuritySolutionAnalyticsModel : Resource + { + /// + /// Initializes a new instance of the IoTSecuritySolutionAnalyticsModel + /// class. + /// + public IoTSecuritySolutionAnalyticsModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecuritySolutionAnalyticsModel + /// class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Security analytics of your IoT Security + /// solution. + /// Number of unhealthy devices + /// within your IoT Security solution. + /// List of device metrics by the + /// aggregation date. + /// List of the 3 devices with the most + /// alerts. + /// List of the 3 most + /// prevalent device alerts. + /// List of the 3 most + /// prevalent device recommendations. + public IoTSecuritySolutionAnalyticsModel(string id = default(string), string name = default(string), string type = default(string), IoTSeverityMetrics metrics = default(IoTSeverityMetrics), int? unhealthyDeviceCount = default(int?), IList devicesMetrics = default(IList), IList topAlertedDevices = default(IList), IList mostPrevalentDeviceAlerts = default(IList), IList mostPrevalentDeviceRecommendations = default(IList)) + : base(id, name, type) + { + Metrics = metrics; + UnhealthyDeviceCount = unhealthyDeviceCount; + DevicesMetrics = devicesMetrics; + TopAlertedDevices = topAlertedDevices; + MostPrevalentDeviceAlerts = mostPrevalentDeviceAlerts; + MostPrevalentDeviceRecommendations = mostPrevalentDeviceRecommendations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets security analytics of your IoT Security solution. + /// + [JsonProperty(PropertyName = "properties.metrics")] + public IoTSeverityMetrics Metrics { get; private set; } + + /// + /// Gets number of unhealthy devices within your IoT Security solution. + /// + [JsonProperty(PropertyName = "properties.unhealthyDeviceCount")] + public int? UnhealthyDeviceCount { get; private set; } + + /// + /// Gets list of device metrics by the aggregation date. + /// + [JsonProperty(PropertyName = "properties.devicesMetrics")] + public IList DevicesMetrics { get; private set; } + + /// + /// Gets or sets list of the 3 devices with the most alerts. + /// + [JsonProperty(PropertyName = "properties.topAlertedDevices")] + public IList TopAlertedDevices { get; set; } + + /// + /// Gets or sets list of the 3 most prevalent device alerts. + /// + [JsonProperty(PropertyName = "properties.mostPrevalentDeviceAlerts")] + public IList MostPrevalentDeviceAlerts { get; set; } + + /// + /// Gets or sets list of the 3 most prevalent device recommendations. + /// + [JsonProperty(PropertyName = "properties.mostPrevalentDeviceRecommendations")] + public IList MostPrevalentDeviceRecommendations { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.cs new file mode 100644 index 000000000000..2dbfcc768ce6 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of Security analytics of your IoT Security solution + /// + public partial class IoTSecuritySolutionAnalyticsModelList + { + /// + /// Initializes a new instance of the + /// IoTSecuritySolutionAnalyticsModelList class. + /// + public IoTSecuritySolutionAnalyticsModelList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IoTSecuritySolutionAnalyticsModelList class. + /// + /// List of Security analytics of your IoT Security + /// solution + /// When there is too much alert data for one + /// page, use this URI to fetch the next page. + public IoTSecuritySolutionAnalyticsModelList(IList value, string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Security analytics of your IoT Security + /// solution + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets when there is too much alert data for one page, use this URI + /// to fetch the next page. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs new file mode 100644 index 000000000000..aee9300681d2 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs @@ -0,0 +1,63 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem + { + /// + /// Initializes a new instance of the + /// IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem + /// class. + /// + public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem + /// class. + /// + /// Aggregation of IoT Security solution device + /// alert metrics by date. + /// Device alert count by + /// severity. + public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem(System.DateTime? date = default(System.DateTime?), IoTSeverityMetrics devicesMetrics = default(IoTSeverityMetrics)) + { + Date = date; + DevicesMetrics = devicesMetrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets aggregation of IoT Security solution device alert + /// metrics by date. + /// + [JsonProperty(PropertyName = "date")] + public System.DateTime? Date { get; set; } + + /// + /// Gets or sets device alert count by severity. + /// + [JsonProperty(PropertyName = "devicesMetrics")] + public IoTSeverityMetrics DevicesMetrics { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs new file mode 100644 index 000000000000..e13dbb4122b8 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs @@ -0,0 +1,200 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// IoT Security solution configuration and resource information. + /// + [Rest.Serialization.JsonTransformation] + public partial class IoTSecuritySolutionModel + { + /// + /// Initializes a new instance of the IoTSecuritySolutionModel class. + /// + public IoTSecuritySolutionModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSecuritySolutionModel class. + /// + /// Workspace resource ID + /// Resource display name. + /// IoT Hub resource IDs + /// Resource Id + /// Resource name + /// Resource type + /// Resource tags + /// The resource location. + /// Status of the IoT Security solution. Possible + /// values include: 'Enabled', 'Disabled' + /// List of additional options for exporting to + /// workspace data. + /// Disabled data sources. Disabling + /// these data sources compromises the system. + /// List of resources that were + /// automatically discovered as relevant to the security + /// solution. + public IoTSecuritySolutionModel(string workspace, string displayName, IList iotHubs, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string status = default(string), IList export = default(IList), IList disabledDataSources = default(IList), UserDefinedResourcesProperties userDefinedResources = default(UserDefinedResourcesProperties), IList autoDiscoveredResources = default(IList), IList recommendationsConfiguration = default(IList)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + Location = location; + Workspace = workspace; + DisplayName = displayName; + Status = status; + Export = export; + DisabledDataSources = disabledDataSources; + IotHubs = iotHubs; + UserDefinedResources = userDefinedResources; + AutoDiscoveredResources = autoDiscoveredResources; + RecommendationsConfiguration = recommendationsConfiguration; + 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 resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets workspace resource ID + /// + [JsonProperty(PropertyName = "properties.workspace")] + public string Workspace { get; set; } + + /// + /// Gets or sets resource display name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets status of the IoT Security solution. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets list of additional options for exporting to workspace + /// data. + /// + [JsonProperty(PropertyName = "properties.export")] + public IList Export { get; set; } + + /// + /// Gets or sets disabled data sources. Disabling these data sources + /// compromises the system. + /// + [JsonProperty(PropertyName = "properties.disabledDataSources")] + public IList DisabledDataSources { get; set; } + + /// + /// Gets or sets ioT Hub resource IDs + /// + [JsonProperty(PropertyName = "properties.iotHubs")] + public IList IotHubs { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.userDefinedResources")] + public UserDefinedResourcesProperties UserDefinedResources { get; set; } + + /// + /// Gets list of resources that were automatically discovered as + /// relevant to the security solution. + /// + [JsonProperty(PropertyName = "properties.autoDiscoveredResources")] + public IList AutoDiscoveredResources { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommendationsConfiguration")] + public IList RecommendationsConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Workspace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Workspace"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (IotHubs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IotHubs"); + } + if (UserDefinedResources != null) + { + UserDefinedResources.Validate(); + } + if (RecommendationsConfiguration != null) + { + foreach (var element in RecommendationsConfiguration) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.cs new file mode 100644 index 000000000000..31723ada6abe --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// IoT Security solution analytics severity metrics. + /// + public partial class IoTSeverityMetrics + { + /// + /// Initializes a new instance of the IoTSeverityMetrics class. + /// + public IoTSeverityMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTSeverityMetrics class. + /// + /// Count of high severity + /// alerts/recommendations. + /// Count of medium severity + /// alerts/recommendations. + /// Count of low severity + /// alerts/recommendations. + public IoTSeverityMetrics(int? high = default(int?), int? medium = default(int?), int? low = default(int?)) + { + High = high; + Medium = medium; + Low = low; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets count of high severity alerts/recommendations. + /// + [JsonProperty(PropertyName = "high")] + public int? High { get; set; } + + /// + /// Gets or sets count of medium severity alerts/recommendations. + /// + [JsonProperty(PropertyName = "medium")] + public int? Medium { get; set; } + + /// + /// Gets or sets count of low severity alerts/recommendations. + /// + [JsonProperty(PropertyName = "low")] + public int? Low { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs index 8e5b8e74b786..d9317bcb088a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs @@ -35,10 +35,13 @@ public JitNetworkAccessPolicyVirtualMachine() /// to this policy /// Port configurations for the virtual /// machine - public JitNetworkAccessPolicyVirtualMachine(string id, IList ports) + /// Public IP address of the Azure + /// Firewall that is linked to this policy, if applicable + public JitNetworkAccessPolicyVirtualMachine(string id, IList ports, string publicIpAddress = default(string)) { Id = id; Ports = ports; + PublicIpAddress = publicIpAddress; CustomInit(); } @@ -60,6 +63,13 @@ public JitNetworkAccessPolicyVirtualMachine(string id, IList Ports { get; set; } + /// + /// Gets or sets public IP address of the Azure Firewall that is linked + /// to this policy, if applicable + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; set; } + /// /// Validate the object. /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs index cdc7305cc79d..18a2297f1887 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs @@ -44,7 +44,9 @@ public JitNetworkAccessRequestPort() /// "192.168.0.0/16". /// Mutually exclusive with /// the "allowedSourceAddressPrefix" parameter. - public JitNetworkAccessRequestPort(int number, System.DateTime endTimeUtc, string status, string statusReason, string allowedSourceAddressPrefix = default(string), IList allowedSourceAddressPrefixes = default(IList)) + /// The port which is mapped to this port's + /// `number` in the Azure Firewall, if applicable + public JitNetworkAccessRequestPort(int number, System.DateTime endTimeUtc, string status, string statusReason, string allowedSourceAddressPrefix = default(string), IList allowedSourceAddressPrefixes = default(IList), int? mappedPort = default(int?)) { Number = number; AllowedSourceAddressPrefix = allowedSourceAddressPrefix; @@ -52,6 +54,7 @@ public JitNetworkAccessRequestPort() EndTimeUtc = endTimeUtc; Status = status; StatusReason = statusReason; + MappedPort = mappedPort; CustomInit(); } @@ -102,6 +105,13 @@ public JitNetworkAccessRequestPort() [JsonProperty(PropertyName = "statusReason")] public string StatusReason { get; set; } + /// + /// Gets or sets the port which is mapped to this port's `number` in + /// the Azure Firewall, if applicable + /// + [JsonProperty(PropertyName = "mappedPort")] + public int? MappedPort { get; set; } + /// /// Validate the object. /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs new file mode 100644 index 000000000000..54e2617ed415 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A List custom alert rule. + /// + public partial class ListCustomAlertRule : CustomAlertRule + { + /// + /// Initializes a new instance of the ListCustomAlertRule class. + /// + public ListCustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListCustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + /// The value type of the items in the list. + /// Possible values include: 'IpCidr', 'String' + public ListCustomAlertRule(bool isEnabled, string ruleType, string displayName = default(string), string description = default(string), string valueType = default(string)) + : base(isEnabled, ruleType, displayName, description) + { + ValueType = valueType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the value type of the items in the list. Possible values + /// include: 'IpCidr', 'String' + /// + [JsonProperty(PropertyName = "valueType")] + public string ValueType { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs new file mode 100644 index 000000000000..36774200ed2c --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs @@ -0,0 +1,123 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a path that is recommended to be allowed and its properties + /// + public partial class PathRecommendation + { + /// + /// Initializes a new instance of the PathRecommendation class. + /// + public PathRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PathRecommendation class. + /// + /// The full path to whitelist + /// Possible values include: 'Recommended', 'Add', + /// 'Remove' + /// Possible values include: 'File', 'FileHash', + /// 'PublisherSignature', 'ProductSignature', 'BinarySignature', + /// 'VersionAndAboveSignature' + /// Whether the path is commonly run on the + /// machine + /// Possible values include: 'Exe', 'Dll', + /// 'Msi', 'Script', 'Executable', 'Unknown' + /// Possible values include: + /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', + /// 'NoStatus' + public PathRecommendation(string path = default(string), string action = default(string), string type = default(string), PublisherInfo publisherInfo = default(PublisherInfo), bool? common = default(bool?), IList userSids = default(IList), IList usernames = default(IList), string fileType = default(string), string configurationStatus = default(string)) + { + Path = path; + Action = action; + Type = type; + PublisherInfo = publisherInfo; + Common = common; + UserSids = userSids; + Usernames = usernames; + FileType = fileType; + ConfigurationStatus = configurationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full path to whitelist + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets possible values include: 'Recommended', 'Add', + /// 'Remove' + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// Gets or sets possible values include: 'File', 'FileHash', + /// 'PublisherSignature', 'ProductSignature', 'BinarySignature', + /// 'VersionAndAboveSignature' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "publisherInfo")] + public PublisherInfo PublisherInfo { get; set; } + + /// + /// Gets or sets whether the path is commonly run on the machine + /// + [JsonProperty(PropertyName = "common")] + public bool? Common { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userSids")] + public IList UserSids { get; set; } + + /// + /// + [JsonProperty(PropertyName = "usernames")] + public IList Usernames { get; set; } + + /// + /// Gets or sets possible values include: 'Exe', 'Dll', 'Msi', + /// 'Script', 'Executable', 'Unknown' + /// + [JsonProperty(PropertyName = "fileType")] + public string FileType { get; set; } + + /// + /// Gets or sets possible values include: 'Configured', + /// 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + /// + [JsonProperty(PropertyName = "configurationStatus")] + public string ConfigurationStatus { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs index bdbe74c661f0..145fa72a76b7 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs @@ -16,7 +16,10 @@ namespace Microsoft.Azure.Management.Security.Models using System.Linq; /// - /// Pricing tier will be applied for the scope based on the resource ID + /// Azure Security Center is provided in two pricing tiers: free and + /// standard, with the standard tier available with a trial period. The + /// standard tier offers advanced security capabilities, while the free + /// tier offers basic security features. /// [Rest.Serialization.JsonTransformation] public partial class Pricing : Resource @@ -32,8 +35,12 @@ public Pricing() /// /// Initializes a new instance of the Pricing class. /// - /// The pricing tier value. Possible values - /// include: 'Free', 'Standard' + /// The pricing tier value. Azure Security + /// Center is provided in two pricing tiers: free and standard, with + /// the standard tier available with a trial period. The standard tier + /// offers advanced security capabilities, while the free tier offers + /// basic security features. Possible values include: 'Free', + /// 'Standard' /// Resource Id /// Resource name /// Resource type @@ -54,8 +61,11 @@ public Pricing() partial void CustomInit(); /// - /// Gets or sets the pricing tier value. Possible values include: - /// 'Free', 'Standard' + /// Gets or sets the pricing tier value. Azure Security Center is + /// provided in two pricing tiers: free and standard, with the standard + /// tier available with a trial period. The standard tier offers + /// advanced security capabilities, while the free tier offers basic + /// security features. Possible values include: 'Free', 'Standard' /// [JsonProperty(PropertyName = "properties.pricingTier")] public string PricingTier { get; set; } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PricingList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PricingList.cs index 8941510826f5..6d3f6c87855b 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PricingList.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PricingList.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Management.Security.Models using System.Linq; /// - /// List of pricing configurations response + /// List of pricing configurations response. /// public partial class PricingList { diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs new file mode 100644 index 000000000000..2ddd5dc41bc4 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs @@ -0,0 +1,86 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents the publisher information of a process/rule + /// + public partial class PublisherInfo + { + /// + /// Initializes a new instance of the PublisherInfo class. + /// + public PublisherInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PublisherInfo class. + /// + /// The Subject field of the x.509 + /// certificate used to sign the code, using the following fields - O + /// = Organization, L = Locality, S = State or Province, and C = + /// Country + /// The product name taken from the file's + /// version resource + /// The "OriginalName" field taken from the + /// file's version resource + /// The binary file version taken from the file's + /// version resource + public PublisherInfo(string publisherName = default(string), string productName = default(string), string binaryName = default(string), string version = default(string)) + { + PublisherName = publisherName; + ProductName = productName; + BinaryName = binaryName; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Subject field of the x.509 certificate used to + /// sign the code, using the following fields - O = Organization, L = + /// Locality, S = State or Province, and C = Country + /// + [JsonProperty(PropertyName = "publisherName")] + public string PublisherName { get; set; } + + /// + /// Gets or sets the product name taken from the file's version + /// resource + /// + [JsonProperty(PropertyName = "productName")] + public string ProductName { get; set; } + + /// + /// Gets or sets the "OriginalName" field taken from the file's version + /// resource + /// + [JsonProperty(PropertyName = "binaryName")] + public string BinaryName { get; set; } + + /// + /// Gets or sets the binary file version taken from the file's version + /// resource + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.cs new file mode 100644 index 000000000000..43bb6bcde242 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.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.Security.Models +{ + + /// + /// Defines values for RecommendationConfigStatus. + /// + public static class RecommendationConfigStatus + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs new file mode 100644 index 000000000000..8f915c231964 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs @@ -0,0 +1,107 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The type of IoT Security recommendation. + /// + public partial class RecommendationConfigurationProperties + { + /// + /// Initializes a new instance of the + /// RecommendationConfigurationProperties class. + /// + public RecommendationConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RecommendationConfigurationProperties class. + /// + /// The type of IoT Security + /// recommendation. Possible values include: 'IoT_ACRAuthentication', + /// 'IoT_AgentSendsUnutilizedMessages', 'IoT_Baseline', + /// 'IoT_EdgeHubMemOptimize', 'IoT_EdgeLoggingOptions', + /// 'IoT_InconsistentModuleSettings', 'IoT_InstallAgent', + /// 'IoT_IPFilter_DenyAll', 'IoT_IPFilter_PermissiveRule', + /// 'IoT_OpenPorts', 'IoT_PermissiveFirewallPolicy', + /// 'IoT_PermissiveInputFirewallRules', + /// 'IoT_PermissiveOutputFirewallRules', 'IoT_PrivilegedDockerOptions', + /// 'IoT_SharedCredentials', 'IoT_VulnerableTLSCipherSuite' + /// Recommendation status. When the recommendation + /// status is disabled recommendations are not generated. Possible + /// values include: 'Disabled', 'Enabled' + public RecommendationConfigurationProperties(string recommendationType, string status, string name = default(string)) + { + RecommendationType = recommendationType; + Name = name; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of IoT Security recommendation. Possible + /// values include: 'IoT_ACRAuthentication', + /// 'IoT_AgentSendsUnutilizedMessages', 'IoT_Baseline', + /// 'IoT_EdgeHubMemOptimize', 'IoT_EdgeLoggingOptions', + /// 'IoT_InconsistentModuleSettings', 'IoT_InstallAgent', + /// 'IoT_IPFilter_DenyAll', 'IoT_IPFilter_PermissiveRule', + /// 'IoT_OpenPorts', 'IoT_PermissiveFirewallPolicy', + /// 'IoT_PermissiveInputFirewallRules', + /// 'IoT_PermissiveOutputFirewallRules', 'IoT_PrivilegedDockerOptions', + /// 'IoT_SharedCredentials', 'IoT_VulnerableTLSCipherSuite' + /// + [JsonProperty(PropertyName = "recommendationType")] + public string RecommendationType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets recommendation status. When the recommendation status + /// is disabled recommendations are not generated. Possible values + /// include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecommendationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RecommendationType"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs new file mode 100644 index 000000000000..325aab5eebae --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs @@ -0,0 +1,101 @@ +// +// 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.Security.Models +{ + + /// + /// Defines values for RecommendationType. + /// + public static class RecommendationType + { + /// + /// Authentication schema used for pull an edge module from an ACR + /// repository does not use Service Principal Authentication. + /// + public const string IoTACRAuthentication = "IoT_ACRAuthentication"; + /// + /// IoT agent message size capacity is currently underutilized, causing + /// an increase in the number of sent messages. Adjust message + /// intervals for better utilization. + /// + public const string IoTAgentSendsUnutilizedMessages = "IoT_AgentSendsUnutilizedMessages"; + /// + /// Identified security related system configuration issues. + /// + public const string IoTBaseline = "IoT_Baseline"; + /// + /// You can optimize Edge Hub memory usage by turning off protocol + /// heads for any protocols not used by Edge modules in your solution. + /// + public const string IoTEdgeHubMemOptimize = "IoT_EdgeHubMemOptimize"; + /// + /// Logging is disabled for this edge module. + /// + public const string IoTEdgeLoggingOptions = "IoT_EdgeLoggingOptions"; + /// + /// A minority within a device security group has inconsistent Edge + /// Module settings with the rest of their group. + /// + public const string IoTInconsistentModuleSettings = "IoT_InconsistentModuleSettings"; + /// + /// Install the Azure Security of Things Agent. + /// + public const string IoTInstallAgent = "IoT_InstallAgent"; + /// + /// IP Filter Configuration should have rules defined for allowed + /// traffic and should deny all other traffic by default. + /// + public const string IoTIPFilterDenyAll = "IoT_IPFilter_DenyAll"; + /// + /// An Allow IP Filter rules source IP range is too large. Overly + /// permissive rules might expose your IoT hub to malicious intenders. + /// + public const string IoTIPFilterPermissiveRule = "IoT_IPFilter_PermissiveRule"; + /// + /// A listening endpoint was found on the device. + /// + public const string IoTOpenPorts = "IoT_OpenPorts"; + /// + /// An Allowed firewall policy was found (INPUT/OUTPUT). The policy + /// should Deny all traffic by default and define rules to allow + /// necessary communication to/from the device. + /// + public const string IoTPermissiveFirewallPolicy = "IoT_PermissiveFirewallPolicy"; + /// + /// A rule in the firewall has been found that contains a permissive + /// pattern for a wide range of IP addresses or Ports. + /// + public const string IoTPermissiveInputFirewallRules = "IoT_PermissiveInputFirewallRules"; + /// + /// A rule in the firewall has been found that contains a permissive + /// pattern for a wide range of IP addresses or Ports. + /// + public const string IoTPermissiveOutputFirewallRules = "IoT_PermissiveOutputFirewallRules"; + /// + /// Edge module is configured to run in privileged mode, with extensive + /// Linux capabilities or with host-level network access (send/receive + /// data to host machine). + /// + public const string IoTPrivilegedDockerOptions = "IoT_PrivilegedDockerOptions"; + /// + /// Same authentication credentials to the IoT Hub used by multiple + /// devices. This could indicate an illegitimate device impersonating a + /// legitimate device. It also exposes the risk of device impersonation + /// by an attacker. + /// + public const string IoTSharedCredentials = "IoT_SharedCredentials"; + /// + /// Insecure TLS configurations detected. Immediate upgrade + /// recommended. + /// + public const string IoTVulnerableTLSCipherSuite = "IoT_VulnerableTLSCipherSuite"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.cs new file mode 100644 index 000000000000..04aa23861a3e --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.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.Security.Models +{ + + /// + /// Defines values for SecuritySolutionStatus. + /// + public static class SecuritySolutionStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs new file mode 100644 index 000000000000..b439ebeeee5c --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs @@ -0,0 +1,65 @@ +// +// 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.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the server vulnerability assessment details on a resource + /// + [Rest.Serialization.JsonTransformation] + public partial class ServerVulnerabilityAssessment : Resource + { + /// + /// Initializes a new instance of the ServerVulnerabilityAssessment + /// class. + /// + public ServerVulnerabilityAssessment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerVulnerabilityAssessment + /// class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// The provisioningState of the + /// vulnerability assessment capability on the VM. Possible values + /// include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', + /// 'Deprovisioning' + public ServerVulnerabilityAssessment(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioningState of the vulnerability assessment + /// capability on the VM. Possible values include: 'Succeeded', + /// 'Failed', 'Canceled', 'Provisioning', 'Deprovisioning' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs similarity index 58% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs index 9367b757121b..55aa5f7c97b7 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs @@ -8,32 +8,34 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Security.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Custom measurements of the event + /// List of server vulnerability assessments /// - public partial class EventsResultDataCustomMeasurements + public partial class ServerVulnerabilityAssessmentsList { /// /// Initializes a new instance of the - /// EventsResultDataCustomMeasurements class. + /// ServerVulnerabilityAssessmentsList class. /// - public EventsResultDataCustomMeasurements() + public ServerVulnerabilityAssessmentsList() { CustomInit(); } /// /// Initializes a new instance of the - /// EventsResultDataCustomMeasurements class. + /// ServerVulnerabilityAssessmentsList class. /// - public EventsResultDataCustomMeasurements(object additionalProperties = default(object)) + public ServerVulnerabilityAssessmentsList(IList value = default(IList)) { - AdditionalProperties = additionalProperties; + Value = value; CustomInit(); } @@ -44,8 +46,8 @@ public EventsResultDataCustomMeasurements() /// /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs similarity index 53% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs index e3cb5c4a0740..66212bd8fb3a 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs @@ -8,33 +8,34 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Security.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Client performance information + /// A container holding only the Tags for a resource, allowing the user to + /// update the tags. /// - public partial class EventsClientPerformanceInfo + public partial class TagsResource { /// - /// Initializes a new instance of the EventsClientPerformanceInfo - /// class. + /// Initializes a new instance of the TagsResource class. /// - public EventsClientPerformanceInfo() + public TagsResource() { CustomInit(); } /// - /// Initializes a new instance of the EventsClientPerformanceInfo - /// class. + /// Initializes a new instance of the TagsResource class. /// - /// The name of the client performance - public EventsClientPerformanceInfo(string name = default(string)) + /// Resource tags + public TagsResource(IDictionary tags = default(IDictionary)) { - Name = name; + Tags = tags; CustomInit(); } @@ -44,10 +45,10 @@ public EventsClientPerformanceInfo() partial void CustomInit(); /// - /// Gets or sets the name of the client performance + /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs new file mode 100644 index 000000000000..e2d1c2cd67e5 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs @@ -0,0 +1,77 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A custom alert rule that checks if a value (depends on the custom alert + /// type) is within the given range. + /// + public partial class ThresholdCustomAlertRule : CustomAlertRule + { + /// + /// Initializes a new instance of the ThresholdCustomAlertRule class. + /// + public ThresholdCustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThresholdCustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The minimum threshold. + /// The maximum threshold. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + public ThresholdCustomAlertRule(bool isEnabled, string ruleType, int minThreshold, int maxThreshold, string displayName = default(string), string description = default(string)) + : base(isEnabled, ruleType, displayName, description) + { + MinThreshold = minThreshold; + MaxThreshold = maxThreshold; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum threshold. + /// + [JsonProperty(PropertyName = "minThreshold")] + public int MinThreshold { get; set; } + + /// + /// Gets or sets the maximum threshold. + /// + [JsonProperty(PropertyName = "maxThreshold")] + public int MaxThreshold { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs new file mode 100644 index 000000000000..331b0b69e8dc --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs @@ -0,0 +1,72 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A custom alert rule that checks if the number of activities (depends on + /// the custom alert type) in a time window is within the given range. + /// + public partial class TimeWindowCustomAlertRule : ThresholdCustomAlertRule + { + /// + /// Initializes a new instance of the TimeWindowCustomAlertRule class. + /// + public TimeWindowCustomAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeWindowCustomAlertRule class. + /// + /// Status of the custom alert. + /// The type of the custom alert rule. + /// The minimum threshold. + /// The maximum threshold. + /// The time window size in iso8601 + /// format. + /// The display name of the custom + /// alert. + /// The description of the custom + /// alert. + public TimeWindowCustomAlertRule(bool isEnabled, string ruleType, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) + : base(isEnabled, ruleType, minThreshold, maxThreshold, displayName, description) + { + TimeWindowSize = timeWindowSize; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time window size in iso8601 format. + /// + [JsonProperty(PropertyName = "timeWindowSize")] + public System.TimeSpan TimeWindowSize { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.cs new file mode 100644 index 000000000000..f789fd59b1e1 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class UpdateIotSecuritySolutionData : TagsResource + { + /// + /// Initializes a new instance of the UpdateIotSecuritySolutionData + /// class. + /// + public UpdateIotSecuritySolutionData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateIotSecuritySolutionData + /// class. + /// + /// Resource tags + public UpdateIotSecuritySolutionData(IDictionary tags = default(IDictionary), UserDefinedResourcesProperties userDefinedResources = default(UserDefinedResourcesProperties), IList recommendationsConfiguration = default(IList)) + : base(tags) + { + UserDefinedResources = userDefinedResources; + RecommendationsConfiguration = recommendationsConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.userDefinedResources")] + public UserDefinedResourcesProperties UserDefinedResources { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.recommendationsConfiguration")] + public IList RecommendationsConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UserDefinedResources != null) + { + UserDefinedResources.Validate(); + } + if (RecommendationsConfiguration != null) + { + foreach (var element in RecommendationsConfiguration) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.cs new file mode 100644 index 000000000000..509f38822ff6 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.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.Security.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of the IoT Security solution's user defined resources. + /// + public partial class UserDefinedResourcesProperties + { + /// + /// Initializes a new instance of the UserDefinedResourcesProperties + /// class. + /// + public UserDefinedResourcesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserDefinedResourcesProperties + /// class. + /// + /// Azure Resource Graph query which represents the + /// security solution's user defined resources. Required to start with + /// "where type != "Microsoft.Devices/IotHubs"" + /// List of Azure subscription ids on + /// which the user defined resources query should be executed. + public UserDefinedResourcesProperties(string query, IList querySubscriptions) + { + Query = query; + QuerySubscriptions = querySubscriptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Resource Graph query which represents the + /// security solution's user defined resources. Required to start with + /// "where type != "Microsoft.Devices/IotHubs"" + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets list of Azure subscription ids on which the user + /// defined resources query should be executed. + /// + [JsonProperty(PropertyName = "querySubscriptions")] + public IList QuerySubscriptions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (QuerySubscriptions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "QuerySubscriptions"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs new file mode 100644 index 000000000000..2fb025f28d4b --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs @@ -0,0 +1,63 @@ +// +// 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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a user that is recommended to be allowed for a certain rule + /// + public partial class UserRecommendation + { + /// + /// Initializes a new instance of the UserRecommendation class. + /// + public UserRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserRecommendation class. + /// + /// Represents a user that is recommended to be + /// allowed for a certain rule + /// Possible values include: + /// 'Recommended', 'Add', 'Remove' + public UserRecommendation(string username = default(string), string recommendationAction = default(string)) + { + Username = username; + RecommendationAction = recommendationAction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets represents a user that is recommended to be allowed + /// for a certain rule + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets possible values include: 'Recommended', 'Add', + /// 'Remove' + /// + [JsonProperty(PropertyName = "recommendationAction")] + public string RecommendationAction { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.cs new file mode 100644 index 000000000000..555342f47de3 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.cs @@ -0,0 +1,28 @@ +// +// 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.Security.Models +{ + + /// + /// Defines values for ValueType. + /// + public static class ValueType + { + /// + /// An IP range in CIDR format (e.g. '192.168.0.1/8'). + /// + public const string IpCidr = "IpCidr"; + /// + /// Any string value. + /// + public const string String = "String"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.cs new file mode 100644 index 000000000000..d3ea8f2951ef --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.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.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a machine that is part of a VM/server group + /// + public partial class VmRecommendation + { + /// + /// Initializes a new instance of the VmRecommendation class. + /// + public VmRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VmRecommendation class. + /// + /// Possible values include: + /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', + /// 'NoStatus' + /// Possible values include: + /// 'Recommended', 'Add', 'Remove' + public VmRecommendation(string configurationStatus = default(string), string recommendationAction = default(string), string resourceId = default(string)) + { + ConfigurationStatus = configurationStatus; + RecommendationAction = recommendationAction; + ResourceId = resourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Configured', + /// 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + /// + [JsonProperty(PropertyName = "configurationStatus")] + public string ConfigurationStatus { get; set; } + + /// + /// Gets or sets possible values include: 'Recommended', 'Add', + /// 'Remove' + /// + [JsonProperty(PropertyName = "recommendationAction")] + public string RecommendationAction { get; set; } + + /// + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs index b3fc26af3286..40be7023380e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs @@ -51,7 +51,7 @@ internal PricingsOperations(SecurityCenterClient client) public SecurityCenterClient Client { get; private set; } /// - /// Security pricing configurations in the subscription + /// Lists Security Center pricing configurations in the subscription. /// /// /// Headers that will be added to request. @@ -234,7 +234,7 @@ internal PricingsOperations(SecurityCenterClient client) } /// - /// Security pricing configuration in the subscription + /// Gets a provided Security Center pricing configuration in the subscription. /// /// /// name of the pricing configuration @@ -426,13 +426,18 @@ internal PricingsOperations(SecurityCenterClient client) } /// - /// Security pricing configuration in the subscription + /// Updates a provided Security Center pricing configuration in the + /// subscription. /// /// /// name of the pricing configuration /// /// - /// The pricing tier value. Possible values include: 'Free', 'Standard' + /// The pricing tier value. Azure Security Center is provided in two pricing + /// tiers: free and standard, with the standard tier available with a trial + /// period. The standard tier offers advanced security capabilities, while the + /// free tier offers basic security features. Possible values include: 'Free', + /// 'Standard' /// /// /// Headers that will be added to request. diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs index 4a4bb93d6457..7e17c1a59785 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Security public static partial class PricingsOperationsExtensions { /// - /// Security pricing configurations in the subscription + /// Lists Security Center pricing configurations in the subscription. /// /// /// The operations group for this extension method. @@ -33,7 +33,7 @@ public static PricingList List(this IPricingsOperations operations) } /// - /// Security pricing configurations in the subscription + /// Lists Security Center pricing configurations in the subscription. /// /// /// The operations group for this extension method. @@ -50,7 +50,7 @@ public static PricingList List(this IPricingsOperations operations) } /// - /// Security pricing configuration in the subscription + /// Gets a provided Security Center pricing configuration in the subscription. /// /// /// The operations group for this extension method. @@ -64,7 +64,7 @@ public static Pricing Get(this IPricingsOperations operations, string pricingNam } /// - /// Security pricing configuration in the subscription + /// Gets a provided Security Center pricing configuration in the subscription. /// /// /// The operations group for this extension method. @@ -84,7 +84,8 @@ public static Pricing Get(this IPricingsOperations operations, string pricingNam } /// - /// Security pricing configuration in the subscription + /// Updates a provided Security Center pricing configuration in the + /// subscription. /// /// /// The operations group for this extension method. @@ -93,7 +94,11 @@ public static Pricing Get(this IPricingsOperations operations, string pricingNam /// name of the pricing configuration /// /// - /// The pricing tier value. Possible values include: 'Free', 'Standard' + /// The pricing tier value. Azure Security Center is provided in two pricing + /// tiers: free and standard, with the standard tier available with a trial + /// period. The standard tier offers advanced security capabilities, while the + /// free tier offers basic security features. Possible values include: 'Free', + /// 'Standard' /// public static Pricing Update(this IPricingsOperations operations, string pricingName, string pricingTier) { @@ -101,7 +106,8 @@ public static Pricing Update(this IPricingsOperations operations, string pricing } /// - /// Security pricing configuration in the subscription + /// Updates a provided Security Center pricing configuration in the + /// subscription. /// /// /// The operations group for this extension method. @@ -110,7 +116,11 @@ public static Pricing Update(this IPricingsOperations operations, string pricing /// name of the pricing configuration /// /// - /// The pricing tier value. Possible values include: 'Free', 'Standard' + /// The pricing tier value. Azure Security Center is provided in two pricing + /// tiers: free and standard, with the standard tier available with a trial + /// period. The standard tier offers advanced security capabilities, while the + /// free tier offers basic security features. Possible values include: 'Free', + /// 'Standard' /// /// /// The cancellation token. diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs index f046e1d41d10..97df5dadd441 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs @@ -19,15 +19,21 @@ public static IEnumerable> ApiInfo_SecurityCenter { return new Tuple[] { + new Tuple("Security", "AdaptiveApplicationControls", "2015-06-01-preview"), new Tuple("Security", "AdvancedThreatProtection", "2017-08-01-preview"), new Tuple("Security", "Alerts", "2019-01-01"), new Tuple("Security", "AllowedConnections", "2015-06-01-preview"), new Tuple("Security", "AutoProvisioningSettings", "2017-08-01-preview"), new Tuple("Security", "ComplianceResults", "2017-08-01"), new Tuple("Security", "Compliances", "2017-08-01-preview"), + new Tuple("Security", "DeviceSecurityGroups", "2019-08-01"), new Tuple("Security", "DiscoveredSecuritySolutions", "2015-06-01-preview"), new Tuple("Security", "ExternalSecuritySolutions", "2015-06-01-preview"), new Tuple("Security", "InformationProtectionPolicies", "2017-08-01-preview"), + new Tuple("Security", "IotSecuritySolution", "2019-08-01"), + new Tuple("Security", "IotSecuritySolutionAnalytics", "2019-08-01"), + new Tuple("Security", "IotSecuritySolutionsAnalyticsAggregatedAlert", "2019-08-01"), + new Tuple("Security", "IotSecuritySolutionsAnalyticsRecommendation", "2019-08-01"), new Tuple("Security", "JitNetworkAccessPolicies", "2015-06-01-preview"), new Tuple("Security", "Locations", "2015-06-01-preview"), new Tuple("Security", "Operations", "2015-06-01-preview"), @@ -36,6 +42,7 @@ public static IEnumerable> ApiInfo_SecurityCenter new Tuple("Security", "RegulatoryComplianceControls", "2019-01-01-preview"), new Tuple("Security", "RegulatoryComplianceStandards", "2019-01-01-preview"), new Tuple("Security", "SecurityContacts", "2017-08-01-preview"), + new Tuple("Security", "ServerVulnerabilityAssessment", "2019-01-01-preview"), new Tuple("Security", "Settings", "2019-01-01"), new Tuple("Security", "Tasks", "2015-06-01-preview"), new Tuple("Security", "Topology", "2015-06-01-preview"), diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs index 5c2d08f0d034..2c579f046c01 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs @@ -96,6 +96,31 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual ISettingsOperations Settings { get; private set; } + /// + /// Gets the IDeviceSecurityGroupsOperations. + /// + public virtual IDeviceSecurityGroupsOperations DeviceSecurityGroups { get; private set; } + + /// + /// Gets the IIotSecuritySolutionOperations. + /// + public virtual IIotSecuritySolutionOperations IotSecuritySolution { get; private set; } + + /// + /// Gets the IIotSecuritySolutionAnalyticsOperations. + /// + public virtual IIotSecuritySolutionAnalyticsOperations IotSecuritySolutionAnalytics { get; private set; } + + /// + /// Gets the IIotSecuritySolutionsAnalyticsAggregatedAlertOperations. + /// + public virtual IIotSecuritySolutionsAnalyticsAggregatedAlertOperations IotSecuritySolutionsAnalyticsAggregatedAlert { get; private set; } + + /// + /// Gets the IIotSecuritySolutionsAnalyticsRecommendationOperations. + /// + public virtual IIotSecuritySolutionsAnalyticsRecommendationOperations IotSecuritySolutionsAnalyticsRecommendation { get; private set; } + /// /// Gets the IAllowedConnectionsOperations. /// @@ -116,6 +141,11 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual IJitNetworkAccessPoliciesOperations JitNetworkAccessPolicies { get; private set; } + /// + /// Gets the IAdaptiveApplicationControlsOperations. + /// + public virtual IAdaptiveApplicationControlsOperations AdaptiveApplicationControls { get; private set; } + /// /// Gets the ILocationsOperations. /// @@ -181,6 +211,11 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual IRegulatoryComplianceAssessmentsOperations RegulatoryComplianceAssessments { get; private set; } + /// + /// Gets the IServerVulnerabilityAssessmentOperations. + /// + public virtual IServerVulnerabilityAssessmentOperations ServerVulnerabilityAssessment { get; private set; } + /// /// Initializes a new instance of the SecurityCenterClient class. /// @@ -426,10 +461,16 @@ private void Initialize() Pricings = new PricingsOperations(this); Alerts = new AlertsOperations(this); Settings = new SettingsOperations(this); + DeviceSecurityGroups = new DeviceSecurityGroupsOperations(this); + IotSecuritySolution = new IotSecuritySolutionOperations(this); + IotSecuritySolutionAnalytics = new IotSecuritySolutionAnalyticsOperations(this); + IotSecuritySolutionsAnalyticsAggregatedAlert = new IotSecuritySolutionsAnalyticsAggregatedAlertOperations(this); + IotSecuritySolutionsAnalyticsRecommendation = new IotSecuritySolutionsAnalyticsRecommendationOperations(this); AllowedConnections = new AllowedConnectionsOperations(this); DiscoveredSecuritySolutions = new DiscoveredSecuritySolutionsOperations(this); ExternalSecuritySolutions = new ExternalSecuritySolutionsOperations(this); JitNetworkAccessPolicies = new JitNetworkAccessPoliciesOperations(this); + AdaptiveApplicationControls = new AdaptiveApplicationControlsOperations(this); Locations = new LocationsOperations(this); Operations = new Operations(this); Tasks = new TasksOperations(this); @@ -443,6 +484,7 @@ private void Initialize() RegulatoryComplianceStandards = new RegulatoryComplianceStandardsOperations(this); RegulatoryComplianceControls = new RegulatoryComplianceControlsOperations(this); RegulatoryComplianceAssessments = new RegulatoryComplianceAssessmentsOperations(this); + ServerVulnerabilityAssessment = new ServerVulnerabilityAssessmentOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs new file mode 100644 index 000000000000..46ac7bbde995 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs @@ -0,0 +1,985 @@ +// +// 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.Security +{ + 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; + + /// + /// ServerVulnerabilityAssessmentOperations operations. + /// + internal partial class ServerVulnerabilityAssessmentOperations : IServiceOperations, IServerVulnerabilityAssessmentOperations + { + /// + /// Initializes a new instance of the ServerVulnerabilityAssessmentOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServerVulnerabilityAssessmentOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// Gets a list of server vulnerability assessment onboarding statuses on a + /// given resource. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceNamespace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); + } + if (resourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + string apiVersion = "2019-01-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceNamespace", resourceNamespace); + tracingParameters.Add("resourceType", resourceType); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByExtendedResource", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); + _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); + _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; + } + + /// + /// Gets a server vulnerability assessment onboarding statuses on a given + /// resource. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceNamespace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); + } + if (resourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + string serverVulnerabilityAssessment = "default"; + string apiVersion = "2019-01-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceNamespace", resourceNamespace); + tracingParameters.Add("resourceType", resourceType); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); + _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); + 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; + } + + /// + /// Creating a server vulnerability assessment on a resource, which will + /// onboard a resource for having a vulnerability assessment on it + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceNamespace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); + } + if (resourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + string serverVulnerabilityAssessment = "default"; + string apiVersion = "2019-01-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceNamespace", resourceNamespace); + tracingParameters.Add("resourceType", resourceType); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); + tracingParameters.Add("apiVersion", apiVersion); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); + _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // 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 != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Removing server vulnerability assessment from a resource. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// 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 resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (resourceNamespace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); + } + if (resourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + string serverVulnerabilityAssessment = "default"; + string apiVersion = "2019-01-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceNamespace", resourceNamespace); + tracingParameters.Add("resourceType", resourceType); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); + tracingParameters.Add("apiVersion", apiVersion); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); + _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs new file mode 100644 index 000000000000..97efe1460c78 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs @@ -0,0 +1,244 @@ +// +// 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.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServerVulnerabilityAssessmentOperations. + /// + public static partial class ServerVulnerabilityAssessmentOperationsExtensions + { + /// + /// Gets a list of server vulnerability assessment onboarding statuses on a + /// given resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + public static ServerVulnerabilityAssessmentsList ListByExtendedResource(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) + { + return operations.ListByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of server vulnerability assessment onboarding statuses on a + /// given resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListByExtendedResourceAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByExtendedResourceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a server vulnerability assessment onboarding statuses on a given + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + public static ServerVulnerabilityAssessment Get(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a server vulnerability assessment onboarding statuses on a given + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creating a server vulnerability assessment on a resource, which will + /// onboard a resource for having a vulnerability assessment on it + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + public static ServerVulnerabilityAssessment CreateOrUpdate(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Creating a server vulnerability assessment on a resource, which will + /// onboard a resource for having a vulnerability assessment on it + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Removing server vulnerability assessment from a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + public static void Delete(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Removing server vulnerability assessment from a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The Namespace of the resource. + /// + /// + /// The type of the resource. + /// + /// + /// Name of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs new file mode 100644 index 000000000000..b911d1f74c85 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs @@ -0,0 +1,782 @@ +// +// 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.Storage +{ + 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; + + /// + /// FileServicesOperations operations. + /// + internal partial class FileServicesOperations : IServiceOperations, IFileServicesOperations + { + /// + /// Initializes a new instance of the FileServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileServicesOperations(StorageManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageManagementClient + /// + public StorageManagementClient Client { get; private set; } + + /// + /// List all file services in storage accounts + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _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; + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + /// + /// 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> SetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string fileServicesName = "default"; + FileServiceProperties parameters = new FileServiceProperties(); + if (cors != null) + { + parameters.Cors = cors; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("fileServicesName", fileServicesName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SetServiceProperties", 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.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{FileServicesName}", System.Uri.EscapeDataString(fileServicesName)); + 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) + { + 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 properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// 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> GetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string fileServicesName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("fileServicesName", fileServicesName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetServiceProperties", 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.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{FileServicesName}", System.Uri.EscapeDataString(fileServicesName)); + 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; + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs new file mode 100644 index 000000000000..ed383c8eccbf --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs @@ -0,0 +1,179 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileServicesOperations. + /// + public static partial class FileServicesOperationsExtensions + { + /// + /// List all file services in storage accounts + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + public static FileServiceItems List(this IFileServicesOperations operations, string resourceGroupName, string accountName) + { + return operations.ListAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// List all file services in storage accounts + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + public static FileServiceProperties SetServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules)) + { + return operations.SetServicePropertiesAsync(resourceGroupName, accountName, cors).GetAwaiter().GetResult(); + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + /// + /// The cancellation token. + /// + public static async Task SetServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SetServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, cors, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + public static FileServiceProperties GetServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName) + { + return operations.GetServicePropertiesAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The cancellation token. + /// + public static async Task GetServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs new file mode 100644 index 000000000000..77a3cfd49c8e --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs @@ -0,0 +1,1567 @@ +// +// 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.Storage +{ + 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; + + /// + /// FileSharesOperations operations. + /// + internal partial class FileSharesOperations : IServiceOperations, IFileSharesOperations + { + /// + /// Initializes a new instance of the FileSharesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileSharesOperations(StorageManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageManagementClient + /// + public StorageManagementClient Client { get; private set; } + + /// + /// Lists all shares. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("maxpagesize", maxpagesize); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _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 (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (maxpagesize != null) + { + _queryParameters.Add(string.Format("$maxpagesize={0}", System.Uri.EscapeDataString(maxpagesize))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (shareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "shareQuota", 5120); + } + if (shareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "shareQuota", 1); + } + FileShare fileShare = new FileShare(); + if (metadata != null || shareQuota != null) + { + fileShare.Metadata = metadata; + fileShare.ShareQuota = shareQuota; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("fileShare", fileShare); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _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("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(fileShare != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileShare, 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; + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (shareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "shareQuota", 5120); + } + if (shareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "shareQuota", 1); + } + FileShare fileShare = new FileShare(); + if (metadata != null || shareQuota != null) + { + fileShare.Metadata = metadata; + fileShare.ShareQuota = shareQuota; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("fileShare", fileShare); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(fileShare != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileShare, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 properties of a specified share. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _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; + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// 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 resourceGroupName, string accountName, string shareName, 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _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("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 shares. + /// + /// + /// 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/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs new file mode 100644 index 000000000000..a0b40883752a --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs @@ -0,0 +1,394 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileSharesOperations. + /// + public static partial class FileSharesOperationsExtensions + { + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + public static IPage List(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string)) + { + return operations.ListAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + public static FileShare Create(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + { + return operations.CreateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota).GetAwaiter().GetResult(); + } + + /// + /// Creates a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + public static FileShare Update(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + { + return operations.UpdateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota).GetAwaiter().GetResult(); + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a specified share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + public static FileShare Get(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName) + { + return operations.GetAsync(resourceGroupName, accountName, shareName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a specified share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, shareName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + public static void Delete(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName) + { + operations.DeleteAsync(resourceGroupName, accountName, shareName).GetAwaiter().GetResult(); + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, shareName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFileSharesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all shares. + /// + /// + /// 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 IFileSharesOperations 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/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs new file mode 100644 index 000000000000..be7be372292c --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs @@ -0,0 +1,119 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileServicesOperations operations. + /// + public partial interface IFileServicesOperations + { + /// + /// List all file services in storage accounts + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sets the properties of file services in storage accounts, including + /// CORS (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to + /// five CorsRule elements in the request. If no CorsRule elements are + /// included in the request body, all CORS rules will be deleted, and + /// CORS will be disabled for the File service. + /// + /// + /// 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> SetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of file services in storage accounts, including + /// CORS (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// 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> GetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs new file mode 100644 index 000000000000..027572ac803a --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs @@ -0,0 +1,244 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileSharesOperations operations. + /// + public partial interface IFileSharesOperations + { + /// + /// Lists all shares. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included + /// in the list. + /// + /// + /// Optional. When specified, only share names starting with the filter + /// will be listed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new share under the specified account as described by + /// request body. The share resource includes metadata and properties + /// for that share. It does not include a list of the files contained + /// by the share. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than + /// 0, and less than or equal to 5TB (5120). + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates share properties as specified in request body. Properties + /// not mentioned in the request will not be changed. Update fails if + /// the specified share does not already exist. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than + /// 0, and less than or equal to 5TB (5120). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a specified share. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes specified share under its account. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all shares. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs index f64d6b478444..54ad36c11da2 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs @@ -104,5 +104,15 @@ public partial interface IStorageManagementClient : System.IDisposable /// IBlobContainersOperations BlobContainers { get; } + /// + /// Gets the IFileServicesOperations. + /// + IFileServicesOperations FileServices { get; } + + /// + /// Gets the IFileSharesOperations. + /// + IFileSharesOperations FileShares { get; } + } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..df95c8e08975 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/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.Storage.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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs similarity index 53% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs index 20a0297d31bb..b53826168db1 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs @@ -8,31 +8,30 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.Storage.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; - /// - /// The custom event information - /// - public partial class EventsCustomEventInfo + public partial class FileServiceItems { /// - /// Initializes a new instance of the EventsCustomEventInfo class. + /// Initializes a new instance of the FileServiceItems class. /// - public EventsCustomEventInfo() + public FileServiceItems() { CustomInit(); } /// - /// Initializes a new instance of the EventsCustomEventInfo class. + /// Initializes a new instance of the FileServiceItems class. /// - /// The name of the custom event - public EventsCustomEventInfo(string name = default(string)) + /// List of file services returned. + public FileServiceItems(IList value = default(IList)) { - Name = name; + Value = value; CustomInit(); } @@ -42,10 +41,10 @@ public EventsCustomEventInfo() partial void CustomInit(); /// - /// Gets or sets the name of the custom event + /// Gets list of file services returned. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs new file mode 100644 index 000000000000..99f762c6efcf --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of File services in storage account. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileServiceProperties : Resource + { + /// + /// Initializes a new instance of the FileServiceProperties class. + /// + public FileServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileServiceProperties class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Specifies CORS rules for the File service. You + /// can include up to five CorsRule elements in the request. If no + /// CorsRule elements are included in the request body, all CORS rules + /// will be deleted, and CORS will be disabled for the File + /// service. + public FileServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules)) + : base(id, name, type) + { + Cors = cors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies CORS rules for the File service. You can + /// include up to five CorsRule elements in the request. If no CorsRule + /// elements are included in the request body, all CORS rules will be + /// deleted, and CORS will be disabled for the File service. + /// + [JsonProperty(PropertyName = "properties.cors")] + public CorsRules Cors { get; set; } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs new file mode 100644 index 000000000000..dc868af4e1fc --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs @@ -0,0 +1,104 @@ +// +// 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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of the file share, including Id, resource name, resource + /// type, Etag. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileShare : AzureEntityResource + { + /// + /// Initializes a new instance of the FileShare class. + /// + public FileShare() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShare class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + /// Returns the date and time the share + /// was last modified. + /// A name-value pair to associate with the + /// share as metadata. + /// The maximum size of the share, in + /// gigabytes. Must be greater than 0, and less than or equal to 5TB + /// (5120). + public FileShare(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + : base(id, name, type, etag) + { + LastModifiedTime = lastModifiedTime; + Metadata = metadata; + ShareQuota = shareQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets returns the date and time the share was last modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets or sets a name-value pair to associate with the share as + /// metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Gets or sets the maximum size of the share, in gigabytes. Must be + /// greater than 0, and less than or equal to 5TB (5120). + /// + [JsonProperty(PropertyName = "properties.shareQuota")] + public int? ShareQuota { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ShareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ShareQuota", 5120); + } + if (ShareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ShareQuota", 1); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.cs new file mode 100644 index 000000000000..4e7bc69bde8e --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The file share properties be listed out. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileShareItem : AzureEntityResource + { + /// + /// Initializes a new instance of the FileShareItem class. + /// + public FileShareItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShareItem class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + /// Returns the date and time the share + /// was last modified. + /// A name-value pair to associate with the + /// share as metadata. + /// The maximum size of the share, in + /// gigabytes. Must be greater than 0, and less than or equal to 5TB + /// (5120). + public FileShareItem(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + : base(id, name, type, etag) + { + LastModifiedTime = lastModifiedTime; + Metadata = metadata; + ShareQuota = shareQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets returns the date and time the share was last modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets or sets a name-value pair to associate with the share as + /// metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Gets or sets the maximum size of the share, in gigabytes. Must be + /// greater than 0, and less than or equal to 5TB (5120). + /// + [JsonProperty(PropertyName = "properties.shareQuota")] + public int? ShareQuota { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ShareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ShareQuota", 5120); + } + if (ShareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ShareQuota", 1); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs index 2e6668fd3764..ade321fb01d3 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs @@ -21,6 +21,8 @@ public static IEnumerable> ApiInfo_StorageManageme { new Tuple("Storage", "BlobContainers", "2019-04-01"), new Tuple("Storage", "BlobServices", "2019-04-01"), + new Tuple("Storage", "FileServices", "2019-04-01"), + new Tuple("Storage", "FileShares", "2019-04-01"), new Tuple("Storage", "ManagementPolicies", "2019-04-01"), new Tuple("Storage", "Operations", "2019-04-01"), new Tuple("Storage", "Skus", "2019-04-01"), @@ -29,16 +31,5 @@ public static IEnumerable> ApiInfo_StorageManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\code\\srpsdk\\sdk\\storage\\Microsoft.Azure.Management.Storage\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "d753d28f32643d8062e1f7863d8f8e188dac9556"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs index 52c34d78383d..c89f3a08d112 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs @@ -109,6 +109,16 @@ public partial class StorageManagementClient : ServiceClient public virtual IBlobContainersOperations BlobContainers { get; private set; } + /// + /// Gets the IFileServicesOperations. + /// + public virtual IFileServicesOperations FileServices { get; private set; } + + /// + /// Gets the IFileSharesOperations. + /// + public virtual IFileSharesOperations FileShares { get; private set; } + /// /// Initializes a new instance of the StorageManagementClient class. /// @@ -357,6 +367,8 @@ private void Initialize() ManagementPolicies = new ManagementPoliciesOperations(this); BlobServices = new BlobServicesOperations(this); BlobContainers = new BlobContainersOperations(this); + FileServices = new FileServicesOperations(this); + FileShares = new FileSharesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2019-04-01"; AcceptLanguage = "en-US";