diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperations.cs new file mode 100644 index 0000000000000..1ad091da5a241 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperations.cs @@ -0,0 +1,400 @@ +// +// 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.DomainServices +{ + 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; + + /// + /// DomainServiceOperations operations. + /// + internal partial class DomainServiceOperations : IServiceOperations, IDomainServiceOperations + { + /// + /// Initializes a new instance of the DomainServiceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DomainServiceOperations(DomainServicesResourceProviderClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DomainServicesResourceProviderClient + /// + public DomainServicesResourceProviderClient Client { get; private set; } + + /// + /// Lists all the available Domain Services operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.AAD/operations").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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperationsExtensions.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperationsExtensions.cs new file mode 100644 index 0000000000000..93bbe2bba9893 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServiceOperationsExtensions.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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DomainServiceOperations. + /// + public static partial class DomainServiceOperationsExtensions + { + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDomainServiceOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDomainServiceOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDomainServiceOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDomainServiceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperations.cs new file mode 100644 index 0000000000000..879de455838cc --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperations.cs @@ -0,0 +1,1815 @@ +// +// 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.DomainServices +{ + 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; + + /// + /// DomainServicesOperations operations. + /// + internal partial class DomainServicesOperations : IServiceOperations, IDomainServicesOperations + { + /// + /// Initializes a new instance of the DomainServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DomainServicesOperations(DomainServicesResourceProviderClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DomainServicesResourceProviderClient + /// + public DomainServicesResourceProviderClient Client { get; private set; } + + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AAD/domainServices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + // 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.AAD/domainServices").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) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Domain Service + /// + /// + /// The Get Domain Service operation retrieves a json representation of the + /// Domain Service. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// 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 domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + 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.AAD/domainServices/{domainServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (domainService == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainService"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("domainService", domainService); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.AAD/domainServices/{domainServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + 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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(domainService != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(domainService, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.AAD/domainServices/{domainServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (domainService == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainService"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("domainService", domainService); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.AAD/domainServices/{domainServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(domainService != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(domainService, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that subscription). + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperationsExtensions.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..fb795254d204d --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesOperationsExtensions.cs @@ -0,0 +1,569 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DomainServicesOperations. + /// + public static partial class DomainServicesOperationsExtensions + { + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that subscription). + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDomainServicesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that subscription). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDomainServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + public static IPage ListByResourceGroup(this IDomainServicesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDomainServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + public static DomainService CreateOrUpdate(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService) + { + return operations.CreateOrUpdateAsync(resourceGroupName, domainServiceName, domainService).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get Domain Service + /// + /// + /// The Get Domain Service operation retrieves a json representation of the + /// Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + public static DomainService Get(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName) + { + return operations.GetAsync(resourceGroupName, domainServiceName).GetAwaiter().GetResult(); + } + + /// + /// Get Domain Service + /// + /// + /// The Get Domain Service operation retrieves a json representation of the + /// Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, domainServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + public static void Delete(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName) + { + operations.DeleteAsync(resourceGroupName, domainServiceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + public static DomainService Update(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService) + { + return operations.UpdateAsync(resourceGroupName, domainServiceName, domainService).GetAwaiter().GetResult(); + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + public static DomainService BeginCreateOrUpdate(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, domainServiceName, domainService).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service with the + /// specified parameters. If the specific service already exists, then any + /// patchable properties will be updated and any immutable properties will + /// remain unchanged. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + public static void BeginDelete(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName) + { + operations.BeginDeleteAsync(resourceGroupName, domainServiceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + public static DomainService BeginUpdate(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService) + { + return operations.BeginUpdateAsync(resourceGroupName, domainServiceName, domainService).GetAwaiter().GetResult(); + } + + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the existing + /// deployment. The update call only supports the properties listed in the + /// PATCH body. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDomainServicesOperations operations, string resourceGroupName, string domainServiceName, DomainService domainService, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, domainService, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that subscription). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDomainServicesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the domain + /// services available under the given subscription (and across all resource + /// groups within that subscription). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDomainServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDomainServicesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the domain + /// services available under the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDomainServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesResourceProviderClient.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesResourceProviderClient.cs new file mode 100644 index 0000000000000..eeeae2ed23a00 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/DomainServicesResourceProviderClient.cs @@ -0,0 +1,380 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// The AAD Domain Services API. + /// + public partial class DomainServicesResourceProviderClient : ServiceClient, IDomainServicesResourceProviderClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets subscription credentials which uniquely identify the Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + public string SubscriptionId { get; set; } + + /// + /// Client Api Version. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IDomainServiceOperations. + /// + public virtual IDomainServiceOperations DomainServiceOperations { get; private set; } + + /// + /// Gets the IDomainServicesOperations. + /// + public virtual IDomainServicesOperations DomainServices { get; private set; } + + /// + /// Gets the IOuContainerOperations. + /// + public virtual IOuContainerOperations OuContainerOperations { get; private set; } + + /// + /// Gets the IOuContainerOperationsOperations. + /// + public virtual IOuContainerOperationsOperations OuContainer { get; private set; } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DomainServicesResourceProviderClient.Dispose(). False: will not dispose provided httpClient + protected DomainServicesResourceProviderClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DomainServicesResourceProviderClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DomainServicesResourceProviderClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DomainServicesResourceProviderClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DomainServicesResourceProviderClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DomainServicesResourceProviderClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DomainServicesResourceProviderClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public DomainServicesResourceProviderClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DomainServicesResourceProviderClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DomainServicesResourceProviderClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DomainServicesResourceProviderClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DomainServicesResourceProviderClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + DomainServiceOperations = new DomainServiceOperations(this); + DomainServices = new DomainServicesOperations(this); + OuContainerOperations = new OuContainerOperations(this); + OuContainer = new OuContainerOperationsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-05-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServiceOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServiceOperations.cs new file mode 100644 index 0000000000000..c1a765c1ee16d --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServiceOperations.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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DomainServiceOperations operations. + /// + public partial interface IDomainServiceOperations + { + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available Domain Services operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesOperations.cs new file mode 100644 index 0000000000000..52679ba3f1570 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesOperations.cs @@ -0,0 +1,355 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DomainServicesOperations operations. + /// + public partial interface IDomainServicesOperations + { + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the + /// domain services available under the given subscription (and across + /// all resource groups within that subscription). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the + /// domain services available under the given resource group. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service + /// with the specified parameters. If the specific service already + /// exists, then any patchable properties will be updated and any + /// immutable properties will remain unchanged. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Domain Service + /// + /// + /// The Get Domain Service operation retrieves a json representation of + /// the Domain Service. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// 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 domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain + /// Service. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the + /// existing deployment. The update call only supports the properties + /// listed in the PATCH body. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update Domain Service (PUT Resource) + /// + /// + /// The Create Domain Service operation creates a new domain service + /// with the specified parameters. If the specific service already + /// exists, then any patchable properties will be updated and any + /// immutable properties will remain unchanged. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Create or Update a Domain Service + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Domain Service (DELETE Resource) + /// + /// + /// The Delete Domain Service operation deletes an existing Domain + /// Service. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Domain Service (PATCH Resource) + /// + /// + /// The Update Domain Service operation can be used to update the + /// existing deployment. The update call only supports the properties + /// listed in the PATCH body. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Properties supplied to the Update a Domain Service operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, DomainService domainService, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Domain Services in Subscription + /// + /// + /// The List Domain Services in Subscription operation lists all the + /// domain services available under the given subscription (and across + /// all resource groups within that subscription). + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Domain Services in Resource Group + /// + /// + /// The List Domain Services in Resource Group operation lists all the + /// domain services available under the given resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesResourceProviderClient.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesResourceProviderClient.cs new file mode 100644 index 0000000000000..4640644896557 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IDomainServicesResourceProviderClient.cs @@ -0,0 +1,95 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// The AAD Domain Services API. + /// + public partial interface IDomainServicesResourceProviderClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Gets subscription credentials which uniquely identify the Microsoft + /// Azure subscription. The subscription ID forms part of the URI for + /// every service call. + /// + string SubscriptionId { get; set; } + + /// + /// Client Api Version. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IDomainServiceOperations. + /// + IDomainServiceOperations DomainServiceOperations { get; } + + /// + /// Gets the IDomainServicesOperations. + /// + IDomainServicesOperations DomainServices { get; } + + /// + /// Gets the IOuContainerOperations. + /// + IOuContainerOperations OuContainerOperations { get; } + + /// + /// Gets the IOuContainerOperationsOperations. + /// + IOuContainerOperationsOperations OuContainer { get; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperations.cs new file mode 100644 index 0000000000000..2fcf92ded98c9 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperations.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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OuContainerOperations operations. + /// + public partial interface IOuContainerOperations + { + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperationsOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperationsOperations.cs new file mode 100644 index 0000000000000..9cb25c1894f2d --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/IOuContainerOperationsOperations.cs @@ -0,0 +1,315 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OuContainerOperationsOperations operations. + /// + public partial interface IOuContainerOperationsOperations + { + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get particular OuContainer in DomainService instance + /// + /// + /// Get OuContainer in DomainService instance. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// 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 domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under + /// the specified Domain Service instance. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under + /// the specified Domain Service instance. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnostics.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnostics.cs new file mode 100644 index 0000000000000..28ca5c2435cfe --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnostics.cs @@ -0,0 +1,66 @@ +// +// 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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Configuration Diagnostics + /// + public partial class ConfigDiagnostics + { + /// + /// Initializes a new instance of the ConfigDiagnostics class. + /// + public ConfigDiagnostics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigDiagnostics class. + /// + /// Last domain configuration diagnostics + /// DateTime + /// List of Configuration Diagnostics + /// validator results. + public ConfigDiagnostics(System.DateTime? lastExecuted = default(System.DateTime?), IList validatorResults = default(IList)) + { + LastExecuted = lastExecuted; + ValidatorResults = validatorResults; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last domain configuration diagnostics DateTime + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "lastExecuted")] + public System.DateTime? LastExecuted { get; set; } + + /// + /// Gets or sets list of Configuration Diagnostics validator results. + /// + [JsonProperty(PropertyName = "validatorResults")] + public IList ValidatorResults { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResult.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResult.cs new file mode 100644 index 0000000000000..c0b1274ae6740 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResult.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Config Diagnostics validator result data + /// + public partial class ConfigDiagnosticsValidatorResult + { + /// + /// Initializes a new instance of the ConfigDiagnosticsValidatorResult + /// class. + /// + public ConfigDiagnosticsValidatorResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigDiagnosticsValidatorResult + /// class. + /// + /// Validator identifier + /// Replica set location and + /// subnet name + /// Status for individual validator after running + /// diagnostics. Possible values include: 'None', 'Running', 'OK', + /// 'Failure', 'Warning', 'Skipped' + /// List of resource config validation + /// issues. + public ConfigDiagnosticsValidatorResult(string validatorId = default(string), string replicaSetSubnetDisplayName = default(string), string status = default(string), IList issues = default(IList)) + { + ValidatorId = validatorId; + ReplicaSetSubnetDisplayName = replicaSetSubnetDisplayName; + Status = status; + Issues = issues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets validator identifier + /// + [JsonProperty(PropertyName = "validatorId")] + public string ValidatorId { get; set; } + + /// + /// Gets or sets replica set location and subnet name + /// + [JsonProperty(PropertyName = "replicaSetSubnetDisplayName")] + public string ReplicaSetSubnetDisplayName { get; set; } + + /// + /// Gets or sets status for individual validator after running + /// diagnostics. Possible values include: 'None', 'Running', 'OK', + /// 'Failure', 'Warning', 'Skipped' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets list of resource config validation issues. + /// + [JsonProperty(PropertyName = "issues")] + public IList Issues { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResultIssue.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResultIssue.cs new file mode 100644 index 0000000000000..edf920fd7ed73 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ConfigDiagnosticsValidatorResultIssue.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specific issue for a particular config diagnostics validator + /// + public partial class ConfigDiagnosticsValidatorResultIssue + { + /// + /// Initializes a new instance of the + /// ConfigDiagnosticsValidatorResultIssue class. + /// + public ConfigDiagnosticsValidatorResultIssue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ConfigDiagnosticsValidatorResultIssue class. + /// + /// Validation issue identifier. + /// List of domain resource property + /// name or values used to compose a rich description. + public ConfigDiagnosticsValidatorResultIssue(string id = default(string), IList descriptionParams = default(IList)) + { + Id = id; + DescriptionParams = descriptionParams; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets validation issue identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets list of domain resource property name or values used + /// to compose a rich description. + /// + [JsonProperty(PropertyName = "descriptionParams")] + public IList DescriptionParams { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ContainerAccount.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ContainerAccount.cs new file mode 100644 index 0000000000000..7c992e8aef5ef --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ContainerAccount.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Container Account Description + /// + public partial class ContainerAccount + { + /// + /// Initializes a new instance of the ContainerAccount class. + /// + public ContainerAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerAccount class. + /// + /// The account name + /// The account spn + /// The account password + public ContainerAccount(string accountName = default(string), string spn = default(string), string password = default(string)) + { + AccountName = accountName; + Spn = spn; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the account name + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets the account spn + /// + [JsonProperty(PropertyName = "spn")] + public string Spn { get; set; } + + /// + /// Gets or sets the account password + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/CreatedByType.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..328137a2736b9 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainSecuritySettings.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainSecuritySettings.cs new file mode 100644 index 0000000000000..7208bbe03cee6 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainSecuritySettings.cs @@ -0,0 +1,124 @@ +// +// 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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Domain Security Settings + /// + public partial class DomainSecuritySettings + { + /// + /// Initializes a new instance of the DomainSecuritySettings class. + /// + public DomainSecuritySettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DomainSecuritySettings class. + /// + /// A flag to determine whether or not NtlmV1 is + /// enabled or disabled. Possible values include: 'Enabled', + /// 'Disabled' + /// A flag to determine whether or not TlsV1 is + /// enabled or disabled. Possible values include: 'Enabled', + /// 'Disabled' + /// A flag to determine whether or not + /// SyncNtlmPasswords is enabled or disabled. Possible values include: + /// 'Enabled', 'Disabled' + /// A flag to determine whether or + /// not SyncKerberosPasswords is enabled or disabled. Possible values + /// include: 'Enabled', 'Disabled' + /// A flag to determine whether or + /// not SyncOnPremPasswords is enabled or disabled. Possible values + /// include: 'Enabled', 'Disabled' + /// A flag to determine whether or + /// not KerberosRc4Encryption is enabled or disabled. Possible values + /// include: 'Enabled', 'Disabled' + /// A flag to determine whether or not + /// KerberosArmoring is enabled or disabled. Possible values include: + /// 'Enabled', 'Disabled' + public DomainSecuritySettings(string ntlmV1 = default(string), string tlsV1 = default(string), string syncNtlmPasswords = default(string), string syncKerberosPasswords = default(string), string syncOnPremPasswords = default(string), string kerberosRc4Encryption = default(string), string kerberosArmoring = default(string)) + { + NtlmV1 = ntlmV1; + TlsV1 = tlsV1; + SyncNtlmPasswords = syncNtlmPasswords; + SyncKerberosPasswords = syncKerberosPasswords; + SyncOnPremPasswords = syncOnPremPasswords; + KerberosRc4Encryption = kerberosRc4Encryption; + KerberosArmoring = kerberosArmoring; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a flag to determine whether or not NtlmV1 is enabled + /// or disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "ntlmV1")] + public string NtlmV1 { get; set; } + + /// + /// Gets or sets a flag to determine whether or not TlsV1 is enabled or + /// disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "tlsV1")] + public string TlsV1 { get; set; } + + /// + /// Gets or sets a flag to determine whether or not SyncNtlmPasswords + /// is enabled or disabled. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "syncNtlmPasswords")] + public string SyncNtlmPasswords { get; set; } + + /// + /// Gets or sets a flag to determine whether or not + /// SyncKerberosPasswords is enabled or disabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "syncKerberosPasswords")] + public string SyncKerberosPasswords { get; set; } + + /// + /// Gets or sets a flag to determine whether or not SyncOnPremPasswords + /// is enabled or disabled. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "syncOnPremPasswords")] + public string SyncOnPremPasswords { get; set; } + + /// + /// Gets or sets a flag to determine whether or not + /// KerberosRc4Encryption is enabled or disabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "kerberosRc4Encryption")] + public string KerberosRc4Encryption { get; set; } + + /// + /// Gets or sets a flag to determine whether or not KerberosArmoring is + /// enabled or disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "kerberosArmoring")] + public string KerberosArmoring { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainService.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainService.cs new file mode 100644 index 0000000000000..f600377281d16 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/DomainService.cs @@ -0,0 +1,197 @@ +// +// 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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Domain service. + /// + [Rest.Serialization.JsonTransformation] + public partial class DomainService : Resource + { + /// + /// Initializes a new instance of the DomainService class. + /// + public DomainService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DomainService class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource location + /// Resource tags + /// Resource etag + /// The system meta data relating to this + /// resource. + /// Data Model Version + /// Azure Active Directory Tenant Id + /// The name of the Azure domain that the user + /// would like to deploy Domain Services to. + /// Deployment Id + /// SyncOwner ReplicaSet Id + /// List of ReplicaSets + /// Secure LDAP Settings + /// Resource Forest + /// Settings + /// DomainSecurity + /// Settings + /// Domain Configuration + /// Type + /// Sku Type + /// Enabled or Disabled flag to turn on + /// Group-based filtered sync. Possible values include: 'Enabled', + /// 'Disabled' + /// Notification Settings + /// Migration Properties + /// the current deployment or + /// provisioning state, which only appears in the response. + /// Configuration diagnostics data + /// containing latest execution from client. + public DomainService(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string etag = default(string), SystemData systemData = default(SystemData), int? version = default(int?), string tenantId = default(string), string domainName = default(string), string deploymentId = default(string), string syncOwner = default(string), IList replicaSets = default(IList), LdapsSettings ldapsSettings = default(LdapsSettings), ResourceForestSettings resourceForestSettings = default(ResourceForestSettings), DomainSecuritySettings domainSecuritySettings = default(DomainSecuritySettings), string domainConfigurationType = default(string), string sku = default(string), string filteredSync = default(string), NotificationSettings notificationSettings = default(NotificationSettings), MigrationProperties migrationProperties = default(MigrationProperties), string provisioningState = default(string), ConfigDiagnostics configDiagnostics = default(ConfigDiagnostics)) + : base(id, name, type, location, tags, etag, systemData) + { + Version = version; + TenantId = tenantId; + DomainName = domainName; + DeploymentId = deploymentId; + SyncOwner = syncOwner; + ReplicaSets = replicaSets; + LdapsSettings = ldapsSettings; + ResourceForestSettings = resourceForestSettings; + DomainSecuritySettings = domainSecuritySettings; + DomainConfigurationType = domainConfigurationType; + Sku = sku; + FilteredSync = filteredSync; + NotificationSettings = notificationSettings; + MigrationProperties = migrationProperties; + ProvisioningState = provisioningState; + ConfigDiagnostics = configDiagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets data Model Version + /// + [JsonProperty(PropertyName = "properties.version")] + public int? Version { get; private set; } + + /// + /// Gets azure Active Directory Tenant Id + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the name of the Azure domain that the user would like + /// to deploy Domain Services to. + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; set; } + + /// + /// Gets deployment Id + /// + [JsonProperty(PropertyName = "properties.deploymentId")] + public string DeploymentId { get; private set; } + + /// + /// Gets syncOwner ReplicaSet Id + /// + [JsonProperty(PropertyName = "properties.syncOwner")] + public string SyncOwner { get; private set; } + + /// + /// Gets or sets list of ReplicaSets + /// + [JsonProperty(PropertyName = "properties.replicaSets")] + public IList ReplicaSets { get; set; } + + /// + /// Gets or sets secure LDAP Settings + /// + [JsonProperty(PropertyName = "properties.ldapsSettings")] + public LdapsSettings LdapsSettings { get; set; } + + /// + /// Gets or sets resource Forest Settings + /// + [JsonProperty(PropertyName = "properties.resourceForestSettings")] + public ResourceForestSettings ResourceForestSettings { get; set; } + + /// + /// Gets or sets domainSecurity Settings + /// + [JsonProperty(PropertyName = "properties.domainSecuritySettings")] + public DomainSecuritySettings DomainSecuritySettings { get; set; } + + /// + /// Gets or sets domain Configuration Type + /// + [JsonProperty(PropertyName = "properties.domainConfigurationType")] + public string DomainConfigurationType { get; set; } + + /// + /// Gets or sets sku Type + /// + [JsonProperty(PropertyName = "properties.sku")] + public string Sku { get; set; } + + /// + /// Gets or sets enabled or Disabled flag to turn on Group-based + /// filtered sync. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.filteredSync")] + public string FilteredSync { get; set; } + + /// + /// Gets or sets notification Settings + /// + [JsonProperty(PropertyName = "properties.notificationSettings")] + public NotificationSettings NotificationSettings { get; set; } + + /// + /// Gets migration Properties + /// + [JsonProperty(PropertyName = "properties.migrationProperties")] + public MigrationProperties MigrationProperties { get; private set; } + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets configuration diagnostics data containing latest + /// execution from client. + /// + [JsonProperty(PropertyName = "properties.configDiagnostics")] + public ConfigDiagnostics ConfigDiagnostics { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ExternalAccess.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ExternalAccess.cs new file mode 100644 index 0000000000000..20f4287baf005 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ExternalAccess.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for ExternalAccess. + /// + public static class ExternalAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/FilteredSync.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/FilteredSync.cs new file mode 100644 index 0000000000000..0f651e5be0340 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/FilteredSync.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for FilteredSync. + /// + public static class FilteredSync + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ForestTrust.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ForestTrust.cs new file mode 100644 index 0000000000000..87c78b114f8f0 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ForestTrust.cs @@ -0,0 +1,83 @@ +// +// 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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Forest Trust Setting + /// + public partial class ForestTrust + { + /// + /// Initializes a new instance of the ForestTrust class. + /// + public ForestTrust() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ForestTrust class. + /// + /// Trusted Domain FQDN + /// Trust Direction + /// Friendly Name + /// Remote Dns ips + /// Trust Password + public ForestTrust(string trustedDomainFqdn = default(string), string trustDirection = default(string), string friendlyName = default(string), string remoteDnsIps = default(string), string trustPassword = default(string)) + { + TrustedDomainFqdn = trustedDomainFqdn; + TrustDirection = trustDirection; + FriendlyName = friendlyName; + RemoteDnsIps = remoteDnsIps; + TrustPassword = trustPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets trusted Domain FQDN + /// + [JsonProperty(PropertyName = "trustedDomainFqdn")] + public string TrustedDomainFqdn { get; set; } + + /// + /// Gets or sets trust Direction + /// + [JsonProperty(PropertyName = "trustDirection")] + public string TrustDirection { get; set; } + + /// + /// Gets or sets friendly Name + /// + [JsonProperty(PropertyName = "friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets remote Dns ips + /// + [JsonProperty(PropertyName = "remoteDnsIps")] + public string RemoteDnsIps { get; set; } + + /// + /// Gets or sets trust Password + /// + [JsonProperty(PropertyName = "trustPassword")] + public string TrustPassword { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthAlert.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthAlert.cs new file mode 100644 index 0000000000000..8be2c8d5f9d52 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthAlert.cs @@ -0,0 +1,100 @@ +// +// 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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Health Alert Description + /// + public partial class HealthAlert + { + /// + /// Initializes a new instance of the HealthAlert class. + /// + public HealthAlert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HealthAlert class. + /// + /// Health Alert Id + /// Health Alert Name + /// Health Alert Issue + /// Health Alert Severity + /// Health Alert Raised DateTime + /// Health Alert Last Detected + /// DateTime + /// Health Alert TSG Link + public HealthAlert(string id = default(string), string name = default(string), string issue = default(string), string severity = default(string), System.DateTime? raised = default(System.DateTime?), System.DateTime? lastDetected = default(System.DateTime?), string resolutionUri = default(string)) + { + Id = id; + Name = name; + Issue = issue; + Severity = severity; + Raised = raised; + LastDetected = lastDetected; + ResolutionUri = resolutionUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets health Alert Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets health Alert Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets health Alert Issue + /// + [JsonProperty(PropertyName = "issue")] + public string Issue { get; private set; } + + /// + /// Gets health Alert Severity + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; private set; } + + /// + /// Gets health Alert Raised DateTime + /// + [JsonProperty(PropertyName = "raised")] + public System.DateTime? Raised { get; private set; } + + /// + /// Gets health Alert Last Detected DateTime + /// + [JsonProperty(PropertyName = "lastDetected")] + public System.DateTime? LastDetected { get; private set; } + + /// + /// Gets health Alert TSG Link + /// + [JsonProperty(PropertyName = "resolutionUri")] + public string ResolutionUri { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthMonitor.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthMonitor.cs new file mode 100644 index 0000000000000..526d5803d4c06 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/HealthMonitor.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Health Monitor Description + /// + public partial class HealthMonitor + { + /// + /// Initializes a new instance of the HealthMonitor class. + /// + public HealthMonitor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HealthMonitor class. + /// + /// Health Monitor Id + /// Health Monitor Name + /// Health Monitor Details + public HealthMonitor(string id = default(string), string name = default(string), string details = default(string)) + { + Id = id; + Name = name; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets health Monitor Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets health Monitor Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets health Monitor Details + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosArmoring.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosArmoring.cs new file mode 100644 index 0000000000000..0adb6629a81fd --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosArmoring.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for KerberosArmoring. + /// + public static class KerberosArmoring + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosRc4Encryption.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosRc4Encryption.cs new file mode 100644 index 0000000000000..ad8dbd8a05c78 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/KerberosRc4Encryption.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for KerberosRc4Encryption. + /// + public static class KerberosRc4Encryption + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Ldaps.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Ldaps.cs new file mode 100644 index 0000000000000..a04dcf14f7709 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Ldaps.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for Ldaps. + /// + public static class Ldaps + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/LdapsSettings.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/LdapsSettings.cs new file mode 100644 index 0000000000000..dacef4a34dd07 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/LdapsSettings.cs @@ -0,0 +1,115 @@ +// +// 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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Secure LDAP Settings + /// + public partial class LdapsSettings + { + /// + /// Initializes a new instance of the LdapsSettings class. + /// + public LdapsSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LdapsSettings class. + /// + /// A flag to determine whether or not Secure LDAP + /// is enabled or disabled. Possible values include: 'Enabled', + /// 'Disabled' + /// The certificate required to configure + /// Secure LDAP. The parameter passed here should be a base64encoded + /// representation of the certificate pfx file. + /// The password to decrypt the + /// provided Secure LDAP certificate pfx file. + /// Public certificate used to + /// configure secure ldap. + /// Thumbprint of configure ldaps + /// certificate. + /// NotAfter DateTime of configure + /// ldaps certificate. + /// A flag to determine whether or not + /// Secure LDAP access over the internet is enabled or disabled. + /// Possible values include: 'Enabled', 'Disabled' + public LdapsSettings(string ldaps = default(string), string pfxCertificate = default(string), string pfxCertificatePassword = default(string), string publicCertificate = default(string), string certificateThumbprint = default(string), System.DateTime? certificateNotAfter = default(System.DateTime?), string externalAccess = default(string)) + { + Ldaps = ldaps; + PfxCertificate = pfxCertificate; + PfxCertificatePassword = pfxCertificatePassword; + PublicCertificate = publicCertificate; + CertificateThumbprint = certificateThumbprint; + CertificateNotAfter = certificateNotAfter; + ExternalAccess = externalAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a flag to determine whether or not Secure LDAP is + /// enabled or disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "ldaps")] + public string Ldaps { get; set; } + + /// + /// Gets or sets the certificate required to configure Secure LDAP. The + /// parameter passed here should be a base64encoded representation of + /// the certificate pfx file. + /// + [JsonProperty(PropertyName = "pfxCertificate")] + public string PfxCertificate { get; set; } + + /// + /// Gets or sets the password to decrypt the provided Secure LDAP + /// certificate pfx file. + /// + [JsonProperty(PropertyName = "pfxCertificatePassword")] + public string PfxCertificatePassword { get; set; } + + /// + /// Gets public certificate used to configure secure ldap. + /// + [JsonProperty(PropertyName = "publicCertificate")] + public string PublicCertificate { get; private set; } + + /// + /// Gets thumbprint of configure ldaps certificate. + /// + [JsonProperty(PropertyName = "certificateThumbprint")] + public string CertificateThumbprint { get; private set; } + + /// + /// Gets notAfter DateTime of configure ldaps certificate. + /// + [JsonProperty(PropertyName = "certificateNotAfter")] + public System.DateTime? CertificateNotAfter { get; private set; } + + /// + /// Gets or sets a flag to determine whether or not Secure LDAP access + /// over the internet is enabled or disabled. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "externalAccess")] + public string ExternalAccess { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProgress.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProgress.cs new file mode 100644 index 0000000000000..12862ed07eac8 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProgress.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Migration Progress + /// + public partial class MigrationProgress + { + /// + /// Initializes a new instance of the MigrationProgress class. + /// + public MigrationProgress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MigrationProgress class. + /// + /// Completion Percentage + /// Progress Message + public MigrationProgress(double? completionPercentage = default(double?), string progressMessage = default(string)) + { + CompletionPercentage = completionPercentage; + ProgressMessage = progressMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets completion Percentage + /// + [JsonProperty(PropertyName = "completionPercentage")] + public double? CompletionPercentage { get; set; } + + /// + /// Gets or sets progress Message + /// + [JsonProperty(PropertyName = "progressMessage")] + public string ProgressMessage { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProperties.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProperties.cs new file mode 100644 index 0000000000000..10943f9678093 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/MigrationProperties.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Migration Properties + /// + public partial class MigrationProperties + { + /// + /// Initializes a new instance of the MigrationProperties class. + /// + public MigrationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MigrationProperties class. + /// + /// Old Subnet Id + /// Old Vnet Site Id + /// Migration Progress + public MigrationProperties(string oldSubnetId = default(string), string oldVnetSiteId = default(string), MigrationProgress migrationProgress = default(MigrationProgress)) + { + OldSubnetId = oldSubnetId; + OldVnetSiteId = oldVnetSiteId; + MigrationProgress = migrationProgress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets old Subnet Id + /// + [JsonProperty(PropertyName = "oldSubnetId")] + public string OldSubnetId { get; private set; } + + /// + /// Gets old Vnet Site Id + /// + [JsonProperty(PropertyName = "oldVnetSiteId")] + public string OldVnetSiteId { get; private set; } + + /// + /// Gets migration Progress + /// + [JsonProperty(PropertyName = "migrationProgress")] + public MigrationProgress MigrationProgress { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotificationSettings.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotificationSettings.cs new file mode 100644 index 0000000000000..0018b9bcbaf7a --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotificationSettings.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Settings for notification + /// + public partial class NotificationSettings + { + /// + /// Initializes a new instance of the NotificationSettings class. + /// + public NotificationSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotificationSettings class. + /// + /// Should global admins be notified. + /// Possible values include: 'Enabled', 'Disabled' + /// Should domain controller admins be + /// notified. Possible values include: 'Enabled', 'Disabled' + /// The list of additional + /// recipients + public NotificationSettings(string notifyGlobalAdmins = default(string), string notifyDcAdmins = default(string), IList additionalRecipients = default(IList)) + { + NotifyGlobalAdmins = notifyGlobalAdmins; + NotifyDcAdmins = notifyDcAdmins; + AdditionalRecipients = additionalRecipients; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets should global admins be notified. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "notifyGlobalAdmins")] + public string NotifyGlobalAdmins { get; set; } + + /// + /// Gets or sets should domain controller admins be notified. Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "notifyDcAdmins")] + public string NotifyDcAdmins { get; set; } + + /// + /// Gets or sets the list of additional recipients + /// + [JsonProperty(PropertyName = "additionalRecipients")] + public IList AdditionalRecipients { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyDcAdmins.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyDcAdmins.cs new file mode 100644 index 0000000000000..79eefaa839536 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyDcAdmins.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for NotifyDcAdmins. + /// + public static class NotifyDcAdmins + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyGlobalAdmins.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyGlobalAdmins.cs new file mode 100644 index 0000000000000..57c058ead3c53 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NotifyGlobalAdmins.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for NotifyGlobalAdmins. + /// + public static class NotifyGlobalAdmins + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NtlmV1.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NtlmV1.cs new file mode 100644 index 0000000000000..2f935b4940356 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/NtlmV1.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for NtlmV1. + /// + public static class NtlmV1 + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationDisplayInfo.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationDisplayInfo.cs new file mode 100644 index 0000000000000..7a3477caf34c3 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationDisplayInfo.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The operation supported by Domain Services. + /// + public partial class OperationDisplayInfo + { + /// + /// Initializes a new instance of the OperationDisplayInfo class. + /// + public OperationDisplayInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplayInfo class. + /// + /// The description of the operation. + /// The action that users can perform, based on + /// their permission level. + /// Service provider: Domain Services. + /// Resource on which the operation is + /// performed. + public OperationDisplayInfo(string description = default(string), string operation = default(string), string provider = default(string), string resource = default(string)) + { + Description = description; + Operation = operation; + Provider = provider; + Resource = resource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the action that users can perform, based on their + /// permission level. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets service provider: Domain Services. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationEntity.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationEntity.cs new file mode 100644 index 0000000000000..9994c824a7ba0 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OperationEntity.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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The operation supported by Domain Services. + /// + public partial class OperationEntity + { + /// + /// Initializes a new instance of the OperationEntity class. + /// + public OperationEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationEntity class. + /// + /// Operation name: + /// {provider}/{resource}/{operation}. + /// The operation supported by Domain + /// Services. + /// The origin of the operation. + public OperationEntity(string name = default(string), OperationDisplayInfo display = default(OperationDisplayInfo), string origin = default(string)) + { + Name = name; + Display = display; + Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation}. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the operation supported by Domain Services. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplayInfo Display { get; set; } + + /// + /// Gets or sets the origin of the operation. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OuContainer.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OuContainer.cs new file mode 100644 index 0000000000000..b0ed035367a67 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/OuContainer.cs @@ -0,0 +1,125 @@ +// +// 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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource for OuContainer. + /// + [Rest.Serialization.JsonTransformation] + public partial class OuContainer : Resource + { + /// + /// Initializes a new instance of the OuContainer class. + /// + public OuContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OuContainer class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource location + /// Resource tags + /// Resource etag + /// The system meta data relating to this + /// resource. + /// Azure Active Directory tenant id + /// The domain name of Domain + /// Services. + /// The Deployment id + /// The OuContainer name + /// The list of container accounts + /// Status of OuContainer instance + /// Distinguished Name of OuContainer + /// instance + /// The current deployment or + /// provisioning state, which only appears in the response. + public OuContainer(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string etag = default(string), SystemData systemData = default(SystemData), string tenantId = default(string), string domainName = default(string), string deploymentId = default(string), string containerId = default(string), IList accounts = default(IList), string serviceStatus = default(string), string distinguishedName = default(string), string provisioningState = default(string)) + : base(id, name, type, location, tags, etag, systemData) + { + TenantId = tenantId; + DomainName = domainName; + DeploymentId = deploymentId; + ContainerId = containerId; + Accounts = accounts; + ServiceStatus = serviceStatus; + DistinguishedName = distinguishedName; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure Active Directory tenant id + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets the domain name of Domain Services. + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; private set; } + + /// + /// Gets the Deployment id + /// + [JsonProperty(PropertyName = "properties.deploymentId")] + public string DeploymentId { get; private set; } + + /// + /// Gets the OuContainer name + /// + [JsonProperty(PropertyName = "properties.containerId")] + public string ContainerId { get; private set; } + + /// + /// Gets or sets the list of container accounts + /// + [JsonProperty(PropertyName = "properties.accounts")] + public IList Accounts { get; set; } + + /// + /// Gets status of OuContainer instance + /// + [JsonProperty(PropertyName = "properties.serviceStatus")] + public string ServiceStatus { get; private set; } + + /// + /// Gets distinguished Name of OuContainer instance + /// + [JsonProperty(PropertyName = "properties.distinguishedName")] + public string DistinguishedName { get; private set; } + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Page.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..d7f14afe38375 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Page.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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ReplicaSet.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ReplicaSet.cs new file mode 100644 index 0000000000000..069a60693f174 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ReplicaSet.cs @@ -0,0 +1,137 @@ +// +// 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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Replica Set Definition + /// + public partial class ReplicaSet + { + /// + /// Initializes a new instance of the ReplicaSet class. + /// + public ReplicaSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicaSet class. + /// + /// ReplicaSet Id + /// Virtual network location + /// Virtual network site id + /// The name of the virtual network that Domain + /// Services will be deployed on. The id of the subnet that Domain + /// Services will be deployed on. + /// /virtualNetwork/vnetName/subnets/subnetName. + /// List of Domain Controller + /// IP Address + /// External access ip + /// address. + /// Status of Domain Service + /// instance + /// Last domain evaluation run + /// DateTime + /// List of Domain Health Monitors + /// List of Domain Health Alerts + public ReplicaSet(string replicaSetId = default(string), string location = default(string), string vnetSiteId = default(string), string subnetId = default(string), IList domainControllerIpAddress = default(IList), string externalAccessIpAddress = default(string), string serviceStatus = default(string), System.DateTime? healthLastEvaluated = default(System.DateTime?), IList healthMonitors = default(IList), IList healthAlerts = default(IList)) + { + ReplicaSetId = replicaSetId; + Location = location; + VnetSiteId = vnetSiteId; + SubnetId = subnetId; + DomainControllerIpAddress = domainControllerIpAddress; + ExternalAccessIpAddress = externalAccessIpAddress; + ServiceStatus = serviceStatus; + HealthLastEvaluated = healthLastEvaluated; + HealthMonitors = healthMonitors; + HealthAlerts = healthAlerts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets replicaSet Id + /// + [JsonProperty(PropertyName = "replicaSetId")] + public string ReplicaSetId { get; private set; } + + /// + /// Gets or sets virtual network location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets virtual network site id + /// + [JsonProperty(PropertyName = "vnetSiteId")] + public string VnetSiteId { get; private set; } + + /// + /// Gets or sets the name of the virtual network that Domain Services + /// will be deployed on. The id of the subnet that Domain Services will + /// be deployed on. /virtualNetwork/vnetName/subnets/subnetName. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets list of Domain Controller IP Address + /// + [JsonProperty(PropertyName = "domainControllerIpAddress")] + public IList DomainControllerIpAddress { get; private set; } + + /// + /// Gets external access ip address. + /// + [JsonProperty(PropertyName = "externalAccessIpAddress")] + public string ExternalAccessIpAddress { get; private set; } + + /// + /// Gets status of Domain Service instance + /// + [JsonProperty(PropertyName = "serviceStatus")] + public string ServiceStatus { get; private set; } + + /// + /// Gets last domain evaluation run DateTime + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "healthLastEvaluated")] + public System.DateTime? HealthLastEvaluated { get; private set; } + + /// + /// Gets list of Domain Health Monitors + /// + [JsonProperty(PropertyName = "healthMonitors")] + public IList HealthMonitors { get; private set; } + + /// + /// Gets list of Domain Health Alerts + /// + [JsonProperty(PropertyName = "healthAlerts")] + public IList HealthAlerts { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Resource.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..763714113406d --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Resource.cs @@ -0,0 +1,104 @@ +// +// 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.DomainServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Resource location + /// Resource tags + /// Resource etag + /// The system meta data relating to this + /// resource. + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string etag = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Etag = etag; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets resource etag + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets the system meta data relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ResourceForestSettings.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ResourceForestSettings.cs new file mode 100644 index 0000000000000..3acdc39ab3cb8 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/ResourceForestSettings.cs @@ -0,0 +1,61 @@ +// +// 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.DomainServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Settings for Resource Forest + /// + public partial class ResourceForestSettings + { + /// + /// Initializes a new instance of the ResourceForestSettings class. + /// + public ResourceForestSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceForestSettings class. + /// + /// List of settings for Resource Forest + /// Resource Forest + public ResourceForestSettings(IList settings = default(IList), string resourceForest = default(string)) + { + Settings = settings; + ResourceForest = resourceForest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of settings for Resource Forest + /// + [JsonProperty(PropertyName = "settings")] + public IList Settings { get; set; } + + /// + /// Gets or sets resource Forest + /// + [JsonProperty(PropertyName = "resourceForest")] + public string ResourceForest { get; set; } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Status.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Status.cs new file mode 100644 index 0000000000000..35a1b1998077a --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/Status.cs @@ -0,0 +1,26 @@ +// +// 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.DomainServices.Models +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string None = "None"; + public const string Running = "Running"; + public const string OK = "OK"; + public const string Failure = "Failure"; + public const string Warning = "Warning"; + public const string Skipped = "Skipped"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncKerberosPasswords.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncKerberosPasswords.cs new file mode 100644 index 0000000000000..2d0554cc6a59c --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncKerberosPasswords.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for SyncKerberosPasswords. + /// + public static class SyncKerberosPasswords + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncNtlmPasswords.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncNtlmPasswords.cs new file mode 100644 index 0000000000000..ec007ab3b1f7d --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncNtlmPasswords.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for SyncNtlmPasswords. + /// + public static class SyncNtlmPasswords + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncOnPremPasswords.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncOnPremPasswords.cs new file mode 100644 index 0000000000000..e564b37bb522f --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SyncOnPremPasswords.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for SyncOnPremPasswords. + /// + public static class SyncOnPremPasswords + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SystemData.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..086594d9322fd --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/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.DomainServices.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/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/TlsV1.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/TlsV1.cs new file mode 100644 index 0000000000000..dce60da171998 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/Models/TlsV1.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DomainServices.Models +{ + + /// + /// Defines values for TlsV1. + /// + public static class TlsV1 + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperations.cs new file mode 100644 index 0000000000000..9d289609d0ad6 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperations.cs @@ -0,0 +1,400 @@ +// +// 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.DomainServices +{ + 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; + + /// + /// OuContainerOperations operations. + /// + internal partial class OuContainerOperations : IServiceOperations, IOuContainerOperations + { + /// + /// Initializes a new instance of the OuContainerOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OuContainerOperations(DomainServicesResourceProviderClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DomainServicesResourceProviderClient + /// + public DomainServicesResourceProviderClient Client { get; private set; } + + /// + /// Lists all the available OuContainer operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Aad/operations").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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsExtensions.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsExtensions.cs new file mode 100644 index 0000000000000..5287593d547f4 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsExtensions.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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OuContainerOperations. + /// + public static partial class OuContainerOperationsExtensions + { + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOuContainerOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOuContainerOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOuContainerOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available OuContainer operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOuContainerOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperations.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperations.cs new file mode 100644 index 0000000000000..b027299f542ce --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperations.cs @@ -0,0 +1,1499 @@ +// +// 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.DomainServices +{ + 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; + + /// + /// OuContainerOperationsOperations operations. + /// + internal partial class OuContainerOperationsOperations : IServiceOperations, IOuContainerOperationsOperations + { + /// + /// Initializes a new instance of the OuContainerOperationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OuContainerOperationsOperations(DomainServicesResourceProviderClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DomainServicesResourceProviderClient + /// + public DomainServicesResourceProviderClient Client { get; private set; } + + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get particular OuContainer in DomainService instance + /// + /// + /// Get OuContainer in DomainService instance. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// 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 domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (ouContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ouContainerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("ouContainerName", ouContainerName); + 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.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + _url = _url.Replace("{ouContainerName}", System.Uri.EscapeDataString(ouContainerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (ouContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ouContainerName"); + } + if (containerAccount == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "containerAccount"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("ouContainerName", ouContainerName); + tracingParameters.Add("containerAccount", containerAccount); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + _url = _url.Replace("{ouContainerName}", System.Uri.EscapeDataString(ouContainerName)); + 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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(containerAccount != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(containerAccount, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (ouContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ouContainerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("ouContainerName", ouContainerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + _url = _url.Replace("{ouContainerName}", System.Uri.EscapeDataString(ouContainerName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (domainServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainServiceName"); + } + if (ouContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ouContainerName"); + } + if (containerAccount == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "containerAccount"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("domainServiceName", domainServiceName); + tracingParameters.Add("ouContainerName", ouContainerName); + tracingParameters.Add("containerAccount", containerAccount); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{domainServiceName}", System.Uri.EscapeDataString(domainServiceName)); + _url = _url.Replace("{ouContainerName}", System.Uri.EscapeDataString(ouContainerName)); + 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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(containerAccount != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(containerAccount, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperationsExtensions.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperationsExtensions.cs new file mode 100644 index 0000000000000..2ed57297fa333 --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/OuContainerOperationsOperationsExtensions.cs @@ -0,0 +1,517 @@ +// +// 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.DomainServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OuContainerOperationsOperations. + /// + public static partial class OuContainerOperationsOperationsExtensions + { + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + public static IPage List(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName) + { + return operations.ListAsync(resourceGroupName, domainServiceName).GetAwaiter().GetResult(); + } + + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, domainServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get particular OuContainer in DomainService instance + /// + /// + /// Get OuContainer in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + public static OuContainer Get(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName) + { + return operations.GetAsync(resourceGroupName, domainServiceName, ouContainerName).GetAwaiter().GetResult(); + } + + /// + /// Get particular OuContainer in DomainService instance + /// + /// + /// Get OuContainer in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + public static OuContainer Create(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount) + { + return operations.CreateAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount).GetAwaiter().GetResult(); + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + public static void Delete(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName) + { + operations.DeleteAsync(resourceGroupName, domainServiceName, ouContainerName).GetAwaiter().GetResult(); + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + public static OuContainer Update(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount) + { + return operations.UpdateAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount).GetAwaiter().GetResult(); + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + public static OuContainer BeginCreate(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount) + { + return operations.BeginCreateAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount).GetAwaiter().GetResult(); + } + + /// + /// Create OuContainer + /// + /// + /// The Create OuContainer operation creates a new OuContainer under the + /// specified Domain Service instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + public static void BeginDelete(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName) + { + operations.BeginDeleteAsync(resourceGroupName, domainServiceName, ouContainerName).GetAwaiter().GetResult(); + } + + /// + /// Delete OuContainer + /// + /// + /// The Delete OuContainer operation deletes specified OuContainer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + public static OuContainer BeginUpdate(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount) + { + return operations.BeginUpdateAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount).GetAwaiter().GetResult(); + } + + /// + /// Update OuContainer (PATCH Resource) + /// + /// + /// The Update OuContainer operation can be used to update the existing + /// OuContainers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the domain service. + /// + /// + /// The name of the OuContainer. + /// + /// + /// Container Account Description. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IOuContainerOperationsOperations operations, string resourceGroupName, string domainServiceName, string ouContainerName, ContainerAccount containerAccount, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, domainServiceName, ouContainerName, containerAccount, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOuContainerOperationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of OuContainers in DomainService instance + /// + /// + /// The List of OuContainers in DomainService instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOuContainerOperationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/SdkInfo_DomainServicesResourceProvider.cs b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/SdkInfo_DomainServicesResourceProvider.cs new file mode 100644 index 0000000000000..7d78d59f87e3f --- /dev/null +++ b/sdk/domainservices/Microsoft.Azure.Management.DomainServices/src/Generated/SdkInfo_DomainServicesResourceProvider.cs @@ -0,0 +1,30 @@ + +// +// 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.DomainServices +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_DomainServicesResourceProvider + { + get + { + return new Tuple[] + { + new Tuple("AAD", "DomainServiceOperations", "2021-05-01"), + new Tuple("AAD", "DomainServices", "2021-05-01"), + new Tuple("Aad", "OuContainer", "2021-05-01"), + new Tuple("Aad", "OuContainerOperations", "2021-05-01"), + }.AsEnumerable(); + } + } + } +}