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

Commit

Permalink
chore: upgrade gapic-generator-python to 0.46.3 (#22)
Browse files Browse the repository at this point in the history
feat: support self-signed JWT flow for service accounts

fix: add async client to %name_%version/init.py

chore: add autogenerated snippets

chore: remove auth, policy, and options from the reserved names list

chore: enable GAPIC metadata generation

chore: sort subpackages in %namespace/%name/init.py
  • Loading branch information
gcf-owl-bot[bot] committed May 20, 2021
1 parent ce65557 commit 0630fa0
Show file tree
Hide file tree
Showing 36 changed files with 1,046 additions and 581 deletions.
28 changes: 14 additions & 14 deletions google/cloud/servicecontrol/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

from google.cloud.servicecontrol_v1.services.quota_controller.async_client import (
QuotaControllerAsyncClient,
)
from google.cloud.servicecontrol_v1.services.quota_controller.client import (
QuotaControllerClient,
)
from google.cloud.servicecontrol_v1.services.service_controller.async_client import (
ServiceControllerAsyncClient,
from google.cloud.servicecontrol_v1.services.quota_controller.async_client import (
QuotaControllerAsyncClient,
)
from google.cloud.servicecontrol_v1.services.service_controller.client import (
ServiceControllerClient,
)
from google.cloud.servicecontrol_v1.services.service_controller.async_client import (
ServiceControllerAsyncClient,
)

from google.cloud.servicecontrol_v1.types.check_error import CheckError
from google.cloud.servicecontrol_v1.types.distribution import Distribution
from google.cloud.servicecontrol_v1.types.http_request import HttpRequest
Expand All @@ -46,11 +46,11 @@
from google.cloud.servicecontrol_v1.types.service_controller import ReportResponse

__all__ = (
"AllocateQuotaRequest",
"AllocateQuotaResponse",
"QuotaControllerClient",
"QuotaControllerAsyncClient",
"ServiceControllerClient",
"ServiceControllerAsyncClient",
"CheckError",
"CheckRequest",
"CheckResponse",
"Distribution",
"HttpRequest",
"LogEntry",
Expand All @@ -59,12 +59,12 @@
"MetricValue",
"MetricValueSet",
"Operation",
"QuotaControllerAsyncClient",
"QuotaControllerClient",
"AllocateQuotaRequest",
"AllocateQuotaResponse",
"QuotaError",
"QuotaOperation",
"CheckRequest",
"CheckResponse",
"ReportRequest",
"ReportResponse",
"ServiceControllerAsyncClient",
"ServiceControllerClient",
)
7 changes: 5 additions & 2 deletions google/cloud/servicecontrol_v1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

from .services.quota_controller import QuotaControllerClient
from .services.quota_controller import QuotaControllerAsyncClient
from .services.service_controller import ServiceControllerClient
from .services.service_controller import ServiceControllerAsyncClient

from .types.check_error import CheckError
from .types.distribution import Distribution
from .types.http_request import HttpRequest
Expand All @@ -35,8 +37,9 @@
from .types.service_controller import ReportRequest
from .types.service_controller import ReportResponse


__all__ = (
"QuotaControllerAsyncClient",
"ServiceControllerAsyncClient",
"AllocateQuotaRequest",
"AllocateQuotaResponse",
"CheckError",
Expand Down
67 changes: 67 additions & 0 deletions google/cloud/servicecontrol_v1/gapic_metadata.json
@@ -0,0 +1,67 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.servicecontrol_v1",
"protoPackage": "google.api.servicecontrol.v1",
"schema": "1.0",
"services": {
"QuotaController": {
"clients": {
"grpc": {
"libraryClient": "QuotaControllerClient",
"rpcs": {
"AllocateQuota": {
"methods": [
"allocate_quota"
]
}
}
},
"grpc-async": {
"libraryClient": "QuotaControllerAsyncClient",
"rpcs": {
"AllocateQuota": {
"methods": [
"allocate_quota"
]
}
}
}
}
},
"ServiceController": {
"clients": {
"grpc": {
"libraryClient": "ServiceControllerClient",
"rpcs": {
"Check": {
"methods": [
"check"
]
},
"Report": {
"methods": [
"report"
]
}
}
},
"grpc-async": {
"libraryClient": "ServiceControllerAsyncClient",
"rpcs": {
"Check": {
"methods": [
"check"
]
},
"Report": {
"methods": [
"report"
]
}
}
}
}
}
}
}
1 change: 0 additions & 1 deletion google/cloud/servicecontrol_v1/services/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
@@ -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 QuotaControllerClient
from .async_client import QuotaControllerAsyncClient

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

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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.servicecontrol_v1.types import metric_value
from google.cloud.servicecontrol_v1.types import quota_controller

from .transports.base import QuotaControllerTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import QuotaControllerGrpcAsyncIOTransport
from .client import QuotaControllerClient
Expand All @@ -55,32 +52,29 @@ class QuotaControllerAsyncClient:
parse_common_billing_account_path = staticmethod(
QuotaControllerClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(QuotaControllerClient.common_folder_path)
parse_common_folder_path = staticmethod(
QuotaControllerClient.parse_common_folder_path
)

common_organization_path = staticmethod(
QuotaControllerClient.common_organization_path
)
parse_common_organization_path = staticmethod(
QuotaControllerClient.parse_common_organization_path
)

common_project_path = staticmethod(QuotaControllerClient.common_project_path)
parse_common_project_path = staticmethod(
QuotaControllerClient.parse_common_project_path
)

common_location_path = staticmethod(QuotaControllerClient.common_location_path)
parse_common_location_path = staticmethod(
QuotaControllerClient.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 @@ -95,7 +89,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 @@ -112,7 +106,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

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

self._client = QuotaControllerClient(
credentials=credentials,
transport=transport,
Expand Down Expand Up @@ -196,7 +189,6 @@ async def allocate_quota(
request (:class:`google.cloud.servicecontrol_v1.types.AllocateQuotaRequest`):
The request object. Request message for the
AllocateQuota method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand All @@ -210,7 +202,6 @@ async def allocate_quota(
"""
# Create or coerce a protobuf request object.

request = quota_controller.AllocateQuotaRequest(request)

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

0 comments on commit 0630fa0

Please sign in to comment.