public async virtual Task <EncryptionScopePutOperation> CreateOrUpdateAsync(string encryptionScopeName, EncryptionScopeData encryptionScope, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (encryptionScopeName == null) { throw new ArgumentNullException(nameof(encryptionScopeName)); } if (encryptionScope == null) { throw new ArgumentNullException(nameof(encryptionScope)); } using var scope = _clientDiagnostics.CreateScope("EncryptionScopeContainer.CreateOrUpdate"); scope.Start(); try { var response = await _restClient.PutAsync(Id.ResourceGroupName, Id.Name, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false); var operation = new EncryptionScopePutOperation(Parent, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual EncryptionScopePutOperation CreateOrUpdate(string encryptionScopeName, EncryptionScopeData encryptionScope, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (encryptionScopeName == null) { throw new ArgumentNullException(nameof(encryptionScopeName)); } if (encryptionScope == null) { throw new ArgumentNullException(nameof(encryptionScope)); } using var scope = _clientDiagnostics.CreateScope("EncryptionScopeCollection.CreateOrUpdate"); scope.Start(); try { var response = _encryptionScopesRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, encryptionScope, cancellationToken); var operation = new EncryptionScopePutOperation(Parent, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }