## Resource: Consent

Represents a user's consent.

| JSON representation |
|---|
| ``` { "name": string, "revisionId": string, "revisionCreateTime": string, "userId": string, "policies": [ { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Policy`) } ], "consentArtifact": string, "state": enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#State`), "metadata": { string: string, ... }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "expireTime": string, "ttl": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. Resource name of the Consent, of the form `projects/{projectId}/locations/{locationId}/datasets/{datasetId}/consentStores/{consentStoreId}/consents/{consent_id}`. Cannot be changed after creation. |
| `revisionId` | `string` Output only. The revision ID of the Consent. The format is an 8-character hexadecimal string. Refer to a specific revision of a Consent by appending `@{revisionId}` to the Consent's resource name. |
| `revisionCreateTime` | ``string(`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The timestamp that the revision was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `userId` | `string` Required. User's UUID provided by the client. |
| `policies[]` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Policy`)`` Optional. Represents a user's consent in terms of the resources that can be accessed and under what conditions. |
| `consentArtifact` | `string` Required. The resource name of the Consent artifact that contains proof of the end user's consent, of the form `projects/{projectId}/locations/{locationId}/datasets/{datasetId}/consentStores/{consentStoreId}/consentArtifacts/{consent_artifact_id}`. |
| `state` | ``enum(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#State`)`` Required. Indicates the current state of this Consent. |
| `metadata` | `map (key: string, value: string)` Optional. User-supplied key-value pairs used to organize Consent resources. Metadata keys must: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - begin with a letter - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes Metadata values must be: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes No more than 64 metadata entries can be associated with a given consent. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| Optional. Allows setting expiration time for Consents. Expired Consents are ignored in access determination methods such as \[CheckDataAccess\]. This value replaces any default expiration duration configured for the Consent store. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `expireTime` | ``string(`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Timestamp in UTC of when this Consent is considered expired. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `ttl` | ``string(`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Input only. The time to live for this Consent from when it is created. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| End of mutually exclusive fields. ||

## Policy

Represents a user's consent in terms of the resources that can be accessed and under what conditions.

| JSON representation |
|---|
| ``` { "resourceAttributes": [ { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/Attribute`) } ], "authorizationRule": { object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/Binding#Expr`) } } ``` |

| Fields ||
|---|---|
| `resourceAttributes[]` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/Attribute`)`` The resources that this policy applies to. A resource is a match if it matches all the attributes listed here. If empty, this policy applies to all User data mappings for the given user. |
| `authorizationRule` | ``object(`https://docs.cloud.google.com/healthcare-api/docs/reference/rest/Shared.Types/Binding#Expr`)`` Required. The request conditions to meet to grant access. In addition to any supported comparison operators, authorization rules may have `IN` operator as well as at most 10 logical operators that are limited to `AND`(`&&`), `OR`(`||`). |

## State

The state of the Consent resource.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | No state specified. Treated as ACTIVE only at the time of resource creation. |
| `ACTIVE` | The Consent is active and is considered when evaluating a user's consent on resources. |
| `ARCHIVED` | The archived state is currently not being used. |
| `REVOKED` | A revoked Consent is not considered when evaluating a user's consent on resources. |
| `DRAFT` | A draft Consent is not considered when evaluating a user's consent on resources unless explicitly specified. |
| `REJECTED` | When a draft Consent is rejected by a user, it is set to a rejected state. A rejected Consent is not considered when evaluating a user's consent on resources. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/activate` | Activates the latest revision of the specified `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` by committing a new revision with `state` updated to `ACTIVE`. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/create` | Creates a new `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` in the parent `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores#ConsentStore`. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/delete` | Deletes the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` and its revisions. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/deleteRevision` | Deletes the specified revision of a `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent`. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/get` | Gets the specified revision of a `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent`, or the latest revision if `revision_id` is not specified in the resource name. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/list` | Lists the `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` in the given `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores#ConsentStore`, returning each Consent's latest revision. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/listRevisions` | Lists the revisions of the specified `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` in reverse chronological order. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/patch` | Updates the latest revision of the specified `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` by committing a new revision with the changes. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/reject` | Rejects the latest revision of the specified `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` by committing a new revision with `state` updated to `REJECTED`. |
| ### `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents/revoke` | Revokes the latest revision of the specified `https://docs.cloud.google.com/healthcare-api/docs/reference/rest/v1/projects.locations.datasets.consentStores.consents#Consent` by committing a new revision with `state` updated to `REVOKED`. |