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

Commit

Permalink
feat: Add client for IAM Deny v2 API (#230)
Browse files Browse the repository at this point in the history
* feat: Create the public IAM Deny v2 API

PiperOrigin-RevId: 470600752

Source-Link: googleapis/googleapis@dac66f6

Source-Link: googleapis/googleapis-gen@729529e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzI5NTI5ZWRjMTAzZTQ1MDg3ZmZhZTgzNTNlYWYwMDlhZDdmZThjMiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* regenerate files using cl/470713093

* workaround docstring formatting issue

* add pytest to samples CI

* lint

* fix import statement in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* docs(samples): migrate samples from iam_v2beta to iam_v2

* update required checks to include samples

* use GOOGLE_CLOUD_PROJECT

* fix imports in samples/snippets

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add pytest

* chore(python): prepare for release of the iam/v2 python client

PiperOrigin-RevId: 471240188

Source-Link: googleapis/googleapis@ea847a1

Source-Link: googleapis/googleapis-gen@6f1e4cd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmYxZTRjZDAxM2FiMjkxNDc3MzgyNmU2OGIyYTJkMDc2MzAzMGEzOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Bump gapic-generator-python version to 1.3.0

PiperOrigin-RevId: 472561635

Source-Link: googleapis/googleapis@332ecf5

Source-Link: googleapis/googleapis-gen@4313d68
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: use gapic-generator-python 1.3.1

PiperOrigin-RevId: 472772457

Source-Link: googleapis/googleapis@855b74d

Source-Link: googleapis/googleapis-gen@b64b1e7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: integrate  gapic-generator-python-1.4.1 and enable more py_test targets

PiperOrigin-RevId: 473833416

Source-Link: googleapis/googleapis@565a550

Source-Link: googleapis/googleapis-gen@1ee1a06
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMWEwNmM2ZGUzY2E4Yjg0MzU3MmMxZmRlMDU0OGY4NDIzNjk4OSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* updated test to delete stale policies and avoid quota error

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat!: remove ListApplicablePolicies

PiperOrigin-RevId: 475955031

Source-Link: googleapis/googleapis@65376f4

Source-Link: googleapis/googleapis-gen@c8504e9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzg1MDRlOTc4OTFlZDllNjY0Y2Y2ODI3MGQ3ZTYxYmVjMTYwZmU1NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* samples: wait for the operation to complete

* samples: minor refactoring

* use project `python-docs-samples-tests`

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Sita Lakshmi Sangameswaran <sitalakshmi@google.com>
Co-authored-by: SitaLakshmi <sita1996@gmail.com>
  • Loading branch information
5 people committed Oct 24, 2022
1 parent 96b63f4 commit 07a2025
Show file tree
Hide file tree
Showing 74 changed files with 9,134 additions and 231 deletions.
36 changes: 36 additions & 0 deletions .github/sync-repo-settings.yaml
@@ -0,0 +1,36 @@
# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings
# Rules for main branch protection
branchProtectionRules:
# Identifies the protection rule pattern. Name of the branch to be protected.
# Defaults to `main`
- pattern: main
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: true
requiredStatusCheckContexts:
- 'cla/google'
- 'OwlBot Post Processor'
- 'docs'
- 'docfx'
- 'lint'
- 'unit (3.6)'
- 'unit (3.7)'
- 'unit (3.8)'
- 'unit (3.9)'
- 'unit (3.10)'
- 'cover'
- 'Samples - Lint'
- 'Samples - Python 3.7'
- 'Samples - Python 3.8'
- 'Samples - Python 3.9'
- 'Samples - Python 3.10'
permissionRules:
- team: actools-python
permission: admin
- team: actools
permission: admin
- team: yoshi-python
permission: push
- team: python-samples-owners
permission: push
- team: python-samples-reviewers
permission: push
10 changes: 10 additions & 0 deletions docs/iam_v2/policies.rst
@@ -0,0 +1,10 @@
Policies
--------------------------

.. automodule:: google.cloud.iam_v2.services.policies
:members:
:inherited-members:

.. automodule:: google.cloud.iam_v2.services.policies.pagers
:members:
:inherited-members:
6 changes: 6 additions & 0 deletions docs/iam_v2/services.rst
@@ -0,0 +1,6 @@
Services for Google Cloud Iam v2 API
====================================
.. toctree::
:maxdepth: 2

policies
7 changes: 7 additions & 0 deletions docs/iam_v2/types.rst
@@ -0,0 +1,7 @@
Types for Google Cloud Iam v2 API
=================================

.. automodule:: google.cloud.iam_v2.types
:members:
:undoc-members:
:show-inheritance:
10 changes: 7 additions & 3 deletions docs/index.rst
Expand Up @@ -2,9 +2,14 @@

.. include:: multiprocessing.rst

This package includes clients for multiple versions of Cloud Identity and Access Management.
By default, you will get version ``iam_credentials_v1``.

API Reference
-------------
.. toctree::
:maxdepth: 2

iam_v2/services
iam_v2/types

API Reference
-------------
Expand All @@ -22,7 +27,6 @@ API Reference
iam_v2beta/services
iam_v2beta/types


Migration Guide
---------------

Expand Down
Expand Up @@ -234,6 +234,13 @@ async def generate_access_token(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
async def sample_generate_access_token():
Expand All @@ -243,7 +250,7 @@ async def sample_generate_access_token():
# Initialize request argument(s)
request = iam_credentials_v1.GenerateAccessTokenRequest(
name="name_value",
scope=['scope_value_1', 'scope_value_2'],
scope=['scope_value1', 'scope_value2'],
)
# Make the request
Expand Down Expand Up @@ -391,6 +398,13 @@ async def generate_id_token(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
async def sample_generate_id_token():
Expand Down Expand Up @@ -541,6 +555,13 @@ async def sign_blob(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
async def sample_sign_blob():
Expand Down Expand Up @@ -678,6 +699,13 @@ async def sign_jwt(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
async def sample_sign_jwt():
Expand Down
Expand Up @@ -455,6 +455,13 @@ def generate_access_token(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
def sample_generate_access_token():
Expand All @@ -464,7 +471,7 @@ def sample_generate_access_token():
# Initialize request argument(s)
request = iam_credentials_v1.GenerateAccessTokenRequest(
name="name_value",
scope=['scope_value_1', 'scope_value_2'],
scope=['scope_value1', 'scope_value2'],
)
# Make the request
Expand Down Expand Up @@ -602,6 +609,13 @@ def generate_id_token(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
def sample_generate_id_token():
Expand Down Expand Up @@ -742,6 +756,13 @@ def sign_blob(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
def sample_sign_blob():
Expand Down Expand Up @@ -869,6 +890,13 @@ def sign_jwt(
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import iam_credentials_v1
def sample_sign_jwt():
Expand Down
44 changes: 44 additions & 0 deletions google/cloud/iam_v2/__init__.py
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .services.policies import PoliciesAsyncClient, PoliciesClient
from .types.deny import DenyRule
from .types.policy import (
CreatePolicyRequest,
DeletePolicyRequest,
GetPolicyRequest,
ListPoliciesRequest,
ListPoliciesResponse,
Policy,
PolicyOperationMetadata,
PolicyRule,
UpdatePolicyRequest,
)

__all__ = (
"PoliciesAsyncClient",
"CreatePolicyRequest",
"DeletePolicyRequest",
"DenyRule",
"GetPolicyRequest",
"ListPoliciesRequest",
"ListPoliciesResponse",
"PoliciesClient",
"Policy",
"PolicyOperationMetadata",
"PolicyRule",
"UpdatePolicyRequest",
)
73 changes: 73 additions & 0 deletions google/cloud/iam_v2/gapic_metadata.json
@@ -0,0 +1,73 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.iam_v2",
"protoPackage": "google.iam.v2",
"schema": "1.0",
"services": {
"Policies": {
"clients": {
"grpc": {
"libraryClient": "PoliciesClient",
"rpcs": {
"CreatePolicy": {
"methods": [
"create_policy"
]
},
"DeletePolicy": {
"methods": [
"delete_policy"
]
},
"GetPolicy": {
"methods": [
"get_policy"
]
},
"ListPolicies": {
"methods": [
"list_policies"
]
},
"UpdatePolicy": {
"methods": [
"update_policy"
]
}
}
},
"grpc-async": {
"libraryClient": "PoliciesAsyncClient",
"rpcs": {
"CreatePolicy": {
"methods": [
"create_policy"
]
},
"DeletePolicy": {
"methods": [
"delete_policy"
]
},
"GetPolicy": {
"methods": [
"get_policy"
]
},
"ListPolicies": {
"methods": [
"list_policies"
]
},
"UpdatePolicy": {
"methods": [
"update_policy"
]
}
}
}
}
}
}
}
2 changes: 2 additions & 0 deletions google/cloud/iam_v2/py.typed
@@ -0,0 +1,2 @@
# Marker file for PEP 561.
# The google-cloud-iam package uses inline types.
15 changes: 15 additions & 0 deletions google/cloud/iam_v2/services/__init__.py
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
22 changes: 22 additions & 0 deletions google/cloud/iam_v2/services/policies/__init__.py
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .async_client import PoliciesAsyncClient
from .client import PoliciesClient

__all__ = (
"PoliciesClient",
"PoliciesAsyncClient",
)

0 comments on commit 07a2025

Please sign in to comment.