diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationAccountOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationAccountOperations.cs index 81ccf6eb8e1e..8fde1e35e337 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationAccountOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationAccountOperations.cs @@ -117,7 +117,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -340,7 +340,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -567,7 +567,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -754,7 +754,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -952,7 +952,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1128,7 +1128,7 @@ internal AutomationAccountOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs index 39ac9fa2650c..df8771b59afa 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.Automation using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Automation Client @@ -286,6 +288,11 @@ public partial class AutomationClient : ServiceClient, IAutoma /// public virtual IWebhookOperations Webhook { get; private set; } + /// + /// Gets the IHybridRunbookWorkersOperations. + /// + public virtual IHybridRunbookWorkersOperations HybridRunbookWorkers { get; private set; } + /// /// Initializes a new instance of the AutomationClient class. /// @@ -570,6 +577,7 @@ private void Initialize() TestJobStreams = new TestJobStreamsOperations(this); TestJob = new TestJobOperations(this); Webhook = new WebhookOperations(this); + HybridRunbookWorkers = new HybridRunbookWorkersOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -604,5 +612,223 @@ private void Initialize() DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Post operation to serialize or deserialize GraphRunbookContent + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// Input data describing the graphical runbook. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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> ConvertGraphRunbookContentWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, GraphicalRunbookContent parameters, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ConvertGraphRunbookContent", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/convertGraphRunbookContent").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _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); + } + System.Net.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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = 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/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClientExtensions.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClientExtensions.cs new file mode 100644 index 000000000000..42076882acd1 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClientExtensions.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.Automation +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AutomationClient. + /// + public static partial class AutomationClientExtensions + { + /// + /// Post operation to serialize or deserialize GraphRunbookContent + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// Input data describing the graphical runbook. + /// + public static GraphicalRunbookContent ConvertGraphRunbookContent(this IAutomationClient operations, string resourceGroupName, string automationAccountName, GraphicalRunbookContent parameters) + { + return operations.ConvertGraphRunbookContentAsync(resourceGroupName, automationAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Post operation to serialize or deserialize GraphRunbookContent + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// Input data describing the graphical runbook. + /// + /// + /// The cancellation token. + /// + public static async Task ConvertGraphRunbookContentAsync(this IAutomationClient operations, string resourceGroupName, string automationAccountName, GraphicalRunbookContent parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ConvertGraphRunbookContentWithHttpMessagesAsync(resourceGroupName, automationAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperations.cs index 453e07969316..cdab44be7e2b 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperations.cs @@ -115,7 +115,7 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -311,7 +311,7 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -458,6 +458,234 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) return _result; } + /// + /// Create a hybrid runbook worker group. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The create or update parameters for hybrid runbook worker group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters hybridRunbookWorkerGroupCreationParameters, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (hybridRunbookWorkerGroupCreationParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupCreationParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("hybridRunbookWorkerGroupCreationParameters", hybridRunbookWorkerGroupCreationParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(hybridRunbookWorkerGroupCreationParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(hybridRunbookWorkerGroupCreationParameters, 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); + } + System.Net.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; + } + /// /// Update a hybrid runbook worker group. /// @@ -495,7 +723,7 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -532,7 +760,7 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -749,7 +977,7 @@ internal HybridRunbookWorkerGroupOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperationsExtensions.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperationsExtensions.cs index 98b76c9d1ae8..aede39982556 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperationsExtensions.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkerGroupOperationsExtensions.cs @@ -115,6 +115,60 @@ public static HybridRunbookWorkerGroup Get(this IHybridRunbookWorkerGroupOperati } } + /// + /// Create a hybrid runbook worker group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The create or update parameters for hybrid runbook worker group. + /// + public static HybridRunbookWorkerGroup Create(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters hybridRunbookWorkerGroupCreationParameters) + { + return operations.CreateAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerGroupCreationParameters).GetAwaiter().GetResult(); + } + + /// + /// Create a hybrid runbook worker group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The create or update parameters for hybrid runbook worker group. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters hybridRunbookWorkerGroupCreationParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerGroupCreationParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Update a hybrid runbook worker group. /// @@ -134,7 +188,7 @@ public static HybridRunbookWorkerGroup Get(this IHybridRunbookWorkerGroupOperati /// /// The hybrid runbook worker group /// - public static HybridRunbookWorkerGroup Update(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupUpdateParameters parameters) + public static HybridRunbookWorkerGroup Update(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters parameters) { return operations.UpdateAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters).GetAwaiter().GetResult(); } @@ -161,7 +215,7 @@ public static HybridRunbookWorkerGroup Update(this IHybridRunbookWorkerGroupOper /// /// The cancellation token. /// - public static async Task UpdateAsync(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IHybridRunbookWorkerGroupOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperations.cs new file mode 100644 index 000000000000..84b67a08596a --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperations.cs @@ -0,0 +1,1328 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + 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; + + /// + /// HybridRunbookWorkersOperations operations. + /// + internal partial class HybridRunbookWorkersOperations : IServiceOperations, IHybridRunbookWorkersOperations + { + /// + /// Initializes a new instance of the HybridRunbookWorkersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal HybridRunbookWorkersOperations(AutomationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomationClient + /// + public AutomationClient Client { get; private set; } + + /// + /// Delete a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// 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 automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (hybridRunbookWorkerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("hybridRunbookWorkerId", hybridRunbookWorkerId); + 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/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{hybridRunbookWorkerId}", System.Uri.EscapeDataString(hybridRunbookWorkerId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + System.Net.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; + } + + /// + /// Retrieve a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker 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 resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (hybridRunbookWorkerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("hybridRunbookWorkerId", hybridRunbookWorkerId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{hybridRunbookWorkerId}", System.Uri.EscapeDataString(hybridRunbookWorkerId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + System.Net.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; + } + + /// + /// Create a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The create or update parameters for hybrid runbook worker. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerCreateParameters hybridRunbookWorkerCreationParameters, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (hybridRunbookWorkerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerId"); + } + if (hybridRunbookWorkerCreationParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerCreationParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("hybridRunbookWorkerId", hybridRunbookWorkerId); + tracingParameters.Add("hybridRunbookWorkerCreationParameters", hybridRunbookWorkerCreationParameters); + tracingParameters.Add("apiVersion", apiVersion); + 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{hybridRunbookWorkerId}", System.Uri.EscapeDataString(hybridRunbookWorkerId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(hybridRunbookWorkerCreationParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(hybridRunbookWorkerCreationParameters, 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); + } + System.Net.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; + } + + /// + /// Move a hybrid worker to a different group. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The hybrid runbook worker move parameters + /// + /// + /// 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 MoveWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerMoveParameters hybridRunbookWorkerMoveParameters, 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (hybridRunbookWorkerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerId"); + } + if (hybridRunbookWorkerMoveParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerMoveParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("hybridRunbookWorkerId", hybridRunbookWorkerId); + tracingParameters.Add("hybridRunbookWorkerMoveParameters", hybridRunbookWorkerMoveParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Move", 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}/move").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{hybridRunbookWorkerId}", System.Uri.EscapeDataString(hybridRunbookWorkerId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(hybridRunbookWorkerMoveParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(hybridRunbookWorkerMoveParameters, 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); + } + System.Net.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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByHybridRunbookWorkerGroupWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, ODataQuery odataQuery = default(ODataQuery), 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 (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (hybridRunbookWorkerGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hybridRunbookWorkerGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2021-06-22"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("automationAccountName", automationAccountName); + tracingParameters.Add("hybridRunbookWorkerGroupName", hybridRunbookWorkerGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByHybridRunbookWorkerGroup", 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.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _url = _url.Replace("{hybridRunbookWorkerGroupName}", System.Uri.EscapeDataString(hybridRunbookWorkerGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + 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); + } + System.Net.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; + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// 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>> ListByHybridRunbookWorkerGroupNextWithHttpMessagesAsync(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, "ListByHybridRunbookWorkerGroupNext", 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); + } + System.Net.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/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperationsExtensions.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperationsExtensions.cs new file mode 100644 index 000000000000..9f7b71cad2c3 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/HybridRunbookWorkersOperationsExtensions.cs @@ -0,0 +1,338 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HybridRunbookWorkersOperations. + /// + public static partial class HybridRunbookWorkersOperationsExtensions + { + /// + /// Delete a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + public static void Delete(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId) + { + operations.DeleteAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId).GetAwaiter().GetResult(); + } + + /// + /// Delete a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieve a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + public static HybridRunbookWorker Get(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId) + { + return operations.GetAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The create or update parameters for hybrid runbook worker. + /// + public static HybridRunbookWorker Create(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerCreateParameters hybridRunbookWorkerCreationParameters) + { + return operations.CreateAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, hybridRunbookWorkerCreationParameters).GetAwaiter().GetResult(); + } + + /// + /// Create a hybrid runbook worker. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The create or update parameters for hybrid runbook worker. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerCreateParameters hybridRunbookWorkerCreationParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, hybridRunbookWorkerCreationParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Move a hybrid worker to a different group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The hybrid runbook worker move parameters + /// + public static void Move(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerMoveParameters hybridRunbookWorkerMoveParameters) + { + operations.MoveAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, hybridRunbookWorkerMoveParameters).GetAwaiter().GetResult(); + } + + /// + /// Move a hybrid worker to a different group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The hybrid runbook worker move parameters + /// + /// + /// The cancellation token. + /// + public static async Task MoveAsync(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerMoveParameters hybridRunbookWorkerMoveParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.MoveWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, hybridRunbookWorkerId, hybridRunbookWorkerMoveParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByHybridRunbookWorkerGroup(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByHybridRunbookWorkerGroupAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHybridRunbookWorkerGroupAsync(this IHybridRunbookWorkersOperations operations, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHybridRunbookWorkerGroupWithHttpMessagesAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByHybridRunbookWorkerGroupNext(this IHybridRunbookWorkersOperations operations, string nextPageLink) + { + return operations.ListByHybridRunbookWorkerGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByHybridRunbookWorkerGroupNextAsync(this IHybridRunbookWorkersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByHybridRunbookWorkerGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs index d61f304fd934..13f3c988bb31 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.Automation using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Automation Client @@ -281,5 +285,30 @@ public partial interface IAutomationClient : System.IDisposable /// IWebhookOperations Webhook { get; } + /// + /// Gets the IHybridRunbookWorkersOperations. + /// + IHybridRunbookWorkersOperations HybridRunbookWorkers { get; } + + /// + /// Post operation to serialize or deserialize GraphRunbookContent + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// Input data describing the graphical runbook. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> ConvertGraphRunbookContentWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, GraphicalRunbookContent parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkerGroupOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkerGroupOperations.cs index 9655a9a55197..210a43730616 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkerGroupOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkerGroupOperations.cs @@ -80,6 +80,38 @@ public partial interface IHybridRunbookWorkerGroupOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Create a hybrid runbook worker group. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The create or update parameters for hybrid runbook worker 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> CreateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters hybridRunbookWorkerGroupCreationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Update a hybrid runbook worker group. /// /// @@ -110,7 +142,7 @@ public partial interface IHybridRunbookWorkerGroupOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, HybridRunbookWorkerGroupCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieve a list of hybrid runbook worker groups. /// diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkersOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkersOperations.cs new file mode 100644 index 000000000000..6f3deee51b95 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IHybridRunbookWorkersOperations.cs @@ -0,0 +1,211 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HybridRunbookWorkersOperations operations. + /// + public partial interface IHybridRunbookWorkersOperations + { + /// + /// Delete a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// 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 automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker 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> GetWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a hybrid runbook worker. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The create or update parameters for hybrid runbook worker. + /// + /// + /// 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 automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerCreateParameters hybridRunbookWorkerCreationParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Move a hybrid worker to a different group. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// The hybrid runbook worker id + /// + /// + /// The hybrid runbook worker move parameters + /// + /// + /// 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 MoveWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId, HybridRunbookWorkerMoveParameters hybridRunbookWorkerMoveParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// Name of an Azure Resource group. + /// + /// + /// The name of the automation account. + /// + /// + /// The hybrid runbook worker group name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByHybridRunbookWorkerGroupWithHttpMessagesAsync(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a list of hybrid runbook workers. + /// + /// + /// + /// 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>> ListByHybridRunbookWorkerGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/KeysOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/KeysOperations.cs index 4f62a96de029..3c801d87f5cd 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/KeysOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/KeysOperations.cs @@ -109,7 +109,7 @@ internal KeysOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccount.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccount.cs index f8f30962e8c4..6088f0e4c849 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccount.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccount.cs @@ -56,8 +56,13 @@ public AutomationAccount() /// Indicates whether traffic on the /// non-ARM endpoint (Webhook/Agent) is allowed from the public /// internet + /// Indicates whether requests using + /// non-AAD authentication are blocked + /// URL of automation hybrid + /// service which is used for hybrid worker on-boarding. /// Gets or sets the etag of the resource. - public AutomationAccount(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), Sku sku = default(Sku), string lastModifiedBy = default(string), string state = default(string), System.DateTimeOffset creationTime = default(System.DateTimeOffset), System.DateTimeOffset lastModifiedTime = default(System.DateTimeOffset), string description = default(string), EncryptionProperties encryption = default(EncryptionProperties), IList privateEndpointConnections = default(IList), bool? publicNetworkAccess = default(bool?), string etag = default(string), Identity identity = default(Identity)) + /// Resource system metadata. + public AutomationAccount(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), Sku sku = default(Sku), string lastModifiedBy = default(string), string state = default(string), System.DateTimeOffset creationTime = default(System.DateTimeOffset), System.DateTimeOffset lastModifiedTime = default(System.DateTimeOffset), string description = default(string), EncryptionProperties encryption = default(EncryptionProperties), IList privateEndpointConnections = default(IList), bool? publicNetworkAccess = default(bool?), bool? disableLocalAuth = default(bool?), string automationHybridServiceUrl = default(string), string etag = default(string), Identity identity = default(Identity), SystemData systemData = default(SystemData)) : base(id, name, type, tags, location) { Sku = sku; @@ -69,8 +74,11 @@ public AutomationAccount() Encryption = encryption; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; + DisableLocalAuth = disableLocalAuth; + AutomationHybridServiceUrl = automationHybridServiceUrl; Etag = etag; Identity = identity; + SystemData = systemData; CustomInit(); } @@ -136,6 +144,20 @@ public AutomationAccount() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public bool? PublicNetworkAccess { get; set; } + /// + /// Gets or sets indicates whether requests using non-AAD + /// authentication are blocked + /// + [JsonProperty(PropertyName = "properties.disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + + /// + /// Gets or sets URL of automation hybrid service which is used for + /// hybrid worker on-boarding. + /// + [JsonProperty(PropertyName = "properties.automationHybridServiceUrl")] + public string AutomationHybridServiceUrl { get; set; } + /// /// Gets or sets the etag of the resource. /// @@ -147,6 +169,12 @@ public AutomationAccount() [JsonProperty(PropertyName = "identity")] public Identity Identity { get; set; } + /// + /// Gets or sets resource system metadata. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + /// /// Validate the object. /// diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateParameters.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateParameters.cs index 1ebade965c5e..89a8386024b3 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateParameters.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountCreateOrUpdateParameters.cs @@ -43,6 +43,8 @@ public AutomationAccountCreateOrUpdateParameters() /// Indicates whether traffic on the /// non-ARM endpoint (Webhook/Agent) is allowed from the public /// internet + /// Indicates whether requests using + /// non-AAD authentication are blocked /// Gets or sets name of the resource. /// Gets or sets the location of the /// resource. @@ -50,11 +52,12 @@ public AutomationAccountCreateOrUpdateParameters() /// account /// Gets or sets the tags attached to the /// resource. - public AutomationAccountCreateOrUpdateParameters(Sku sku = default(Sku), EncryptionProperties encryption = default(EncryptionProperties), bool? publicNetworkAccess = default(bool?), string name = default(string), string location = default(string), Identity identity = default(Identity), IDictionary tags = default(IDictionary)) + public AutomationAccountCreateOrUpdateParameters(Sku sku = default(Sku), EncryptionProperties encryption = default(EncryptionProperties), bool? publicNetworkAccess = default(bool?), bool? disableLocalAuth = default(bool?), string name = default(string), string location = default(string), Identity identity = default(Identity), IDictionary tags = default(IDictionary)) { Sku = sku; Encryption = encryption; PublicNetworkAccess = publicNetworkAccess; + DisableLocalAuth = disableLocalAuth; Name = name; Location = location; Identity = identity; @@ -87,6 +90,13 @@ public AutomationAccountCreateOrUpdateParameters() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public bool? PublicNetworkAccess { get; set; } + /// + /// Gets or sets indicates whether requests using non-AAD + /// authentication are blocked + /// + [JsonProperty(PropertyName = "properties.disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + /// /// Gets or sets name of the resource. /// diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountUpdateParameters.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountUpdateParameters.cs index 826604ee9c87..32450653651f 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountUpdateParameters.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/AutomationAccountUpdateParameters.cs @@ -42,6 +42,8 @@ public AutomationAccountUpdateParameters() /// Indicates whether traffic on the /// non-ARM endpoint (Webhook/Agent) is allowed from the public /// internet + /// Indicates whether requests using + /// non-AAD authentication are blocked /// Gets or sets the name of the resource. /// Gets or sets the location of the /// resource. @@ -49,11 +51,12 @@ public AutomationAccountUpdateParameters() /// account /// Gets or sets the tags attached to the /// resource. - public AutomationAccountUpdateParameters(Sku sku = default(Sku), EncryptionProperties encryption = default(EncryptionProperties), bool? publicNetworkAccess = default(bool?), string name = default(string), string location = default(string), Identity identity = default(Identity), IDictionary tags = default(IDictionary)) + public AutomationAccountUpdateParameters(Sku sku = default(Sku), EncryptionProperties encryption = default(EncryptionProperties), bool? publicNetworkAccess = default(bool?), bool? disableLocalAuth = default(bool?), string name = default(string), string location = default(string), Identity identity = default(Identity), IDictionary tags = default(IDictionary)) { Sku = sku; Encryption = encryption; PublicNetworkAccess = publicNetworkAccess; + DisableLocalAuth = disableLocalAuth; Name = name; Location = location; Identity = identity; @@ -86,6 +89,13 @@ public AutomationAccountUpdateParameters() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public bool? PublicNetworkAccess { get; set; } + /// + /// Gets or sets indicates whether requests using non-AAD + /// authentication are blocked + /// + [JsonProperty(PropertyName = "properties.disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + /// /// Gets or sets the name of the resource. /// diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/CreatedByType.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..3687c56ce203 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/CreatedByType.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.Automation.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphRunbookType.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphRunbookType.cs new file mode 100644 index 000000000000..1b96ff469daa --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphRunbookType.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.Automation.Models +{ + + /// + /// Defines values for GraphRunbookType. + /// + public static class GraphRunbookType + { + public const string GraphPowerShell = "GraphPowerShell"; + public const string GraphPowerShellWorkflow = "GraphPowerShellWorkflow"; + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphicalRunbookContent.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphicalRunbookContent.cs new file mode 100644 index 000000000000..c9c3b9de55d5 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/GraphicalRunbookContent.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.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Graphical Runbook Content + /// + public partial class GraphicalRunbookContent + { + /// + /// Initializes a new instance of the GraphicalRunbookContent class. + /// + public GraphicalRunbookContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GraphicalRunbookContent class. + /// + /// Raw graphical Runbook content. + /// Graphical Runbook content as + /// JSON + public GraphicalRunbookContent(RawGraphicalRunbookContent rawContent = default(RawGraphicalRunbookContent), string graphRunbookJson = default(string)) + { + RawContent = rawContent; + GraphRunbookJson = graphRunbookJson; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets raw graphical Runbook content. + /// + [JsonProperty(PropertyName = "rawContent")] + public RawGraphicalRunbookContent RawContent { get; set; } + + /// + /// Gets or sets graphical Runbook content as JSON + /// + [JsonProperty(PropertyName = "graphRunbookJson")] + public string GraphRunbookJson { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorker.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorker.cs index 4ed571f95553..9cce47b3c833 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorker.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorker.cs @@ -10,13 +10,16 @@ namespace Microsoft.Azure.Management.Automation.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// /// Definition of hybrid runbook worker. /// - public partial class HybridRunbookWorker + [Rest.Serialization.JsonTransformation] + public partial class HybridRunbookWorker : Resource { /// /// Initializes a new instance of the HybridRunbookWorker class. @@ -29,19 +32,32 @@ public HybridRunbookWorker() /// /// Initializes a new instance of the HybridRunbookWorker class. /// - /// Gets or sets the worker machine name. + /// Fully qualified resource Id for the + /// resource + /// The name of the resource + /// The type of the resource. /// Gets or sets the assigned machine IP /// address. - /// Gets or sets the registration time + /// Gets or sets the registration time /// of the worker machine. /// Last Heartbeat from the /// Worker - public HybridRunbookWorker(string name = default(string), string ip = default(string), System.DateTimeOffset registrationTime = default(System.DateTimeOffset), System.DateTimeOffset lastSeenDateTime = default(System.DateTimeOffset)) + /// Azure Resource Manager Id for a virtual + /// machine. + /// Type of the HybridWorker. Possible values + /// include: 'HybridV1', 'HybridV2' + /// Name of the HybridWorker. + /// Resource system metadata. + public HybridRunbookWorker(string id = default(string), string name = default(string), string type = default(string), string ip = default(string), System.DateTimeOffset registeredDateTime = default(System.DateTimeOffset), System.DateTimeOffset lastSeenDateTime = default(System.DateTimeOffset), string vmResourceId = default(string), string workerType = default(string), string workerName = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) { - Name = name; Ip = ip; - RegistrationTime = registrationTime; + RegisteredDateTime = registeredDateTime; LastSeenDateTime = lastSeenDateTime; + VmResourceId = vmResourceId; + WorkerType = workerType; + WorkerName = workerName; + SystemData = systemData; CustomInit(); } @@ -50,29 +66,48 @@ public HybridRunbookWorker() /// partial void CustomInit(); - /// - /// Gets or sets the worker machine name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - /// /// Gets or sets the assigned machine IP address. /// - [JsonProperty(PropertyName = "ip")] + [JsonProperty(PropertyName = "properties.ip")] public string Ip { get; set; } /// /// Gets or sets the registration time of the worker machine. /// - [JsonProperty(PropertyName = "registrationTime")] - public System.DateTimeOffset RegistrationTime { get; set; } + [JsonProperty(PropertyName = "properties.registeredDateTime")] + public System.DateTimeOffset RegisteredDateTime { get; set; } /// /// Gets or sets last Heartbeat from the Worker /// - [JsonProperty(PropertyName = "lastSeenDateTime")] + [JsonProperty(PropertyName = "properties.lastSeenDateTime")] public System.DateTimeOffset LastSeenDateTime { get; set; } + /// + /// Gets or sets azure Resource Manager Id for a virtual machine. + /// + [JsonProperty(PropertyName = "properties.vmResourceId")] + public string VmResourceId { get; set; } + + /// + /// Gets or sets type of the HybridWorker. Possible values include: + /// 'HybridV1', 'HybridV2' + /// + [JsonProperty(PropertyName = "properties.workerType")] + public string WorkerType { get; set; } + + /// + /// Gets or sets name of the HybridWorker. + /// + [JsonProperty(PropertyName = "properties.workerName")] + public string WorkerName { get; set; } + + /// + /// Gets or sets resource system metadata. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + } } diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerCreateParameters.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerCreateParameters.cs new file mode 100644 index 000000000000..fc044feb934b --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerCreateParameters.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.Automation.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters supplied to the create hybrid runbook worker operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class HybridRunbookWorkerCreateParameters + { + /// + /// Initializes a new instance of the + /// HybridRunbookWorkerCreateParameters class. + /// + public HybridRunbookWorkerCreateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// HybridRunbookWorkerCreateParameters class. + /// + /// Azure Resource Manager Id for a virtual + /// machine. + /// Gets or sets the name of the resource. + public HybridRunbookWorkerCreateParameters(string vmResourceId = default(string), string name = default(string)) + { + VmResourceId = vmResourceId; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Resource Manager Id for a virtual machine. + /// + [JsonProperty(PropertyName = "properties.vmResourceId")] + public string VmResourceId { get; set; } + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroup.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroup.cs index 58f8b12ec10b..0ad442531e19 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroup.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroup.cs @@ -10,6 +10,8 @@ namespace Microsoft.Azure.Management.Automation.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -18,7 +20,7 @@ namespace Microsoft.Azure.Management.Automation.Models /// /// Definition of hybrid runbook worker group. /// - public partial class HybridRunbookWorkerGroup + public partial class HybridRunbookWorkerGroup : IResource { /// /// Initializes a new instance of the HybridRunbookWorkerGroup class. @@ -33,19 +35,23 @@ public HybridRunbookWorkerGroup() /// /// Gets or sets the id of the resource. /// Gets or sets the name of the group. + /// The type of the resource. /// Gets or sets the list of hybrid /// runbook workers. /// Sets the credential of a worker /// group. /// Type of the HybridWorkerGroup. Possible /// values include: 'User', 'System' - public HybridRunbookWorkerGroup(string id = default(string), string name = default(string), IList hybridRunbookWorkers = default(IList), RunAsCredentialAssociationProperty credential = default(RunAsCredentialAssociationProperty), string groupType = default(string)) + /// Resource system metadata. + public HybridRunbookWorkerGroup(string id = default(string), string name = default(string), string type = default(string), IList hybridRunbookWorkers = default(IList), RunAsCredentialAssociationProperty credential = default(RunAsCredentialAssociationProperty), string groupType = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; + Type = type; HybridRunbookWorkers = hybridRunbookWorkers; Credential = credential; GroupType = groupType; + SystemData = systemData; CustomInit(); } @@ -66,11 +72,17 @@ public HybridRunbookWorkerGroup() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets the type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + /// /// Gets or sets the list of hybrid runbook workers. /// [JsonProperty(PropertyName = "hybridRunbookWorkers")] - public IList HybridRunbookWorkers { get; set; } + public IList HybridRunbookWorkers { get; set; } /// /// Gets or sets sets the credential of a worker group. @@ -85,5 +97,11 @@ public HybridRunbookWorkerGroup() [JsonProperty(PropertyName = "groupType")] public string GroupType { get; set; } + /// + /// Gets or sets resource system metadata. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + } } diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateParameters.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateParameters.cs new file mode 100644 index 000000000000..a20a2a625993 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerGroupCreateOrUpdateParameters.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.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters supplied to the create or update hybrid runbook worker + /// group operation. + /// + public partial class HybridRunbookWorkerGroupCreateOrUpdateParameters + { + /// + /// Initializes a new instance of the + /// HybridRunbookWorkerGroupCreateOrUpdateParameters class. + /// + public HybridRunbookWorkerGroupCreateOrUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// HybridRunbookWorkerGroupCreateOrUpdateParameters class. + /// + /// Sets the credential of a worker + /// group. + public HybridRunbookWorkerGroupCreateOrUpdateParameters(RunAsCredentialAssociationProperty credential = default(RunAsCredentialAssociationProperty)) + { + Credential = credential; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sets the credential of a worker group. + /// + [JsonProperty(PropertyName = "credential")] + public RunAsCredentialAssociationProperty Credential { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerLegacy.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerLegacy.cs new file mode 100644 index 000000000000..ccd62f580a2d --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerLegacy.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.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Definition of hybrid runbook worker Legacy. + /// + public partial class HybridRunbookWorkerLegacy + { + /// + /// Initializes a new instance of the HybridRunbookWorkerLegacy class. + /// + public HybridRunbookWorkerLegacy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HybridRunbookWorkerLegacy class. + /// + /// Gets or sets the worker machine name. + /// Gets or sets the assigned machine IP + /// address. + /// Gets or sets the registration time + /// of the worker machine. + /// Last Heartbeat from the + /// Worker + public HybridRunbookWorkerLegacy(string name = default(string), string ip = default(string), System.DateTimeOffset registrationTime = default(System.DateTimeOffset), System.DateTimeOffset lastSeenDateTime = default(System.DateTimeOffset)) + { + Name = name; + Ip = ip; + RegistrationTime = registrationTime; + LastSeenDateTime = lastSeenDateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the worker machine name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the assigned machine IP address. + /// + [JsonProperty(PropertyName = "ip")] + public string Ip { get; set; } + + /// + /// Gets or sets the registration time of the worker machine. + /// + [JsonProperty(PropertyName = "registrationTime")] + public System.DateTimeOffset RegistrationTime { get; set; } + + /// + /// Gets or sets last Heartbeat from the Worker + /// + [JsonProperty(PropertyName = "lastSeenDateTime")] + public System.DateTimeOffset LastSeenDateTime { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerMoveParameters.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerMoveParameters.cs new file mode 100644 index 000000000000..ffbd56d6ef8d --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/HybridRunbookWorkerMoveParameters.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters supplied to move hybrid worker operation. + /// + public partial class HybridRunbookWorkerMoveParameters + { + /// + /// Initializes a new instance of the HybridRunbookWorkerMoveParameters + /// class. + /// + public HybridRunbookWorkerMoveParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HybridRunbookWorkerMoveParameters + /// class. + /// + /// Gets or sets the target + /// hybrid runbook worker group. + public HybridRunbookWorkerMoveParameters(string hybridRunbookWorkerGroupName = default(string)) + { + HybridRunbookWorkerGroupName = hybridRunbookWorkerGroupName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target hybrid runbook worker group. + /// + [JsonProperty(PropertyName = "hybridRunbookWorkerGroupName")] + public string HybridRunbookWorkerGroupName { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/RawGraphicalRunbookContent.cs new file mode 100644 index 000000000000..dc6e031d22c2 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/RawGraphicalRunbookContent.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.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Raw Graphical Runbook content + /// + public partial class RawGraphicalRunbookContent + { + /// + /// Initializes a new instance of the RawGraphicalRunbookContent class. + /// + public RawGraphicalRunbookContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RawGraphicalRunbookContent class. + /// + /// Schema version of the + /// serializer. + /// Serialized Graphical + /// runbook + /// Runbook Type. Possible values include: + /// 'GraphPowerShell', 'GraphPowerShellWorkflow' + public RawGraphicalRunbookContent(string schemaVersion = default(string), string runbookDefinition = default(string), string runbookType = default(string)) + { + SchemaVersion = schemaVersion; + RunbookDefinition = runbookDefinition; + RunbookType = runbookType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets schema version of the serializer. + /// + [JsonProperty(PropertyName = "schemaVersion")] + public string SchemaVersion { get; set; } + + /// + /// Gets or sets serialized Graphical runbook + /// + [JsonProperty(PropertyName = "runbookDefinition")] + public string RunbookDefinition { get; set; } + + /// + /// Gets or sets runbook Type. Possible values include: + /// 'GraphPowerShell', 'GraphPowerShellWorkflow' + /// + [JsonProperty(PropertyName = "runbookType")] + public string RunbookType { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/SystemData.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..a4537869fd22 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/SystemData.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.Automation.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTimeOffset? createdAt = default(System.DateTimeOffset?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTimeOffset? lastModifiedAt = default(System.DateTimeOffset?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTimeOffset? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTimeOffset? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/WorkerType.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/WorkerType.cs new file mode 100644 index 000000000000..a090db8f71f9 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/WorkerType.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.Automation.Models +{ + + /// + /// Defines values for WorkerType. + /// + public static class WorkerType + { + public const string HybridV1 = "HybridV1"; + public const string HybridV2 = "HybridV2"; + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Operations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Operations.cs index 15285ffeddf8..8a2571caf17b 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Operations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(AutomationClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-06-01"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs index 383da9f9975b..ef555117a594 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/SdkInfo_AutomationClient.cs @@ -21,7 +21,7 @@ public static IEnumerable> ApiInfo_AutomationClien { new Tuple("Automation", "Activity", "2020-01-13-preview"), new Tuple("Automation", "AgentRegistrationInformation", "2020-01-13-preview"), - new Tuple("Automation", "AutomationAccount", "2020-01-13-preview"), + new Tuple("Automation", "AutomationAccount", "2021-06-22"), new Tuple("Automation", "Certificate", "2020-01-13-preview"), new Tuple("Automation", "Connection", "2020-01-13-preview"), new Tuple("Automation", "ConnectionType", "2020-01-13-preview"), @@ -32,17 +32,18 @@ public static IEnumerable> ApiInfo_AutomationClien new Tuple("Automation", "DscNode", "2020-01-13-preview"), new Tuple("Automation", "DscNodeConfiguration", "2020-01-13-preview"), new Tuple("Automation", "Fields", "2020-01-13-preview"), - new Tuple("Automation", "HybridRunbookWorkerGroup", "2020-01-13-preview"), + new Tuple("Automation", "HybridRunbookWorkerGroup", "2021-06-22"), + new Tuple("Automation", "HybridRunbookWorkers", "2021-06-22"), new Tuple("Automation", "Job", "2019-06-01"), new Tuple("Automation", "JobSchedule", "2020-01-13-preview"), new Tuple("Automation", "JobStream", "2019-06-01"), - new Tuple("Automation", "Keys", "2020-01-13-preview"), + new Tuple("Automation", "Keys", "2021-06-22"), new Tuple("Automation", "LinkedWorkspace", "2020-01-13-preview"), new Tuple("Automation", "Module", "2020-01-13-preview"), new Tuple("Automation", "NodeCountInformation", "2020-01-13-preview"), new Tuple("Automation", "NodeReports", "2020-01-13-preview"), new Tuple("Automation", "ObjectDataTypes", "2020-01-13-preview"), - new Tuple("Automation", "Operations", "2019-06-01"), + new Tuple("Automation", "Operations", "2021-06-22"), new Tuple("Automation", "PrivateEndpointConnections", "2020-01-13-preview"), new Tuple("Automation", "PrivateLinkResources", "2020-01-13-preview"), new Tuple("Automation", "Python2Package", "2020-01-13-preview"), @@ -55,26 +56,16 @@ public static IEnumerable> ApiInfo_AutomationClien new Tuple("Automation", "SourceControl", "2020-01-13-preview"), new Tuple("Automation", "SourceControlSyncJob", "2020-01-13-preview"), new Tuple("Automation", "SourceControlSyncJobStreams", "2020-01-13-preview"), - new Tuple("Automation", "Statistics", "2020-01-13-preview"), + new Tuple("Automation", "Statistics", "2021-06-22"), new Tuple("Automation", "TestJob", "2018-06-30"), new Tuple("Automation", "TestJobStreams", "2018-06-30"), - new Tuple("Automation", "Usages", "2020-01-13-preview"), + new Tuple("Automation", "Usages", "2021-06-22"), new Tuple("Automation", "Variable", "2020-01-13-preview"), new Tuple("Automation", "Watcher", "2020-01-13-preview"), new Tuple("Automation", "Webhook", "2015-10-31"), + new Tuple("Automation", "convertGraphRunbookContent", "2021-06-22"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - 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/automation/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\myWorkingDirectoryNew\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "7eb57e7d969380ed72039d150ab35f731ebf8a73"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/StatisticsOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/StatisticsOperations.cs index 28c55d07d639..b8a00f9a6b30 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/StatisticsOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/StatisticsOperations.cs @@ -113,7 +113,7 @@ internal StatisticsOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/UsagesOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/UsagesOperations.cs index 2df39115c078..872f06256c1c 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/UsagesOperations.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/UsagesOperations.cs @@ -110,7 +110,7 @@ internal UsagesOperations(AutomationClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-01-13-preview"; + string apiVersion = "2021-06-22"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null;