public async virtual Task <RestorePointCollectionCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string restorePointCollectionName, RestorePointGroupData parameters, CancellationToken cancellationToken = default) { if (restorePointCollectionName == null) { throw new ArgumentNullException(nameof(restorePointCollectionName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("RestorePointGroupCollection.CreateOrUpdate"); scope.Start(); try { var response = await _restorePointCollectionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, restorePointCollectionName, parameters, cancellationToken).ConfigureAwait(false); var operation = new RestorePointCollectionCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual RestorePointCollectionCreateOrUpdateOperation CreateOrUpdate(string restorePointCollectionName, RestorePointCollectionData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (restorePointCollectionName == null) { throw new ArgumentNullException(nameof(restorePointCollectionName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("RestorePointCollectionContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, restorePointCollectionName, parameters, cancellationToken); var operation = new RestorePointCollectionCreateOrUpdateOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }