public virtual P2SVpnGatewayGenerateVpnProfileOperation GenerateVpnProfile(P2SVpnProfileParameters parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("P2SVpnGateway.GenerateVpnProfile"); scope.Start(); try { var response = _restClient.GenerateVpnProfile(Id.ResourceGroupName, Id.Name, parameters, cancellationToken); var operation = new P2SVpnGatewayGenerateVpnProfileOperation(_clientDiagnostics, Pipeline, _restClient.CreateGenerateVpnProfileRequest(Id.ResourceGroupName, Id.Name, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual P2SVpnGatewaysGenerateVpnProfileOperation StartGenerateVpnProfile(string resourceGroupName, string gatewayName, P2SVpnProfileParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (gatewayName == null) { throw new ArgumentNullException(nameof(gatewayName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("P2SVpnGatewaysOperations.StartGenerateVpnProfile"); scope.Start(); try { var originalResponse = RestClient.GenerateVpnProfile(resourceGroupName, gatewayName, parameters, cancellationToken); return(new P2SVpnGatewaysGenerateVpnProfileOperation(_clientDiagnostics, _pipeline, RestClient.CreateGenerateVpnProfileRequest(resourceGroupName, gatewayName, parameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <VpnProfileResponse> GenerateVpnProfile(bool waitForCompletion, P2SVpnProfileParameters parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _p2SVpnGatewayP2sVpnGatewaysClientDiagnostics.CreateScope("P2SVpnGateway.GenerateVpnProfile"); scope.Start(); try { var response = _p2SVpnGatewayP2sVpnGatewaysRestClient.GenerateVpnProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); var operation = new NetworkArmOperation <VpnProfileResponse>(new VpnProfileResponseOperationSource(), _p2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, _p2SVpnGatewayP2sVpnGatewaysRestClient.CreateGenerateVpnProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task <string> GenerateP2SVpnGatewayVpnProfileAsync(string resourceGroupName, string p2sVpnGatewayName, P2SVpnProfileParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { string baseUrl = NetworkManagementClient.BaseUri.ToString(); string apiVersion = "2019-08-01"; // Construct URL var url = new Uri(new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/" + "providers/Microsoft.Network/p2sVpnGateways/{p2sVpnGatewayName}/generatevpnprofile").ToString(); url = url.Replace("{resourceGroupName}", Uri.EscapeDataString(resourceGroupName)); url = url.Replace("{p2sVpnGatewayName}", Uri.EscapeDataString(p2sVpnGatewayName)); url = url.Replace("{subscriptionId}", Uri.EscapeDataString(NetworkManagementClient.SubscriptionId)); url += "?" + string.Join("&", string.Format("api-version={0}", Uri.EscapeDataString(apiVersion))); if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } AzureOperationResponse <string> result = await this.ExecuteOperationWithHttpMessagesAsync(resourceGroupName, p2sVpnGatewayName, parameters, url, apiVersion, null, cancellationToken).ConfigureAwait(false); return(result.Body); }
public string GenerateP2SVpnGatewayVpnProfile(string resourceGroupName, string p2sVpnGatewayName, P2SVpnProfileParameters parameters) { return(Task.Factory.StartNew(() => GenerateP2SVpnGatewayVpnProfileAsync(resourceGroupName, p2sVpnGatewayName, parameters)).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Generates VPN profile for P2S client of the P2SVpnGateway in the specified /// resource group. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='gatewayName'> /// The name of the P2SVpnGateway. /// </param> /// <param name='parameters'> /// Parameters supplied to the generate P2SVpnGateway VPN client package /// operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <VpnProfileResponse> BeginGenerateVpnProfileAsync(this IP2sVpnGatewaysOperations operations, string resourceGroupName, string gatewayName, P2SVpnProfileParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginGenerateVpnProfileWithHttpMessagesAsync(resourceGroupName, gatewayName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Generates VPN profile for P2S client of the P2SVpnGateway in the specified /// resource group. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='gatewayName'> /// The name of the P2SVpnGateway. /// </param> /// <param name='parameters'> /// Parameters supplied to the generate P2SVpnGateway VPN client package /// operation. /// </param> public static VpnProfileResponse BeginGenerateVpnProfile(this IP2sVpnGatewaysOperations operations, string resourceGroupName, string gatewayName, P2SVpnProfileParameters parameters) { return(operations.BeginGenerateVpnProfileAsync(resourceGroupName, gatewayName, parameters).GetAwaiter().GetResult()); }
public async virtual Task <P2SVpnGatewayGenerateVpnProfileOperation> GenerateVpnProfileAsync(bool waitForCompletion, P2SVpnProfileParameters parameters, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _p2SVpnGatewayP2sVpnGatewaysClientDiagnostics.CreateScope("P2SVpnGateway.GenerateVpnProfile"); scope.Start(); try { var response = await _p2SVpnGatewayP2sVpnGatewaysRestClient.GenerateVpnProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken).ConfigureAwait(false); var operation = new P2SVpnGatewayGenerateVpnProfileOperation(_p2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, _p2SVpnGatewayP2sVpnGatewaysRestClient.CreateGenerateVpnProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }