public virtual ArmOperation <SqlRoleDefinitionResource> Update(WaitUntil waitUntil, SqlRoleDefinitionCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); using var scope = _sqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("SqlRoleDefinitionResource.Update"); scope.Start(); try { var response = _sqlRoleDefinitionSqlResourcesRestClient.CreateUpdateSqlRoleDefinition(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); var operation = new CosmosDBArmOperation <SqlRoleDefinitionResource>(new SqlRoleDefinitionOperationSource(Client), _sqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, _sqlRoleDefinitionSqlResourcesRestClient.CreateCreateUpdateSqlRoleDefinitionRequest(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; } }
public virtual async Task <ArmOperation <SqlRoleDefinitionResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string roleDefinitionId, SqlRoleDefinitionCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId)); Argument.AssertNotNull(content, nameof(content)); using var scope = _sqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("SqlRoleDefinitionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _sqlRoleDefinitionSqlResourcesRestClient.CreateUpdateSqlRoleDefinitionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, content, cancellationToken).ConfigureAwait(false); var operation = new CosmosDBArmOperation <SqlRoleDefinitionResource>(new SqlRoleDefinitionOperationSource(Client), _sqlRoleDefinitionSqlResourcesClientDiagnostics, Pipeline, _sqlRoleDefinitionSqlResourcesRestClient.CreateCreateUpdateSqlRoleDefinitionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }