public virtual PrivateLinkServiceCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string serviceName, PrivateLinkServiceData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _privateLinkServiceClientDiagnostics.CreateScope("PrivateLinkServiceCollection.CreateOrUpdate"); scope.Start(); try { var response = _privateLinkServiceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, serviceName, parameters, cancellationToken); var operation = new PrivateLinkServiceCreateOrUpdateOperation(ArmClient, _privateLinkServiceClientDiagnostics, Pipeline, _privateLinkServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, serviceName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <PrivateLinkServiceCreateOrUpdateOperation> CreateOrUpdateAsync(string serviceName, PrivateLinkServiceData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (serviceName == null) { throw new ArgumentNullException(nameof(serviceName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("PrivateLinkServiceCollection.CreateOrUpdate"); scope.Start(); try { var response = await _privateLinkServicesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, serviceName, parameters, cancellationToken).ConfigureAwait(false); var operation = new PrivateLinkServiceCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _privateLinkServicesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, serviceName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual PrivateLinkServiceCreateOrUpdateOperation CreateOrUpdate(string serviceName, PrivateLinkServiceData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (serviceName == null) { throw new ArgumentNullException(nameof(serviceName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("PrivateLinkServiceContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, serviceName, parameters, cancellationToken); var operation = new PrivateLinkServiceCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, serviceName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }