Skip to content
Permalink
Browse files
chore: upgrade gapic-generator-python to 0.46.3 (#19)
fix: add async client to %name_%version/init.py

feat: support self-signed JWT flow for service accounts

chore: enable GAPIC metadata generation

chore: sort subpackages in %namespace/%name/init.py
  • Loading branch information
gcf-owl-bot committed May 21, 2021
1 parent 33dae15 commit ad65aade357a811bcd41344702d48c497034c9e1
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,32 +14,33 @@
# limitations under the License.
#

from google.cloud.policytroubleshooter_v1.services.iam_checker.async_client import (
IamCheckerAsyncClient,
)
from google.cloud.policytroubleshooter_v1.services.iam_checker.client import (
IamCheckerClient,
)
from google.cloud.policytroubleshooter_v1.services.iam_checker.async_client import (
IamCheckerAsyncClient,
)

from google.cloud.policytroubleshooter_v1.types.checker import (
TroubleshootIamPolicyRequest,
)
from google.cloud.policytroubleshooter_v1.types.checker import (
TroubleshootIamPolicyResponse,
)
from google.cloud.policytroubleshooter_v1.types.explanations import AccessState
from google.cloud.policytroubleshooter_v1.types.explanations import AccessTuple
from google.cloud.policytroubleshooter_v1.types.explanations import BindingExplanation
from google.cloud.policytroubleshooter_v1.types.explanations import ExplainedPolicy
from google.cloud.policytroubleshooter_v1.types.explanations import AccessState
from google.cloud.policytroubleshooter_v1.types.explanations import HeuristicRelevance

__all__ = (
"AccessState",
"IamCheckerClient",
"IamCheckerAsyncClient",
"TroubleshootIamPolicyRequest",
"TroubleshootIamPolicyResponse",
"AccessTuple",
"BindingExplanation",
"ExplainedPolicy",
"AccessState",
"HeuristicRelevance",
"IamCheckerAsyncClient",
"IamCheckerClient",
"TroubleshootIamPolicyRequest",
"TroubleshootIamPolicyResponse",
)
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,22 +15,24 @@
#

from .services.iam_checker import IamCheckerClient
from .services.iam_checker import IamCheckerAsyncClient

from .types.checker import TroubleshootIamPolicyRequest
from .types.checker import TroubleshootIamPolicyResponse
from .types.explanations import AccessState
from .types.explanations import AccessTuple
from .types.explanations import BindingExplanation
from .types.explanations import ExplainedPolicy
from .types.explanations import AccessState
from .types.explanations import HeuristicRelevance


__all__ = (
"IamCheckerAsyncClient",
"AccessState",
"AccessTuple",
"BindingExplanation",
"ExplainedPolicy",
"HeuristicRelevance",
"IamCheckerClient",
"TroubleshootIamPolicyRequest",
"TroubleshootIamPolicyResponse",
"IamCheckerClient",
)
@@ -0,0 +1,33 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.policytroubleshooter_v1",
"protoPackage": "google.cloud.policytroubleshooter.v1",
"schema": "1.0",
"services": {
"IamChecker": {
"clients": {
"grpc": {
"libraryClient": "IamCheckerClient",
"rpcs": {
"TroubleshootIamPolicy": {
"methods": [
"troubleshoot_iam_policy"
]
}
}
},
"grpc-async": {
"libraryClient": "IamCheckerAsyncClient",
"rpcs": {
"TroubleshootIamPolicy": {
"methods": [
"troubleshoot_iam_policy"
]
}
}
}
}
}
}
}
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .client import IamCheckerClient
from .async_client import IamCheckerAsyncClient

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,23 +13,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from collections import OrderedDict
import functools
import re
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core import exceptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.cloud.policytroubleshooter_v1.types import checker
from google.cloud.policytroubleshooter_v1.types import explanations

from .transports.base import IamCheckerTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import IamCheckerGrpcAsyncIOTransport
from .client import IamCheckerClient
@@ -53,26 +50,23 @@ class IamCheckerAsyncClient:
parse_common_billing_account_path = staticmethod(
IamCheckerClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(IamCheckerClient.common_folder_path)
parse_common_folder_path = staticmethod(IamCheckerClient.parse_common_folder_path)

common_organization_path = staticmethod(IamCheckerClient.common_organization_path)
parse_common_organization_path = staticmethod(
IamCheckerClient.parse_common_organization_path
)

common_project_path = staticmethod(IamCheckerClient.common_project_path)
parse_common_project_path = staticmethod(IamCheckerClient.parse_common_project_path)

common_location_path = staticmethod(IamCheckerClient.common_location_path)
parse_common_location_path = staticmethod(
IamCheckerClient.parse_common_location_path
)

@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
"""Creates an instance of this client using the provided credentials
info.
Args:
info (dict): The service account private key info.
@@ -87,7 +81,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
file.
Args:
filename (str): The path to the service account private key json
@@ -104,7 +98,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

@property
def transport(self) -> IamCheckerTransport:
"""Return the transport used by the client instance.
"""Returns the transport used by the client instance.
Returns:
IamCheckerTransport: The transport used by the client instance.
@@ -118,12 +112,12 @@ def transport(self) -> IamCheckerTransport:
def __init__(
self,
*,
credentials: credentials.Credentials = None,
credentials: ga_credentials.Credentials = None,
transport: Union[str, IamCheckerTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the iam checker client.
"""Instantiates the iam checker client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -155,7 +149,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""

self._client = IamCheckerClient(
credentials=credentials,
transport=transport,
@@ -179,7 +172,6 @@ async def troubleshoot_iam_policy(
request (:class:`google.cloud.policytroubleshooter_v1.types.TroubleshootIamPolicyRequest`):
The request object. Request for
[TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -193,7 +185,6 @@ async def troubleshoot_iam_policy(
"""
# Create or coerce a protobuf request object.

request = checker.TroubleshootIamPolicyRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
Loading

0 comments on commit ad65aad

Please sign in to comment.