Skip to content
Permalink
Browse files
chore: upgrade gapic-generator-python to 0.46.3 (#22)
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 committed May 20, 2021
1 parent ce65557 commit 0630fa0538a633297cae935bd094443d7eeb8d45
Showing with 1,046 additions and 581 deletions.
  1. +14 −14 google/cloud/servicecontrol/__init__.py
  2. +5 −2 google/cloud/servicecontrol_v1/__init__.py
  3. +67 −0 google/cloud/servicecontrol_v1/gapic_metadata.json
  4. +0 −1 google/cloud/servicecontrol_v1/services/__init__.py
  5. +0 −2 google/cloud/servicecontrol_v1/services/quota_controller/__init__.py
  6. +8 −17 google/cloud/servicecontrol_v1/services/quota_controller/async_client.py
  7. +30 −29 google/cloud/servicecontrol_v1/services/quota_controller/client.py
  8. +0 −2 google/cloud/servicecontrol_v1/services/quota_controller/transports/__init__.py
  9. +82 −22 google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py
  10. +11 −11 google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py
  11. +11 −12 google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py
  12. +0 −2 google/cloud/servicecontrol_v1/services/service_controller/__init__.py
  13. +8 −19 google/cloud/servicecontrol_v1/services/service_controller/async_client.py
  14. +30 −31 google/cloud/servicecontrol_v1/services/service_controller/client.py
  15. +0 −2 google/cloud/servicecontrol_v1/services/service_controller/transports/__init__.py
  16. +85 −25 google/cloud/servicecontrol_v1/services/service_controller/transports/base.py
  17. +11 −11 google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py
  18. +11 −12 google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py
  19. +0 −2 google/cloud/servicecontrol_v1/types/__init__.py
  20. +4 −10 google/cloud/servicecontrol_v1/types/check_error.py
  21. +13 −30 google/cloud/servicecontrol_v1/types/distribution.py
  22. +16 −33 google/cloud/servicecontrol_v1/types/http_request.py
  23. +20 −40 google/cloud/servicecontrol_v1/types/log_entry.py
  24. +9 −21 google/cloud/servicecontrol_v1/types/metric_value.py
  25. +9 −22 google/cloud/servicecontrol_v1/types/operation.py
  26. +10 −28 google/cloud/servicecontrol_v1/types/quota_controller.py
  27. +15 −38 google/cloud/servicecontrol_v1/types/service_controller.py
  28. +4 −7 scripts/fixup_servicecontrol_v1_keywords.py
  29. +1 −0 setup.py
  30. +2 −0 testing/constraints-3.6.txt
  31. +15 −0 tests/__init__.py
  32. +15 −0 tests/unit/__init__.py
  33. +15 −0 tests/unit/gapic/__init__.py
  34. +0 −1 tests/unit/gapic/servicecontrol_v1/__init__.py
  35. +259 −58 tests/unit/gapic/servicecontrol_v1/test_quota_controller.py
  36. +266 −77 tests/unit/gapic/servicecontrol_v1/test_service_controller.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -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
@@ -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",
@@ -59,12 +59,12 @@
"MetricValue",
"MetricValueSet",
"Operation",
"QuotaControllerAsyncClient",
"QuotaControllerClient",
"AllocateQuotaRequest",
"AllocateQuotaResponse",
"QuotaError",
"QuotaOperation",
"CheckRequest",
"CheckResponse",
"ReportRequest",
"ReportResponse",
"ServiceControllerAsyncClient",
"ServiceControllerClient",
)
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -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
@@ -35,8 +37,9 @@
from .types.service_controller import ReportRequest
from .types.service_controller import ReportResponse


__all__ = (
"QuotaControllerAsyncClient",
"ServiceControllerAsyncClient",
"AllocateQuotaRequest",
"AllocateQuotaResponse",
"CheckError",
@@ -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,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 QuotaControllerClient
from .async_client import QuotaControllerAsyncClient

@@ -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.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
@@ -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.
@@ -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
@@ -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.
@@ -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
@@ -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,
@@ -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.
@@ -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,
Loading

0 comments on commit 0630fa0

Please sign in to comment.