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

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#181)
Browse files Browse the repository at this point in the history
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

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

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Dec 8, 2022
1 parent 9c86c72 commit c5f88eb
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 70 deletions.
5 changes: 0 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
16 changes: 16 additions & 0 deletions google/cloud/servicemanagement_v1/gapic_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- 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.
#
__version__ = "1.3.3" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.servicemanagement_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -248,7 +249,7 @@ async def list_services(
producer_project_id: Optional[str] = None,
consumer_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServicesAsyncPager:
r"""Lists managed services.
Expand Down Expand Up @@ -371,7 +372,7 @@ async def get_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.ManagedService:
r"""Gets a managed service. Authentication is required
Expand Down Expand Up @@ -478,7 +479,7 @@ async def create_service(
*,
service: Optional[resources.ManagedService] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new managed service.
Expand Down Expand Up @@ -517,7 +518,7 @@ async def sample_create_service():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -597,7 +598,7 @@ async def delete_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes a managed service. This method will change the service
Expand Down Expand Up @@ -634,7 +635,7 @@ async def sample_delete_service():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -732,7 +733,7 @@ async def undelete_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Revives a previously deleted managed service. The
Expand Down Expand Up @@ -768,7 +769,7 @@ async def sample_undelete_service():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -859,7 +860,7 @@ async def list_service_configs(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServiceConfigsAsyncPager:
r"""Lists the history of the service configuration for a
Expand Down Expand Up @@ -981,7 +982,7 @@ async def get_service_config(
config_id: Optional[str] = None,
view: Optional[servicemanager.GetServiceConfigRequest.ConfigView] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> service_pb2.Service:
r"""Gets a service configuration (version) for a managed
Expand Down Expand Up @@ -1143,7 +1144,7 @@ async def create_service_config(
service_name: Optional[str] = None,
service_config: Optional[service_pb2.Service] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> service_pb2.Service:
r"""Creates a new service configuration (version) for a managed
Expand Down Expand Up @@ -1295,7 +1296,7 @@ async def submit_config_source(
config_source: Optional[resources.ConfigSource] = None,
validate_only: Optional[bool] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new service configuration (version) for a managed
Expand Down Expand Up @@ -1337,7 +1338,7 @@ async def sample_submit_config_source():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1451,7 +1452,7 @@ async def list_service_rollouts(
service_name: Optional[str] = None,
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServiceRolloutsAsyncPager:
r"""Lists the history of the service configuration
Expand Down Expand Up @@ -1590,7 +1591,7 @@ async def get_service_rollout(
service_name: Optional[str] = None,
rollout_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Rollout:
r"""Gets a service configuration
Expand Down Expand Up @@ -1717,7 +1718,7 @@ async def create_service_rollout(
service_name: Optional[str] = None,
rollout: Optional[resources.Rollout] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new service configuration rollout. Based on
Expand Down Expand Up @@ -1763,7 +1764,7 @@ async def sample_create_service_rollout():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1867,7 +1868,7 @@ async def generate_config_report(
new_config: Optional[any_pb2.Any] = None,
old_config: Optional[any_pb2.Any] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> servicemanager.GenerateConfigReportResponse:
r"""Generates and returns a report (errors, warnings and changes
Expand Down Expand Up @@ -1991,14 +1992,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-service-management",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("ServiceManagerAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.servicemanagement_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -455,7 +456,7 @@ def list_services(
producer_project_id: Optional[str] = None,
consumer_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServicesPager:
r"""Lists managed services.
Expand Down Expand Up @@ -578,7 +579,7 @@ def get_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.ManagedService:
r"""Gets a managed service. Authentication is required
Expand Down Expand Up @@ -685,7 +686,7 @@ def create_service(
*,
service: Optional[resources.ManagedService] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Creates a new managed service.
Expand Down Expand Up @@ -804,7 +805,7 @@ def delete_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Deletes a managed service. This method will change the service
Expand Down Expand Up @@ -939,7 +940,7 @@ def undelete_service(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Revives a previously deleted managed service. The
Expand Down Expand Up @@ -1066,7 +1067,7 @@ def list_service_configs(
*,
service_name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServiceConfigsPager:
r"""Lists the history of the service configuration for a
Expand Down Expand Up @@ -1188,7 +1189,7 @@ def get_service_config(
config_id: Optional[str] = None,
view: Optional[servicemanager.GetServiceConfigRequest.ConfigView] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> service_pb2.Service:
r"""Gets a service configuration (version) for a managed
Expand Down Expand Up @@ -1350,7 +1351,7 @@ def create_service_config(
service_name: Optional[str] = None,
service_config: Optional[service_pb2.Service] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> service_pb2.Service:
r"""Creates a new service configuration (version) for a managed
Expand Down Expand Up @@ -1502,7 +1503,7 @@ def submit_config_source(
config_source: Optional[resources.ConfigSource] = None,
validate_only: Optional[bool] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Creates a new service configuration (version) for a managed
Expand Down Expand Up @@ -1658,7 +1659,7 @@ def list_service_rollouts(
service_name: Optional[str] = None,
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListServiceRolloutsPager:
r"""Lists the history of the service configuration
Expand Down Expand Up @@ -1797,7 +1798,7 @@ def get_service_rollout(
service_name: Optional[str] = None,
rollout_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> resources.Rollout:
r"""Gets a service configuration
Expand Down Expand Up @@ -1924,7 +1925,7 @@ def create_service_rollout(
service_name: Optional[str] = None,
rollout: Optional[resources.Rollout] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Creates a new service configuration rollout. Based on
Expand Down Expand Up @@ -2074,7 +2075,7 @@ def generate_config_report(
new_config: Optional[any_pb2.Any] = None,
old_config: Optional[any_pb2.Any] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> servicemanager.GenerateConfigReportResponse:
r"""Generates and returns a report (errors, warnings and changes
Expand Down Expand Up @@ -2205,14 +2206,9 @@ def __exit__(self, type, value, traceback):
self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-service-management",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("ServiceManagerClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@
from google.auth import credentials as ga_credentials # type: ignore
from google.longrunning import operations_pb2 # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.servicemanagement_v1 import gapic_version as package_version
from google.cloud.servicemanagement_v1.types import resources, servicemanager

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-service-management",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class ServiceManagerTransport(abc.ABC):
Expand Down
1 change: 1 addition & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
".": {
"release-type": "python",
"extra-files": [
"google/cloud/servicemanagement_v1/gapic_version.py",
"google/cloud/servicemanagement/gapic_version.py",
{
"type": "json",
Expand Down
Loading

0 comments on commit c5f88eb

Please sign in to comment.