Skip to content

Commit

Permalink
chore: upgrade gapic-generator-python to 0.46.3 (#129)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 373649163

Source-Link: googleapis/googleapis@7e1b14e

Source-Link: googleapis/googleapis-gen@0a3c7d2

fix: add async client to %name_%version/init.py
chore: add autogenerated snippets
chore: remove auth, policy, and options from the reserved names list
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[bot] authored May 21, 2021
1 parent e7756c1 commit 642cfa9
Show file tree
Hide file tree
Showing 20 changed files with 696 additions and 414 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

from google.cloud.devtools.containeranalysis_v1.services.container_analysis.async_client import (
ContainerAnalysisAsyncClient,
)
from google.cloud.devtools.containeranalysis_v1.services.container_analysis.client import (
ContainerAnalysisClient,
)
from google.cloud.devtools.containeranalysis_v1.services.container_analysis.async_client import (
ContainerAnalysisAsyncClient,
)

from google.cloud.devtools.containeranalysis_v1.types.containeranalysis import (
GetVulnerabilityOccurrencesSummaryRequest,
)
Expand All @@ -29,8 +29,8 @@
)

__all__ = (
"ContainerAnalysisAsyncClient",
"ContainerAnalysisClient",
"ContainerAnalysisAsyncClient",
"GetVulnerabilityOccurrencesSummaryRequest",
"VulnerabilityOccurrencesSummary",
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,12 +15,14 @@
#

from .services.container_analysis import ContainerAnalysisClient
from .services.container_analysis import ContainerAnalysisAsyncClient

from .types.containeranalysis import GetVulnerabilityOccurrencesSummaryRequest
from .types.containeranalysis import VulnerabilityOccurrencesSummary


__all__ = (
"ContainerAnalysisAsyncClient",
"ContainerAnalysisClient",
"GetVulnerabilityOccurrencesSummaryRequest",
"VulnerabilityOccurrencesSummary",
"ContainerAnalysisClient",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.devtools.containeranalysis_v1",
"protoPackage": "google.devtools.containeranalysis.v1",
"schema": "1.0",
"services": {
"ContainerAnalysis": {
"clients": {
"grpc": {
"libraryClient": "ContainerAnalysisClient",
"rpcs": {
"GetIamPolicy": {
"methods": [
"get_iam_policy"
]
},
"GetVulnerabilityOccurrencesSummary": {
"methods": [
"get_vulnerability_occurrences_summary"
]
},
"SetIamPolicy": {
"methods": [
"set_iam_policy"
]
},
"TestIamPermissions": {
"methods": [
"test_iam_permissions"
]
}
}
},
"grpc-async": {
"libraryClient": "ContainerAnalysisAsyncClient",
"rpcs": {
"GetIamPolicy": {
"methods": [
"get_iam_policy"
]
},
"GetVulnerabilityOccurrencesSummary": {
"methods": [
"get_vulnerability_occurrences_summary"
]
},
"SetIamPolicy": {
"methods": [
"set_iam_policy"
]
},
"TestIamPermissions": {
"methods": [
"test_iam_permissions"
]
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

from .client import ContainerAnalysisClient
from .async_client import ContainerAnalysisAsyncClient

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,24 +13,22 @@
# 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.devtools.containeranalysis_v1.types import containeranalysis
from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore
from google.iam.v1 import policy_pb2 as policy # type: ignore

from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from .transports.base import ContainerAnalysisTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import ContainerAnalysisGrpcAsyncIOTransport
from .client import ContainerAnalysisClient
Expand Down Expand Up @@ -70,32 +67,29 @@ class ContainerAnalysisAsyncClient:
parse_common_billing_account_path = staticmethod(
ContainerAnalysisClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(ContainerAnalysisClient.common_folder_path)
parse_common_folder_path = staticmethod(
ContainerAnalysisClient.parse_common_folder_path
)

common_organization_path = staticmethod(
ContainerAnalysisClient.common_organization_path
)
parse_common_organization_path = staticmethod(
ContainerAnalysisClient.parse_common_organization_path
)

common_project_path = staticmethod(ContainerAnalysisClient.common_project_path)
parse_common_project_path = staticmethod(
ContainerAnalysisClient.parse_common_project_path
)

common_location_path = staticmethod(ContainerAnalysisClient.common_location_path)
parse_common_location_path = staticmethod(
ContainerAnalysisClient.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.
Expand All @@ -110,7 +104,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
Expand All @@ -127,7 +121,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

@property
def transport(self) -> ContainerAnalysisTransport:
"""Return the transport used by the client instance.
"""Returns the transport used by the client instance.
Returns:
ContainerAnalysisTransport: The transport used by the client instance.
Expand All @@ -141,12 +135,12 @@ def transport(self) -> ContainerAnalysisTransport:
def __init__(
self,
*,
credentials: credentials.Credentials = None,
credentials: ga_credentials.Credentials = None,
transport: Union[str, ContainerAnalysisTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the container analysis client.
"""Instantiates the container analysis client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
Expand Down Expand Up @@ -178,7 +172,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""

self._client = ContainerAnalysisClient(
credentials=credentials,
transport=transport,
Expand All @@ -197,13 +190,13 @@ def get_grafeas_client(self) -> grafeas_v1.GrafeasClient:

async def set_iam_policy(
self,
request: iam_policy.SetIamPolicyRequest = None,
request: iam_policy_pb2.SetIamPolicyRequest = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy.Policy:
) -> policy_pb2.Policy:
r"""Sets the access control policy on the specified note or
occurrence. Requires ``containeranalysis.notes.setIamPolicy`` or
``containeranalysis.occurrences.setIamPolicy`` permission if the
Expand All @@ -227,7 +220,6 @@ async def set_iam_policy(
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down Expand Up @@ -306,10 +298,9 @@ async def set_iam_policy(
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy.SetIamPolicyRequest(**request)

request = iam_policy_pb2.SetIamPolicyRequest(**request)
elif not request:
request = iam_policy.SetIamPolicyRequest(resource=resource,)
request = iam_policy_pb2.SetIamPolicyRequest(resource=resource,)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -333,13 +324,13 @@ async def set_iam_policy(

async def get_iam_policy(
self,
request: iam_policy.GetIamPolicyRequest = None,
request: iam_policy_pb2.GetIamPolicyRequest = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy.Policy:
) -> policy_pb2.Policy:
r"""Gets the access control policy for a note or an occurrence
resource. Requires ``containeranalysis.notes.setIamPolicy`` or
``containeranalysis.occurrences.setIamPolicy`` permission if the
Expand All @@ -363,7 +354,6 @@ async def get_iam_policy(
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down Expand Up @@ -442,10 +432,9 @@ async def get_iam_policy(
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy.GetIamPolicyRequest(**request)

request = iam_policy_pb2.GetIamPolicyRequest(**request)
elif not request:
request = iam_policy.GetIamPolicyRequest(resource=resource,)
request = iam_policy_pb2.GetIamPolicyRequest(resource=resource,)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand All @@ -469,14 +458,14 @@ async def get_iam_policy(

async def test_iam_permissions(
self,
request: iam_policy.TestIamPermissionsRequest = None,
request: iam_policy_pb2.TestIamPermissionsRequest = None,
*,
resource: str = None,
permissions: Sequence[str] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> iam_policy.TestIamPermissionsResponse:
) -> iam_policy_pb2.TestIamPermissionsResponse:
r"""Returns the permissions that a caller has on the specified note
or occurrence. Requires list permission on the project (for
example, ``containeranalysis.notes.list``).
Expand Down Expand Up @@ -508,7 +497,6 @@ async def test_iam_permissions(
This corresponds to the ``permissions`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand All @@ -532,10 +520,9 @@ async def test_iam_permissions(
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = iam_policy.TestIamPermissionsRequest(**request)

request = iam_policy_pb2.TestIamPermissionsRequest(**request)
elif not request:
request = iam_policy.TestIamPermissionsRequest(
request = iam_policy_pb2.TestIamPermissionsRequest(
resource=resource, permissions=permissions,
)

Expand Down Expand Up @@ -588,7 +575,6 @@ async def get_vulnerability_occurrences_summary(
This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down Expand Up @@ -616,7 +602,6 @@ async def get_vulnerability_occurrences_summary(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if parent is not None:
request.parent = parent
if filter is not None:
Expand Down
Loading

0 comments on commit 642cfa9

Please sign in to comment.