# REST Resource: projects.policy

- [Resource: Policy](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy#Policy)
  - [JSON representation](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy#Policy.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy#METHODS_SUMMARY)

## Resource: Policy

A `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/Policy` for Binary Authorization.

| JSON representation |
|---|
| ``` { "name": string, "description": string, "globalPolicyEvaluationMode": enum (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/GlobalPolicyEvaluationMode`), "admissionWhitelistPatterns": [ { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionWhitelistPattern`) } ], "clusterAdmissionRules": { string: { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`) }, ... }, "kubernetesNamespaceAdmissionRules": { string: { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`) }, ... }, "kubernetesServiceAccountAdmissionRules": { string: { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`) }, ... }, "istioServiceIdentityAdmissionRules": { string: { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`) }, ... }, "defaultAdmissionRule": { object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`) }, "updateTime": string, "etag": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The resource name, in the format `projects/*/policy`. There is at most one policy per project. |
| `description` | `string` Optional. A descriptive comment. |
| `globalPolicyEvaluationMode` | ``enum (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/GlobalPolicyEvaluationMode`)`` Optional. Controls the evaluation of a Google-maintained global admission policy for common system-level images. Images not covered by the global policy will be subject to the project admission policy. This setting has no effect when specified inside a global admission policy. |
| `admissionWhitelistPatterns[]` | ``object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionWhitelistPattern`)`` Optional. Admission policy allowlisting. A matching admission request will always be permitted. This feature is typically used to exclude Google or third-party infrastructure images from Binary Authorization policies. |
| `clusterAdmissionRules` | ``map (key: string, value: object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`))`` Optional. Per-cluster admission rules. Cluster spec format: `location.clusterId`. There can be at most one admission rule per cluster spec. A `location` is either a compute zone (e.g. us-central1-a) or a region (e.g. us-central1). For `clusterId` syntax restrictions see <https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters>. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `kubernetesNamespaceAdmissionRules` | ``map (key: string, value: object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`))`` Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format: `[a-z.-]+`, e.g. `some-namespace` An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `kubernetesServiceAccountAdmissionRules` | ``map (key: string, value: object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`))`` Optional. Per-kubernetes-service-account admission rules. Service account spec format: `namespace:serviceaccount`. e.g. `test-ns:default` An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `istioServiceIdentityAdmissionRules` | ``map (key: string, value: object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`))`` Optional. Per-istio-service-identity admission rules. Istio service identity spec format: `spiffe://<domain>/ns/<namespace>/sa/<serviceaccount>` or `<domain>/ns/<namespace>/sa/<serviceaccount>` e.g. `spiffe://example.com/ns/test-ns/sa/default` An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `defaultAdmissionRule` | ``object (`https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/AdmissionRule`)`` Required. Default admission rule for a cluster without a per-cluster, per- kubernetes-service-account, or per-istio-service-identity admission rule. |
| `updateTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` Output only. Time when the policy was last updated. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `etag` | `string` Optional. A checksum, returned by the server, that can be sent on update requests to ensure the policy has an up-to-date value before attempting to update it. See <https://google.aip.dev/154>. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy/getIamPolicy` | Gets the access control policy for a resource. |
| ### `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy/setIamPolicy` | Sets the access control policy on the specified resource. |
| ### `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1beta1/projects.policy/testIamPermissions` | Returns permissions that a caller has on the specified resource. |