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

Commit 2e193c3

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#144)
* 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: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b 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>
1 parent 7e8512a commit 2e193c3

16 files changed

+111
-112
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.4.1" # {x-release-please-version}

google/cloud/deploy_v1/services/cloud_deploy/async_client.py

Lines changed: 44 additions & 48 deletions
Large diffs are not rendered by default.

google/cloud/deploy_v1/services/cloud_deploy/client.py

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.deploy_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -670,7 +671,7 @@ def list_delivery_pipelines(
670671
*,
671672
parent: Optional[str] = None,
672673
retry: OptionalRetry = gapic_v1.method.DEFAULT,
673-
timeout: Optional[float] = None,
674+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
674675
metadata: Sequence[Tuple[str, str]] = (),
675676
) -> pagers.ListDeliveryPipelinesPager:
676677
r"""Lists DeliveryPipelines in a given project and
@@ -786,7 +787,7 @@ def get_delivery_pipeline(
786787
*,
787788
name: Optional[str] = None,
788789
retry: OptionalRetry = gapic_v1.method.DEFAULT,
789-
timeout: Optional[float] = None,
790+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
790791
metadata: Sequence[Tuple[str, str]] = (),
791792
) -> cloud_deploy.DeliveryPipeline:
792793
r"""Gets details of a single DeliveryPipeline.
@@ -896,7 +897,7 @@ def create_delivery_pipeline(
896897
delivery_pipeline: Optional[cloud_deploy.DeliveryPipeline] = None,
897898
delivery_pipeline_id: Optional[str] = None,
898899
retry: OptionalRetry = gapic_v1.method.DEFAULT,
899-
timeout: Optional[float] = None,
900+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
900901
metadata: Sequence[Tuple[str, str]] = (),
901902
) -> operation.Operation:
902903
r"""Creates a new DeliveryPipeline in a given project and
@@ -1037,7 +1038,7 @@ def update_delivery_pipeline(
10371038
delivery_pipeline: Optional[cloud_deploy.DeliveryPipeline] = None,
10381039
update_mask: Optional[field_mask_pb2.FieldMask] = None,
10391040
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1040-
timeout: Optional[float] = None,
1041+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10411042
metadata: Sequence[Tuple[str, str]] = (),
10421043
) -> operation.Operation:
10431044
r"""Updates the parameters of a single DeliveryPipeline.
@@ -1173,7 +1174,7 @@ def delete_delivery_pipeline(
11731174
*,
11741175
name: Optional[str] = None,
11751176
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1176-
timeout: Optional[float] = None,
1177+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11771178
metadata: Sequence[Tuple[str, str]] = (),
11781179
) -> operation.Operation:
11791180
r"""Deletes a single DeliveryPipeline.
@@ -1298,7 +1299,7 @@ def list_targets(
12981299
*,
12991300
parent: Optional[str] = None,
13001301
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1301-
timeout: Optional[float] = None,
1302+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13021303
metadata: Sequence[Tuple[str, str]] = (),
13031304
) -> pagers.ListTargetsPager:
13041305
r"""Lists Targets in a given project and location.
@@ -1413,7 +1414,7 @@ def get_target(
14131414
*,
14141415
name: Optional[str] = None,
14151416
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1416-
timeout: Optional[float] = None,
1417+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14171418
metadata: Sequence[Tuple[str, str]] = (),
14181419
) -> cloud_deploy.Target:
14191420
r"""Gets details of a single Target.
@@ -1518,7 +1519,7 @@ def create_target(
15181519
target: Optional[cloud_deploy.Target] = None,
15191520
target_id: Optional[str] = None,
15201521
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1521-
timeout: Optional[float] = None,
1522+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15221523
metadata: Sequence[Tuple[str, str]] = (),
15231524
) -> operation.Operation:
15241525
r"""Creates a new Target in a given project and location.
@@ -1655,7 +1656,7 @@ def update_target(
16551656
target: Optional[cloud_deploy.Target] = None,
16561657
update_mask: Optional[field_mask_pb2.FieldMask] = None,
16571658
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1658-
timeout: Optional[float] = None,
1659+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16591660
metadata: Sequence[Tuple[str, str]] = (),
16601661
) -> operation.Operation:
16611662
r"""Updates the parameters of a single Target.
@@ -1787,7 +1788,7 @@ def delete_target(
17871788
*,
17881789
name: Optional[str] = None,
17891790
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1790-
timeout: Optional[float] = None,
1791+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17911792
metadata: Sequence[Tuple[str, str]] = (),
17921793
) -> operation.Operation:
17931794
r"""Deletes a single Target.
@@ -1912,7 +1913,7 @@ def list_releases(
19121913
*,
19131914
parent: Optional[str] = None,
19141915
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1915-
timeout: Optional[float] = None,
1916+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19161917
metadata: Sequence[Tuple[str, str]] = (),
19171918
) -> pagers.ListReleasesPager:
19181919
r"""Lists Releases in a given project and location.
@@ -2026,7 +2027,7 @@ def get_release(
20262027
*,
20272028
name: Optional[str] = None,
20282029
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2029-
timeout: Optional[float] = None,
2030+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20302031
metadata: Sequence[Tuple[str, str]] = (),
20312032
) -> cloud_deploy.Release:
20322033
r"""Gets details of a single Release.
@@ -2131,7 +2132,7 @@ def create_release(
21312132
release: Optional[cloud_deploy.Release] = None,
21322133
release_id: Optional[str] = None,
21332134
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2134-
timeout: Optional[float] = None,
2135+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21352136
metadata: Sequence[Tuple[str, str]] = (),
21362137
) -> operation.Operation:
21372138
r"""Creates a new Release in a given project and
@@ -2268,7 +2269,7 @@ def abandon_release(
22682269
*,
22692270
name: Optional[str] = None,
22702271
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2271-
timeout: Optional[float] = None,
2272+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22722273
metadata: Sequence[Tuple[str, str]] = (),
22732274
) -> cloud_deploy.AbandonReleaseResponse:
22742275
r"""Abandons a Release in the Delivery Pipeline.
@@ -2370,7 +2371,7 @@ def approve_rollout(
23702371
*,
23712372
name: Optional[str] = None,
23722373
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2373-
timeout: Optional[float] = None,
2374+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23742375
metadata: Sequence[Tuple[str, str]] = (),
23752376
) -> cloud_deploy.ApproveRolloutResponse:
23762377
r"""Approves a Rollout.
@@ -2473,7 +2474,7 @@ def list_rollouts(
24732474
*,
24742475
parent: Optional[str] = None,
24752476
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2476-
timeout: Optional[float] = None,
2477+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24772478
metadata: Sequence[Tuple[str, str]] = (),
24782479
) -> pagers.ListRolloutsPager:
24792480
r"""Lists Rollouts in a given project and location.
@@ -2588,7 +2589,7 @@ def get_rollout(
25882589
*,
25892590
name: Optional[str] = None,
25902591
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2591-
timeout: Optional[float] = None,
2592+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
25922593
metadata: Sequence[Tuple[str, str]] = (),
25932594
) -> cloud_deploy.Rollout:
25942595
r"""Gets details of a single Rollout.
@@ -2694,7 +2695,7 @@ def create_rollout(
26942695
rollout: Optional[cloud_deploy.Rollout] = None,
26952696
rollout_id: Optional[str] = None,
26962697
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2697-
timeout: Optional[float] = None,
2698+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
26982699
metadata: Sequence[Tuple[str, str]] = (),
26992700
) -> operation.Operation:
27002701
r"""Creates a new Rollout in a given project and
@@ -2837,7 +2838,7 @@ def retry_job(
28372838
phase_id: Optional[str] = None,
28382839
job_id: Optional[str] = None,
28392840
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2840-
timeout: Optional[float] = None,
2841+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
28412842
metadata: Sequence[Tuple[str, str]] = (),
28422843
) -> cloud_deploy.RetryJobResponse:
28432844
r"""Retries the specified Job in a Rollout.
@@ -2959,7 +2960,7 @@ def list_job_runs(
29592960
*,
29602961
parent: Optional[str] = None,
29612962
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2962-
timeout: Optional[float] = None,
2963+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
29632964
metadata: Sequence[Tuple[str, str]] = (),
29642965
) -> pagers.ListJobRunsPager:
29652966
r"""Lists JobRuns in a given project and location.
@@ -3074,7 +3075,7 @@ def get_job_run(
30743075
*,
30753076
name: Optional[str] = None,
30763077
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3077-
timeout: Optional[float] = None,
3078+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
30783079
metadata: Sequence[Tuple[str, str]] = (),
30793080
) -> cloud_deploy.JobRun:
30803081
r"""Gets details of a single JobRun.
@@ -3178,7 +3179,7 @@ def get_config(
31783179
*,
31793180
name: Optional[str] = None,
31803181
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3181-
timeout: Optional[float] = None,
3182+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
31823183
metadata: Sequence[Tuple[str, str]] = (),
31833184
) -> cloud_deploy.Config:
31843185
r"""Gets the configuration for a location.
@@ -3289,7 +3290,7 @@ def list_operations(
32893290
request: Optional[operations_pb2.ListOperationsRequest] = None,
32903291
*,
32913292
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3292-
timeout: Optional[float] = None,
3293+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
32933294
metadata: Sequence[Tuple[str, str]] = (),
32943295
) -> operations_pb2.ListOperationsResponse:
32953296
r"""Lists operations that match the specified filter in the request.
@@ -3343,7 +3344,7 @@ def get_operation(
33433344
request: Optional[operations_pb2.GetOperationRequest] = None,
33443345
*,
33453346
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3346-
timeout: Optional[float] = None,
3347+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
33473348
metadata: Sequence[Tuple[str, str]] = (),
33483349
) -> operations_pb2.Operation:
33493350
r"""Gets the latest state of a long-running operation.
@@ -3397,7 +3398,7 @@ def delete_operation(
33973398
request: Optional[operations_pb2.DeleteOperationRequest] = None,
33983399
*,
33993400
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3400-
timeout: Optional[float] = None,
3401+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
34013402
metadata: Sequence[Tuple[str, str]] = (),
34023403
) -> None:
34033404
r"""Deletes a long-running operation.
@@ -3452,7 +3453,7 @@ def cancel_operation(
34523453
request: Optional[operations_pb2.CancelOperationRequest] = None,
34533454
*,
34543455
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3455-
timeout: Optional[float] = None,
3456+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
34563457
metadata: Sequence[Tuple[str, str]] = (),
34573458
) -> None:
34583459
r"""Starts asynchronous cancellation on a long-running operation.
@@ -3506,7 +3507,7 @@ def set_iam_policy(
35063507
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
35073508
*,
35083509
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3509-
timeout: Optional[float] = None,
3510+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
35103511
metadata: Sequence[Tuple[str, str]] = (),
35113512
) -> policy_pb2.Policy:
35123513
r"""Sets the IAM access control policy on the specified function.
@@ -3626,7 +3627,7 @@ def get_iam_policy(
36263627
request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
36273628
*,
36283629
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3629-
timeout: Optional[float] = None,
3630+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
36303631
metadata: Sequence[Tuple[str, str]] = (),
36313632
) -> policy_pb2.Policy:
36323633
r"""Gets the IAM access control policy for a function.
@@ -3747,7 +3748,7 @@ def test_iam_permissions(
37473748
request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
37483749
*,
37493750
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3750-
timeout: Optional[float] = None,
3751+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
37513752
metadata: Sequence[Tuple[str, str]] = (),
37523753
) -> iam_policy_pb2.TestIamPermissionsResponse:
37533754
r"""Tests the specified IAM permissions against the IAM access control
@@ -3806,7 +3807,7 @@ def get_location(
38063807
request: Optional[locations_pb2.GetLocationRequest] = None,
38073808
*,
38083809
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3809-
timeout: Optional[float] = None,
3810+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
38103811
metadata: Sequence[Tuple[str, str]] = (),
38113812
) -> locations_pb2.Location:
38123813
r"""Gets information about a location.
@@ -3860,7 +3861,7 @@ def list_locations(
38603861
request: Optional[locations_pb2.ListLocationsRequest] = None,
38613862
*,
38623863
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3863-
timeout: Optional[float] = None,
3864+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
38643865
metadata: Sequence[Tuple[str, str]] = (),
38653866
) -> locations_pb2.ListLocationsResponse:
38663867
r"""Lists information about the supported locations for this service.
@@ -3910,14 +3911,9 @@ def list_locations(
39103911
return response
39113912

39123913

3913-
try:
3914-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
3915-
gapic_version=pkg_resources.get_distribution(
3916-
"google-cloud-deploy",
3917-
).version,
3918-
)
3919-
except pkg_resources.DistributionNotFound:
3920-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
3914+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
3915+
gapic_version=package_version.__version__
3916+
)
39213917

39223918

39233919
__all__ = ("CloudDeployClient",)

google/cloud/deploy_v1/services/cloud_deploy/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,13 @@
2727
from google.iam.v1 import policy_pb2 # type: ignore
2828
from google.longrunning import operations_pb2 # type: ignore
2929
from google.oauth2 import service_account # type: ignore
30-
import pkg_resources
3130

31+
from google.cloud.deploy_v1 import gapic_version as package_version
3232
from google.cloud.deploy_v1.types import cloud_deploy
3333

34-
try:
35-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
36-
gapic_version=pkg_resources.get_distribution(
37-
"google-cloud-deploy",
38-
).version,
39-
)
40-
except pkg_resources.DistributionNotFound:
41-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
34+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35+
gapic_version=package_version.__version__
36+
)
4237

4338

4439
class CloudDeployTransport(abc.ABC):

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
".": {
55
"release-type": "python",
66
"extra-files": [
7+
"google/cloud/deploy_v1/gapic_version.py",
78
"google/cloud/deploy/gapic_version.py",
89
{
910
"type": "json",

samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_delivery_pipeline_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def sample_create_delivery_pipeline():
4949

5050
print("Waiting for operation to complete...")
5151

52-
response = await operation.result()
52+
response = (await operation).result()
5353

5454
# Handle the response
5555
print(response)

samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_release_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def sample_create_release():
4949

5050
print("Waiting for operation to complete...")
5151

52-
response = await operation.result()
52+
response = (await operation).result()
5353

5454
# Handle the response
5555
print(response)

samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_rollout_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def sample_create_rollout():
5353

5454
print("Waiting for operation to complete...")
5555

56-
response = await operation.result()
56+
response = (await operation).result()
5757

5858
# Handle the response
5959
print(response)

samples/generated_samples/clouddeploy_v1_generated_cloud_deploy_create_target_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def sample_create_target():
4949

5050
print("Waiting for operation to complete...")
5151

52-
response = await operation.result()
52+
response = (await operation).result()
5353

5454
# Handle the response
5555
print(response)

0 commit comments

Comments
 (0)