Skip to main content

policies

Creates, updates, deletes, gets or lists a policies resource.

Overview

Namepolicies
TypeResource
Idgoogle.binaryauthorization.policies

Fields

NameDatatypeDescription
namestringOutput only. The relative resource name of the Binary Authorization platform policy, in the form of projects/*/platforms/*/policies/*.
descriptionstringOptional. A description comment about the policy.
etagstringOptional. Used to prevent updating the policy when another request has updated it since it was retrieved.
gkePolicyobjectA Binary Authorization policy for a GKE cluster. This is one type of policy that can occur as a PlatformPolicy.
updateTimestringOutput only. Time when the policy was last updated.

Methods

NameAccessible byRequired ParamsDescription
getSELECTplatformsId, policiesId, projectsIdGets a platform policy. Returns NOT_FOUND if the policy doesn't exist.
listSELECTplatformsId, projectsIdLists platform policies owned by a project in the specified platform. Returns INVALID_ARGUMENT if the project or the platform doesn't exist.
createINSERTplatformsId, projectsIdCreates a platform policy, and returns a copy of it. Returns NOT_FOUND if the project or platform doesn't exist, INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the policy already exists, and INVALID_ARGUMENT if the policy contains a platform-specific policy that does not match the platform value specified in the URL.
deleteDELETEplatformsId, policiesId, projectsIdDeletes a platform policy. Returns NOT_FOUND if the policy doesn't exist.
replace_platform_policyREPLACEplatformsId, policiesId, projectsIdReplaces a platform policy. Returns NOT_FOUND if the policy doesn't exist.
evaluateEXECpoliciesId, projectsIdEvaluates a Kubernetes object versus a GKE platform policy. Returns NOT_FOUND if the policy doesn't exist, INVALID_ARGUMENT if the policy or request is malformed and PERMISSION_DENIED if the client does not have sufficient permissions.

SELECT examples

Lists platform policies owned by a project in the specified platform. Returns INVALID_ARGUMENT if the project or the platform doesn't exist.

SELECT
name,
description,
etag,
gkePolicy,
updateTime
FROM google.binaryauthorization.policies
WHERE platformsId = '{{ platformsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new policies resource.

/*+ create */
INSERT INTO google.binaryauthorization.policies (
platformsId,
projectsId,
description,
gkePolicy,
etag
)
SELECT
'{{ platformsId }}',
'{{ projectsId }}',
'{{ description }}',
'{{ gkePolicy }}',
'{{ etag }}'
;

REPLACE example

Replaces all fields in the specified policies resource.

/*+ update */
REPLACE google.binaryauthorization.policies
SET
description = '{{ description }}',
gkePolicy = '{{ gkePolicy }}',
etag = '{{ etag }}'
WHERE
platformsId = '{{ platformsId }}'
AND policiesId = '{{ policiesId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified policies resource.

/*+ delete */
DELETE FROM google.binaryauthorization.policies
WHERE platformsId = '{{ platformsId }}'
AND policiesId = '{{ policiesId }}'
AND projectsId = '{{ projectsId }}';