-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[operationalinsight] sdk migration #26784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JoyerJin
wants to merge
6
commits into
main
Choose a base branch
from
joyer/operationalinsight-sdk-migration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be0b62c
generate csharp SDK for OperationalInsights
JoyerJin 71ee13d
generate OperationalInsights by autorest.powershell
JoyerJin a04a797
Add change log and edit test project reference
JoyerJin 0914603
Merge remote-tracking branch 'Azure/legacy-main-tools-2025-02-14' int…
JoyerJin d4eb8f3
Merge remote-tracking branch 'Azure/main' into joyer/operationalinsig…
JoyerJin 8d606e1
sync up latest autorest generated code
JoyerJin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...perationalInsights/OperationalInsights.Management.Sdk/Customizations/Models/DataExport.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // <auto-generated> | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for | ||
| // license information. | ||
| // | ||
| // Code generated by Microsoft (R) AutoRest Code Generator. | ||
| // Changes may cause incorrect behavior and will be lost if the code is | ||
| // regenerated. | ||
| // </auto-generated> | ||
|
|
||
| namespace Microsoft.Azure.Management.OperationalInsights.Models | ||
| { | ||
| public partial class DataExport : Resource | ||
| { | ||
| } | ||
| } | ||
282 changes: 282 additions & 0 deletions
282
...lInsights/OperationalInsights.Management.Sdk/Generated/AvailableServiceTiersOperations.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.OperationalInsights | ||
| { | ||
| using System.Linq; | ||
| using Microsoft.Rest; | ||
| using Microsoft.Rest.Azure; | ||
| using Models; | ||
|
|
||
| /// <summary> | ||
| /// AvailableServiceTiersOperations operations. | ||
| /// </summary> | ||
| internal partial class AvailableServiceTiersOperations : Microsoft.Rest.IServiceOperations<OperationalInsightsManagementClient>, IAvailableServiceTiersOperations | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the AvailableServiceTiersOperations class. | ||
| /// </summary> | ||
| /// <param name='client'> | ||
| /// Reference to the service client. | ||
| /// </param> | ||
| /// <exception cref="System.ArgumentNullException"> | ||
| /// Thrown when a required parameter is null | ||
| /// </exception> | ||
| internal AvailableServiceTiersOperations (OperationalInsightsManagementClient client) | ||
| { | ||
| if (client == null) | ||
| { | ||
| throw new System.ArgumentNullException("client"); | ||
| } | ||
| this.Client = client; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets a reference to the OperationalInsightsManagementClient | ||
| /// </summary> | ||
| public OperationalInsightsManagementClient Client { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the available service tiers for the workspace. | ||
| /// </summary> | ||
| /// <param name='resourceGroupName'> | ||
| /// The name of the resource group. The name is case insensitive. | ||
| /// </param> | ||
| /// <param name='workspaceName'> | ||
| /// The name of the workspace. | ||
| /// </param> | ||
| /// <param name='customHeaders'> | ||
| /// Headers that will be added to request. | ||
| /// </param> | ||
| /// <param name='cancellationToken'> | ||
| /// The cancellation token. | ||
| /// </param> | ||
| /// <exception cref="Microsoft.Rest.Azure.CloudException"> | ||
| /// Thrown when the operation returned an invalid status code | ||
| /// </exception> | ||
| /// <exception cref="Microsoft.Rest.SerializationException"> | ||
| /// Thrown when unable to deserialize the response | ||
| /// </exception> | ||
| /// <exception cref="Microsoft.Rest.ValidationException"> | ||
| /// Thrown when a required parameter is null | ||
| /// </exception> | ||
| /// <exception cref="System.ArgumentNullException"> | ||
| /// Thrown when a required parameter is null | ||
| /// </exception> | ||
| /// <return> | ||
| /// A response object containing the response body and response headers. | ||
| /// </return> | ||
| public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<System.Collections.Generic.IList<AvailableServiceTier>>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) | ||
| { | ||
|
|
||
|
|
||
|
|
||
|
|
||
| if (this.Client.SubscriptionId == null) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); | ||
| } | ||
| if (this.Client.SubscriptionId != null) | ||
| { | ||
| if (this.Client.SubscriptionId.Length < 1) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); | ||
| } | ||
| } | ||
| if (resourceGroupName == null) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); | ||
| } | ||
| if (resourceGroupName != null) | ||
| { | ||
| if (resourceGroupName.Length > 90) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); | ||
| } | ||
| if (resourceGroupName.Length < 1) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); | ||
| } | ||
| } | ||
| if (workspaceName == null) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); | ||
| } | ||
| if (workspaceName != null) | ||
| { | ||
| if (workspaceName.Length > 63) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "workspaceName", 63); | ||
| } | ||
| if (workspaceName.Length < 4) | ||
| { | ||
| throw new Microsoft.Rest.ValidationException(Microsoft.Rest.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 Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); | ||
| } | ||
| } | ||
| string apiVersion = "2020-08-01"; | ||
| // Tracing | ||
| bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; | ||
| string _invocationId = null; | ||
| if (_shouldTrace) | ||
| { | ||
| _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); | ||
| System.Collections.Generic.Dictionary<string, object> tracingParameters = new System.Collections.Generic.Dictionary<string, object>(); | ||
| tracingParameters.Add("resourceGroupName", resourceGroupName); | ||
| tracingParameters.Add("workspaceName", workspaceName); | ||
| tracingParameters.Add("apiVersion", apiVersion); | ||
|
|
||
|
|
||
| tracingParameters.Add("cancellationToken", cancellationToken); | ||
| Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); | ||
| } | ||
| // Construct URL | ||
|
|
||
| var _baseUrl = this.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(this.Client.SubscriptionId)); | ||
| _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); | ||
| _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); | ||
|
|
||
| System.Collections.Generic.List<string> _queryParameters = new System.Collections.Generic.List<string>(); | ||
| 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 System.Net.Http.HttpRequestMessage(); | ||
| System.Net.Http.HttpResponseMessage _httpResponse = null; | ||
| _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); | ||
| _httpRequest.RequestUri = new System.Uri(_url); | ||
| // Set Headers | ||
| if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) | ||
| { | ||
| _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); | ||
| } | ||
| if (this.Client.AcceptLanguage != null) | ||
| { | ||
| if (_httpRequest.Headers.Contains("accept-language")) | ||
| { | ||
| _httpRequest.Headers.Remove("accept-language"); | ||
| } | ||
| _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) | ||
| { | ||
| cancellationToken.ThrowIfCancellationRequested(); | ||
| await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | ||
| } | ||
| // Send Request | ||
| if (_shouldTrace) | ||
| { | ||
| Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); | ||
| } | ||
| cancellationToken.ThrowIfCancellationRequested(); | ||
| _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); | ||
| if (_shouldTrace) | ||
| { | ||
| Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); | ||
| } | ||
|
|
||
| System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; | ||
| cancellationToken.ThrowIfCancellationRequested(); | ||
| string _responseContent = null; | ||
|
|
||
| if ((int)_statusCode != 200) | ||
| { | ||
| var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); | ||
| try | ||
| { | ||
| _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); | ||
| CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, this.Client.DeserializationSettings); | ||
| if (_errorBody != null) | ||
| { | ||
| ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); | ||
| ex.Body = _errorBody; | ||
| } | ||
| } | ||
| catch (Newtonsoft.Json.JsonException) | ||
| { | ||
| // Ignore the exception | ||
| } | ||
| ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); | ||
| ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); | ||
| if (_httpResponse.Headers.Contains("x-ms-request-id")) | ||
| { | ||
| ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); | ||
| } | ||
| if (_shouldTrace) | ||
| { | ||
| Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); | ||
| } | ||
| _httpRequest.Dispose(); | ||
| if (_httpResponse != null) | ||
| { | ||
| _httpResponse.Dispose(); | ||
| } | ||
| throw ex; | ||
| } | ||
| // Create Result | ||
| var _result = new Microsoft.Rest.Azure.AzureOperationResponse<System.Collections.Generic.IList<AvailableServiceTier>>(); | ||
| _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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<System.Collections.Generic.IList<AvailableServiceTier>>(_responseContent, this.Client.DeserializationSettings); | ||
| } | ||
| catch (Newtonsoft.Json.JsonException ex) | ||
| { | ||
| _httpRequest.Dispose(); | ||
| if (_httpResponse != null) | ||
| { | ||
| _httpResponse.Dispose(); | ||
| } | ||
| throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); | ||
| } | ||
| } | ||
| if (_shouldTrace) | ||
| { | ||
| Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); | ||
| } | ||
| return _result; | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...OperationalInsights.Management.Sdk/Generated/AvailableServiceTiersOperationsExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.OperationalInsights | ||
| { | ||
| using Microsoft.Rest.Azure; | ||
| using Models; | ||
|
|
||
| /// <summary> | ||
| /// Extension methods for AvailableServiceTiersOperations | ||
| /// </summary> | ||
| public static partial class AvailableServiceTiersOperationsExtensions | ||
| { | ||
| /// <summary> | ||
| /// Gets the available service tiers for the workspace. | ||
| /// </summary> | ||
| /// <param name='operations'> | ||
| /// The operations group for this extension method. | ||
| /// </param> | ||
| /// <param name='resourceGroupName'> | ||
| /// The name of the resource group. The name is case insensitive. | ||
| /// </param> | ||
| /// <param name='workspaceName'> | ||
| /// The name of the workspace. | ||
| /// </param> | ||
| public static System.Collections.Generic.IList<AvailableServiceTier> ListByWorkspace(this IAvailableServiceTiersOperations operations, string resourceGroupName, string workspaceName) | ||
| { | ||
| return ((IAvailableServiceTiersOperations)operations).ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the available service tiers for the workspace. | ||
| /// </summary> | ||
| /// <param name='operations'> | ||
| /// The operations group for this extension method. | ||
| /// </param> | ||
| /// <param name='resourceGroupName'> | ||
| /// The name of the resource group. The name is case insensitive. | ||
| /// </param> | ||
| /// <param name='workspaceName'> | ||
| /// The name of the workspace. | ||
| /// </param> | ||
| /// <param name='cancellationToken'> | ||
| /// The cancellation token. | ||
| /// </param> | ||
| public static async System.Threading.Tasks.Task<System.Collections.Generic.IList<AvailableServiceTier>> ListByWorkspaceAsync(this IAvailableServiceTiersOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) | ||
| { | ||
| using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) | ||
| { | ||
| return _result.Body; | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The partial class DataExport lacks documentation. Consider adding XML documentation comments to explain the purpose of this customization and its relationship to the base Resource class.