Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

docs(samples): add deny samples and tests #209

Merged
merged 25 commits into from
Jul 15, 2022
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
edc4134
docs(samples): init add deny samples and tests
Sita04 Jun 30, 2022
a21d50e
docs(samples): added requirements.txt
Sita04 Jun 30, 2022
7170f3b
docs(samples): minor update and refactoring
Sita04 Jul 1, 2022
a40c6fe
added nox files
Sita04 Jul 1, 2022
ded132e
added comments and minor refactoring
Sita04 Jul 6, 2022
2ef557f
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 6, 2022
1f500b8
added region tags
Sita04 Jul 6, 2022
5f63938
Merge branch 'deny-samples' of https://github.com/googleapis/python-i…
Sita04 Jul 6, 2022
f3c058d
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 6, 2022
91fa3cb
added region tags
Sita04 Jul 6, 2022
2d61e82
modified comments acc to review
Sita04 Jul 7, 2022
fe7805a
modified comments acc to review
Sita04 Jul 12, 2022
4714da2
updated env var
Sita04 Jul 12, 2022
ac45f12
Merge branch 'main' into deny-samples
nicain Jul 13, 2022
83743d8
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2022
0ac4dc9
Merge branch 'main' into deny-samples
parthea Jul 14, 2022
0b1bdf6
modified acc to review comments
Sita04 Jul 14, 2022
a21ead3
Merge remote-tracking branch 'origin/deny-samples' into deny-samples
Sita04 Jul 14, 2022
b58b1b4
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 14, 2022
f707ae1
modified acc to review comments
Sita04 Jul 14, 2022
6be97fd
Merge remote-tracking branch 'origin/deny-samples' into deny-samples
Sita04 Jul 14, 2022
c51313a
Merge branch 'main' into deny-samples
Sita04 Jul 14, 2022
69a06be
added init.py
Sita04 Jul 14, 2022
de2f2df
Merge remote-tracking branch 'origin/deny-samples' into deny-samples
Sita04 Jul 14, 2022
79f4ac3
updated acc to review comments
Sita04 Jul 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🦉 Updates from OwlBot post-processor
  • Loading branch information
gcf-owl-bot[bot] committed Jul 6, 2022
commit f3c058db7f9f3c728c05591ad629773aa4af263c
14 changes: 12 additions & 2 deletions samples/snippets/deny_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
def create_deny_policy(project_id: str, policy_id: str) -> None:
from google.cloud import iam_v2beta
from google.cloud.iam_v2beta import Policy, types

from google.type import expr_pb2

"""
Create a deny policy.
You can add deny policies to organizations, folders, and projects.
Expand Down Expand Up @@ -99,6 +99,8 @@ def create_deny_policy(project_id: str, policy_id: str) -> None:
# Build the create policy request.
policies_client.create_policy(request=request)
print(f"Created the deny policy: {policy_id}")


# [END iam_create_deny_policy]


Expand Down Expand Up @@ -138,6 +140,8 @@ def list_deny_policy(project_id: str) -> None:
for policy in policies:
print(policy.name)
print("Listed all deny policies")


# [END iam_list_deny_policy]


Expand Down Expand Up @@ -175,15 +179,17 @@ def get_deny_policy(project_id: str, policy_id: str):
policy = policies_client.get_policy(request=request)
print(f"Retrieved the deny policy: {policy_id} : {policy}")
return policy


# [END iam_get_deny_policy]


# [START iam_update_deny_policy]
def update_deny_policy(project_id: str, policy_id: str, etag: str) -> None:
from google.cloud import iam_v2beta
from google.cloud.iam_v2beta import types

from google.type import expr_pb2

"""
Update the deny rules and/ or its display name after policy creation.

Expand Down Expand Up @@ -260,6 +266,8 @@ def update_deny_policy(project_id: str, policy_id: str, etag: str) -> None:

policies_client.update_policy(request=request)
print(f"Updated the deny policy: {policy_id}")


# [START iam_update_deny_policy]


Expand Down Expand Up @@ -296,6 +304,8 @@ def delete_deny_policy(project_id: str, policy_id: str) -> None:
# Create the DeletePolicy request.
policies_client.delete_policy(request=request)
print(f"Deleted the deny policy: {policy_id}")


# [START iam_delete_deny_policy]


Expand Down