diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperationsExtensions.cs deleted file mode 100644 index 49b38f8198e9..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperationsExtensions.cs +++ /dev/null @@ -1,258 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AccountsOperations. - /// - public static partial class AccountsOperationsExtensions - { - /// - /// Creates an Automanage Account - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Automanage account. - /// - /// - /// The resource group name. - /// - /// - /// Parameters supplied to create or update Automanage account. - /// - public static Account CreateOrUpdate(this IAccountsOperations operations, string accountName, string resourceGroupName, Account parameters) - { - return operations.CreateOrUpdateAsync(accountName, resourceGroupName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates an Automanage Account - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Automanage account. - /// - /// - /// The resource group name. - /// - /// - /// Parameters supplied to create or update Automanage account. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAccountsOperations operations, string accountName, string resourceGroupName, Account parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(accountName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get information about a Automanage account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Automanage account name. - /// - /// - /// The resource group name. - /// - public static Account Get(this IAccountsOperations operations, string accountName, string resourceGroupName) - { - return operations.GetAsync(accountName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get information about a Automanage account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Automanage account name. - /// - /// - /// The resource group name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAccountsOperations operations, string accountName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(accountName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete a Automanage account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The resource group name. - /// - /// - /// Name of the Automanage account - /// - public static void Delete(this IAccountsOperations operations, string resourceGroupName, string accountName) - { - operations.DeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); - } - - /// - /// Delete a Automanage account - /// - /// - /// The operations group for this extension method. - /// - /// - /// The resource group name. - /// - /// - /// Name of the Automanage account - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates an Automanage Account - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Automanage account. - /// - /// - /// The resource group name. - /// - /// - /// Parameters supplied to update Automanage account. - /// - public static Account Update(this IAccountsOperations operations, string accountName, string resourceGroupName, Account parameters) - { - return operations.UpdateAsync(accountName, resourceGroupName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Updates an Automanage Account - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Automanage account. - /// - /// - /// The resource group name. - /// - /// - /// Parameters supplied to update Automanage account. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAccountsOperations operations, string accountName, string resourceGroupName, Account parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(accountName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve a list of Automanage accounts within a given resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The resource group name. - /// - public static IEnumerable ListByResourceGroup(this IAccountsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve a list of Automanage accounts within a given resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The resource group name. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IAccountsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve a list of Automanage accounts within a subscription - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscription(this IAccountsOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Retrieve a list of Automanage accounts within a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAccountsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AutomanageClient.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AutomanageClient.cs index f817a238c76a..fc0630fa3710 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AutomanageClient.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AutomanageClient.cs @@ -47,13 +47,12 @@ public partial class AutomanageClient : ServiceClient, IAutoma public ServiceClientCredentials Credentials { get; private set; } /// - /// Client Api Version. + /// The API version to use for this operation. /// public string ApiVersion { get; private set; } /// - /// Subscription ID which uniquely identify Microsoft Azure subscription. The - /// subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } @@ -76,25 +75,45 @@ public partial class AutomanageClient : ServiceClient, IAutoma public bool? GenerateClientRequestId { get; set; } /// - /// Gets the IAccountsOperations. + /// Gets the IBestPracticesOperations. /// - public virtual IAccountsOperations Accounts { get; private set; } + public virtual IBestPracticesOperations BestPractices { get; private set; } /// - /// Gets the IConfigurationProfileAssignmentsOperations. + /// Gets the IBestPracticesVersionsOperations. /// - public virtual IConfigurationProfileAssignmentsOperations ConfigurationProfileAssignments { get; private set; } + public virtual IBestPracticesVersionsOperations BestPracticesVersions { get; private set; } + + /// + /// Gets the IConfigurationProfilesOperations. + /// + public virtual IConfigurationProfilesOperations ConfigurationProfiles { get; private set; } + + /// + /// Gets the IConfigurationProfilesVersionsOperations. + /// + public virtual IConfigurationProfilesVersionsOperations ConfigurationProfilesVersions { get; private set; } /// - /// Gets the IConfigurationProfilePreferencesOperations. + /// Gets the IConfigurationProfileAssignmentsOperations. /// - public virtual IConfigurationProfilePreferencesOperations ConfigurationProfilePreferences { get; private set; } + public virtual IConfigurationProfileAssignmentsOperations ConfigurationProfileAssignments { get; private set; } /// /// Gets the IOperations. /// public virtual IOperations Operations { get; private set; } + /// + /// Gets the IReportsOperations. + /// + public virtual IReportsOperations Reports { get; private set; } + + /// + /// Gets the IServicePrincipalsOperations. + /// + public virtual IServicePrincipalsOperations ServicePrincipals { get; private set; } + /// /// Initializes a new instance of the AutomanageClient class. /// @@ -336,12 +355,16 @@ public AutomanageClient(System.Uri baseUri, ServiceClientCredentials credentials /// private void Initialize() { - Accounts = new AccountsOperations(this); + BestPractices = new BestPracticesOperations(this); + BestPracticesVersions = new BestPracticesVersionsOperations(this); + ConfigurationProfiles = new ConfigurationProfilesOperations(this); + ConfigurationProfilesVersions = new ConfigurationProfilesVersionsOperations(this); ConfigurationProfileAssignments = new ConfigurationProfileAssignmentsOperations(this); - ConfigurationProfilePreferences = new ConfigurationProfilePreferencesOperations(this); Operations = new Operations(this); + Reports = new ReportsOperations(this); + ServicePrincipals = new ServicePrincipalsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-06-30-preview"; + ApiVersion = "2021-04-30-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperations.cs new file mode 100644 index 000000000000..cb49031cd3bc --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperations.cs @@ -0,0 +1,413 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + 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; + + /// + /// BestPracticesOperations operations. + /// + internal partial class BestPracticesOperations : IServiceOperations, IBestPracticesOperations + { + /// + /// Initializes a new instance of the BestPracticesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BestPracticesOperations(AutomanageClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomanageClient + /// + public AutomanageClient Client { get; private set; } + + /// + /// Get information about a Automanage best practice + /// + /// + /// The Automanage best practice name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string bestPracticeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (bestPracticeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bestPracticeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("bestPracticeName", bestPracticeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Automanage/bestPractices/{bestPracticeName}").ToString(); + _url = _url.Replace("{bestPracticeName}", System.Uri.EscapeDataString(bestPracticeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve a list of Automanage best practices + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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>> ListByTenantWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTenant", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Automanage/bestPractices").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperationsExtensions.cs new file mode 100644 index 000000000000..5cc67d75f4f4 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesOperationsExtensions.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BestPracticesOperations. + /// + public static partial class BestPracticesOperationsExtensions + { + /// + /// Get information about a Automanage best practice + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + public static BestPractice Get(this IBestPracticesOperations operations, string bestPracticeName) + { + return operations.GetAsync(bestPracticeName).GetAwaiter().GetResult(); + } + + /// + /// Get information about a Automanage best practice + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBestPracticesOperations operations, string bestPracticeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(bestPracticeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve a list of Automanage best practices + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListByTenant(this IBestPracticesOperations operations) + { + return operations.ListByTenantAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of Automanage best practices + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTenantAsync(this IBestPracticesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTenantWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperations.cs new file mode 100644 index 000000000000..3a555cbe22e4 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperations.cs @@ -0,0 +1,431 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + 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; + + /// + /// BestPracticesVersionsOperations operations. + /// + internal partial class BestPracticesVersionsOperations : IServiceOperations, IBestPracticesVersionsOperations + { + /// + /// Initializes a new instance of the BestPracticesVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BestPracticesVersionsOperations(AutomanageClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomanageClient + /// + public AutomanageClient Client { get; private set; } + + /// + /// Get information about a Automanage best practice version + /// + /// + /// The Automanage best practice name. + /// + /// + /// The Automanage best practice version name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string bestPracticeName, string versionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (bestPracticeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bestPracticeName"); + } + if (versionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "versionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("bestPracticeName", bestPracticeName); + tracingParameters.Add("versionName", versionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Automanage/bestPractices/{bestPracticeName}/versions/{versionName}").ToString(); + _url = _url.Replace("{bestPracticeName}", System.Uri.EscapeDataString(bestPracticeName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve a list of Automanage best practices versions + /// + /// + /// The Automanage best practice name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTenantWithHttpMessagesAsync(string bestPracticeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (bestPracticeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bestPracticeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("bestPracticeName", bestPracticeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTenant", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Automanage/bestPractices/{bestPracticeName}/versions").ToString(); + _url = _url.Replace("{bestPracticeName}", System.Uri.EscapeDataString(bestPracticeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..296657b24550 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/BestPracticesVersionsOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BestPracticesVersionsOperations. + /// + public static partial class BestPracticesVersionsOperationsExtensions + { + /// + /// Get information about a Automanage best practice version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + /// + /// The Automanage best practice version name. + /// + public static BestPractice Get(this IBestPracticesVersionsOperations operations, string bestPracticeName, string versionName) + { + return operations.GetAsync(bestPracticeName, versionName).GetAwaiter().GetResult(); + } + + /// + /// Get information about a Automanage best practice version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + /// + /// The Automanage best practice version name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBestPracticesVersionsOperations operations, string bestPracticeName, string versionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(bestPracticeName, versionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve a list of Automanage best practices versions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + public static IEnumerable ListByTenant(this IBestPracticesVersionsOperations operations, string bestPracticeName) + { + return operations.ListByTenantAsync(bestPracticeName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of Automanage best practices versions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Automanage best practice name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTenantAsync(this IBestPracticesVersionsOperations operations, string bestPracticeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTenantWithHttpMessagesAsync(bestPracticeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperations.cs index 841ad0a27cf1..e9191f3f3c3a 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperations.cs @@ -61,32 +61,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// assignment. /// /// - /// The resource group name. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(configurationProfileAssignmentName, parameters, resourceGroupName, vmName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get information about a configuration profile assignment - /// - /// - /// The resource group name. - /// - /// - /// The configuration profile assignment name. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the virtual machine. @@ -112,26 +87,41 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (configurationProfileAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); } - if (resourceGroupName != null) + if (parameters == null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - if (configurationProfileAssignmentName == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.SubscriptionId == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } } if (vmName == null) { @@ -141,6 +131,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -148,18 +145,19 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vmName", vmName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{configurationProfileAssignmentName}", System.Uri.EscapeDataString(configurationProfileAssignmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -173,7 +171,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -204,6 +202,12 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -224,7 +228,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -279,6 +283,24 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -287,13 +309,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } /// - /// Delete a configuration profile assignment + /// Get information about a configuration profile assignment /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Name of the configuration profile assignment + /// The configuration profile assignment name. /// /// /// The name of the virtual machine. @@ -307,6 +329,9 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -316,7 +341,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -324,9 +349,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (configurationProfileAssignmentName == null) @@ -337,6 +366,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (vmName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); @@ -345,6 +381,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -356,7 +399,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); tracingParameters.Add("vmName", vmName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -377,7 +420,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -428,7 +471,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -458,13 +501,31 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -473,10 +534,16 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } /// - /// Get list of configuration profile assignments + /// Delete a configuration profile assignment /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the configuration profile assignment + /// + /// + /// The name of the virtual machine. /// /// /// Headers that will be added to request. @@ -487,9 +554,6 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -499,7 +563,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -507,19 +571,45 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } + if (configurationProfileAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -528,14 +618,18 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); + tracingParameters.Add("vmName", vmName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + 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.Automanage/configurationProfileAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{configurationProfileAssignmentName}", System.Uri.EscapeDataString(configurationProfileAssignmentName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -548,7 +642,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -599,7 +693,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -629,31 +723,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -662,8 +738,11 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } /// - /// Get list of configuration profile assignments under a given subscription + /// Get list of configuration profile assignments /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Headers that will be added to request. /// @@ -685,16 +764,45 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,12 +810,14 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfileAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfileAssignments").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -835,21 +945,8 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) } /// - /// Creates an association between a VM and Automanage configuration profile + /// Get list of configuration profile assignments under a given subscription /// - /// - /// Name of the configuration profile assignment. Only default is supported. - /// - /// - /// Parameters supplied to the create or update configuration profile - /// assignment. - /// - /// - /// The resource group name. - /// - /// - /// The name of the virtual machine. - /// /// /// Headers that will be added to request. /// @@ -871,39 +968,30 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (configurationProfileAssignmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) + if (Client.SubscriptionId != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - if (vmName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -911,20 +999,13 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("vmName", vmName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}").ToString(); - _url = _url.Replace("{configurationProfileAssignmentName}", System.Uri.EscapeDataString(configurationProfileAssignmentName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfileAssignments").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -937,7 +1018,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -968,12 +1049,6 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -994,7 +1069,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1024,7 +1099,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1037,25 +1112,7 @@ internal ConfigurationProfileAssignmentsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperationsExtensions.cs index bd37c422f1f1..06152e556409 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperationsExtensions.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfileAssignmentsOperationsExtensions.cs @@ -37,7 +37,7 @@ public static partial class ConfigurationProfileAssignmentsOperationsExtensions /// assignment. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the virtual machine. @@ -61,7 +61,7 @@ public static ConfigurationProfileAssignment CreateOrUpdate(this IConfigurationP /// assignment. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the virtual machine. @@ -84,7 +84,7 @@ public static ConfigurationProfileAssignment CreateOrUpdate(this IConfigurationP /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The configuration profile assignment name. @@ -104,7 +104,7 @@ public static ConfigurationProfileAssignment Get(this IConfigurationProfileAssig /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The configuration profile assignment name. @@ -130,7 +130,7 @@ public static ConfigurationProfileAssignment Get(this IConfigurationProfileAssig /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the configuration profile assignment @@ -150,7 +150,7 @@ public static void Delete(this IConfigurationProfileAssignmentsOperations operat /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the configuration profile assignment @@ -173,7 +173,7 @@ public static void Delete(this IConfigurationProfileAssignmentsOperations operat /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// public static IEnumerable List(this IConfigurationProfileAssignmentsOperations operations, string resourceGroupName) { @@ -187,7 +187,7 @@ public static IEnumerable List(this IConfigurati /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. @@ -228,59 +228,5 @@ public static IEnumerable ListBySubscription(thi } } - /// - /// Creates an association between a VM and Automanage configuration profile - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the configuration profile assignment. Only default is supported. - /// - /// - /// Parameters supplied to the create or update configuration profile - /// assignment. - /// - /// - /// The resource group name. - /// - /// - /// The name of the virtual machine. - /// - public static ConfigurationProfileAssignment BeginCreateOrUpdate(this IConfigurationProfileAssignmentsOperations operations, string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName) - { - return operations.BeginCreateOrUpdateAsync(configurationProfileAssignmentName, parameters, resourceGroupName, vmName).GetAwaiter().GetResult(); - } - - /// - /// Creates an association between a VM and Automanage configuration profile - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the configuration profile assignment. Only default is supported. - /// - /// - /// Parameters supplied to the create or update configuration profile - /// assignment. - /// - /// - /// The resource group name. - /// - /// - /// The name of the virtual machine. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IConfigurationProfileAssignmentsOperations operations, string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(configurationProfileAssignmentName, parameters, resourceGroupName, vmName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperations.cs similarity index 84% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperations.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperations.cs index 98a6e17bb363..6a5821cd05bb 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Automanage using System.Threading.Tasks; /// - /// ConfigurationProfilePreferencesOperations operations. + /// ConfigurationProfilesOperations operations. /// - internal partial class ConfigurationProfilePreferencesOperations : IServiceOperations, IConfigurationProfilePreferencesOperations + internal partial class ConfigurationProfilesOperations : IServiceOperations, IConfigurationProfilesOperations { /// - /// Initializes a new instance of the ConfigurationProfilePreferencesOperations class. + /// Initializes a new instance of the ConfigurationProfilesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ConfigurationProfilePreferencesOperations : IServiceOpera /// /// Thrown when a required parameter is null /// - internal ConfigurationProfilePreferencesOperations(AutomanageClient client) + internal ConfigurationProfilesOperations(AutomanageClient client) { if (client == null) { @@ -51,16 +51,16 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) public AutomanageClient Client { get; private set; } /// - /// Creates a configuration profile preference + /// Creates a configuration profile /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to create or update configuration profile. /// /// /// Headers that will be added to request. @@ -83,35 +83,57 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, ConfigurationProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (configurationProfilePreferenceName == null) + if (configurationProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfilePreferenceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -119,7 +141,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("configurationProfilePreferenceName", configurationProfilePreferenceName); + tracingParameters.Add("configurationProfileName", configurationProfileName); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,8 +149,8 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}").ToString(); - _url = _url.Replace("{configurationProfilePreferenceName}", System.Uri.EscapeDataString(configurationProfilePreferenceName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -230,7 +252,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -243,7 +265,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -261,7 +283,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -281,13 +303,13 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } /// - /// Get information about a configuration profile preference + /// Get information about a configuration profile /// - /// - /// The configuration profile preference name. + /// + /// The configuration profile name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -310,31 +332,49 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (configurationProfilePreferenceName == null) + if (configurationProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfilePreferenceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -342,15 +382,15 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("configurationProfilePreferenceName", configurationProfilePreferenceName); + tracingParameters.Add("configurationProfileName", configurationProfileName); tracingParameters.Add("resourceGroupName", resourceGroupName); 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.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}").ToString(); - _url = _url.Replace("{configurationProfilePreferenceName}", System.Uri.EscapeDataString(configurationProfilePreferenceName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -446,7 +486,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -459,7 +499,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -479,13 +519,13 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } /// - /// Delete a configuration profile preference + /// Delete a configuration profile /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the configuration profile preference + /// + /// Name of the configuration profile /// /// /// Headers that will be added to request. @@ -505,7 +545,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfilePreferenceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -513,23 +553,41 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - if (configurationProfilePreferenceName == null) + if (configurationProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfilePreferenceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,15 +596,15 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("configurationProfilePreferenceName", configurationProfilePreferenceName); + tracingParameters.Add("configurationProfileName", configurationProfileName); 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.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{configurationProfilePreferenceName}", System.Uri.EscapeDataString(configurationProfilePreferenceName)); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -656,16 +714,16 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } /// - /// Updates a configuration profile preference + /// Updates a configuration profile /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to update configuration profile. /// /// /// Headers that will be added to request. @@ -688,31 +746,49 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, ConfigurationProfileUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (configurationProfilePreferenceName == null) + if (configurationProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfilePreferenceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -724,7 +800,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("configurationProfilePreferenceName", configurationProfilePreferenceName); + tracingParameters.Add("configurationProfileName", configurationProfileName); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -732,8 +808,8 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences/{configurationProfilePreferenceName}").ToString(); - _url = _url.Replace("{configurationProfilePreferenceName}", System.Uri.EscapeDataString(configurationProfilePreferenceName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -835,7 +911,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -848,7 +924,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -868,11 +944,10 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } /// - /// Retrieve a list of configuration profile preferences within a given - /// resource group + /// Retrieve a list of configuration profile within a given resource group /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -895,27 +970,45 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -929,7 +1022,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfilePreferences").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -1025,7 +1118,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1038,7 +1131,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1058,7 +1151,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } /// - /// Retrieve a list of configuration profile preferences within a subscription + /// Retrieve a list of configuration profile within a subscription /// /// /// Headers that will be added to request. @@ -1081,16 +1174,30 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1103,7 +1210,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfilePreferences").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfiles").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1198,7 +1305,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1211,7 +1318,7 @@ internal ConfigurationProfilePreferencesOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperationsExtensions.cs similarity index 52% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperationsExtensions.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperationsExtensions.cs index f4289cba50a5..528f06ac449f 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilePreferencesOperationsExtensions.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesOperationsExtensions.cs @@ -19,208 +19,206 @@ namespace Microsoft.Azure.Management.Automanage using System.Threading.Tasks; /// - /// Extension methods for ConfigurationProfilePreferencesOperations. + /// Extension methods for ConfigurationProfilesOperations. /// - public static partial class ConfigurationProfilePreferencesOperationsExtensions + public static partial class ConfigurationProfilesOperationsExtensions { /// - /// Creates a configuration profile preference + /// Creates a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to create or update configuration profile. /// - public static ConfigurationProfilePreference CreateOrUpdate(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters) + public static ConfigurationProfile CreateOrUpdate(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName, ConfigurationProfile parameters) { - return operations.CreateOrUpdateAsync(configurationProfilePreferenceName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(configurationProfileName, resourceGroupName, parameters).GetAwaiter().GetResult(); } /// - /// Creates a configuration profile preference + /// Creates a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to create or update configuration profile. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName, ConfigurationProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(configurationProfilePreferenceName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(configurationProfileName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get information about a configuration profile preference + /// Get information about a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// The configuration profile preference name. + /// + /// The configuration profile name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - public static ConfigurationProfilePreference Get(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName) + public static ConfigurationProfile Get(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName) { - return operations.GetAsync(configurationProfilePreferenceName, resourceGroupName).GetAwaiter().GetResult(); + return operations.GetAsync(configurationProfileName, resourceGroupName).GetAwaiter().GetResult(); } /// - /// Get information about a configuration profile preference + /// Get information about a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// The configuration profile preference name. + /// + /// The configuration profile name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(configurationProfilePreferenceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(configurationProfileName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete a configuration profile preference + /// Delete a configuration profile /// /// /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the configuration profile preference + /// + /// Name of the configuration profile /// - public static void Delete(this IConfigurationProfilePreferencesOperations operations, string resourceGroupName, string configurationProfilePreferenceName) + public static void Delete(this IConfigurationProfilesOperations operations, string resourceGroupName, string configurationProfileName) { - operations.DeleteAsync(resourceGroupName, configurationProfilePreferenceName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, configurationProfileName).GetAwaiter().GetResult(); } /// - /// Delete a configuration profile preference + /// Delete a configuration profile /// /// /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the configuration profile preference + /// + /// Name of the configuration profile /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IConfigurationProfilePreferencesOperations operations, string resourceGroupName, string configurationProfilePreferenceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IConfigurationProfilesOperations operations, string resourceGroupName, string configurationProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, configurationProfilePreferenceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, configurationProfileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Updates a configuration profile preference + /// Updates a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to update configuration profile. /// - public static ConfigurationProfilePreference Update(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters) + public static ConfigurationProfile Update(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName, ConfigurationProfileUpdate parameters) { - return operations.UpdateAsync(configurationProfilePreferenceName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(configurationProfileName, resourceGroupName, parameters).GetAwaiter().GetResult(); } /// - /// Updates a configuration profile preference + /// Updates a configuration profile /// /// /// The operations group for this extension method. /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile preference. + /// Parameters supplied to update configuration profile. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IConfigurationProfilePreferencesOperations operations, string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IConfigurationProfilesOperations operations, string configurationProfileName, string resourceGroupName, ConfigurationProfileUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(configurationProfilePreferenceName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(configurationProfileName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Retrieve a list of configuration profile preferences within a given - /// resource group + /// Retrieve a list of configuration profile within a given resource group /// /// /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - public static IEnumerable ListByResourceGroup(this IConfigurationProfilePreferencesOperations operations, string resourceGroupName) + public static IEnumerable ListByResourceGroup(this IConfigurationProfilesOperations operations, string resourceGroupName) { return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } /// - /// Retrieve a list of configuration profile preferences within a given - /// resource group + /// Retrieve a list of configuration profile within a given resource group /// /// /// The operations group for this extension method. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IConfigurationProfilePreferencesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IConfigurationProfilesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -229,18 +227,18 @@ public static IEnumerable ListByResourceGroup(th } /// - /// Retrieve a list of configuration profile preferences within a subscription + /// Retrieve a list of configuration profile within a subscription /// /// /// The operations group for this extension method. /// - public static IEnumerable ListBySubscription(this IConfigurationProfilePreferencesOperations operations) + public static IEnumerable ListBySubscription(this IConfigurationProfilesOperations operations) { return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); } /// - /// Retrieve a list of configuration profile preferences within a subscription + /// Retrieve a list of configuration profile within a subscription /// /// /// The operations group for this extension method. @@ -248,7 +246,7 @@ public static IEnumerable ListBySubscription(thi /// /// The cancellation token. /// - public static async Task> ListBySubscriptionAsync(this IConfigurationProfilePreferencesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListBySubscriptionAsync(this IConfigurationProfilesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperations.cs similarity index 79% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperations.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperations.cs index 65b8232de9d2..411a8ea7f7fd 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/AccountsOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Automanage using System.Threading.Tasks; /// - /// AccountsOperations operations. + /// ConfigurationProfilesVersionsOperations operations. /// - internal partial class AccountsOperations : IServiceOperations, IAccountsOperations + internal partial class ConfigurationProfilesVersionsOperations : IServiceOperations, IConfigurationProfilesVersionsOperations { /// - /// Initializes a new instance of the AccountsOperations class. + /// Initializes a new instance of the ConfigurationProfilesVersionsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class AccountsOperations : IServiceOperations /// /// Thrown when a required parameter is null /// - internal AccountsOperations(AutomanageClient client) + internal ConfigurationProfilesVersionsOperations(AutomanageClient client) { if (client == null) { @@ -51,16 +51,19 @@ internal AccountsOperations(AutomanageClient client) public AutomanageClient Client { get; private set; } /// - /// Creates an Automanage Account + /// Creates a configuration profile version /// - /// - /// Name of the Automanage account. + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update Automanage account. + /// Parameters supplied to create or update configuration profile. /// /// /// Headers that will be added to request. @@ -83,35 +86,61 @@ internal AccountsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string accountName, string resourceGroupName, Account parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (accountName == null) + if (configurationProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); + } + if (versionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "versionName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -119,7 +148,8 @@ internal AccountsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("accountName", accountName); + tracingParameters.Add("configurationProfileName", configurationProfileName); + tracingParameters.Add("versionName", versionName); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -127,8 +157,9 @@ internal AccountsOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}").ToString(); - _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -230,7 +261,7 @@ internal AccountsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -243,7 +274,7 @@ internal AccountsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -261,7 +292,7 @@ internal AccountsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -281,13 +312,16 @@ internal AccountsOperations(AutomanageClient client) } /// - /// Get information about a Automanage account + /// Get information about a configuration profile version /// - /// - /// The Automanage account name. + /// + /// The configuration profile name. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -310,31 +344,53 @@ internal AccountsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string accountName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (accountName == null) + if (configurationProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); + } + if (versionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "versionName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -342,15 +398,17 @@ internal AccountsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("accountName", accountName); + tracingParameters.Add("configurationProfileName", configurationProfileName); + tracingParameters.Add("versionName", versionName); tracingParameters.Add("resourceGroupName", resourceGroupName); 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.Automanage/accounts/{accountName}").ToString(); - _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -446,7 +504,7 @@ internal AccountsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -459,7 +517,7 @@ internal AccountsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -479,13 +537,16 @@ internal AccountsOperations(AutomanageClient client) } /// - /// Delete a Automanage account + /// Delete a configuration profile version /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the Automanage account + /// + /// Name of the configuration profile + /// + /// + /// The configuration profile version name. /// /// /// Headers that will be added to request. @@ -505,7 +566,7 @@ internal AccountsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileName, string versionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -513,23 +574,45 @@ internal AccountsOperations(AutomanageClient client) } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - if (accountName == null) + if (configurationProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); + } + if (versionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "versionName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -538,15 +621,17 @@ internal AccountsOperations(AutomanageClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("accountName", accountName); + tracingParameters.Add("configurationProfileName", configurationProfileName); + tracingParameters.Add("versionName", versionName); 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.Automanage/accounts/{accountName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -656,16 +741,19 @@ internal AccountsOperations(AutomanageClient client) } /// - /// Updates an Automanage Account + /// Updates a configuration profile version /// - /// - /// Name of the Automanage account. + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to update Automanage account. + /// Parameters supplied to update configuration profile. /// /// /// Headers that will be added to request. @@ -688,31 +776,53 @@ internal AccountsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string accountName, string resourceGroupName, Account parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfileUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (accountName == null) + if (configurationProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); + } + if (versionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "versionName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -724,7 +834,8 @@ internal AccountsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("accountName", accountName); + tracingParameters.Add("configurationProfileName", configurationProfileName); + tracingParameters.Add("versionName", versionName); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -732,8 +843,9 @@ internal AccountsOperations(AutomanageClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts/{accountName}").ToString(); - _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); @@ -835,7 +947,7 @@ internal AccountsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -848,7 +960,7 @@ internal AccountsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -868,10 +980,14 @@ internal AccountsOperations(AutomanageClient client) } /// - /// Retrieve a list of Automanage accounts within a given resource group + /// Retrieve a list of configuration profile version for a configuration + /// profile /// + /// + /// Name of the configuration profile. + /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -894,201 +1010,48 @@ internal AccountsOperations(AutomanageClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListChildResourcesWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._]+$"); - } - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/accounts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (configurationProfileName == null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileName"); } - 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) + if (Client.SubscriptionId == null) { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.AcceptLanguage != null) + if (Client.SubscriptionId != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (Client.SubscriptionId.Length < 1) { - _httpRequest.Headers.Remove("accept-language"); + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } - _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) + if (resourceGroupName == null) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) + if (resourceGroupName != null) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try + if (resourceGroupName.Length > 90) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } - catch (JsonException) + if (resourceGroupName.Length < 1) { - // Ignore the exception + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } - 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")) + if (Client.ApiVersion == null) { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - // Deserialize Response - if ((int)_statusCode == 200) + if (Client.ApiVersion != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try + if (Client.ApiVersion.Length < 1) { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } - 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 Automanage accounts within a subscription - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1097,13 +1060,17 @@ internal AccountsOperations(AutomanageClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("configurationProfileName", configurationProfileName); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListChildResources", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/accounts").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions").ToString(); + _url = _url.Replace("{configurationProfileName}", System.Uri.EscapeDataString(configurationProfileName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1197,7 +1164,7 @@ internal AccountsOperations(AutomanageClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1210,7 +1177,7 @@ internal AccountsOperations(AutomanageClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..9e74f44c3d2f --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ConfigurationProfilesVersionsOperationsExtensions.cs @@ -0,0 +1,262 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConfigurationProfilesVersionsOperations. + /// + public static partial class ConfigurationProfilesVersionsOperationsExtensions + { + /// + /// Creates a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Parameters supplied to create or update configuration profile. + /// + public static ConfigurationProfile CreateOrUpdate(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfile parameters) + { + return operations.CreateOrUpdateAsync(configurationProfileName, versionName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Parameters supplied to create or update configuration profile. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(configurationProfileName, versionName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get information about a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The configuration profile name. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static ConfigurationProfile Get(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName) + { + return operations.GetAsync(configurationProfileName, versionName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get information about a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The configuration profile name. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(configurationProfileName, versionName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the configuration profile + /// + /// + /// The configuration profile version name. + /// + public static void Delete(this IConfigurationProfilesVersionsOperations operations, string resourceGroupName, string configurationProfileName, string versionName) + { + operations.DeleteAsync(resourceGroupName, configurationProfileName, versionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the configuration profile + /// + /// + /// The configuration profile version name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IConfigurationProfilesVersionsOperations operations, string resourceGroupName, string configurationProfileName, string versionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, configurationProfileName, versionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Parameters supplied to update configuration profile. + /// + public static ConfigurationProfile Update(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfileUpdate parameters) + { + return operations.UpdateAsync(configurationProfileName, versionName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a configuration profile version + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Parameters supplied to update configuration profile. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfileUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(configurationProfileName, versionName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve a list of configuration profile version for a configuration + /// profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListChildResources(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string resourceGroupName) + { + return operations.ListChildResourcesAsync(configurationProfileName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of configuration profile version for a configuration + /// profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the configuration profile. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListChildResourcesAsync(this IConfigurationProfilesVersionsOperations operations, string configurationProfileName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListChildResourcesWithHttpMessagesAsync(configurationProfileName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAutomanageClient.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAutomanageClient.cs index 6c188aab1e5a..302a3188061f 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAutomanageClient.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAutomanageClient.cs @@ -41,14 +41,12 @@ public partial interface IAutomanageClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Client Api Version. + /// The API version to use for this operation. /// string ApiVersion { get; } /// - /// Subscription ID which uniquely identify Microsoft Azure - /// subscription. The subscription ID forms part of the URI for every - /// service call. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } @@ -72,24 +70,44 @@ public partial interface IAutomanageClient : System.IDisposable /// - /// Gets the IAccountsOperations. + /// Gets the IBestPracticesOperations. /// - IAccountsOperations Accounts { get; } + IBestPracticesOperations BestPractices { get; } /// - /// Gets the IConfigurationProfileAssignmentsOperations. + /// Gets the IBestPracticesVersionsOperations. /// - IConfigurationProfileAssignmentsOperations ConfigurationProfileAssignments { get; } + IBestPracticesVersionsOperations BestPracticesVersions { get; } + + /// + /// Gets the IConfigurationProfilesOperations. + /// + IConfigurationProfilesOperations ConfigurationProfiles { get; } + + /// + /// Gets the IConfigurationProfilesVersionsOperations. + /// + IConfigurationProfilesVersionsOperations ConfigurationProfilesVersions { get; } /// - /// Gets the IConfigurationProfilePreferencesOperations. + /// Gets the IConfigurationProfileAssignmentsOperations. /// - IConfigurationProfilePreferencesOperations ConfigurationProfilePreferences { get; } + IConfigurationProfileAssignmentsOperations ConfigurationProfileAssignments { get; } /// /// Gets the IOperations. /// IOperations Operations { get; } + /// + /// Gets the IReportsOperations. + /// + IReportsOperations Reports { get; } + + /// + /// Gets the IServicePrincipalsOperations. + /// + IServicePrincipalsOperations ServicePrincipals { get; } + } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesOperations.cs new file mode 100644 index 000000000000..b7f4d2852f26 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BestPracticesOperations operations. + /// + public partial interface IBestPracticesOperations + { + /// + /// Get information about a Automanage best practice + /// + /// + /// The Automanage best practice name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string bestPracticeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a list of Automanage best practices + /// + /// + /// 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>> ListByTenantWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesVersionsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesVersionsOperations.cs new file mode 100644 index 000000000000..c2cd87d0dc64 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IBestPracticesVersionsOperations.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BestPracticesVersionsOperations operations. + /// + public partial interface IBestPracticesVersionsOperations + { + /// + /// Get information about a Automanage best practice version + /// + /// + /// The Automanage best practice name. + /// + /// + /// The Automanage best practice version name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string bestPracticeName, string versionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a list of Automanage best practices versions + /// + /// + /// The Automanage best practice name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTenantWithHttpMessagesAsync(string bestPracticeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfileAssignmentsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfileAssignmentsOperations.cs index ce75480dd0a4..7462ee047b6e 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfileAssignmentsOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfileAssignmentsOperations.cs @@ -36,7 +36,7 @@ public partial interface IConfigurationProfileAssignmentsOperations /// assignment. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the virtual machine. @@ -61,7 +61,7 @@ public partial interface IConfigurationProfileAssignmentsOperations /// Get information about a configuration profile assignment /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The configuration profile assignment name. @@ -89,7 +89,7 @@ public partial interface IConfigurationProfileAssignmentsOperations /// Delete a configuration profile assignment /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the configuration profile assignment @@ -114,7 +114,7 @@ public partial interface IConfigurationProfileAssignmentsOperations /// Get list of configuration profile assignments /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -152,39 +152,5 @@ public partial interface IConfigurationProfileAssignmentsOperations /// Thrown when a required parameter is null /// Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates an association between a VM and Automanage configuration - /// profile - /// - /// - /// Name of the configuration profile assignment. Only default is - /// supported. - /// - /// - /// Parameters supplied to the create or update configuration profile - /// assignment. - /// - /// - /// The resource group name. - /// - /// - /// The name of the virtual machine. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string configurationProfileAssignmentName, ConfigurationProfileAssignment parameters, string resourceGroupName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilePreferencesOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesOperations.cs similarity index 65% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilePreferencesOperations.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesOperations.cs index 583cf07ae647..ae904c3e5f54 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilePreferencesOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesOperations.cs @@ -19,22 +19,21 @@ namespace Microsoft.Azure.Management.Automanage using System.Threading.Tasks; /// - /// ConfigurationProfilePreferencesOperations operations. + /// ConfigurationProfilesOperations operations. /// - public partial interface IConfigurationProfilePreferencesOperations + public partial interface IConfigurationProfilesOperations { /// - /// Creates a configuration profile preference + /// Creates a configuration profile /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile - /// preference. + /// Parameters supplied to create or update configuration profile. /// /// /// The headers that will be added to request. @@ -51,15 +50,15 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, ConfigurationProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get information about a configuration profile preference + /// Get information about a configuration profile /// - /// - /// The configuration profile preference name. + /// + /// The configuration profile name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -76,15 +75,15 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a configuration profile preference + /// Delete a configuration profile /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the configuration profile preference + /// + /// Name of the configuration profile /// /// /// The headers that will be added to request. @@ -98,19 +97,18 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfilePreferenceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates a configuration profile preference + /// Updates a configuration profile /// - /// - /// Name of the configuration profile preference. + /// + /// Name of the configuration profile. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update configuration profile - /// preference. + /// Parameters supplied to update configuration profile. /// /// /// The headers that will be added to request. @@ -127,13 +125,13 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string configurationProfilePreferenceName, string resourceGroupName, ConfigurationProfilePreference parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, ConfigurationProfileUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieve a list of configuration profile preferences within a given - /// resource group + /// Retrieve a list of configuration profile within a given resource + /// group /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -150,10 +148,9 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieve a list of configuration profile preferences within a - /// subscription + /// Retrieve a list of configuration profile within a subscription /// /// /// The headers that will be added to request. @@ -170,6 +167,6 @@ public partial interface IConfigurationProfilePreferencesOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAccountsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesVersionsOperations.cs similarity index 59% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAccountsOperations.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesVersionsOperations.cs index a3fbaf02dc02..dfe75794a78f 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IAccountsOperations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IConfigurationProfilesVersionsOperations.cs @@ -19,21 +19,24 @@ namespace Microsoft.Azure.Management.Automanage using System.Threading.Tasks; /// - /// AccountsOperations operations. + /// ConfigurationProfilesVersionsOperations operations. /// - public partial interface IAccountsOperations + public partial interface IConfigurationProfilesVersionsOperations { /// - /// Creates an Automanage Account + /// Creates a configuration profile version /// - /// - /// Name of the Automanage account. + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to create or update Automanage account. + /// Parameters supplied to create or update configuration profile. /// /// /// The headers that will be added to request. @@ -50,15 +53,18 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string accountName, string resourceGroupName, Account parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get information about a Automanage account + /// Get information about a configuration profile version /// - /// - /// The Automanage account name. + /// + /// The configuration profile name. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -75,15 +81,18 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string accountName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a Automanage account + /// Delete a configuration profile version /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the configuration profile /// - /// - /// Name of the Automanage account + /// + /// The configuration profile version name. /// /// /// The headers that will be added to request. @@ -97,18 +106,21 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string configurationProfileName, string versionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an Automanage Account + /// Updates a configuration profile version /// - /// - /// Name of the Automanage account. + /// + /// Name of the configuration profile. + /// + /// + /// The configuration profile version name. /// /// - /// The resource group name. + /// The name of the resource group. The name is case insensitive. /// /// - /// Parameters supplied to update Automanage account. + /// Parameters supplied to update configuration profile. /// /// /// The headers that will be added to request. @@ -125,33 +137,17 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string accountName, string resourceGroupName, Account parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string configurationProfileName, string versionName, string resourceGroupName, ConfigurationProfileUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Retrieve a list of Automanage accounts within a given resource - /// group + /// Retrieve a list of configuration profile version for a + /// configuration profile /// - /// - /// The resource group name. + /// + /// Name of the configuration profile. /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve a list of Automanage accounts within a subscription - /// /// /// The headers that will be added to request. /// @@ -167,6 +163,6 @@ public partial interface IAccountsOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListChildResourcesWithHttpMessagesAsync(string configurationProfileName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IReportsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IReportsOperations.cs new file mode 100644 index 000000000000..10748c06c6c2 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IReportsOperations.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReportsOperations operations. + /// + public partial interface IReportsOperations + { + /// + /// Get information about a report associated with a configuration + /// profile assignment run + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The report name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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 configurationProfileAssignmentName, string reportName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a list of reports within a given configuration profile + /// assignment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// 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>> ListByConfigurationProfileAssignmentsWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IServicePrincipalsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IServicePrincipalsOperations.cs new file mode 100644 index 000000000000..7a36778bb565 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/IServicePrincipalsOperations.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServicePrincipalsOperations operations. + /// + public partial interface IServicePrincipalsOperations + { + /// + /// Get the Automanage AAD first party Application Service Principal + /// details for the subscription id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the Automanage AAD first party Application Service Principal + /// details for the subscription id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Account.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Account.cs deleted file mode 100644 index faf5333d903b..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Account.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of the Automanage account. - /// - public partial class Account : TrackedResource - { - /// - /// Initializes a new instance of the Account class. - /// - public Account() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Account class. - /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. - /// Resource tags. - /// The identity of the Automanage - /// account. - public Account(string id = default(string), string name = default(string), string location = default(string), string type = default(string), IDictionary tags = default(IDictionary), AccountIdentity identity = default(AccountIdentity)) - : base(id, name, location, type, tags) - { - Identity = identity; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the identity of the Automanage account. - /// - [JsonProperty(PropertyName = "identity")] - public AccountIdentity Identity { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AccountIdentity.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AccountIdentity.cs deleted file mode 100644 index 7dc6ceec8406..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AccountIdentity.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Identity for the Automanage account. - /// - public partial class AccountIdentity - { - /// - /// Initializes a new instance of the AccountIdentity class. - /// - public AccountIdentity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AccountIdentity class. - /// - /// The principal id of Automanage account - /// identity. - /// The tenant id associated with the Automanage - /// account. - /// The type of identity used for the Automanage - /// account. Currently, the only supported type is 'SystemAssigned', - /// which implicitly creates an identity. Possible values include: - /// 'SystemAssigned', 'None' - public AccountIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) - { - PrincipalId = principalId; - TenantId = tenantId; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the principal id of Automanage account identity. - /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; private set; } - - /// - /// Gets the tenant id associated with the Automanage account. - /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; private set; } - - /// - /// Gets or sets the type of identity used for the Automanage account. - /// Currently, the only supported type is 'SystemAssigned', which - /// implicitly creates an identity. Possible values include: - /// 'SystemAssigned', 'None' - /// - [JsonProperty(PropertyName = "type")] - public ResourceIdentityType? Type { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ScanType.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ActionType.cs similarity index 74% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ScanType.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ActionType.cs index 402ef1096e3f..91e83a73b236 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ScanType.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ActionType.cs @@ -12,11 +12,10 @@ namespace Microsoft.Azure.Management.Automanage.Models { /// - /// Defines values for ScanType. + /// Defines values for ActionType. /// - public static class ScanType + public static class ActionType { - public const string Quick = "Quick"; - public const string Full = "Full"; + public const string Internal = "Internal"; } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AzureEntityResource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..f764ac441d41 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/BestPractice.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/BestPractice.cs new file mode 100644 index 000000000000..7f7cfcebc8a4 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/BestPractice.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Definition of the Automanage best practice. + /// + [Rest.Serialization.JsonTransformation] + public partial class BestPractice : IResource + { + /// + /// Initializes a new instance of the BestPractice class. + /// + public BestPractice() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BestPractice class. + /// + /// The fully qualified ID for the best practice. For + /// example, + /// /providers/Microsoft.Automanage/bestPractices/azureBestPracticesProduction + /// The type of the resource. For example, + /// Microsoft.Automanage/bestPractices + /// The name of the best practice. For example, + /// azureBestPracticesProduction + /// configuration + /// overrides + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public BestPractice(string id = default(string), string type = default(string), string name = default(string), object configuration = default(object), IList overrides = default(IList), SystemData systemData = default(SystemData)) + { + Id = id; + Type = type; + Name = name; + Configuration = configuration; + Overrides = overrides; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the best practice. For example, + /// /providers/Microsoft.Automanage/bestPractices/azureBestPracticesProduction + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Automanage/bestPractices + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the name of the best practice. For example, + /// azureBestPracticesProduction + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets configuration + /// + /// + /// configuration dictionary of the configuration profile. + /// + [JsonProperty(PropertyName = "properties.configuration")] + public object Configuration { get; set; } + + /// + /// Gets or sets overrides + /// + /// + /// overrides of the configuration profile. + /// + [JsonProperty(PropertyName = "properties.overrides")] + public IList Overrides { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfile.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfile.cs index e44616853159..95f2ee47a099 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfile.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfile.cs @@ -10,13 +10,75 @@ namespace Microsoft.Azure.Management.Automanage.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; /// - /// Defines values for ConfigurationProfile. + /// Definition of the configuration profile. /// - public static class ConfigurationProfile + public partial class ConfigurationProfile : TrackedResource { - public const string AzureBestPracticesTestDev = "Azure Best Practices - TestDev"; - public const string AzureBestPracticesProd = "Azure Best Practices - Prod"; + /// + /// Initializes a new instance of the ConfigurationProfile class. + /// + public ConfigurationProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigurationProfile class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Resource tags. + /// Properties of the configuration + /// profile. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ConfigurationProfile(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ConfigurationProfileProperties properties = default(ConfigurationProfileProperties), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the configuration profile. + /// + [JsonProperty(PropertyName = "properties")] + public ConfigurationProfileProperties Properties { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignment.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignment.cs index 29e4e04a13b2..5857677c76e6 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignment.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignment.cs @@ -32,17 +32,21 @@ public ConfigurationProfileAssignment() /// Initializes a new instance of the ConfigurationProfileAssignment /// class. /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Properties of the configuration profile /// assignment. - public ConfigurationProfileAssignment(string id = default(string), string name = default(string), string location = default(string), string type = default(string), ConfigurationProfileAssignmentProperties properties = default(ConfigurationProfileAssignmentProperties)) - : base(id, name, location, type) + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ConfigurationProfileAssignment(string id = default(string), string name = default(string), string type = default(string), ConfigurationProfileAssignmentProperties properties = default(ConfigurationProfileAssignmentProperties), SystemData systemData = default(SystemData)) + : base(id, name, type) { Properties = properties; + SystemData = systemData; CustomInit(); } @@ -57,5 +61,12 @@ public ConfigurationProfileAssignment() [JsonProperty(PropertyName = "properties")] public ConfigurationProfileAssignmentProperties Properties { get; set; } + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentCompliance.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentCompliance.cs deleted file mode 100644 index ce4b26bbc693..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentCompliance.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The compliance status for the configuration profile assignment. - /// - public partial class ConfigurationProfileAssignmentCompliance - { - /// - /// Initializes a new instance of the - /// ConfigurationProfileAssignmentCompliance class. - /// - public ConfigurationProfileAssignmentCompliance() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ConfigurationProfileAssignmentCompliance class. - /// - /// The state of compliance, which only - /// appears in the response. Possible values include: 'Succeeded', - /// 'Failed', 'Created' - public ConfigurationProfileAssignmentCompliance(string updateStatus = default(string)) - { - UpdateStatus = updateStatus; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the state of compliance, which only appears in the response. - /// Possible values include: 'Succeeded', 'Failed', 'Created' - /// - [JsonProperty(PropertyName = "updateStatus")] - public string UpdateStatus { get; private set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentProperties.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentProperties.cs index a1991d0ec909..c3909b65b4cf 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentProperties.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileAssignmentProperties.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Automanage.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -31,27 +33,19 @@ public ConfigurationProfileAssignmentProperties() /// Initializes a new instance of the /// ConfigurationProfileAssignmentProperties class. /// - /// A value indicating configuration - /// profile. Possible values include: 'Azure Best Practices - TestDev', - /// 'Azure Best Practices - Prod' + /// The Automanage + /// configurationProfile ARM Resource URI. /// The target VM resource URI - /// The Automanage account ARM Resource - /// URI - /// The configuration - /// profile custom preferences ARM resource URI - /// The state of onboarding, which - /// only appears in the response. Possible values include: 'Succeeded', - /// 'Failed', 'Created' - /// The configuration setting for the - /// configuration profile. - public ConfigurationProfileAssignmentProperties(string configurationProfile = default(string), string targetId = default(string), string accountId = default(string), string configurationProfilePreferenceId = default(string), string provisioningStatus = default(string), ConfigurationProfileAssignmentCompliance compliance = default(ConfigurationProfileAssignmentCompliance)) + /// The status of onboarding, which only appears + /// in the response. + /// The profileOverrides setting for the + /// configuration profile assignment. + public ConfigurationProfileAssignmentProperties(string configurationProfile = default(string), string targetId = default(string), string status = default(string), IDictionary profileOverrides = default(IDictionary)) { ConfigurationProfile = configurationProfile; TargetId = targetId; - AccountId = accountId; - ConfigurationProfilePreferenceId = configurationProfilePreferenceId; - ProvisioningStatus = provisioningStatus; - Compliance = compliance; + Status = status; + ProfileOverrides = profileOverrides; CustomInit(); } @@ -61,9 +55,7 @@ public ConfigurationProfileAssignmentProperties() partial void CustomInit(); /// - /// Gets or sets a value indicating configuration profile. Possible - /// values include: 'Azure Best Practices - TestDev', 'Azure Best - /// Practices - Prod' + /// Gets or sets the Automanage configurationProfile ARM Resource URI. /// [JsonProperty(PropertyName = "configurationProfile")] public string ConfigurationProfile { get; set; } @@ -75,31 +67,17 @@ public ConfigurationProfileAssignmentProperties() public string TargetId { get; set; } /// - /// Gets or sets the Automanage account ARM Resource URI + /// Gets the status of onboarding, which only appears in the response. /// - [JsonProperty(PropertyName = "accountId")] - public string AccountId { get; set; } + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } /// - /// Gets or sets the configuration profile custom preferences ARM - /// resource URI + /// Gets or sets the profileOverrides setting for the configuration + /// profile assignment. /// - [JsonProperty(PropertyName = "configurationProfilePreferenceId")] - public string ConfigurationProfilePreferenceId { get; set; } - - /// - /// Gets the state of onboarding, which only appears in the response. - /// Possible values include: 'Succeeded', 'Failed', 'Created' - /// - [JsonProperty(PropertyName = "provisioningStatus")] - public string ProvisioningStatus { get; private set; } - - /// - /// Gets or sets the configuration setting for the configuration - /// profile. - /// - [JsonProperty(PropertyName = "compliance")] - public ConfigurationProfileAssignmentCompliance Compliance { get; set; } + [JsonProperty(PropertyName = "profileOverrides")] + public IDictionary ProfileOverrides { get; set; } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceAntiMalware.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceAntiMalware.cs deleted file mode 100644 index 8875b4d641bd..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceAntiMalware.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Automanage configuration profile Antimalware preferences. - /// - public partial class ConfigurationProfilePreferenceAntiMalware - { - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceAntiMalware class. - /// - public ConfigurationProfilePreferenceAntiMalware() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceAntiMalware class. - /// - /// Enables or disables Real - /// Time Protection. Possible values include: 'True', 'False' - /// Extensions, Paths and Processes that must - /// be excluded from scan - /// Enables or disables a periodic scan - /// for antimalware. Possible values include: 'True', 'False' - /// Type of scheduled scan. Possible values - /// include: 'Quick', 'Full' - /// Schedule scan settings day - /// Schedule scan settings time - public ConfigurationProfilePreferenceAntiMalware(string enableRealTimeProtection = default(string), object exclusions = default(object), string runScheduledScan = default(string), string scanType = default(string), string scanDay = default(string), string scanTimeInMinutes = default(string)) - { - EnableRealTimeProtection = enableRealTimeProtection; - Exclusions = exclusions; - RunScheduledScan = runScheduledScan; - ScanType = scanType; - ScanDay = scanDay; - ScanTimeInMinutes = scanTimeInMinutes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets enables or disables Real Time Protection. Possible - /// values include: 'True', 'False' - /// - [JsonProperty(PropertyName = "enableRealTimeProtection")] - public string EnableRealTimeProtection { get; set; } - - /// - /// Gets or sets extensions, Paths and Processes that must be excluded - /// from scan - /// - [JsonProperty(PropertyName = "exclusions")] - public object Exclusions { get; set; } - - /// - /// Gets or sets enables or disables a periodic scan for antimalware. - /// Possible values include: 'True', 'False' - /// - [JsonProperty(PropertyName = "runScheduledScan")] - public string RunScheduledScan { get; set; } - - /// - /// Gets or sets type of scheduled scan. Possible values include: - /// 'Quick', 'Full' - /// - [JsonProperty(PropertyName = "scanType")] - public string ScanType { get; set; } - - /// - /// Gets or sets schedule scan settings day - /// - [JsonProperty(PropertyName = "scanDay")] - public string ScanDay { get; set; } - - /// - /// Gets or sets schedule scan settings time - /// - [JsonProperty(PropertyName = "scanTimeInMinutes")] - public string ScanTimeInMinutes { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceProperties.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceProperties.cs deleted file mode 100644 index 86314938bf14..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceProperties.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Automanage configuration profile preference properties. - /// - public partial class ConfigurationProfilePreferenceProperties - { - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceProperties class. - /// - public ConfigurationProfilePreferenceProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceProperties class. - /// - /// The custom preferences for Azure VM - /// Backup. - /// The custom preferences for Azure - /// Antimalware. - public ConfigurationProfilePreferenceProperties(ConfigurationProfilePreferenceVmBackup vmBackup = default(ConfigurationProfilePreferenceVmBackup), ConfigurationProfilePreferenceAntiMalware antiMalware = default(ConfigurationProfilePreferenceAntiMalware)) - { - VmBackup = vmBackup; - AntiMalware = antiMalware; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the custom preferences for Azure VM Backup. - /// - [JsonProperty(PropertyName = "vmBackup")] - public ConfigurationProfilePreferenceVmBackup VmBackup { get; set; } - - /// - /// Gets or sets the custom preferences for Azure Antimalware. - /// - [JsonProperty(PropertyName = "antiMalware")] - public ConfigurationProfilePreferenceAntiMalware AntiMalware { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceVmBackup.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceVmBackup.cs deleted file mode 100644 index e27200a8c493..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreferenceVmBackup.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Automanage configuration profile VM Backup preferences. - /// - public partial class ConfigurationProfilePreferenceVmBackup - { - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceVmBackup class. - /// - public ConfigurationProfilePreferenceVmBackup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ConfigurationProfilePreferenceVmBackup class. - /// - /// TimeZone optional input as string. For - /// example: Pacific Standard Time - /// Instant RP retention - /// policy range in days - /// Retention policy with the details on - /// backup copy retention ranges. - /// Backup schedule specified as part of - /// backup policy. - public ConfigurationProfilePreferenceVmBackup(string timeZone = default(string), int? instantRpRetentionRangeInDays = default(int?), string retentionPolicy = default(string), string schedulePolicy = default(string)) - { - TimeZone = timeZone; - InstantRpRetentionRangeInDays = instantRpRetentionRangeInDays; - RetentionPolicy = retentionPolicy; - SchedulePolicy = schedulePolicy; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets timeZone optional input as string. For example: - /// Pacific Standard Time - /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } - - /// - /// Gets or sets instant RP retention policy range in days - /// - [JsonProperty(PropertyName = "instantRpRetentionRangeInDays")] - public int? InstantRpRetentionRangeInDays { get; set; } - - /// - /// Gets or sets retention policy with the details on backup copy - /// retention ranges. - /// - [JsonProperty(PropertyName = "retentionPolicy")] - public string RetentionPolicy { get; set; } - - /// - /// Gets or sets backup schedule specified as part of backup policy. - /// - [JsonProperty(PropertyName = "schedulePolicy")] - public string SchedulePolicy { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs new file mode 100644 index 000000000000..cef5401af6c6 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileProperties.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Automanage configuration profile properties. + /// + public partial class ConfigurationProfileProperties + { + /// + /// Initializes a new instance of the ConfigurationProfileProperties + /// class. + /// + public ConfigurationProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigurationProfileProperties + /// class. + /// + /// configuration + /// overrides + public ConfigurationProfileProperties(object configuration = default(object), IList overrides = default(IList)) + { + Configuration = configuration; + Overrides = overrides; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets configuration + /// + /// + /// configuration dictionary of the configuration profile. + /// + [JsonProperty(PropertyName = "configuration")] + public object Configuration { get; set; } + + /// + /// Gets or sets overrides + /// + /// + /// overrides of the configuration profile. + /// + [JsonProperty(PropertyName = "overrides")] + public IList Overrides { get; set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreference.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileUpdate.cs similarity index 53% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreference.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileUpdate.cs index dc99520292c9..bb6df59f62dd 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfilePreference.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ConfigurationProfileUpdate.cs @@ -16,33 +16,26 @@ namespace Microsoft.Azure.Management.Automanage.Models using System.Linq; /// - /// Definition of the configuration profile preference. + /// Definition of the configuration profile. /// - public partial class ConfigurationProfilePreference : TrackedResource + public partial class ConfigurationProfileUpdate : UpdateResource { /// - /// Initializes a new instance of the ConfigurationProfilePreference - /// class. + /// Initializes a new instance of the ConfigurationProfileUpdate class. /// - public ConfigurationProfilePreference() + public ConfigurationProfileUpdate() { CustomInit(); } /// - /// Initializes a new instance of the ConfigurationProfilePreference - /// class. + /// Initializes a new instance of the ConfigurationProfileUpdate class. /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. - /// Resource tags. - /// Properties of the configuration profile - /// preference. - public ConfigurationProfilePreference(string id = default(string), string name = default(string), string location = default(string), string type = default(string), IDictionary tags = default(IDictionary), ConfigurationProfilePreferenceProperties properties = default(ConfigurationProfilePreferenceProperties)) - : base(id, name, location, type, tags) + /// The tags of the resource. + /// Properties of the configuration + /// profile. + public ConfigurationProfileUpdate(IDictionary tags = default(IDictionary), ConfigurationProfileProperties properties = default(ConfigurationProfileProperties)) + : base(tags) { Properties = properties; CustomInit(); @@ -54,10 +47,10 @@ public ConfigurationProfilePreference() partial void CustomInit(); /// - /// Gets or sets properties of the configuration profile preference. + /// Gets or sets properties of the configuration profile. /// [JsonProperty(PropertyName = "properties")] - public ConfigurationProfilePreferenceProperties Properties { get; set; } + public ConfigurationProfileProperties Properties { get; set; } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProvisioningStatus.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/CreatedByType.cs similarity index 61% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProvisioningStatus.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/CreatedByType.cs index 39e799c0d1c6..d96f19f7382c 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProvisioningStatus.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/CreatedByType.cs @@ -12,12 +12,13 @@ namespace Microsoft.Azure.Management.Automanage.Models { /// - /// Defines values for ProvisioningStatus. + /// Defines values for CreatedByType. /// - public static class ProvisioningStatus + public static class CreatedByType { - public const string Succeeded = "Succeeded"; - public const string Failed = "Failed"; - public const string Created = "Created"; + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..4f601ae52600 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorAdditionalInfo.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.Automanage.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorDetail.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..bf0e71949c63 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponse.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponse.cs index ca24e2ca8ae2..081fc1e3b8f2 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponse.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponse.cs @@ -14,8 +14,13 @@ namespace Microsoft.Azure.Management.Automanage.Models using System.Linq; /// - /// ARM error response body. + /// Error response /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// public partial class ErrorResponse { /// @@ -29,8 +34,8 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Details about the error. - public ErrorResponse(ErrorResponseBody error = default(ErrorResponseBody)) + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { Error = error; CustomInit(); @@ -42,10 +47,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets or sets details about the error. + /// Gets or sets the error object. /// [JsonProperty(PropertyName = "error")] - public ErrorResponseBody Error { get; set; } + public ErrorDetail Error { get; set; } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponseBody.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponseBody.cs deleted file mode 100644 index 3eee8cac5155..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ErrorResponseBody.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An error response from the Automanage service. - /// - public partial class ErrorResponseBody - { - /// - /// Initializes a new instance of the ErrorResponseBody class. - /// - public ErrorResponseBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponseBody class. - /// - /// An identifier for the error. Codes are invariant - /// and are intended to be consumed programmatically. - /// A message describing the error, intended to - /// be suitable for display in a user interface. - /// The target of the particular error. For - /// example, the name of the property in error. - public ErrorResponseBody(string code = default(string), string message = default(string), string target = default(string)) - { - Code = code; - Message = message; - Target = target; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an identifier for the error. Codes are invariant and - /// are intended to be consumed programmatically. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a message describing the error, intended to be - /// suitable for display in a user interface. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the target of the particular error. For example, the - /// name of the property in error. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Operation.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Operation.cs index 83e105f29360..3c1f9a0b235a 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Operation.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Operation.cs @@ -10,15 +10,16 @@ namespace Microsoft.Azure.Management.Automanage.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// - /// Automanage REST API operation + /// REST API Operation /// - [Rest.Serialization.JsonTransformation] + /// + /// Details of a REST API operation, returned from the Resource Provider + /// Operations API + /// public partial class Operation { /// @@ -32,21 +33,29 @@ public Operation() /// /// Initializes a new instance of the Operation class. /// - /// Operation name: For ex. - /// providers/Microsoft.Automanage/configurationProfileAssignments/write - /// or read - /// Indicates whether the operation is a - /// data action - /// Provider, Resource, Operation and description - /// values. - /// Service provider: - /// Microsoft.Automanage - public Operation(string name = default(string), string isDataAction = default(string), OperationDisplay display = default(OperationDisplay), string statusCode = default(string)) + /// The name of the operation, as per Resource-Based + /// Access Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// Whether the operation applies to + /// data-plane. This is "true" for data-plane operations and "false" + /// for ARM/control-plane operations. + /// Localized display information for this + /// particular operation. + /// The intended executor of the operation; as in + /// Resource Based Access Control (RBAC) and audit logs UX. Default + /// value is "user,system". Possible values include: 'user', 'system', + /// 'user,system' + /// Enum. Indicates the action type. + /// "Internal" refers to actions that are for internal only APIs. + /// Possible values include: 'Internal' + public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), string actionType = default(string)) { Name = name; IsDataAction = isDataAction; Display = display; - StatusCode = statusCode; + Origin = origin; + ActionType = actionType; CustomInit(); } @@ -56,30 +65,45 @@ public Operation() partial void CustomInit(); /// - /// Gets or sets operation name: For ex. - /// providers/Microsoft.Automanage/configurationProfileAssignments/write - /// or read + /// Gets the name of the operation, as per Resource-Based Access + /// Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" /// [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; private set; } /// - /// Gets or sets indicates whether the operation is a data action + /// Gets whether the operation applies to data-plane. This is "true" + /// for data-plane operations and "false" for ARM/control-plane + /// operations. /// [JsonProperty(PropertyName = "isDataAction")] - public string IsDataAction { get; set; } + public bool? IsDataAction { get; private set; } /// - /// Gets or sets provider, Resource, Operation and description values. + /// Gets or sets localized display information for this particular + /// operation. /// [JsonProperty(PropertyName = "display")] public OperationDisplay Display { get; set; } /// - /// Gets or sets service provider: Microsoft.Automanage + /// Gets the intended executor of the operation; as in Resource Based + /// Access Control (RBAC) and audit logs UX. Default value is + /// "user,system". Possible values include: 'user', 'system', + /// 'user,system' /// - [JsonProperty(PropertyName = "properties.statusCode")] - public string StatusCode { get; set; } + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets enum. Indicates the action type. "Internal" refers to actions + /// that are for internal only APIs. Possible values include: + /// 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; private set; } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/OperationDisplay.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/OperationDisplay.cs index de8fbc510b94..275f939860c5 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/OperationDisplay.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/OperationDisplay.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Automanage.Models using System.Linq; /// - /// Provider, Resource, Operation and description values. + /// Localized display information for this particular operation. /// public partial class OperationDisplay { @@ -29,13 +29,18 @@ public OperationDisplay() /// /// Initializes a new instance of the OperationDisplay class. /// - /// Service provider: - /// Microsoft.Automanage - /// Resource on which the operation is - /// performed: For ex. - /// Operation type: Read, write, delete, - /// etc. - /// Description about operation. + /// The localized friendly form of the resource + /// provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + /// Compute". + /// The localized friendly name of the resource + /// type related to this operation. E.g. "Virtual Machines" or "Job + /// Schedule Collections". + /// The concise, localized friendly name for + /// the operation; suitable for dropdowns. E.g. "Create or Update + /// Virtual Machine", "Restart Virtual Machine". + /// The short, localized friendly description + /// of the operation; suitable for tool tips and detailed + /// views. public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) { Provider = provider; @@ -51,28 +56,34 @@ public OperationDisplay() partial void CustomInit(); /// - /// Gets or sets service provider: Microsoft.Automanage + /// Gets the localized friendly form of the resource provider name, + /// e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". /// [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } + public string Provider { get; private set; } /// - /// Gets or sets resource on which the operation is performed: For ex. + /// Gets the localized friendly name of the resource type related to + /// this operation. E.g. "Virtual Machines" or "Job Schedule + /// Collections". /// [JsonProperty(PropertyName = "resource")] - public string Resource { get; set; } + public string Resource { get; private set; } /// - /// Gets or sets operation type: Read, write, delete, etc. + /// Gets the concise, localized friendly name for the operation; + /// suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". /// [JsonProperty(PropertyName = "operation")] - public string Operation { get; set; } + public string Operation { get; private set; } /// - /// Gets or sets description about operation. + /// Gets the short, localized friendly description of the operation; + /// suitable for tool tips and detailed views. /// [JsonProperty(PropertyName = "description")] - public string Description { get; set; } + public string Description { get; private set; } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/EnableRealTimeProtection.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Origin.cs similarity index 68% rename from sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/EnableRealTimeProtection.cs rename to sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Origin.cs index 8e6a85bd3186..6b4e57de5459 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/EnableRealTimeProtection.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Origin.cs @@ -12,11 +12,12 @@ namespace Microsoft.Azure.Management.Automanage.Models { /// - /// Defines values for EnableRealTimeProtection. + /// Defines values for Origin. /// - public static class EnableRealTimeProtection + public static class Origin { - public const string True = "True"; - public const string False = "False"; + public const string User = "user"; + public const string System = "system"; + public const string Usersystem = "user,system"; } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProxyResource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProxyResource.cs index 93b7529e80ca..b89f18a98138 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProxyResource.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ProxyResource.cs @@ -13,8 +13,12 @@ namespace Microsoft.Azure.Management.Automanage.Models using System.Linq; /// - /// ARM proxy resource. + /// Proxy Resource /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// public partial class ProxyResource : Resource { /// @@ -28,13 +32,14 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. - public ProxyResource(string id = default(string), string name = default(string), string location = default(string), string type = default(string)) - : base(id, name, location, type) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) { CustomInit(); } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Report.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Report.cs new file mode 100644 index 000000000000..ed7848588edd --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Report.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Definition of the report. + /// + [Rest.Serialization.JsonTransformation] + public partial class Report : ProxyResource + { + /// + /// Initializes a new instance of the Report class. + /// + public Report() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Report class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Start time of the configuration profile + /// assignment processing. + /// End time of the configuration profile + /// assignment processing. + /// Last modified time of the + /// configuration profile assignment processing. + /// Duration of the configuration profile + /// assignment processing. + /// Type of the configuration profile + /// assignment processing (Initial/Consistency). + /// The status of the configuration profile + /// assignment. + /// The configurationProfile linked + /// to the assignment. + /// List of resources processed by the + /// configuration profile assignment. + /// Error message, if any, returned by the + /// configuration profile assignment processing. + /// Version of the report + /// format + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Report(string id = default(string), string name = default(string), string type = default(string), string startTime = default(string), string endTime = default(string), string lastModifiedTime = default(string), string duration = default(string), string reportType = default(string), string status = default(string), string configurationProfile = default(string), IList resources = default(IList), ErrorDetail error = default(ErrorDetail), string reportFormatVersion = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + StartTime = startTime; + EndTime = endTime; + LastModifiedTime = lastModifiedTime; + Duration = duration; + ReportType = reportType; + Status = status; + ConfigurationProfile = configurationProfile; + Resources = resources; + Error = error; + ReportFormatVersion = reportFormatVersion; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets start time of the configuration profile assignment + /// processing. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets end time of the configuration profile assignment + /// processing. + /// + [JsonProperty(PropertyName = "properties.endTime")] + public string EndTime { get; set; } + + /// + /// Gets last modified time of the configuration profile assignment + /// processing. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public string LastModifiedTime { get; private set; } + + /// + /// Gets duration of the configuration profile assignment processing. + /// + [JsonProperty(PropertyName = "properties.duration")] + public string Duration { get; private set; } + + /// + /// Gets type of the configuration profile assignment processing + /// (Initial/Consistency). + /// + [JsonProperty(PropertyName = "properties.type")] + public string ReportType { get; private set; } + + /// + /// Gets the status of the configuration profile assignment. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the configurationProfile linked to the assignment. + /// + [JsonProperty(PropertyName = "properties.configurationProfile")] + public string ConfigurationProfile { get; private set; } + + /// + /// Gets list of resources processed by the configuration profile + /// assignment. + /// + [JsonProperty(PropertyName = "properties.resources")] + public IList Resources { get; private set; } + + /// + /// Gets error message, if any, returned by the configuration profile + /// assignment processing. + /// + [JsonProperty(PropertyName = "properties.error")] + public ErrorDetail Error { get; private set; } + + /// + /// Gets version of the report format + /// + [JsonProperty(PropertyName = "properties.reportFormatVersion")] + public string ReportFormatVersion { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ReportResource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ReportResource.cs new file mode 100644 index 000000000000..6b38fa9ec653 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ReportResource.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details about the resource processed by the configuration profile + /// assignment + /// + public partial class ReportResource + { + /// + /// Initializes a new instance of the ReportResource class. + /// + public ReportResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportResource class. + /// + /// Name of the resource. + /// ARM id of the resource. + /// Type of the resource. + /// Status of the resource. + /// Error message, if any, returned when deploying + /// the resource. + public ReportResource(string name = default(string), string id = default(string), string type = default(string), string status = default(string), ErrorDetail error = default(ErrorDetail)) + { + Name = name; + Id = id; + Type = type; + Status = status; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets ARM id of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets status of the resource. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets error message, if any, returned when deploying the resource. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Resource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Resource.cs index 35f3ef7e94db..58fa3937a1a0 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Resource.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/Resource.cs @@ -16,8 +16,12 @@ namespace Microsoft.Azure.Management.Automanage.Models using System.Linq; /// - /// The core properties of ARM resources + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -31,16 +35,16 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. - public Resource(string id = default(string), string name = default(string), string location = default(string), string type = default(string)) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; Name = name; - Location = location; Type = type; CustomInit(); } @@ -51,25 +55,22 @@ public Resource() partial void CustomInit(); /// - /// Gets ARM resource id of the Automanage assignment. + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets name of the Automanage assignment. + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets region where the VM is located. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the type of the resource. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ResourceIdentityType.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ResourceIdentityType.cs deleted file mode 100644 index 3d1ae4491aa1..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ResourceIdentityType.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ResourceIdentityType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ResourceIdentityType - { - [EnumMember(Value = "SystemAssigned")] - SystemAssigned, - [EnumMember(Value = "None")] - None - } - internal static class ResourceIdentityTypeEnumExtension - { - internal static string ToSerializedValue(this ResourceIdentityType? value) - { - return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ResourceIdentityType value) - { - switch( value ) - { - case ResourceIdentityType.SystemAssigned: - return "SystemAssigned"; - case ResourceIdentityType.None: - return "None"; - } - return null; - } - - internal static ResourceIdentityType? ParseResourceIdentityType(this string value) - { - switch( value ) - { - case "SystemAssigned": - return ResourceIdentityType.SystemAssigned; - case "None": - return ResourceIdentityType.None; - } - return null; - } - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/RunScheduledScan.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/RunScheduledScan.cs deleted file mode 100644 index 08e058eccbd5..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/RunScheduledScan.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - - /// - /// Defines values for RunScheduledScan. - /// - public static class RunScheduledScan - { - public const string True = "True"; - public const string False = "False"; - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ServicePrincipal.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ServicePrincipal.cs new file mode 100644 index 000000000000..8295cd9ac52c --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/ServicePrincipal.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Service Principal Id for the subscription. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServicePrincipal : ProxyResource + { + /// + /// Initializes a new instance of the ServicePrincipal class. + /// + public ServicePrincipal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipal class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The Service Principal Id for the + /// subscription. + /// Returns the contributor RBAC Role + /// exist or not for the Service Principal Id. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ServicePrincipal(string id = default(string), string name = default(string), string type = default(string), string servicePrincipalId = default(string), bool? authorizationSet = default(bool?), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + ServicePrincipalId = servicePrincipalId; + AuthorizationSet = authorizationSet; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Service Principal Id for the subscription. + /// + [JsonProperty(PropertyName = "properties.servicePrincipalId")] + public string ServicePrincipalId { get; private set; } + + /// + /// Gets returns the contributor RBAC Role exist or not for the Service + /// Principal Id. + /// + [JsonProperty(PropertyName = "properties.authorizationSet")] + public bool? AuthorizationSet { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/SystemData.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..6d3226997536 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/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.Automanage.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.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + 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.DateTime? 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.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/TrackedResource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/TrackedResource.cs index 2a109511571d..bc2bca24d38c 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/TrackedResource.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/TrackedResource.cs @@ -10,14 +10,19 @@ namespace Microsoft.Azure.Management.Automanage.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// The resource model definition for a ARM tracked top level resource + /// Tracked Resource /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// public partial class TrackedResource : Resource { /// @@ -31,16 +36,20 @@ public TrackedResource() /// /// Initializes a new instance of the TrackedResource class. /// - /// ARM resource id of the Automanage - /// assignment. - /// Name of the Automanage assignment. - /// Region where the VM is located. - /// The type of the resource. + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. - public TrackedResource(string id = default(string), string name = default(string), string location = default(string), string type = default(string), IDictionary tags = default(IDictionary)) - : base(id, name, location, type) + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) { Tags = tags; + Location = location; CustomInit(); } @@ -55,5 +64,24 @@ public TrackedResource() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } } } diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateResource.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateResource.cs new file mode 100644 index 000000000000..adf42729c36c --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateResource.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an update resource + /// + public partial class UpdateResource + { + /// + /// Initializes a new instance of the UpdateResource class. + /// + public UpdateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateResource class. + /// + /// The tags of the resource. + public UpdateResource(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tags of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateStatus.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateStatus.cs deleted file mode 100644 index a57d4d77bf46..000000000000 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Models/UpdateStatus.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Automanage.Models -{ - - /// - /// Defines values for UpdateStatus. - /// - public static class UpdateStatus - { - public const string Succeeded = "Succeeded"; - public const string Failed = "Failed"; - public const string Created = "Created"; - } -} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Operations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Operations.cs index 3e2db2f56cc3..faec19de81c4 100644 --- a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Operations.cs +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/Operations.cs @@ -80,6 +80,13 @@ internal Operations(AutomanageClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperations.cs new file mode 100644 index 000000000000..158644c5bb1d --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperations.cs @@ -0,0 +1,514 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + 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; + + /// + /// ReportsOperations operations. + /// + internal partial class ReportsOperations : IServiceOperations, IReportsOperations + { + /// + /// Initializes a new instance of the ReportsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ReportsOperations(AutomanageClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomanageClient + /// + public AutomanageClient Client { get; private set; } + + /// + /// Get information about a report associated with a configuration profile + /// assignment run + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The report name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 configurationProfileAssignmentName, string reportName, string vmName, 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 (configurationProfileAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); + } + if (reportName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "reportName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); + tracingParameters.Add("reportName", reportName); + tracingParameters.Add("vmName", vmName); + 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.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{configurationProfileAssignmentName}", System.Uri.EscapeDataString(configurationProfileAssignmentName)); + _url = _url.Replace("{reportName}", System.Uri.EscapeDataString(reportName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve a list of reports within a given configuration profile assignment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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>> ListByConfigurationProfileAssignmentsWithHttpMessagesAsync(string resourceGroupName, string configurationProfileAssignmentName, string vmName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (configurationProfileAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationProfileAssignmentName"); + } + if (vmName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("configurationProfileAssignmentName", configurationProfileAssignmentName); + tracingParameters.Add("vmName", vmName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByConfigurationProfileAssignments", 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.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{configurationProfileAssignmentName}", System.Uri.EscapeDataString(configurationProfileAssignmentName)); + _url = _url.Replace("{vmName}", System.Uri.EscapeDataString(vmName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperationsExtensions.cs new file mode 100644 index 000000000000..56cfb5bfa166 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ReportsOperationsExtensions.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReportsOperations. + /// + public static partial class ReportsOperationsExtensions + { + /// + /// Get information about a report associated with a configuration profile + /// assignment run + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The report name. + /// + /// + /// The name of the virtual machine. + /// + public static Report Get(this IReportsOperations operations, string resourceGroupName, string configurationProfileAssignmentName, string reportName, string vmName) + { + return operations.GetAsync(resourceGroupName, configurationProfileAssignmentName, reportName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Get information about a report associated with a configuration profile + /// assignment run + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The report name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IReportsOperations operations, string resourceGroupName, string configurationProfileAssignmentName, string reportName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, configurationProfileAssignmentName, reportName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve a list of reports within a given configuration profile assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The name of the virtual machine. + /// + public static IEnumerable ListByConfigurationProfileAssignments(this IReportsOperations operations, string resourceGroupName, string configurationProfileAssignmentName, string vmName) + { + return operations.ListByConfigurationProfileAssignmentsAsync(resourceGroupName, configurationProfileAssignmentName, vmName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a list of reports within a given configuration profile assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The configuration profile assignment name. + /// + /// + /// The name of the virtual machine. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByConfigurationProfileAssignmentsAsync(this IReportsOperations operations, string resourceGroupName, string configurationProfileAssignmentName, string vmName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByConfigurationProfileAssignmentsWithHttpMessagesAsync(resourceGroupName, configurationProfileAssignmentName, vmName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/SdkInfo_AutomanageClient.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/SdkInfo_AutomanageClient.cs new file mode 100644 index 000000000000..ef6836cb5e0f --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/SdkInfo_AutomanageClient.cs @@ -0,0 +1,35 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AutomanageClient + { + get + { + return new Tuple[] + { + new Tuple("Automanage", "BestPractices", "2021-04-30-preview"), + new Tuple("Automanage", "BestPracticesVersions", "2021-04-30-preview"), + new Tuple("Automanage", "ConfigurationProfileAssignments", "2021-04-30-preview"), + new Tuple("Automanage", "ConfigurationProfiles", "2021-04-30-preview"), + new Tuple("Automanage", "ConfigurationProfilesVersions", "2021-04-30-preview"), + new Tuple("Automanage", "Operations", "2021-04-30-preview"), + new Tuple("Automanage", "ServicePrincipals", "2021-04-30-preview"), + new Tuple("Compute", "ConfigurationProfileAssignments", "2021-04-30-preview"), + new Tuple("Compute", "reports", "2021-04-30-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperations.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperations.cs new file mode 100644 index 000000000000..417994075153 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperations.cs @@ -0,0 +1,430 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + 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; + + /// + /// ServicePrincipalsOperations operations. + /// + internal partial class ServicePrincipalsOperations : IServiceOperations, IServicePrincipalsOperations + { + /// + /// Initializes a new instance of the ServicePrincipalsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServicePrincipalsOperations(AutomanageClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AutomanageClient + /// + public AutomanageClient Client { get; private set; } + + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperationsExtensions.cs b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperationsExtensions.cs new file mode 100644 index 000000000000..e97c7e467db9 --- /dev/null +++ b/sdk/automanage/Microsoft.Azure.Management.Automanage/src/Generated/ServicePrincipalsOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Automanage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServicePrincipalsOperations. + /// + public static partial class ServicePrincipalsOperationsExtensions + { + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListBySubscription(this IServicePrincipalsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IServicePrincipalsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// The operations group for this extension method. + /// + public static ServicePrincipal Get(this IServicePrincipalsOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the Automanage AAD first party Application Service Principal details + /// for the subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServicePrincipalsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}