From 68511a3c4ac0886db2ae11645ceffc2fecc91d94 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 10 Nov 2020 02:45:38 +0000 Subject: [PATCH] Generated from 30060f5b479356df87a4fe9682e1143c310e288a --- .../src/Generated/AuthorizationsOperations.cs | 17 +- .../AuthorizationsOperationsExtensions.cs | 28 +- .../src/Generated/AvsClient.cs | 16 +- .../GlobalReachConnectionsOperations.cs | 1218 +++ ...balReachConnectionsOperationsExtensions.cs | 335 + .../Generated/HcxEnterpriseSitesOperations.cs | 10 +- .../HcxEnterpriseSitesOperationsExtensions.cs | 14 +- .../Generated/IAuthorizationsOperations.cs | 10 +- .../src/Generated/IAvsClient.cs | 10 + .../IGlobalReachConnectionsOperations.cs | 214 + .../IHcxEnterpriseSitesOperations.cs | 5 +- .../Generated/IWorkloadNetworksOperations.cs | 1208 +++ .../src/Generated/Models/Cluster.cs | 20 +- .../Models/CommonClusterProperties.cs | 80 + .../Generated/Models/GlobalReachConnection.cs | 105 + .../GlobalReachConnectionProvisioningState.cs | 23 + .../Models/GlobalReachConnectionStatus.cs | 23 + .../src/Generated/Models/ManagementCluster.cs | 33 +- .../Generated/Models/NsxtAdminRotateEnum.cs | 21 + .../Models/PortMirroringDirectionEnum.cs | 21 + .../Models/PortMirroringStatusEnum.cs | 21 + .../src/Generated/Models/PrivateCloud.cs | 44 +- .../Generated/Models/PrivateCloudUpdate.cs | 28 +- .../src/Generated/Models/ProxyResource.cs | 46 + .../src/Generated/Models/SegmentStatusEnum.cs | 21 + .../src/Generated/Models/VMGroupStatusEnum.cs | 21 + .../src/Generated/Models/VMTypeEnum.cs | 21 + .../Generated/Models/VcsaAdminRotateEnum.cs | 21 + .../Generated/Models/WorkloadNetworkDhcp.cs | 87 + .../Models/WorkloadNetworkDhcpEntity.cs | 81 + .../WorkloadNetworkDhcpProvisioningState.cs | 25 + .../Models/WorkloadNetworkDhcpRelay.cs | 82 + .../Models/WorkloadNetworkDhcpServer.cs | 69 + .../Models/WorkloadNetworkGateway.cs | 66 + .../Models/WorkloadNetworkPortMirroring.cs | 116 + ...adNetworkPortMirroringProvisioningState.cs | 25 + .../Models/WorkloadNetworkSegment.cs | 114 + ...es.cs => WorkloadNetworkSegmentPortVif.cs} | 25 +- ...WorkloadNetworkSegmentProvisioningState.cs | 25 + .../Models/WorkloadNetworkSegmentSubnet.cs | 63 + .../Models/WorkloadNetworkVMGroup.cs | 97 + ...WorkloadNetworkVMGroupProvisioningState.cs | 25 + .../Models/WorkloadNetworkVirtualMachine.cs | 70 + .../SdkInfo_AzureVMwareSolutionAPI.cs | 25 +- .../Generated/WorkloadNetworksOperations.cs | 7087 +++++++++++++++++ .../WorkloadNetworksOperationsExtensions.cs | 1939 +++++ 46 files changed, 13501 insertions(+), 154 deletions(-) create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperations.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperationsExtensions.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IGlobalReachConnectionsOperations.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IWorkloadNetworksOperations.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/CommonClusterProperties.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnection.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/NsxtAdminRotateEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringStatusEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/SegmentStatusEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMGroupStatusEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMTypeEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VcsaAdminRotateEnum.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkGateway.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegment.cs rename sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/{ClusterUpdateProperties.cs => WorkloadNetworkSegmentPortVif.cs} (56%) create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperations.cs create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperationsExtensions.cs diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs index a18c46d2206ed..d0d133a22a866 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs @@ -521,19 +521,16 @@ internal AuthorizationsOperations(AvsClient client) /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, object authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, authorization, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -574,9 +571,6 @@ internal AuthorizationsOperations(AvsClient client) /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// Headers that will be added to request. /// @@ -598,7 +592,7 @@ internal AuthorizationsOperations(AvsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, object authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -638,10 +632,6 @@ internal AuthorizationsOperations(AvsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName"); } - if (authorization == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "authorization"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -653,6 +643,7 @@ internal AuthorizationsOperations(AvsClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + ExpressRouteAuthorization authorization = new ExpressRouteAuthorization(); // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs index 13fb020ab5579..396f174e4bf50 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs @@ -122,12 +122,9 @@ public static ExpressRouteAuthorization Get(this IAuthorizationsOperations opera /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// - public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, object authorization) + public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName) { - return operations.CreateOrUpdateAsync(resourceGroupName, privateCloudName, authorizationName, authorization).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult(); } /// @@ -145,15 +142,12 @@ public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOpera /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, object authorization, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, authorization, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -217,12 +211,9 @@ public static void Delete(this IAuthorizationsOperations operations, string reso /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// - public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, object authorization) + public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, privateCloudName, authorizationName, authorization).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult(); } /// @@ -240,15 +231,12 @@ public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizations /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, object authorization, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, authorization, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs index 13580eab77c90..3667d32c3fc5b 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs @@ -104,6 +104,16 @@ public partial class AvsClient : ServiceClient, IAvsClient, IAzureCli /// public virtual IAuthorizationsOperations Authorizations { get; private set; } + /// + /// Gets the IGlobalReachConnectionsOperations. + /// + public virtual IGlobalReachConnectionsOperations GlobalReachConnections { get; private set; } + + /// + /// Gets the IWorkloadNetworksOperations. + /// + public virtual IWorkloadNetworksOperations WorkloadNetworks { get; private set; } + /// /// Initializes a new instance of the AvsClient class. /// @@ -351,8 +361,10 @@ private void Initialize() Clusters = new ClustersOperations(this); HcxEnterpriseSites = new HcxEnterpriseSitesOperations(this); Authorizations = new AuthorizationsOperations(this); + GlobalReachConnections = new GlobalReachConnectionsOperations(this); + WorkloadNetworks = new WorkloadNetworksOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-03-20"; + ApiVersion = "2020-07-17-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -382,6 +394,8 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("dhcpType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("dhcpType")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperations.cs new file mode 100644 index 0000000000000..bf9741d4d0406 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperations.cs @@ -0,0 +1,1218 @@ +// +// 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.Avs +{ + 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; + + /// + /// GlobalReachConnectionsOperations operations. + /// + internal partial class GlobalReachConnectionsOperations : IServiceOperations, IGlobalReachConnectionsOperations + { + /// + /// Initializes a new instance of the GlobalReachConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GlobalReachConnectionsOperations(AvsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AvsClient + /// + public AvsClient Client { get; private set; } + + /// + /// List global reach connections in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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 privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + 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.AVS/privateClouds/{privateCloudName}/globalReachConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a global reach connection by name in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (globalReachConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "globalReachConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("globalReachConnectionName", globalReachConnectionName); + 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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{globalReachConnectionName}", System.Uri.EscapeDataString(globalReachConnectionName)); + 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 a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (globalReachConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "globalReachConnectionName"); + } + if (globalReachConnection == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "globalReachConnection"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("globalReachConnectionName", globalReachConnectionName); + tracingParameters.Add("globalReachConnection", globalReachConnection); + 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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{globalReachConnectionName}", System.Uri.EscapeDataString(globalReachConnectionName)); + 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(globalReachConnection != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(globalReachConnection, 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) + { + 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (globalReachConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "globalReachConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("globalReachConnectionName", globalReachConnectionName); + 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.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{globalReachConnectionName}", System.Uri.EscapeDataString(globalReachConnectionName)); + 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; + } + + /// + /// List global reach connections in a private cloud + /// + /// + /// 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/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..378441896ac2d --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/GlobalReachConnectionsOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// 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.Avs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GlobalReachConnectionsOperations. + /// + public static partial class GlobalReachConnectionsOperationsExtensions + { + /// + /// List global reach connections in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage List(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List global reach connections in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a global reach connection by name in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + public static GlobalReachConnection Get(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + return operations.GetAsync(resourceGroupName, privateCloudName, globalReachConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Get a global reach connection by name in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + public static GlobalReachConnection CreateOrUpdate(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection) + { + return operations.CreateOrUpdateAsync(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection).GetAwaiter().GetResult(); + } + + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + public static void Delete(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + operations.DeleteAsync(resourceGroupName, privateCloudName, globalReachConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + public static GlobalReachConnection BeginCreateOrUpdate(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection).GetAwaiter().GetResult(); + } + + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + public static void BeginDelete(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, privateCloudName, globalReachConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IGlobalReachConnectionsOperations operations, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, globalReachConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List global reach connections in a private cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IGlobalReachConnectionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List global reach connections in a private cloud + /// + /// + /// 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 IGlobalReachConnectionsOperations 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/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperations.cs index 764b0ec84ec9a..a1bd0251cd25b 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperations.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperations.cs @@ -521,9 +521,6 @@ internal HcxEnterpriseSitesOperations(AvsClient client) /// /// Name of the HCX Enterprise Site in the private cloud /// - /// - /// The HCX Enterprise Site - /// /// /// Headers that will be added to request. /// @@ -545,7 +542,7 @@ internal HcxEnterpriseSitesOperations(AvsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, object hcxEnterpriseSite, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -585,10 +582,6 @@ internal HcxEnterpriseSitesOperations(AvsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "hcxEnterpriseSiteName"); } - if (hcxEnterpriseSite == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "hcxEnterpriseSite"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -600,6 +593,7 @@ internal HcxEnterpriseSitesOperations(AvsClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + HcxEnterpriseSite hcxEnterpriseSite = new HcxEnterpriseSite(); // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperationsExtensions.cs index c5f1f9cbcd607..8479b065feae0 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperationsExtensions.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/HcxEnterpriseSitesOperationsExtensions.cs @@ -122,12 +122,9 @@ public static HcxEnterpriseSite Get(this IHcxEnterpriseSitesOperations operation /// /// Name of the HCX Enterprise Site in the private cloud /// - /// - /// The HCX Enterprise Site - /// - public static HcxEnterpriseSite CreateOrUpdate(this IHcxEnterpriseSitesOperations operations, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, object hcxEnterpriseSite) + public static HcxEnterpriseSite CreateOrUpdate(this IHcxEnterpriseSitesOperations operations, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) { - return operations.CreateOrUpdateAsync(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, privateCloudName, hcxEnterpriseSiteName).GetAwaiter().GetResult(); } /// @@ -145,15 +142,12 @@ public static HcxEnterpriseSite CreateOrUpdate(this IHcxEnterpriseSitesOperation /// /// Name of the HCX Enterprise Site in the private cloud /// - /// - /// The HCX Enterprise Site - /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IHcxEnterpriseSitesOperations operations, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, object hcxEnterpriseSite, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IHcxEnterpriseSitesOperations operations, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAuthorizationsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAuthorizationsOperations.cs index c193a85cc899e..d47d8f9c8e17c 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAuthorizationsOperations.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAuthorizationsOperations.cs @@ -90,9 +90,6 @@ public partial interface IAuthorizationsOperations /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// The headers that will be added to request. /// @@ -108,7 +105,7 @@ public partial interface IAuthorizationsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, object authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an ExpressRoute Circuit Authorization in a private cloud /// @@ -147,9 +144,6 @@ public partial interface IAuthorizationsOperations /// /// Name of the ExpressRoute Circuit Authorization in the private cloud /// - /// - /// An ExpressRoute Circuit Authorization - /// /// /// The headers that will be added to request. /// @@ -165,7 +159,7 @@ public partial interface IAuthorizationsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, object authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an ExpressRoute Circuit Authorization in a private cloud /// diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAvsClient.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAvsClient.cs index 9a1f08824bc6b..070897b64bdca 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAvsClient.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IAvsClient.cs @@ -99,5 +99,15 @@ public partial interface IAvsClient : System.IDisposable /// IAuthorizationsOperations Authorizations { get; } + /// + /// Gets the IGlobalReachConnectionsOperations. + /// + IGlobalReachConnectionsOperations GlobalReachConnections { get; } + + /// + /// Gets the IWorkloadNetworksOperations. + /// + IWorkloadNetworksOperations WorkloadNetworks { get; } + } } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IGlobalReachConnectionsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IGlobalReachConnectionsOperations.cs new file mode 100644 index 0000000000000..ab9136b335ace --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IGlobalReachConnectionsOperations.cs @@ -0,0 +1,214 @@ +// +// 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.Avs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GlobalReachConnectionsOperations operations. + /// + public partial interface IGlobalReachConnectionsOperations + { + /// + /// List global reach connections in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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 privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a global reach connection by name in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the private cloud. + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// A global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, GlobalReachConnection globalReachConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a global reach connection in a private cloud + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// Name of the global reach connection in the private cloud + /// + /// + /// 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 privateCloudName, string globalReachConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List global reach connections in a private cloud + /// + /// + /// 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/avs/Microsoft.Azure.Management.Avs/src/Generated/IHcxEnterpriseSitesOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IHcxEnterpriseSitesOperations.cs index c14d2eadc49e6..9a41a4eec5f35 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IHcxEnterpriseSitesOperations.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IHcxEnterpriseSitesOperations.cs @@ -88,9 +88,6 @@ public partial interface IHcxEnterpriseSitesOperations /// /// Name of the HCX Enterprise Site in the private cloud /// - /// - /// The HCX Enterprise Site - /// /// /// The headers that will be added to request. /// @@ -106,7 +103,7 @@ public partial interface IHcxEnterpriseSitesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, object hcxEnterpriseSite, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an HCX Enterprise Site in a private cloud /// diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IWorkloadNetworksOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IWorkloadNetworksOperations.cs new file mode 100644 index 0000000000000..875770a1bb9e2 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/IWorkloadNetworksOperations.cs @@ -0,0 +1,1208 @@ +// +// 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.Avs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkloadNetworksOperations operations. + /// + public partial interface IWorkloadNetworksOperations + { + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// NSX Segment + /// + /// + /// 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> CreateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a segment by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// NSX Segment + /// + /// + /// 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> UpdateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// 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 DeleteSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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> GetDhcpWithHttpMessagesAsync(string resourceGroupName, string dhcpId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> CreateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> UpdateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// 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 DeleteDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListGatewaysWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a gateway by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display + /// name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetGatewayWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string gatewayId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of port mirroring profiles in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListPortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetPortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> CreatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a port mirroring profile by id in a private cloud + /// workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> UpdatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 DeletePortMirroringWithHttpMessagesAsync(string resourceGroupName, string portMirroringId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListVMGroupsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a vm group by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 DeleteVMGroupWithHttpMessagesAsync(string resourceGroupName, string vmGroupId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListVirtualMachinesWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a virtual machine by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Virtual Machine identifier. + /// + /// + /// 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> GetVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string virtualMachineId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// NSX Segment + /// + /// + /// 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> BeginCreateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a segment by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// NSX Segment + /// + /// + /// 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> BeginUpdateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display + /// name + /// + /// + /// 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 BeginDeleteSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> BeginCreateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> BeginUpdateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// 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 BeginDeleteDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> BeginCreatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a port mirroring profile by id in a private cloud + /// workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> BeginUpdatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port + /// Mirroring display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 BeginDeletePortMirroringWithHttpMessagesAsync(string resourceGroupName, string portMirroringId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a vm group by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 BeginDeleteVMGroupWithHttpMessagesAsync(string resourceGroupName, string vmGroupId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of segments in a private cloud workload network. + /// + /// + /// 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>> ListSegmentsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// 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>> ListDhcpNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// 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>> ListGatewaysNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of port mirroring profiles in a private cloud workload + /// network. + /// + /// + /// 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>> ListPortMirroringNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// 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>> ListVMGroupsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// 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>> ListVirtualMachinesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/Cluster.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/Cluster.cs index cb7d3ca0bc9d6..a897b17f4c9b1 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/Cluster.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/Cluster.cs @@ -38,18 +38,18 @@ public Cluster() /// Resource ID. /// Resource name. /// Resource type. - /// The cluster size /// The state of the cluster /// provisioning. Possible values include: 'Succeeded', 'Failed', /// 'Cancelled', 'Deleting', 'Updating' + /// The cluster size /// The identity /// The hosts - public Cluster(Sku sku, string id = default(string), string name = default(string), string type = default(string), int? clusterSize = default(int?), string provisioningState = default(string), int? clusterId = default(int?), IList hosts = default(IList)) + public Cluster(Sku sku, string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), int? clusterSize = default(int?), int? clusterId = default(int?), IList hosts = default(IList)) : base(id, name, type) { Sku = sku; - ClusterSize = clusterSize; ProvisioningState = provisioningState; + ClusterSize = clusterSize; ClusterId = clusterId; Hosts = hosts; CustomInit(); @@ -67,17 +67,17 @@ public Cluster() public Sku Sku { get; set; } /// - /// Gets or sets the cluster size + /// Gets the state of the cluster provisioning. Possible values + /// include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' /// - [JsonProperty(PropertyName = "properties.clusterSize")] - public int? ClusterSize { get; set; } + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } /// - /// Gets or sets the state of the cluster provisioning. Possible values - /// include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' + /// Gets or sets the cluster size /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [JsonProperty(PropertyName = "properties.clusterSize")] + public int? ClusterSize { get; set; } /// /// Gets the identity diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/CommonClusterProperties.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/CommonClusterProperties.cs new file mode 100644 index 0000000000000..1e9bf2c500687 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/CommonClusterProperties.cs @@ -0,0 +1,80 @@ +// +// 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.Avs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The common properties of a cluster + /// + public partial class CommonClusterProperties + { + /// + /// Initializes a new instance of the CommonClusterProperties class. + /// + public CommonClusterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommonClusterProperties class. + /// + /// The state of the cluster + /// provisioning. Possible values include: 'Succeeded', 'Failed', + /// 'Cancelled', 'Deleting', 'Updating' + /// The cluster size + /// The identity + /// The hosts + public CommonClusterProperties(string provisioningState = default(string), int? clusterSize = default(int?), int? clusterId = default(int?), IList hosts = default(IList)) + { + ProvisioningState = provisioningState; + ClusterSize = clusterSize; + ClusterId = clusterId; + Hosts = hosts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the state of the cluster provisioning. Possible values + /// include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the cluster size + /// + [JsonProperty(PropertyName = "clusterSize")] + public int? ClusterSize { get; set; } + + /// + /// Gets the identity + /// + [JsonProperty(PropertyName = "clusterId")] + public int? ClusterId { get; private set; } + + /// + /// Gets the hosts + /// + [JsonProperty(PropertyName = "hosts")] + public IList Hosts { get; private set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnection.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnection.cs new file mode 100644 index 0000000000000..1b8a420751312 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnection.cs @@ -0,0 +1,105 @@ +// +// 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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A global reach connection resource + /// + [Rest.Serialization.JsonTransformation] + public partial class GlobalReachConnection : Resource + { + /// + /// Initializes a new instance of the GlobalReachConnection class. + /// + public GlobalReachConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GlobalReachConnection class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of the ExpressRoute + /// Circuit Authorization provisioning. Possible values include: + /// 'Succeeded', 'Failed', 'Updating' + /// The network used for global reach + /// carved out from the original network block provided for the private + /// cloud + /// Authorization key from the peer + /// express route used for the global reach connection + /// The connection status of the + /// global reach connection. Possible values include: 'Connected', + /// 'Connecting', 'Disconnected' + /// Identifier of the + /// ExpressRoute Circuit to peer with in the global reach + /// connection + public GlobalReachConnection(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string addressPrefix = default(string), string authorizationKey = default(string), string circuitConnectionStatus = default(string), string peerExpressRouteCircuit = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + AddressPrefix = addressPrefix; + AuthorizationKey = authorizationKey; + CircuitConnectionStatus = circuitConnectionStatus; + PeerExpressRouteCircuit = peerExpressRouteCircuit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the state of the ExpressRoute Circuit Authorization + /// provisioning. Possible values include: 'Succeeded', 'Failed', + /// 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets the network used for global reach carved out from the original + /// network block provided for the private cloud + /// + [JsonProperty(PropertyName = "properties.addressPrefix")] + public string AddressPrefix { get; private set; } + + /// + /// Gets or sets authorization key from the peer express route used for + /// the global reach connection + /// + [JsonProperty(PropertyName = "properties.authorizationKey")] + public string AuthorizationKey { get; set; } + + /// + /// Gets the connection status of the global reach connection. Possible + /// values include: 'Connected', 'Connecting', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.circuitConnectionStatus")] + public string CircuitConnectionStatus { get; private set; } + + /// + /// Gets or sets identifier of the ExpressRoute Circuit to peer with in + /// the global reach connection + /// + [JsonProperty(PropertyName = "properties.peerExpressRouteCircuit")] + public string PeerExpressRouteCircuit { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs new file mode 100644 index 0000000000000..759acff8e4c41 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs @@ -0,0 +1,23 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for GlobalReachConnectionProvisioningState. + /// + public static class GlobalReachConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs new file mode 100644 index 0000000000000..65e388184c8ee --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs @@ -0,0 +1,23 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for GlobalReachConnectionStatus. + /// + public static class GlobalReachConnectionStatus + { + public const string Connected = "Connected"; + public const string Connecting = "Connecting"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ManagementCluster.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ManagementCluster.cs index fe051ed0ed665..e7df982c7630b 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ManagementCluster.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ManagementCluster.cs @@ -10,15 +10,14 @@ namespace Microsoft.Azure.Management.Avs.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// The properties of a default cluster + /// The properties of a management cluster /// - public partial class ManagementCluster : ClusterUpdateProperties + public partial class ManagementCluster : CommonClusterProperties { /// /// Initializes a new instance of the ManagementCluster class. @@ -31,18 +30,15 @@ public ManagementCluster() /// /// Initializes a new instance of the ManagementCluster class. /// - /// The cluster size /// The state of the cluster /// provisioning. Possible values include: 'Succeeded', 'Failed', /// 'Cancelled', 'Deleting', 'Updating' + /// The cluster size /// The identity /// The hosts - public ManagementCluster(int? clusterSize = default(int?), string provisioningState = default(string), int? clusterId = default(int?), IList hosts = default(IList)) - : base(clusterSize) + public ManagementCluster(string provisioningState = default(string), int? clusterSize = default(int?), int? clusterId = default(int?), IList hosts = default(IList)) + : base(provisioningState, clusterSize, clusterId, hosts) { - ProvisioningState = provisioningState; - ClusterId = clusterId; - Hosts = hosts; CustomInit(); } @@ -51,24 +47,5 @@ public ManagementCluster() /// partial void CustomInit(); - /// - /// Gets or sets the state of the cluster provisioning. Possible values - /// include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets the identity - /// - [JsonProperty(PropertyName = "clusterId")] - public int? ClusterId { get; private set; } - - /// - /// Gets the hosts - /// - [JsonProperty(PropertyName = "hosts")] - public IList Hosts { get; private set; } - } } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/NsxtAdminRotateEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/NsxtAdminRotateEnum.cs new file mode 100644 index 0000000000000..4e8a37c3887d4 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/NsxtAdminRotateEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for NsxtAdminRotateEnum. + /// + public static class NsxtAdminRotateEnum + { + public const string OnetimeRotate = "OnetimeRotate"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs new file mode 100644 index 0000000000000..793ccd3553c0e --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for PortMirroringDirectionEnum. + /// + public static class PortMirroringDirectionEnum + { + public const string INGRESSEGRESSBIDIRECTIONAL = "INGRESS, EGRESS, BIDIRECTIONAL"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringStatusEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringStatusEnum.cs new file mode 100644 index 0000000000000..d43685318d4be --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PortMirroringStatusEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for PortMirroringStatusEnum. + /// + public static class PortMirroringStatusEnum + { + public const string SUCCESSFAILURE = "SUCCESS, FAILURE"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloud.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloud.cs index 4e5acde239e7f..164e53bf44e6e 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloud.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloud.cs @@ -50,6 +50,12 @@ public PrivateCloud() /// disabled. Possible values include: 'Enabled', 'Disabled' /// vCenter Single Sign On Identity /// Sources + /// Indicate to rotate the vCenter admin + /// password for the private cloud. Possible values include: + /// 'OnetimeRotate' + /// Indicate to rotate the NSX-T Manager + /// password for the private cloud. Possible values include: + /// 'OnetimeRotate' /// The provisioning state. Possible /// values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending', /// 'Building', 'Deleting', 'Updating' @@ -61,21 +67,19 @@ public PrivateCloud() /// migration, cloning, and snapshot migration /// Used for live migration of virtual /// machines - /// Optionally, set the vCenter admin - /// password when the private cloud is created - /// Optionally, set the NSX-T Manager - /// password when the private cloud is created /// Thumbprint of the /// vCenter Server SSL certificate /// Thumbprint of the NSX-T /// Manager SSL certificate - public PrivateCloud(Sku sku, string networkBlock, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ManagementCluster managementCluster = default(ManagementCluster), string internet = default(string), IList identitySources = default(IList), string provisioningState = default(string), Circuit circuit = default(Circuit), Endpoints endpoints = default(Endpoints), string managementNetwork = default(string), string provisioningNetwork = default(string), string vmotionNetwork = default(string), string vcenterPassword = default(string), string nsxtPassword = default(string), string vcenterCertificateThumbprint = default(string), string nsxtCertificateThumbprint = default(string)) + public PrivateCloud(Sku sku, string networkBlock, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ManagementCluster managementCluster = default(ManagementCluster), string internet = default(string), IList identitySources = default(IList), string vcenterPassword = default(string), string nsxtPassword = default(string), string provisioningState = default(string), Circuit circuit = default(Circuit), Endpoints endpoints = default(Endpoints), string managementNetwork = default(string), string provisioningNetwork = default(string), string vmotionNetwork = default(string), string vcenterCertificateThumbprint = default(string), string nsxtCertificateThumbprint = default(string)) : base(id, name, type, location, tags) { Sku = sku; ManagementCluster = managementCluster; Internet = internet; IdentitySources = identitySources; + VcenterPassword = vcenterPassword; + NsxtPassword = nsxtPassword; ProvisioningState = provisioningState; Circuit = circuit; Endpoints = endpoints; @@ -83,8 +87,6 @@ public PrivateCloud() ManagementNetwork = managementNetwork; ProvisioningNetwork = provisioningNetwork; VmotionNetwork = vmotionNetwork; - VcenterPassword = vcenterPassword; - NsxtPassword = nsxtPassword; VcenterCertificateThumbprint = vcenterCertificateThumbprint; NsxtCertificateThumbprint = nsxtCertificateThumbprint; CustomInit(); @@ -120,6 +122,20 @@ public PrivateCloud() [JsonProperty(PropertyName = "properties.identitySources")] public IList IdentitySources { get; set; } + /// + /// Gets or sets indicate to rotate the vCenter admin password for the + /// private cloud. Possible values include: 'OnetimeRotate' + /// + [JsonProperty(PropertyName = "properties.vcenterPassword")] + public string VcenterPassword { get; set; } + + /// + /// Gets or sets indicate to rotate the NSX-T Manager password for the + /// private cloud. Possible values include: 'OnetimeRotate' + /// + [JsonProperty(PropertyName = "properties.nsxtPassword")] + public string NsxtPassword { get; set; } + /// /// Gets the provisioning state. Possible values include: 'Succeeded', /// 'Failed', 'Cancelled', 'Pending', 'Building', 'Deleting', @@ -168,20 +184,6 @@ public PrivateCloud() [JsonProperty(PropertyName = "properties.vmotionNetwork")] public string VmotionNetwork { get; private set; } - /// - /// Gets or sets optionally, set the vCenter admin password when the - /// private cloud is created - /// - [JsonProperty(PropertyName = "properties.vcenterPassword")] - public string VcenterPassword { get; set; } - - /// - /// Gets or sets optionally, set the NSX-T Manager password when the - /// private cloud is created - /// - [JsonProperty(PropertyName = "properties.nsxtPassword")] - public string NsxtPassword { get; set; } - /// /// Gets thumbprint of the vCenter Server SSL certificate /// diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloudUpdate.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloudUpdate.cs index 6a3b0eb3ecea1..ba33ff6eadd28 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloudUpdate.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/PrivateCloudUpdate.cs @@ -34,19 +34,27 @@ public PrivateCloudUpdate() /// /// Initializes a new instance of the PrivateCloudUpdate class. /// - /// Resource tags. + /// Resource tags /// The default cluster used for /// management /// Connectivity to internet is enabled or /// disabled. Possible values include: 'Enabled', 'Disabled' /// vCenter Single Sign On Identity /// Sources - public PrivateCloudUpdate(IDictionary tags = default(IDictionary), ManagementCluster managementCluster = default(ManagementCluster), string internet = default(string), IList identitySources = default(IList)) + /// Indicate to rotate the vCenter admin + /// password for the private cloud. Possible values include: + /// 'OnetimeRotate' + /// Indicate to rotate the NSX-T Manager + /// password for the private cloud. Possible values include: + /// 'OnetimeRotate' + public PrivateCloudUpdate(IDictionary tags = default(IDictionary), ManagementCluster managementCluster = default(ManagementCluster), string internet = default(string), IList identitySources = default(IList), string vcenterPassword = default(string), string nsxtPassword = default(string)) { Tags = tags; ManagementCluster = managementCluster; Internet = internet; IdentitySources = identitySources; + VcenterPassword = vcenterPassword; + NsxtPassword = nsxtPassword; CustomInit(); } @@ -56,7 +64,7 @@ public PrivateCloudUpdate() partial void CustomInit(); /// - /// Gets or sets resource tags. + /// Gets or sets resource tags /// [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } @@ -80,5 +88,19 @@ public PrivateCloudUpdate() [JsonProperty(PropertyName = "properties.identitySources")] public IList IdentitySources { get; set; } + /// + /// Gets or sets indicate to rotate the vCenter admin password for the + /// private cloud. Possible values include: 'OnetimeRotate' + /// + [JsonProperty(PropertyName = "properties.vcenterPassword")] + public string VcenterPassword { get; set; } + + /// + /// Gets or sets indicate to rotate the NSX-T Manager password for the + /// private cloud. Possible values include: 'OnetimeRotate' + /// + [JsonProperty(PropertyName = "properties.nsxtPassword")] + public string NsxtPassword { get; set; } + } } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ProxyResource.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..2309696789282 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,46 @@ +// +// 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.Avs.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/SegmentStatusEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/SegmentStatusEnum.cs new file mode 100644 index 0000000000000..c339d194ed255 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/SegmentStatusEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for SegmentStatusEnum. + /// + public static class SegmentStatusEnum + { + public const string SUCCESSFAILURE = "SUCCESS, FAILURE"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMGroupStatusEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMGroupStatusEnum.cs new file mode 100644 index 0000000000000..742a4b865e846 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMGroupStatusEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for VMGroupStatusEnum. + /// + public static class VMGroupStatusEnum + { + public const string SUCCESSFAILURE = "SUCCESS, FAILURE"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMTypeEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMTypeEnum.cs new file mode 100644 index 0000000000000..cb194cf8b75e3 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VMTypeEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for VMTypeEnum. + /// + public static class VMTypeEnum + { + public const string REGULAREDGESERVICE = "REGULAR, EDGE, SERVICE"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VcsaAdminRotateEnum.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VcsaAdminRotateEnum.cs new file mode 100644 index 0000000000000..fc4c21c003867 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/VcsaAdminRotateEnum.cs @@ -0,0 +1,21 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for VcsaAdminRotateEnum. + /// + public static class VcsaAdminRotateEnum + { + public const string OnetimeRotate = "OnetimeRotate"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs new file mode 100644 index 0000000000000..196cf9ce944bc --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcp.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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// NSX DHCP + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkDhcp : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkDhcp class. + /// + public WorkloadNetworkDhcp() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkDhcp class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + public WorkloadNetworkDhcp(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList segments = default(IList), string provisioningState = default(string), long? revision = default(long?)) + : base(id, name, type) + { + DisplayName = displayName; + Segments = segments; + ProvisioningState = provisioningState; + Revision = revision; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the DHCP entity. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets NSX Segments consuming DHCP. + /// + [JsonProperty(PropertyName = "properties.segments")] + public IList Segments { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: 'Succeeded', + /// 'Failed', 'Building', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets NSX revision number. + /// + [JsonProperty(PropertyName = "properties.revision")] + public long? Revision { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs new file mode 100644 index 0000000000000..01a6e98fb1370 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs @@ -0,0 +1,81 @@ +// +// 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.Avs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay + /// to inherit from + /// + public partial class WorkloadNetworkDhcpEntity + { + /// + /// Initializes a new instance of the WorkloadNetworkDhcpEntity class. + /// + public WorkloadNetworkDhcpEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkDhcpEntity class. + /// + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + public WorkloadNetworkDhcpEntity(string displayName = default(string), IList segments = default(IList), string provisioningState = default(string), long? revision = default(long?)) + { + DisplayName = displayName; + Segments = segments; + ProvisioningState = provisioningState; + Revision = revision; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the DHCP entity. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets NSX Segments consuming DHCP. + /// + [JsonProperty(PropertyName = "segments")] + public IList Segments { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: 'Succeeded', + /// 'Failed', 'Building', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets NSX revision number. + /// + [JsonProperty(PropertyName = "revision")] + public long? Revision { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs new file mode 100644 index 0000000000000..e59d525f1b9d9 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for WorkloadNetworkDhcpProvisioningState. + /// + public static class WorkloadNetworkDhcpProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Building = "Building"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs new file mode 100644 index 0000000000000..474f7707bc726 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Avs.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// NSX DHCP Relay + /// + [Newtonsoft.Json.JsonObject("RELAY")] + public partial class WorkloadNetworkDhcpRelay : WorkloadNetworkDhcpEntity + { + /// + /// Initializes a new instance of the WorkloadNetworkDhcpRelay class. + /// + public WorkloadNetworkDhcpRelay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkDhcpRelay class. + /// + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + /// DHCP Relay Addresses. Max 3. + public WorkloadNetworkDhcpRelay(string displayName = default(string), IList segments = default(IList), string provisioningState = default(string), long? revision = default(long?), IList serverAddresses = default(IList)) + : base(displayName, segments, provisioningState, revision) + { + ServerAddresses = serverAddresses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DHCP Relay Addresses. Max 3. + /// + [JsonProperty(PropertyName = "serverAddresses")] + public IList ServerAddresses { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServerAddresses != null) + { + if (ServerAddresses.Count > 3) + { + throw new ValidationException(ValidationRules.MaxItems, "ServerAddresses", 3); + } + if (ServerAddresses.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "ServerAddresses", 1); + } + } + } + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs new file mode 100644 index 0000000000000..8789ca861cdf7 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.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.Avs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// NSX DHCP Server + /// + [Newtonsoft.Json.JsonObject("SERVER")] + public partial class WorkloadNetworkDhcpServer : WorkloadNetworkDhcpEntity + { + /// + /// Initializes a new instance of the WorkloadNetworkDhcpServer class. + /// + public WorkloadNetworkDhcpServer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkDhcpServer class. + /// + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + /// DHCP Server Address. + /// DHCP Server Lease Time. + public WorkloadNetworkDhcpServer(string displayName = default(string), IList segments = default(IList), string provisioningState = default(string), long? revision = default(long?), string serverAddress = default(string), long? leaseTime = default(long?)) + : base(displayName, segments, provisioningState, revision) + { + ServerAddress = serverAddress; + LeaseTime = leaseTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DHCP Server Address. + /// + [JsonProperty(PropertyName = "serverAddress")] + public string ServerAddress { get; set; } + + /// + /// Gets or sets DHCP Server Lease Time. + /// + [JsonProperty(PropertyName = "leaseTime")] + public long? LeaseTime { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkGateway.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkGateway.cs new file mode 100644 index 0000000000000..479d1664d4465 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkGateway.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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// NSX Gateway. + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkGateway : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkGateway class. + /// + public WorkloadNetworkGateway() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkGateway class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the DHCP entity. + /// NSX Gateway Path. + public WorkloadNetworkGateway(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string path = default(string)) + : base(id, name, type) + { + DisplayName = displayName; + Path = path; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the DHCP entity. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets NSX Gateway Path. + /// + [JsonProperty(PropertyName = "properties.path")] + public string Path { get; private set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs new file mode 100644 index 0000000000000..7012b6171721f --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs @@ -0,0 +1,116 @@ +// +// 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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// NSX Port Mirroring + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkPortMirroring : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkPortMirroring + /// class. + /// + public WorkloadNetworkPortMirroring() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkPortMirroring + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the port mirroring + /// profile. + /// Direction of port mirroring profile. + /// Possible values include: 'INGRESS, EGRESS, BIDIRECTIONAL' + /// Source VM Group. + /// Destination VM Group. + /// Port Mirroring Status. Possible values + /// include: 'SUCCESS, FAILURE' + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + public WorkloadNetworkPortMirroring(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string direction = default(string), string source = default(string), string destination = default(string), string status = default(string), string provisioningState = default(string), long? revision = default(long?)) + : base(id, name, type) + { + DisplayName = displayName; + Direction = direction; + Source = source; + Destination = destination; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the port mirroring profile. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets direction of port mirroring profile. Possible values + /// include: 'INGRESS, EGRESS, BIDIRECTIONAL' + /// + [JsonProperty(PropertyName = "properties.direction")] + public string Direction { get; set; } + + /// + /// Gets or sets source VM Group. + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + /// + /// Gets or sets destination VM Group. + /// + [JsonProperty(PropertyName = "properties.destination")] + public string Destination { get; set; } + + /// + /// Gets port Mirroring Status. Possible values include: 'SUCCESS, + /// FAILURE' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: 'Succeeded', + /// 'Failed', 'Building', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets NSX revision number. + /// + [JsonProperty(PropertyName = "properties.revision")] + public long? Revision { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs new file mode 100644 index 0000000000000..4375fc5b321bb --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for WorkloadNetworkPortMirroringProvisioningState. + /// + public static class WorkloadNetworkPortMirroringProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Building = "Building"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegment.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegment.cs new file mode 100644 index 0000000000000..dddad47941130 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegment.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// NSX Segment + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkSegment : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkSegment class. + /// + public WorkloadNetworkSegment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkSegment class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the segment. + /// Gateway which to connect segment + /// to. + /// Subnet which to connect segment to. + /// Port Vif which segment is associated + /// with. + /// Segment status. Possible values include: + /// 'SUCCESS, FAILURE' + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + public WorkloadNetworkSegment(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string connectedGateway = default(string), WorkloadNetworkSegmentSubnet subnet = default(WorkloadNetworkSegmentSubnet), IList portVif = default(IList), string status = default(string), string provisioningState = default(string), long? revision = default(long?)) + : base(id, name, type) + { + DisplayName = displayName; + ConnectedGateway = connectedGateway; + Subnet = subnet; + PortVif = portVif; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the segment. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets gateway which to connect segment to. + /// + [JsonProperty(PropertyName = "properties.connectedGateway")] + public string ConnectedGateway { get; set; } + + /// + /// Gets or sets subnet which to connect segment to. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public WorkloadNetworkSegmentSubnet Subnet { get; set; } + + /// + /// Gets port Vif which segment is associated with. + /// + [JsonProperty(PropertyName = "properties.portVif")] + public IList PortVif { get; private set; } + + /// + /// Gets segment status. Possible values include: 'SUCCESS, FAILURE' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: 'Succeeded', + /// 'Failed', 'Building', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets NSX revision number. + /// + [JsonProperty(PropertyName = "properties.revision")] + public long? Revision { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ClusterUpdateProperties.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs similarity index 56% rename from sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ClusterUpdateProperties.cs rename to sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs index c55da6cf5e02b..51816387b709d 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/ClusterUpdateProperties.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs @@ -14,25 +14,28 @@ namespace Microsoft.Azure.Management.Avs.Models using System.Linq; /// - /// The properties of a cluster that may be updated + /// Ports and any VIF attached to segment. /// - public partial class ClusterUpdateProperties + public partial class WorkloadNetworkSegmentPortVif { /// - /// Initializes a new instance of the ClusterUpdateProperties class. + /// Initializes a new instance of the WorkloadNetworkSegmentPortVif + /// class. /// - public ClusterUpdateProperties() + public WorkloadNetworkSegmentPortVif() { CustomInit(); } /// - /// Initializes a new instance of the ClusterUpdateProperties class. + /// Initializes a new instance of the WorkloadNetworkSegmentPortVif + /// class. /// - /// The cluster size - public ClusterUpdateProperties(int? clusterSize = default(int?)) + /// Name of port or VIF attached to + /// segment. + public WorkloadNetworkSegmentPortVif(string portName = default(string)) { - ClusterSize = clusterSize; + PortName = portName; CustomInit(); } @@ -42,10 +45,10 @@ public ClusterUpdateProperties() partial void CustomInit(); /// - /// Gets or sets the cluster size + /// Gets or sets name of port or VIF attached to segment. /// - [JsonProperty(PropertyName = "clusterSize")] - public int? ClusterSize { get; set; } + [JsonProperty(PropertyName = "portName")] + public string PortName { get; set; } } } diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs new file mode 100644 index 0000000000000..a2940a28f10b7 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for WorkloadNetworkSegmentProvisioningState. + /// + public static class WorkloadNetworkSegmentProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Building = "Building"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs new file mode 100644 index 0000000000000..632ae6a681c1f --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs @@ -0,0 +1,63 @@ +// +// 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.Avs.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Subnet configuration for segment + /// + public partial class WorkloadNetworkSegmentSubnet + { + /// + /// Initializes a new instance of the WorkloadNetworkSegmentSubnet + /// class. + /// + public WorkloadNetworkSegmentSubnet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkSegmentSubnet + /// class. + /// + /// DHCP Range assigned for subnet. + /// Gateway address. + public WorkloadNetworkSegmentSubnet(IList dhcpRanges = default(IList), string gatewayAddress = default(string)) + { + DhcpRanges = dhcpRanges; + GatewayAddress = gatewayAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DHCP Range assigned for subnet. + /// + [JsonProperty(PropertyName = "dhcpRanges")] + public IList DhcpRanges { get; set; } + + /// + /// Gets or sets gateway address. + /// + [JsonProperty(PropertyName = "gatewayAddress")] + public string GatewayAddress { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs new file mode 100644 index 0000000000000..d593cc66159f3 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs @@ -0,0 +1,97 @@ +// +// 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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// NSX VM Group + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkVMGroup : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkVMGroup class. + /// + public WorkloadNetworkVMGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkVMGroup class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the VM group. + /// Virtual machine members of this + /// group. + /// VM Group status. Possible values include: + /// 'SUCCESS, FAILURE' + /// The provisioning state. Possible + /// values include: 'Succeeded', 'Failed', 'Building', 'Deleting', + /// 'Updating' + /// NSX revision number. + public WorkloadNetworkVMGroup(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList members = default(IList), string status = default(string), string provisioningState = default(string), long? revision = default(long?)) + : base(id, name, type) + { + DisplayName = displayName; + Members = members; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the VM group. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets virtual machine members of this group. + /// + [JsonProperty(PropertyName = "properties.members")] + public IList Members { get; set; } + + /// + /// Gets VM Group status. Possible values include: 'SUCCESS, FAILURE' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the provisioning state. Possible values include: 'Succeeded', + /// 'Failed', 'Building', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets NSX revision number. + /// + [JsonProperty(PropertyName = "properties.revision")] + public long? Revision { get; set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs new file mode 100644 index 0000000000000..2f09a3c99922c --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.Avs.Models +{ + + /// + /// Defines values for WorkloadNetworkVMGroupProvisioningState. + /// + public static class WorkloadNetworkVMGroupProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Building = "Building"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs new file mode 100644 index 0000000000000..5a90a70483cd9 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs @@ -0,0 +1,70 @@ +// +// 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.Avs.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// NSX Virtual Machine + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkloadNetworkVirtualMachine : ProxyResource + { + /// + /// Initializes a new instance of the WorkloadNetworkVirtualMachine + /// class. + /// + public WorkloadNetworkVirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkloadNetworkVirtualMachine + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Display name of the VM. + /// Virtual machine type. Possible values include: + /// 'REGULAR, EDGE, SERVICE' + public WorkloadNetworkVirtualMachine(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string vmType = default(string)) + : base(id, name, type) + { + DisplayName = displayName; + VmType = vmType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the VM. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets virtual machine type. Possible values include: 'REGULAR, EDGE, + /// SERVICE' + /// + [JsonProperty(PropertyName = "properties.vmType")] + public string VmType { get; private set; } + + } +} diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/SdkInfo_AzureVMwareSolutionAPI.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/SdkInfo_AzureVMwareSolutionAPI.cs index 14aaa6a7a8ab6..e5ac7f5080531 100644 --- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/SdkInfo_AzureVMwareSolutionAPI.cs +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/SdkInfo_AzureVMwareSolutionAPI.cs @@ -19,25 +19,16 @@ public static IEnumerable> ApiInfo_AzureVMwareSolu { return new Tuple[] { - new Tuple("AVS", "Authorizations", "2020-03-20"), - new Tuple("AVS", "Clusters", "2020-03-20"), - new Tuple("AVS", "HcxEnterpriseSites", "2020-03-20"), - new Tuple("AVS", "Locations", "2020-03-20"), - new Tuple("AVS", "Operations", "2020-03-20"), - new Tuple("AVS", "PrivateClouds", "2020-03-20"), + new Tuple("AVS", "Authorizations", "2020-07-17-preview"), + new Tuple("AVS", "Clusters", "2020-07-17-preview"), + new Tuple("AVS", "GlobalReachConnections", "2020-07-17-preview"), + new Tuple("AVS", "HcxEnterpriseSites", "2020-07-17-preview"), + new Tuple("AVS", "Locations", "2020-07-17-preview"), + new Tuple("AVS", "Operations", "2020-07-17-preview"), + new Tuple("AVS", "PrivateClouds", "2020-07-17-preview"), + new Tuple("AVS", "WorkloadNetworks", "2020-07-17-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/vmware/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Users\\cataggar\\io\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "3faca877220bd1d20af91576946e3e6c5819ce96"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperations.cs new file mode 100644 index 0000000000000..a9b49253e3b9a --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperations.cs @@ -0,0 +1,7087 @@ +// +// 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.Avs +{ + 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; + + /// + /// WorkloadNetworksOperations operations. + /// + internal partial class WorkloadNetworksOperations : IServiceOperations, IWorkloadNetworksOperations + { + /// + /// Initializes a new instance of the WorkloadNetworksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkloadNetworksOperations(AvsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AvsClient + /// + public AvsClient Client { get; private set; } + + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSegments", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (segmentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "segmentId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("segmentId", segmentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSegment", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{segmentId}", System.Uri.EscapeDataString(segmentId)); + 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 a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteSegmentWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListDhcp", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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> GetDhcpWithHttpMessagesAsync(string resourceGroupName, string dhcpId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (dhcpId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dhcpId"); + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dhcpId", dhcpId); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDhcp", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dhcpId}", System.Uri.EscapeDataString(dhcpId)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListGatewaysWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListGateways", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a gateway by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetGatewayWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string gatewayId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (gatewayId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gatewayId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("gatewayId", gatewayId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGateway", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); + 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 of port mirroring profiles in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListPortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListPortMirroring", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetPortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (portMirroringId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portMirroringId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("portMirroringId", portMirroringId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPortMirroring", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{portMirroringId}", System.Uri.EscapeDataString(portMirroringId)); + 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 a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeletePortMirroringWithHttpMessagesAsync(string resourceGroupName, string portMirroringId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeletePortMirroringWithHttpMessagesAsync(resourceGroupName, portMirroringId, privateCloudName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListVMGroupsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVMGroups", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (vmGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmGroupId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("vmGroupId", vmGroupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetVMGroup", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{vmGroupId}", System.Uri.EscapeDataString(vmGroupId)); + 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 a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteVMGroupWithHttpMessagesAsync(string resourceGroupName, string vmGroupId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteVMGroupWithHttpMessagesAsync(resourceGroupName, vmGroupId, privateCloudName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// 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>> ListVirtualMachinesWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachines", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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 a virtual machine by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Virtual Machine identifier. + /// + /// + /// 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> GetVirtualMachineWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string virtualMachineId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (virtualMachineId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachineId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("virtualMachineId", virtualMachineId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetVirtualMachine", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{virtualMachineId}", System.Uri.EscapeDataString(virtualMachineId)); + 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 a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// 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> BeginCreateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (segmentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "segmentId"); + } + if (workloadNetworkSegment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkSegment"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("segmentId", segmentId); + tracingParameters.Add("workloadNetworkSegment", workloadNetworkSegment); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSegments", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{segmentId}", System.Uri.EscapeDataString(segmentId)); + 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(workloadNetworkSegment != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkSegment, 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) + { + 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// 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> BeginUpdateSegmentsWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (segmentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "segmentId"); + } + if (workloadNetworkSegment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkSegment"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("segmentId", segmentId); + tracingParameters.Add("workloadNetworkSegment", workloadNetworkSegment); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateSegments", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{segmentId}", System.Uri.EscapeDataString(segmentId)); + 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(workloadNetworkSegment != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkSegment, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// 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 BeginDeleteSegmentWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string segmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (segmentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "segmentId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("segmentId", segmentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteSegment", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{segmentId}", System.Uri.EscapeDataString(segmentId)); + 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; + } + + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> BeginCreateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (dhcpId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dhcpId"); + } + if (workloadNetworkDhcp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkDhcp"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("dhcpId", dhcpId); + tracingParameters.Add("workloadNetworkDhcp", workloadNetworkDhcp); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateDhcp", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{dhcpId}", System.Uri.EscapeDataString(dhcpId)); + 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(workloadNetworkDhcp != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkDhcp, 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) + { + 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// 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> BeginUpdateDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (dhcpId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dhcpId"); + } + if (workloadNetworkDhcp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkDhcp"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("dhcpId", dhcpId); + tracingParameters.Add("workloadNetworkDhcp", workloadNetworkDhcp); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateDhcp", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{dhcpId}", System.Uri.EscapeDataString(dhcpId)); + 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(workloadNetworkDhcp != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkDhcp, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// 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 BeginDeleteDhcpWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string dhcpId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (dhcpId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dhcpId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("dhcpId", dhcpId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteDhcp", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{dhcpId}", System.Uri.EscapeDataString(dhcpId)); + 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; + } + + /// + /// Create a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> BeginCreatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (portMirroringId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portMirroringId"); + } + if (workloadNetworkPortMirroring == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkPortMirroring"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("portMirroringId", portMirroringId); + tracingParameters.Add("workloadNetworkPortMirroring", workloadNetworkPortMirroring); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreatePortMirroring", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{portMirroringId}", System.Uri.EscapeDataString(portMirroringId)); + 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(workloadNetworkPortMirroring != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkPortMirroring, 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) + { + 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// 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> BeginUpdatePortMirroringWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (portMirroringId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portMirroringId"); + } + if (workloadNetworkPortMirroring == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkPortMirroring"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("portMirroringId", portMirroringId); + tracingParameters.Add("workloadNetworkPortMirroring", workloadNetworkPortMirroring); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdatePortMirroring", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{portMirroringId}", System.Uri.EscapeDataString(portMirroringId)); + 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(workloadNetworkPortMirroring != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkPortMirroring, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 BeginDeletePortMirroringWithHttpMessagesAsync(string resourceGroupName, string portMirroringId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (portMirroringId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portMirroringId"); + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("portMirroringId", portMirroringId); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeletePortMirroring", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{portMirroringId}", System.Uri.EscapeDataString(portMirroringId)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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; + } + + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (vmGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmGroupId"); + } + if (workloadNetworkVMGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkVMGroup"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("vmGroupId", vmGroupId); + tracingParameters.Add("workloadNetworkVMGroup", workloadNetworkVMGroup); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateVMGroup", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{vmGroupId}", System.Uri.EscapeDataString(vmGroupId)); + 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(workloadNetworkVMGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkVMGroup, 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) + { + 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateVMGroupWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + if (vmGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmGroupId"); + } + if (workloadNetworkVMGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workloadNetworkVMGroup"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("vmGroupId", vmGroupId); + tracingParameters.Add("workloadNetworkVMGroup", workloadNetworkVMGroup); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateVMGroup", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + _url = _url.Replace("{vmGroupId}", System.Uri.EscapeDataString(vmGroupId)); + 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(workloadNetworkVMGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workloadNetworkVMGroup, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + /// + /// 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 BeginDeleteVMGroupWithHttpMessagesAsync(string resourceGroupName, string vmGroupId, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (vmGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vmGroupId"); + } + if (privateCloudName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vmGroupId", vmGroupId); + tracingParameters.Add("privateCloudName", privateCloudName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteVMGroup", 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.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vmGroupId}", System.Uri.EscapeDataString(vmGroupId)); + _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName)); + 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; + } + + /// + /// List of segments in a private cloud workload network. + /// + /// + /// 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>> ListSegmentsNextWithHttpMessagesAsync(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, "ListSegmentsNext", 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 dhcp in a private cloud workload network. + /// + /// + /// 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>> ListDhcpNextWithHttpMessagesAsync(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, "ListDhcpNext", 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 of gateways in a private cloud workload network. + /// + /// + /// 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>> ListGatewaysNextWithHttpMessagesAsync(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, "ListGatewaysNext", 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 of port mirroring profiles in a private cloud workload network. + /// + /// + /// 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>> ListPortMirroringNextWithHttpMessagesAsync(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, "ListPortMirroringNext", 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 of vm groups in a private cloud workload network. + /// + /// + /// 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>> ListVMGroupsNextWithHttpMessagesAsync(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, "ListVMGroupsNext", 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 of virtual machines in a private cloud workload network. + /// + /// + /// 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>> ListVirtualMachinesNextWithHttpMessagesAsync(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, "ListVirtualMachinesNext", 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/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperationsExtensions.cs new file mode 100644 index 0000000000000..59137f491a808 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/WorkloadNetworksOperationsExtensions.cs @@ -0,0 +1,1939 @@ +// +// 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.Avs +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkloadNetworksOperations. + /// + public static partial class WorkloadNetworksOperationsExtensions + { + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListSegments(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListSegmentsAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListSegmentsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + public static WorkloadNetworkSegment GetSegment(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId) + { + return operations.GetSegmentAsync(resourceGroupName, privateCloudName, segmentId).GetAwaiter().GetResult(); + } + + /// + /// Get a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// The cancellation token. + /// + public static async Task GetSegmentAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSegmentWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + public static WorkloadNetworkSegment CreateSegments(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + { + return operations.CreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).GetAwaiter().GetResult(); + } + + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The cancellation token. + /// + public static async Task CreateSegmentsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + public static WorkloadNetworkSegment UpdateSegments(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + { + return operations.UpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).GetAwaiter().GetResult(); + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The cancellation token. + /// + public static async Task UpdateSegmentsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + public static void DeleteSegment(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId) + { + operations.DeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId).GetAwaiter().GetResult(); + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteSegmentAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteSegmentWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListDhcpAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// Name of the private cloud + /// + public static WorkloadNetworkDhcp GetDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string dhcpId, string privateCloudName) + { + return operations.GetDhcpAsync(resourceGroupName, dhcpId, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// Get dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task GetDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string dhcpId, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDhcpWithHttpMessagesAsync(resourceGroupName, dhcpId, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + public static WorkloadNetworkDhcp CreateDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + return operations.CreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).GetAwaiter().GetResult(); + } + + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The cancellation token. + /// + public static async Task CreateDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + public static WorkloadNetworkDhcp UpdateDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + return operations.UpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).GetAwaiter().GetResult(); + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + public static void DeleteDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId) + { + operations.DeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId).GetAwaiter().GetResult(); + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListGateways(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListGatewaysAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListGatewaysAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListGatewaysWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a gateway by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display name + /// + public static WorkloadNetworkGateway GetGateway(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string gatewayId) + { + return operations.GetGatewayAsync(resourceGroupName, privateCloudName, gatewayId).GetAwaiter().GetResult(); + } + + /// + /// Get a gateway by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Gateway identifier. Generally the same as the Gateway's display name + /// + /// + /// The cancellation token. + /// + public static async Task GetGatewayAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGatewayWithHttpMessagesAsync(resourceGroupName, privateCloudName, gatewayId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of port mirroring profiles in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListPortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListPortMirroringAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List of port mirroring profiles in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListPortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + public static WorkloadNetworkPortMirroring GetPortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId) + { + return operations.GetPortMirroringAsync(resourceGroupName, privateCloudName, portMirroringId).GetAwaiter().GetResult(); + } + + /// + /// Get a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// The cancellation token. + /// + public static async Task GetPortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + public static WorkloadNetworkPortMirroring CreatePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + return operations.CreatePortMirroringAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring).GetAwaiter().GetResult(); + } + + /// + /// Create a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The cancellation token. + /// + public static async Task CreatePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + public static WorkloadNetworkPortMirroring UpdatePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + return operations.UpdatePortMirroringAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring).GetAwaiter().GetResult(); + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + public static void DeletePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string portMirroringId, string privateCloudName) + { + operations.DeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task DeletePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string portMirroringId, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeletePortMirroringWithHttpMessagesAsync(resourceGroupName, portMirroringId, privateCloudName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListVMGroups(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListVMGroupsAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListVMGroupsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVMGroupsWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + public static WorkloadNetworkVMGroup GetVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId) + { + return operations.GetVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId).GetAwaiter().GetResult(); + } + + /// + /// Get a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// The cancellation token. + /// + public static async Task GetVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + public static WorkloadNetworkVMGroup CreateVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + return operations.CreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).GetAwaiter().GetResult(); + } + + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The cancellation token. + /// + public static async Task CreateVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + public static WorkloadNetworkVMGroup UpdateVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + return operations.UpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).GetAwaiter().GetResult(); + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The cancellation token. + /// + public static async Task UpdateVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + public static void DeleteVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string vmGroupId, string privateCloudName) + { + operations.DeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task DeleteVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string vmGroupId, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteVMGroupWithHttpMessagesAsync(resourceGroupName, vmGroupId, privateCloudName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + public static IPage ListVirtualMachines(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName) + { + return operations.ListVirtualMachinesAsync(resourceGroupName, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task> ListVirtualMachinesAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVirtualMachinesWithHttpMessagesAsync(resourceGroupName, privateCloudName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a virtual machine by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Virtual Machine identifier. + /// + public static WorkloadNetworkVirtualMachine GetVirtualMachine(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string virtualMachineId) + { + return operations.GetVirtualMachineAsync(resourceGroupName, privateCloudName, virtualMachineId).GetAwaiter().GetResult(); + } + + /// + /// Get a virtual machine by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Virtual Machine identifier. + /// + /// + /// The cancellation token. + /// + public static async Task GetVirtualMachineAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetVirtualMachineWithHttpMessagesAsync(resourceGroupName, privateCloudName, virtualMachineId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + public static WorkloadNetworkSegment BeginCreateSegments(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + { + return operations.BeginCreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).GetAwaiter().GetResult(); + } + + /// + /// Create a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateSegmentsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + public static WorkloadNetworkSegment BeginUpdateSegments(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + { + return operations.BeginUpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).GetAwaiter().GetResult(); + } + + /// + /// Create or update a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// NSX Segment + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateSegmentsAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateSegmentsWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + public static void BeginDeleteSegment(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId) + { + operations.BeginDeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId).GetAwaiter().GetResult(); + } + + /// + /// Delete a segment by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Segment identifier. Generally the same as the Segment's display name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteSegmentAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteSegmentWithHttpMessagesAsync(resourceGroupName, privateCloudName, segmentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + public static WorkloadNetworkDhcp BeginCreateDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + return operations.BeginCreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).GetAwaiter().GetResult(); + } + + /// + /// Create dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + public static WorkloadNetworkDhcp BeginUpdateDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + return operations.BeginUpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).GetAwaiter().GetResult(); + } + + /// + /// Create or update dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// NSX DHCP + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + public static void BeginDeleteDhcp(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId) + { + operations.BeginDeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId).GetAwaiter().GetResult(); + } + + /// + /// Delete dhcp by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX DHCP identifier. Generally the same as the DHCP display name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteDhcpAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteDhcpWithHttpMessagesAsync(resourceGroupName, privateCloudName, dhcpId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + public static WorkloadNetworkPortMirroring BeginCreatePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + return operations.BeginCreatePortMirroringAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring).GetAwaiter().GetResult(); + } + + /// + /// Create a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreatePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + public static WorkloadNetworkPortMirroring BeginUpdatePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + return operations.BeginUpdatePortMirroringAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring).GetAwaiter().GetResult(); + } + + /// + /// Create or update a port mirroring profile by id in a private cloud workload + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// NSX port mirroring + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdatePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdatePortMirroringWithHttpMessagesAsync(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + public static void BeginDeletePortMirroring(this IWorkloadNetworksOperations operations, string resourceGroupName, string portMirroringId, string privateCloudName) + { + operations.BeginDeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// Delete a port mirroring profile by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring + /// display name + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeletePortMirroringAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string portMirroringId, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeletePortMirroringWithHttpMessagesAsync(resourceGroupName, portMirroringId, privateCloudName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + public static WorkloadNetworkVMGroup BeginCreateVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + return operations.BeginCreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).GetAwaiter().GetResult(); + } + + /// + /// Create a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + public static WorkloadNetworkVMGroup BeginUpdateVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + return operations.BeginUpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).GetAwaiter().GetResult(); + } + + /// + /// Create or update a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the private cloud + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// NSX VM Group + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateVMGroupWithHttpMessagesAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + public static void BeginDeleteVMGroup(this IWorkloadNetworksOperations operations, string resourceGroupName, string vmGroupId, string privateCloudName) + { + operations.BeginDeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName).GetAwaiter().GetResult(); + } + + /// + /// Delete a vm group by id in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// NSX VM Group identifier. Generally the same as the VM Group's display name + /// + /// + /// Name of the private cloud + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteVMGroupAsync(this IWorkloadNetworksOperations operations, string resourceGroupName, string vmGroupId, string privateCloudName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteVMGroupWithHttpMessagesAsync(resourceGroupName, vmGroupId, privateCloudName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListSegmentsNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListSegmentsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of segments in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSegmentsNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSegmentsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListDhcpNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListDhcpNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List dhcp in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListDhcpNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListDhcpNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListGatewaysNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListGatewaysNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of gateways in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListGatewaysNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListGatewaysNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of port mirroring profiles in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListPortMirroringNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListPortMirroringNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of port mirroring profiles in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPortMirroringNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPortMirroringNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListVMGroupsNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListVMGroupsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of vm groups in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVMGroupsNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVMGroupsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListVirtualMachinesNext(this IWorkloadNetworksOperations operations, string nextPageLink) + { + return operations.ListVirtualMachinesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of virtual machines in a private cloud workload network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListVirtualMachinesNextAsync(this IWorkloadNetworksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListVirtualMachinesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}