public virtual async Task <ArmOperation <SqlRoleAssignmentResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string roleAssignmentId, SqlRoleAssignmentCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(roleAssignmentId, nameof(roleAssignmentId)); Argument.AssertNotNull(content, nameof(content)); using var scope = _sqlRoleAssignmentSqlResourcesClientDiagnostics.CreateScope("SqlRoleAssignmentCollection.CreateOrUpdate"); scope.Start(); try { var response = await _sqlRoleAssignmentSqlResourcesRestClient.CreateUpdateSqlRoleAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleAssignmentId, content, cancellationToken).ConfigureAwait(false); var operation = new CosmosDBArmOperation <SqlRoleAssignmentResource>(new SqlRoleAssignmentOperationSource(Client), _sqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, _sqlRoleAssignmentSqlResourcesRestClient.CreateCreateUpdateSqlRoleAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleAssignmentId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <SqlRoleAssignmentResource> Update(WaitUntil waitUntil, SqlRoleAssignmentCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); using var scope = _sqlRoleAssignmentSqlResourcesClientDiagnostics.CreateScope("SqlRoleAssignmentResource.Update"); scope.Start(); try { var response = _sqlRoleAssignmentSqlResourcesRestClient.CreateUpdateSqlRoleAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); var operation = new CosmosDBArmOperation <SqlRoleAssignmentResource>(new SqlRoleAssignmentOperationSource(Client), _sqlRoleAssignmentSqlResourcesClientDiagnostics, Pipeline, _sqlRoleAssignmentSqlResourcesRestClient.CreateCreateUpdateSqlRoleAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }