public virtual ElasticPoolCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string elasticPoolName, ElasticPoolData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(elasticPoolName, nameof(elasticPoolName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _elasticPoolClientDiagnostics.CreateScope("ElasticPoolCollection.CreateOrUpdate"); scope.Start(); try { var response = _elasticPoolRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, parameters, cancellationToken); var operation = new ElasticPoolCreateOrUpdateOperation(ArmClient, _elasticPoolClientDiagnostics, Pipeline, _elasticPoolRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ElasticPoolCreateOrUpdateOperation> CreateOrUpdateAsync(string elasticPoolName, ElasticPoolData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (elasticPoolName == null) { throw new ArgumentNullException(nameof(elasticPoolName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ElasticPoolCollection.CreateOrUpdate"); scope.Start(); try { var response = await _elasticPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ElasticPoolCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _elasticPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, elasticPoolName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }