**Full name**: projects.locations.datasets.fhirStores.applyAdminConsents

Applies the admin Consent resources for the FHIR store and reindexes the underlying resources in the FHIR store according to the aggregate consents. This method also updates the `consentConfig.enforced_admin_consents` field of the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores#FhirStore` unless `validateOnly=true` in `ApplyAdminConsentsRequest`. Any admin Consent resource change after this operation execution (including deletion) requires you to call `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/applyAdminConsents#google.cloud.healthcare.v1beta1.fhir.FhirStoreService.ApplyAdminConsents` again for the change to take effect.

This method returns an `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation` that can be used to track the progress of the resources that were reindexed, by calling `operations.get`. Upon completion, the `ApplyAdminConsentsResponse` additionally contains the number of resources that were reindexed.

If at least one Consent resource contains an error or fails be be enforced for any reason, the method returns an error instead of an `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`. No resources will be reindexed and the `consentConfig.enforced_admin_consents` field will be unchanged.

To enforce a consent check for data access, `consentConfig.access_enforced` must be set to true for the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores#FhirStore`.

FHIR Consent is not supported in DSTU2 or R5.

### HTTP request

`POST https://healthcare.googleapis.com/v1beta1/{name=projects/*/locations/*/datasets/*/fhirStores/*}:applyAdminConsents`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The name of the FHIR store to enforce, in the format `projects/{projectId}/locations/{locationId}/datasets/{datasetId}/fhirStores/{fhirStoreId}`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `name`: - `healthcare.fhirStores.applyConsents` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "validateOnly": boolean, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "newConsentsList": { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/applyAdminConsents#AdminConsents`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `validateOnly` | `boolean` If true, the method only validates Consent resources to make sure they are supported. Otherwise, the method applies the aggregate consent information to update the enforcement model and reindex the FHIR resources. If all Consent resources can be applied successfully, the `ApplyAdminConsentsResponse` is returned containing the following fields: \* `consentApplySuccess` to indicate the number of Consent resources applied. \* `affectedResources` to indicate the number of resources that might have had their consent access changed. If, however, one or more Consent resources are unsupported or cannot be applied, the method fails and `ApplyAdminConsentsErrorDetail` is is returned with details about the unsupported Consent resources. |
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `newConsentsList` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores/applyAdminConsents#AdminConsents`)`` A new list of admin Consent resources to be applied. Any existing enforced Consents, which are specified in `consentConfig.enforced_admin_consents` of the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1beta1/projects.locations.datasets.fhirStores#FhirStore`, that are not part of this list will be disabled. An empty list is equivalent to clearing or disabling all Consents enforced on the FHIR store. When a FHIR store has `disableResourceVersioning=true` and this list contains a Consent resource that exists in `consentConfig.enforced_admin_consents`, the method enforces any updates to the existing resource since the last enforcement. If the existing resource hasn't been updated since the last enforcement, the resource is unaffected. After the method finishes, the resulting consent enforcement model is determined by the contents of the Consent resource(s) when the method was called: \* When `disableResourceVersioning=true`, the result is identical to the current resource(s) in the FHIR store. \* When `disableResourceVersioning=false`, the result is based on the historical version(s) of the Consent resource(s) at the point in time when the method was called. At most 200 Consents can be specified. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-healthcare`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## AdminConsents

List of admin Consent resources to be applied.

| JSON representation |
|---|
| ``` { "names": [ string ] } ``` |

| Fields ||
|---|---|
| `names[]` | `string` The versioned names of the admin Consent resource(s), in the format `projects/{projectId}/locations/{location}/datasets/{datasetId}/fhirStores/{fhirStoreId}/fhir/Consent/{resourceId}/_history/{version_id}`. For FHIR stores with `disableResourceVersioning=true`, the format is `projects/{projectId}/locations/{location}/datasets/{datasetId}/fhirStores/{fhirStoreId}/fhir/Consent/{resourceId}`. |