diff --git a/eng/mgmt/mgmtmetadata/operationalinsights_resource-manager.txt b/eng/mgmt/mgmtmetadata/operationalinsights_resource-manager.txt index abb643b8099d..09649d4f760c 100644 --- a/eng/mgmt/mgmtmetadata/operationalinsights_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/operationalinsights_resource-manager.txt @@ -1,14 +1,14 @@ -Installing AutoRest version: 2.0.4413 +Installing AutoRest version: v2 AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/operationalinsights/resource-manager/readme.md --csharp --version=2.0.4413 --reflect-api-versions --csharp.output-folder=C:\Users\yabhu\Documents\workspace\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.Management.OperationalInsights\src\Generated -2020-04-30 07:25:26 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/operationalinsights/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=D:\workspace\azure-sdk-for-net\sdk +2020-05-21 07:03:07 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: c3bb4114dbe040ae207922958f29a6724ccb5a50 +Commit: b069b0fa4817788d6363007645cae04317864f09 AutoRest information -Requested version: 2.0.4413 +Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperations.cs new file mode 100644 index 000000000000..44dbf7076277 --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperations.cs @@ -0,0 +1,294 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.OperationalInsights +{ + 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; + + /// + /// AvailableServiceTiersOperations operations. + /// + internal partial class AvailableServiceTiersOperations : IServiceOperations, IAvailableServiceTiersOperations + { + /// + /// Initializes a new instance of the AvailableServiceTiersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailableServiceTiersOperations(OperationalInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the OperationalInsightsManagementClient + /// + public OperationalInsightsManagementClient Client { get; private set; } + + /// + /// Gets the available service tiers for the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 63); + } + if (workspaceName.Length < 4) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 4); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(workspaceName, "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); + } + } + 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("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperationsExtensions.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperationsExtensions.cs new file mode 100644 index 000000000000..d55c34356b09 --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/AvailableServiceTiersOperationsExtensions.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.OperationalInsights +{ + 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 AvailableServiceTiersOperations. + /// + public static partial class AvailableServiceTiersOperationsExtensions + { + /// + /// Gets the available service tiers for the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + public static IList ListByWorkspace(this IAvailableServiceTiersOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the available service tiers for the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByWorkspaceAsync(this IAvailableServiceTiersOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperations.cs new file mode 100644 index 000000000000..9979fd74e170 --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperations.cs @@ -0,0 +1,463 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.OperationalInsights +{ + 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; + + /// + /// DeletedWorkspacesOperations operations. + /// + internal partial class DeletedWorkspacesOperations : IServiceOperations, IDeletedWorkspacesOperations + { + /// + /// Initializes a new instance of the DeletedWorkspacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedWorkspacesOperations(OperationalInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the OperationalInsightsManagementClient + /// + public OperationalInsightsManagementClient Client { get; private set; } + + /// + /// Gets recently deleted workspaces in a subscription, available for recovery. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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.OperationalInsights/deletedWorkspaces").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 recently deleted workspaces in a resource group, available for + /// recovery. + /// + /// + /// 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.OperationalInsights/deletedWorkspaces").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; + } + + } +} diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperationsExtensions.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperationsExtensions.cs new file mode 100644 index 000000000000..88d91dd2e860 --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/DeletedWorkspacesOperationsExtensions.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.OperationalInsights +{ + 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 DeletedWorkspacesOperations. + /// + public static partial class DeletedWorkspacesOperationsExtensions + { + /// + /// Gets recently deleted workspaces in a subscription, available for recovery. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IDeletedWorkspacesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets recently deleted workspaces in a subscription, available for recovery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeletedWorkspacesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets recently deleted workspaces in a resource group, available for + /// recovery. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListByResourceGroup(this IDeletedWorkspacesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets recently deleted workspaces in a resource group, available for + /// recovery. + /// + /// + /// 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 IDeletedWorkspacesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IAvailableServiceTiersOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IAvailableServiceTiersOperations.cs new file mode 100644 index 000000000000..e10add9d9636 --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IAvailableServiceTiersOperations.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.OperationalInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailableServiceTiersOperations operations. + /// + public partial interface IAvailableServiceTiersOperations + { + /// + /// Gets the available service tiers for the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// 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>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IDeletedWorkspacesOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IDeletedWorkspacesOperations.cs new file mode 100644 index 000000000000..14fcc81ed76e --- /dev/null +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IDeletedWorkspacesOperations.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.OperationalInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedWorkspacesOperations operations. + /// + public partial interface IDeletedWorkspacesOperations + { + /// + /// Gets recently deleted workspaces in a subscription, available for + /// recovery. + /// + /// + /// 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 recently deleted workspaces in a resource group, available for + /// recovery. + /// + /// + /// 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)); + } +} diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IOperationalInsightsManagementClient.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IOperationalInsightsManagementClient.cs index 05b246294f72..fdd744e341c9 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IOperationalInsightsManagementClient.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IOperationalInsightsManagementClient.cs @@ -124,6 +124,11 @@ public partial interface IOperationalInsightsManagementClient : System.IDisposab /// IWorkspacesOperations Workspaces { get; } + /// + /// Gets the IDeletedWorkspacesOperations. + /// + IDeletedWorkspacesOperations DeletedWorkspaces { get; } + /// /// Gets the IClustersOperations. /// @@ -139,6 +144,11 @@ public partial interface IOperationalInsightsManagementClient : System.IDisposab /// ISavedSearchesOperations SavedSearches { get; } + /// + /// Gets the IAvailableServiceTiersOperations. + /// + IAvailableServiceTiersOperations AvailableServiceTiers { get; } + /// /// Gets the IGatewaysOperations. /// diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IWorkspacesOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IWorkspacesOperations.cs index 2b04ea0b3191..0b2abede6bf7 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IWorkspacesOperations.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/IWorkspacesOperations.cs @@ -93,7 +93,11 @@ public partial interface IWorkspacesOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it + /// again with the same name, in the same subscription, resource group + /// and location. The name is kept for 14 days and cannot be used for + /// another workspace. To remove the workspace completely and release + /// the name, use the force flag. /// /// /// The name of the resource group. The name is case insensitive. @@ -101,6 +105,10 @@ public partial interface IWorkspacesOperations /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that + /// was deleted with this flag cannot be recovered. + /// /// /// The headers that will be added to request. /// @@ -113,7 +121,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a workspace instance. /// @@ -168,31 +176,6 @@ public partial interface IWorkspacesOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspacePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the available service tiers for the workspace. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// 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>> AvailableServiceTiersWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Create or update a workspace. /// /// @@ -221,7 +204,11 @@ public partial interface IWorkspacesOperations /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it + /// again with the same name, in the same subscription, resource group + /// and location. The name is kept for 14 days and cannot be used for + /// another workspace. To remove the workspace completely and release + /// the name, use the force flag. /// /// /// The name of the resource group. The name is case insensitive. @@ -229,6 +216,10 @@ public partial interface IWorkspacesOperations /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that + /// was deleted with this flag cannot be recovered. + /// /// /// The headers that will be added to request. /// @@ -241,6 +232,6 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/Models/SavedSearch.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/Models/SavedSearch.cs index 5d11e548c599..18fae783328c 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/Models/SavedSearch.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/Models/SavedSearch.cs @@ -48,16 +48,26 @@ public SavedSearch() /// Microsoft.Compute/virtualMachines or /// Microsoft.Storage/storageAccounts. /// The ETag of the saved search. + /// The function alias if query serves as a + /// function. + /// The optional function parameters + /// if query serves as a function. Value should be in the following + /// format: 'param-name1:type1 = default_value1, param-name2:type2 = + /// default_value2'. For more examples and proper syntax please refer + /// to + /// https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. /// The version number of the query language. The /// current version is 2 and is the default. /// The tags attached to the saved search. - public SavedSearch(string category, string displayName, string query, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), long? version = default(long?), IList tags = default(IList)) + public SavedSearch(string category, string displayName, string query, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string functionAlias = default(string), string functionParameters = default(string), long? version = default(long?), IList tags = default(IList)) : base(id, name, type) { ETag = eTag; Category = category; DisplayName = displayName; Query = query; + FunctionAlias = functionAlias; + FunctionParameters = functionParameters; Version = version; Tags = tags; CustomInit(); @@ -95,6 +105,23 @@ public SavedSearch() [JsonProperty(PropertyName = "properties.query")] public string Query { get; set; } + /// + /// Gets or sets the function alias if query serves as a function. + /// + [JsonProperty(PropertyName = "properties.functionAlias")] + public string FunctionAlias { get; set; } + + /// + /// Gets or sets the optional function parameters if query serves as a + /// function. Value should be in the following format: + /// 'param-name1:type1 = default_value1, param-name2:type2 = + /// default_value2'. For more examples and proper syntax please refer + /// to + /// https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + /// + [JsonProperty(PropertyName = "properties.functionParameters")] + public string FunctionParameters { get; set; } + /// /// Gets or sets the version number of the query language. The current /// version is 2 and is the default. diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/OperationalInsightsManagementClient.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/OperationalInsightsManagementClient.cs index 3f0ca238358b..5847d07adee8 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/OperationalInsightsManagementClient.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/OperationalInsightsManagementClient.cs @@ -129,6 +129,11 @@ public partial class OperationalInsightsManagementClient : ServiceClient public virtual IWorkspacesOperations Workspaces { get; private set; } + /// + /// Gets the IDeletedWorkspacesOperations. + /// + public virtual IDeletedWorkspacesOperations DeletedWorkspaces { get; private set; } + /// /// Gets the IClustersOperations. /// @@ -144,6 +149,11 @@ public partial class OperationalInsightsManagementClient : ServiceClient public virtual ISavedSearchesOperations SavedSearches { get; private set; } + /// + /// Gets the IAvailableServiceTiersOperations. + /// + public virtual IAvailableServiceTiersOperations AvailableServiceTiers { get; private set; } + /// /// Gets the IGatewaysOperations. /// @@ -411,9 +421,11 @@ private void Initialize() SharedKeys = new SharedKeysOperations(this); Usages = new UsagesOperations(this); Workspaces = new WorkspacesOperations(this); + DeletedWorkspaces = new DeletedWorkspacesOperations(this); Clusters = new ClustersOperations(this); StorageInsightConfigs = new StorageInsightConfigsOperations(this); SavedSearches = new SavedSearchesOperations(this); + AvailableServiceTiers = new AvailableServiceTiersOperations(this); Gateways = new GatewaysOperations(this); Schema = new SchemaOperations(this); WorkspacePurge = new WorkspacePurgeOperations(this); diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/SdkInfo_OperationalInsightsManagementClient.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/SdkInfo_OperationalInsightsManagementClient.cs index 0376bed2fcf5..b3ea3aa28bba 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/SdkInfo_OperationalInsightsManagementClient.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/SdkInfo_OperationalInsightsManagementClient.cs @@ -19,9 +19,11 @@ public static IEnumerable> ApiInfo_OperationalInsi { return new Tuple[] { + new Tuple("OperationalInsights", "AvailableServiceTiers", "2020-03-01-preview"), new Tuple("OperationalInsights", "Clusters", "2020-03-01-preview"), new Tuple("OperationalInsights", "DataExports", "2020-03-01-preview"), new Tuple("OperationalInsights", "DataSources", "2020-03-01-preview"), + new Tuple("OperationalInsights", "DeletedWorkspaces", "2020-03-01-preview"), new Tuple("OperationalInsights", "Gateways", "2020-03-01-preview"), new Tuple("OperationalInsights", "IntelligencePacks", "2020-03-01-preview"), new Tuple("OperationalInsights", "LinkedServices", "2020-03-01-preview"), @@ -40,12 +42,12 @@ public static IEnumerable> ApiInfo_OperationalInsi } } // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "2.0.4413"; + public static readonly String AutoRestVersion = "v2"; public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/operationalinsights/resource-manager/readme.md --csharp --version=2.0.4413 --reflect-api-versions --csharp.output-folder=C:\\Users\\yabhu\\Documents\\workspace\\azure-sdk-for-net\\sdk\\operationalinsights\\Microsoft.Azure.Management.OperationalInsights\\src\\Generated"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/operationalinsights/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=D:\\workspace\\azure-sdk-for-net\\sdk"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "c3bb4114dbe040ae207922958f29a6724ccb5a50"; + public static readonly String GithubCommidId = "b069b0fa4817788d6363007645cae04317864f09"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperations.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperations.cs index 9f1fc0a46bfd..8a03600e471e 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperations.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperations.cs @@ -484,7 +484,10 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The name of the resource group. The name is case insensitive. @@ -492,16 +495,20 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, force, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -999,246 +1006,6 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) return _result; } - /// - /// Gets the available service tiers for the workspace. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation 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>> AvailableServiceTiersWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); - } - if (workspaceName != null) - { - if (workspaceName.Length > 63) - { - throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 63); - } - if (workspaceName.Length < 4) - { - throw new ValidationException(ValidationRules.MinLength, "workspaceName", 4); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(workspaceName, "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$")) - { - throw new ValidationException(ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); - } - } - 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("workspaceName", workspaceName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AvailableServiceTiers", 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.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - 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 or update a workspace. /// @@ -1516,7 +1283,10 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The name of the resource group. The name is case insensitive. @@ -1524,6 +1294,10 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// /// /// Headers that will be added to request. /// @@ -1542,7 +1316,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1613,6 +1387,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("force", force); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1627,6 +1402,10 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (force != null) + { + _queryParameters.Add(string.Format("force={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(force, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperationsExtensions.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperationsExtensions.cs index be68a3ff845c..360e15a73131 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperationsExtensions.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Generated/WorkspacesOperationsExtensions.cs @@ -132,7 +132,10 @@ public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, st } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The operations group for this extension method. @@ -143,13 +146,20 @@ public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, st /// /// The name of the workspace. /// - public static void Delete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// + public static void Delete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, bool? force = default(bool?)) { - operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, workspaceName, force).GetAwaiter().GetResult(); } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The operations group for this extension method. @@ -160,12 +170,16 @@ public static void Delete(this IWorkspacesOperations operations, string resource /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, bool? force = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, force, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -254,46 +268,6 @@ public static Workspace Update(this IWorkspacesOperations operations, string res } } - /// - /// Gets the available service tiers for the workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the workspace. - /// - public static IList AvailableServiceTiers(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) - { - return operations.AvailableServiceTiersAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); - } - - /// - /// Gets the available service tiers for the workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// The cancellation token. - /// - public static async Task> AvailableServiceTiersAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.AvailableServiceTiersWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Create or update a workspace. /// @@ -341,7 +315,10 @@ public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operation } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The operations group for this extension method. @@ -352,13 +329,20 @@ public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operation /// /// The name of the workspace. /// - public static void BeginDelete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// + public static void BeginDelete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, bool? force = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, workspaceName, force).GetAwaiter().GetResult(); } /// - /// Deletes a workspace instance. + /// Deletes a workspace resource. To recover the workspace, create it again + /// with the same name, in the same subscription, resource group and location. + /// The name is kept for 14 days and cannot be used for another workspace. To + /// remove the workspace completely and release the name, use the force flag. /// /// /// The operations group for this extension method. @@ -369,12 +353,16 @@ public static void BeginDelete(this IWorkspacesOperations operations, string res /// /// The name of the workspace. /// + /// + /// Deletes the workspace without the recovery option. A workspace that was + /// deleted with this flag cannot be recovered. + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, bool? force = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, force, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Microsoft.Azure.Management.OperationalInsights.csproj b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Microsoft.Azure.Management.OperationalInsights.csproj index 191d81c9e9c7..60f1806893c8 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Microsoft.Azure.Management.OperationalInsights.csproj +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Microsoft.Azure.Management.OperationalInsights.csproj @@ -7,9 +7,9 @@ Microsoft.Azure.Management.OperationalInsights Provides Microsoft Azure Operational Insights management operations Microsoft.Azure.Management.OperationalInsights - 0.20.0-preview + 0.21.0-preview Microsoft Azure OperationalInsights;OperationalInsights; - updated API for workspace; added linked storage account; la cluster; linked service + updated API for workspace; added linked storage account; la cluster; linked service; Added parameters for saved searches; Add DeletedWorkspace $(SdkTargetFx) diff --git a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Properties/AssemblyInfo.cs b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Properties/AssemblyInfo.cs index 3bfef00c4924..9ead5dfd6dd2 100644 --- a/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Properties/AssemblyInfo.cs +++ b/sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights/src/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: AssemblyProduct("Azure .NET SDK")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] -[assembly: AssemblyVersion("0.20.0.0")] -[assembly: AssemblyFileVersion("0.20.0.0")] +[assembly: AssemblyVersion("0.21.0.0")] +[assembly: AssemblyFileVersion("0.21.0.0")] [assembly: AssemblyTitle("Microsoft Azure OperationalInsights Management Library")] [assembly: AssemblyDescription("Provides Microsoft Azure OperationalInsights management operations.")] [assembly: AssemblyCulture("")]