policies
Creates, updates, deletes, gets or lists a policies
resource.
Overview
Name | policies |
Type | Resource |
Id | google.iamv2.policies |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Immutable. The resource name of the Policy , which must be unique. Format: policies/{attachment_point}/denypolicies/{policy_id} The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, / , must be written as %2F . For example, policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy . For organizations and folders, use the numeric ID in the full resource name. For projects, requests can use the alphanumeric or the numeric ID. Responses always contain the numeric ID. |
annotations | object | A key-value map to store arbitrary metadata for the Policy . Keys can be up to 63 characters. Values can be up to 255 characters. |
createTime | string | Output only. The time when the Policy was created. |
deleteTime | string | Output only. The time when the Policy was deleted. Empty if the policy is not deleted. |
displayName | string | A user-specified description of the Policy . This value can be up to 63 characters. |
etag | string | An opaque tag that identifies the current version of the Policy . IAM uses this value to help manage concurrent updates, so they do not cause one update to be overwritten by another. If this field is present in a CreatePolicyRequest, the value is ignored. |
kind | string | Output only. The kind of the Policy . Always contains the value DenyPolicy . |
rules | array | A list of rules that specify the behavior of the Policy . All of the rules should be of the kind specified in the Policy . |
uid | string | Immutable. The globally unique ID of the Policy . Assigned automatically when the Policy is created. |
updateTime | string | Output only. The time when the Policy was last updated. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | policiesId, policiesId1, policiesId2 | Gets a policy. |
list_policies | SELECT | policiesId, policiesId1 | Retrieves the policies of the specified kind that are attached to a resource. The response lists only policy metadata. In particular, policy rules are omitted. |
create_policy | INSERT | policiesId, policiesId1 | Creates a policy. |
delete | DELETE | policiesId, policiesId1, policiesId2 | Deletes a policy. This action is permanent. |
update | REPLACE | policiesId, policiesId1, policiesId2 | Updates the specified policy. You can update only the rules and the display name for the policy. To update a policy, you should use a read-modify-write loop: 1. Use GetPolicy to read the current version of the policy. 2. Modify the policy as needed. 3. Use UpdatePolicy to write the updated policy. This pattern helps prevent conflicts between concurrent updates. |
SELECT
examples
Retrieves the policies of the specified kind that are attached to a resource. The response lists only policy metadata. In particular, policy rules are omitted.
SELECT
name,
annotations,
createTime,
deleteTime,
displayName,
etag,
kind,
rules,
uid,
updateTime
FROM google.iamv2.policies
WHERE policiesId = '{{ policiesId }}'
AND policiesId1 = '{{ policiesId1 }}';
INSERT
example
Use the following StackQL query and manifest file to create a new policies
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.iamv2.policies (
policiesId,
policiesId1,
name,
uid,
displayName,
annotations,
etag,
rules
)
SELECT
'{{ policiesId }}',
'{{ policiesId1 }}',
'{{ name }}',
'{{ uid }}',
'{{ displayName }}',
'{{ annotations }}',
'{{ etag }}',
'{{ rules }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: uid
value: string
- name: kind
value: string
- name: displayName
value: string
- name: annotations
value: object
- name: etag
value: string
- name: createTime
value: string
- name: updateTime
value: string
- name: deleteTime
value: string
- name: rules
value:
- - name: denyRule
value:
- name: deniedPrincipals
value:
- string
- name: exceptionPrincipals
value:
- string
- name: deniedPermissions
value:
- string
- name: exceptionPermissions
value:
- string
- name: denialCondition
value:
- name: expression
value: string
- name: title
value: string
- name: description
value: string
- name: location
value: string
- name: description
value: string
REPLACE
example
Replaces all fields in the specified policies
resource.
/*+ update */
REPLACE google.iamv2.policies
SET
name = '{{ name }}',
uid = '{{ uid }}',
displayName = '{{ displayName }}',
annotations = '{{ annotations }}',
etag = '{{ etag }}',
rules = '{{ rules }}'
WHERE
policiesId = '{{ policiesId }}'
AND policiesId1 = '{{ policiesId1 }}'
AND policiesId2 = '{{ policiesId2 }}';
DELETE
example
Deletes the specified policies
resource.
/*+ delete */
DELETE FROM google.iamv2.policies
WHERE policiesId = '{{ policiesId }}'
AND policiesId1 = '{{ policiesId1 }}'
AND policiesId2 = '{{ policiesId2 }}';