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 df8771b59afa..bed2c3b01c4e 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/AutomationClient.cs @@ -293,6 +293,11 @@ public partial class AutomationClient : ServiceClient, IAutoma /// public virtual IHybridRunbookWorkersOperations HybridRunbookWorkers { get; private set; } + /// + /// Gets the IDeletedAutomationAccountsOperations. + /// + public virtual IDeletedAutomationAccountsOperations DeletedAutomationAccounts { get; private set; } + /// /// Initializes a new instance of the AutomationClient class. /// @@ -578,6 +583,7 @@ private void Initialize() TestJob = new TestJobOperations(this); Webhook = new WebhookOperations(this); HybridRunbookWorkers = new HybridRunbookWorkersOperations(this); + DeletedAutomationAccounts = new DeletedAutomationAccountsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperations.cs new file mode 100644 index 000000000000..2a34bf787186 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperations.cs @@ -0,0 +1,239 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 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; + + /// + /// DeletedAutomationAccountsOperations operations. + /// + internal partial class DeletedAutomationAccountsOperations : IServiceOperations, IDeletedAutomationAccountsOperations + { + /// + /// Initializes a new instance of the DeletedAutomationAccountsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedAutomationAccountsOperations(AutomationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomationClient + /// + public AutomationClient Client { get; private set; } + + /// + /// Retrieve deleted automation account. + /// + /// + /// The name of the automation account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 automationAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (automationAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "automationAccountName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2022-01-31"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("automationAccountName", automationAccountName); + 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}/providers/Microsoft.Automation/deletedAutomationAccounts/{automationAccountName}").ToString(); + _url = _url.Replace("{automationAccountName}", System.Uri.EscapeDataString(automationAccountName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperationsExtensions.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperationsExtensions.cs new file mode 100644 index 000000000000..1489bf9746ad --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/DeletedAutomationAccountsOperationsExtensions.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeletedAutomationAccountsOperations. + /// + public static partial class DeletedAutomationAccountsOperationsExtensions + { + /// + /// Retrieve deleted automation account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the automation account. + /// + public static DeletedAutomationAccountListResult Get(this IDeletedAutomationAccountsOperations operations, string automationAccountName) + { + return operations.GetAsync(automationAccountName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve deleted automation account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the automation account. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDeletedAutomationAccountsOperations operations, string automationAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(automationAccountName, 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 13f3c988bb31..d5713d0117d4 100644 --- a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IAutomationClient.cs @@ -290,6 +290,11 @@ public partial interface IAutomationClient : System.IDisposable /// IHybridRunbookWorkersOperations HybridRunbookWorkers { get; } + /// + /// Gets the IDeletedAutomationAccountsOperations. + /// + IDeletedAutomationAccountsOperations DeletedAutomationAccounts { get; } + /// /// Post operation to serialize or deserialize GraphRunbookContent /// diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDeletedAutomationAccountsOperations.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDeletedAutomationAccountsOperations.cs new file mode 100644 index 000000000000..c7c4dfbc35fd --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/IDeletedAutomationAccountsOperations.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedAutomationAccountsOperations operations. + /// + public partial interface IDeletedAutomationAccountsOperations + { + /// + /// Retrieve deleted automation account. + /// + /// + /// The name of the automation account. + /// + /// + /// 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 automationAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccount.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccount.cs new file mode 100644 index 000000000000..e306bf117f08 --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccount.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// Definition of the deleted automation account type. + /// + [Rest.Serialization.JsonTransformation] + public partial class DeletedAutomationAccount + { + /// + /// Initializes a new instance of the DeletedAutomationAccount class. + /// + public DeletedAutomationAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedAutomationAccount class. + /// + /// Gets or sets the + /// Automation Account Resource Id. + /// Gets or sets the Automation + /// Account Id. + /// Gets or + /// sets the location of the resource. + /// Gets the creation time. + /// The resource id. + /// Gets or sets name of the resource. + /// The resource type. + /// Gets or sets the location of the + /// resource. + public DeletedAutomationAccount(string automationAccountResourceId = default(string), string automationAccountId = default(string), string deletedAutomationAccountPropertiesLocation = default(string), System.DateTimeOffset deletedTime = default(System.DateTimeOffset), string id = default(string), string name = default(string), string type = default(string), string location = default(string)) + { + AutomationAccountResourceId = automationAccountResourceId; + AutomationAccountId = automationAccountId; + DeletedAutomationAccountPropertiesLocation = deletedAutomationAccountPropertiesLocation; + DeletedTime = deletedTime; + Id = id; + Name = name; + Type = type; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Automation Account Resource Id. + /// + [JsonProperty(PropertyName = "properties.automationAccountResourceId")] + public string AutomationAccountResourceId { get; set; } + + /// + /// Gets or sets the Automation Account Id. + /// + [JsonProperty(PropertyName = "properties.automationAccountId")] + public string AutomationAccountId { get; set; } + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "properties.location")] + public string DeletedAutomationAccountPropertiesLocation { get; set; } + + /// + /// Gets the creation time. + /// + [JsonProperty(PropertyName = "properties.deletedTime")] + public System.DateTimeOffset DeletedTime { get; private set; } + + /// + /// Gets or sets the resource id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs new file mode 100644 index 000000000000..d5b01e40837d --- /dev/null +++ b/sdk/automation/Microsoft.Azure.Management.Automation/src/Generated/Models/DeletedAutomationAccountListResult.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response model for the list deleted automation account. + /// + public partial class DeletedAutomationAccountListResult + { + /// + /// Initializes a new instance of the + /// DeletedAutomationAccountListResult class. + /// + public DeletedAutomationAccountListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DeletedAutomationAccountListResult class. + /// + /// Gets or sets the list of deleted automation + /// accounts. + public DeletedAutomationAccountListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of deleted automation accounts. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} 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 ef555117a594..ca1e60832507 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 @@ -64,6 +64,7 @@ public static IEnumerable> ApiInfo_AutomationClien new Tuple("Automation", "Watcher", "2020-01-13-preview"), new Tuple("Automation", "Webhook", "2015-10-31"), new Tuple("Automation", "convertGraphRunbookContent", "2021-06-22"), + new Tuple("Automation", "deletedAutomationAccounts", "2022-01-31"), }.AsEnumerable(); } }