Skip to content

Commit a79f41d

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#193)
* 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>
1 parent c3056f0 commit a79f41d

15 files changed

+67
-68
lines changed

packages/google-cloud-managed-identities/.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.5.4" # {x-release-please-version}

packages/google-cloud-managed-identities/google/cloud/managedidentities_v1/services/managed_identities_service/async_client.py

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.managedidentities_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -269,7 +270,7 @@ async def create_microsoft_ad_domain(
269270
domain_name: Optional[str] = None,
270271
domain: Optional[resource.Domain] = None,
271272
retry: OptionalRetry = gapic_v1.method.DEFAULT,
272-
timeout: Optional[float] = None,
273+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
273274
metadata: Sequence[Tuple[str, str]] = (),
274275
) -> operation_async.AsyncOperation:
275276
r"""Creates a Microsoft AD domain.
@@ -306,7 +307,7 @@ async def sample_create_microsoft_ad_domain():
306307
307308
print("Waiting for operation to complete...")
308309
309-
response = await operation.result()
310+
response = (await operation).result()
310311
311312
# Handle the response
312313
print(response)
@@ -425,7 +426,7 @@ async def reset_admin_password(
425426
*,
426427
name: Optional[str] = None,
427428
retry: OptionalRetry = gapic_v1.method.DEFAULT,
428-
timeout: Optional[float] = None,
429+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
429430
metadata: Sequence[Tuple[str, str]] = (),
430431
) -> managed_identities_service.ResetAdminPasswordResponse:
431432
r"""Resets a domain's administrator password.
@@ -529,7 +530,7 @@ async def list_domains(
529530
*,
530531
parent: Optional[str] = None,
531532
retry: OptionalRetry = gapic_v1.method.DEFAULT,
532-
timeout: Optional[float] = None,
533+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
533534
metadata: Sequence[Tuple[str, str]] = (),
534535
) -> pagers.ListDomainsAsyncPager:
535536
r"""Lists domains in a project.
@@ -646,7 +647,7 @@ async def get_domain(
646647
*,
647648
name: Optional[str] = None,
648649
retry: OptionalRetry = gapic_v1.method.DEFAULT,
649-
timeout: Optional[float] = None,
650+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
650651
metadata: Sequence[Tuple[str, str]] = (),
651652
) -> resource.Domain:
652653
r"""Gets information about a domain.
@@ -751,7 +752,7 @@ async def update_domain(
751752
domain: Optional[resource.Domain] = None,
752753
update_mask: Optional[field_mask_pb2.FieldMask] = None,
753754
retry: OptionalRetry = gapic_v1.method.DEFAULT,
754-
timeout: Optional[float] = None,
755+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
755756
metadata: Sequence[Tuple[str, str]] = (),
756757
) -> operation_async.AsyncOperation:
757758
r"""Updates the metadata and configuration of a domain.
@@ -786,7 +787,7 @@ async def sample_update_domain():
786787
787788
print("Waiting for operation to complete...")
788789
789-
response = await operation.result()
790+
response = (await operation).result()
790791
791792
# Handle the response
792793
print(response)
@@ -892,7 +893,7 @@ async def delete_domain(
892893
*,
893894
name: Optional[str] = None,
894895
retry: OptionalRetry = gapic_v1.method.DEFAULT,
895-
timeout: Optional[float] = None,
896+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
896897
metadata: Sequence[Tuple[str, str]] = (),
897898
) -> operation_async.AsyncOperation:
898899
r"""Deletes a domain.
@@ -922,7 +923,7 @@ async def sample_delete_domain():
922923
923924
print("Waiting for operation to complete...")
924925
925-
response = await operation.result()
926+
response = (await operation).result()
926927
927928
# Handle the response
928929
print(response)
@@ -1019,7 +1020,7 @@ async def attach_trust(
10191020
name: Optional[str] = None,
10201021
trust: Optional[resource.Trust] = None,
10211022
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1022-
timeout: Optional[float] = None,
1023+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10231024
metadata: Sequence[Tuple[str, str]] = (),
10241025
) -> operation_async.AsyncOperation:
10251026
r"""Adds an AD trust to a domain.
@@ -1057,7 +1058,7 @@ async def sample_attach_trust():
10571058
10581059
print("Waiting for operation to complete...")
10591060
1060-
response = await operation.result()
1061+
response = (await operation).result()
10611062
10621063
# Handle the response
10631064
print(response)
@@ -1156,7 +1157,7 @@ async def reconfigure_trust(
11561157
target_domain_name: Optional[str] = None,
11571158
target_dns_ip_addresses: Optional[MutableSequence[str]] = None,
11581159
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1159-
timeout: Optional[float] = None,
1160+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11601161
metadata: Sequence[Tuple[str, str]] = (),
11611162
) -> operation_async.AsyncOperation:
11621163
r"""Updates the DNS conditional forwarder.
@@ -1188,7 +1189,7 @@ async def sample_reconfigure_trust():
11881189
11891190
print("Waiting for operation to complete...")
11901191
1191-
response = await operation.result()
1192+
response = (await operation).result()
11921193
11931194
# Handle the response
11941195
print(response)
@@ -1299,7 +1300,7 @@ async def detach_trust(
12991300
name: Optional[str] = None,
13001301
trust: Optional[resource.Trust] = None,
13011302
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1302-
timeout: Optional[float] = None,
1303+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13031304
metadata: Sequence[Tuple[str, str]] = (),
13041305
) -> operation_async.AsyncOperation:
13051306
r"""Removes an AD trust.
@@ -1337,7 +1338,7 @@ async def sample_detach_trust():
13371338
13381339
print("Waiting for operation to complete...")
13391340
1340-
response = await operation.result()
1341+
response = (await operation).result()
13411342
13421343
# Handle the response
13431344
print(response)
@@ -1437,7 +1438,7 @@ async def validate_trust(
14371438
name: Optional[str] = None,
14381439
trust: Optional[resource.Trust] = None,
14391440
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1440-
timeout: Optional[float] = None,
1441+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14411442
metadata: Sequence[Tuple[str, str]] = (),
14421443
) -> operation_async.AsyncOperation:
14431444
r"""Validates a trust state, that the target domain is
@@ -1477,7 +1478,7 @@ async def sample_validate_trust():
14771478
14781479
print("Waiting for operation to complete...")
14791480
1480-
response = await operation.result()
1481+
response = (await operation).result()
14811482
14821483
# Handle the response
14831484
print(response)
@@ -1575,14 +1576,9 @@ async def __aexit__(self, exc_type, exc, tb):
15751576
await self.transport.close()
15761577

15771578

1578-
try:
1579-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1580-
gapic_version=pkg_resources.get_distribution(
1581-
"google-cloud-managed-identities",
1582-
).version,
1583-
)
1584-
except pkg_resources.DistributionNotFound:
1585-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1579+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1580+
gapic_version=package_version.__version__
1581+
)
15861582

15871583

15881584
__all__ = ("ManagedIdentitiesServiceAsyncClient",)

packages/google-cloud-managed-identities/google/cloud/managedidentities_v1/services/managed_identities_service/client.py

Lines changed: 15 additions & 19 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.managedidentities_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -491,7 +492,7 @@ def create_microsoft_ad_domain(
491492
domain_name: Optional[str] = None,
492493
domain: Optional[resource.Domain] = None,
493494
retry: OptionalRetry = gapic_v1.method.DEFAULT,
494-
timeout: Optional[float] = None,
495+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
495496
metadata: Sequence[Tuple[str, str]] = (),
496497
) -> operation.Operation:
497498
r"""Creates a Microsoft AD domain.
@@ -651,7 +652,7 @@ def reset_admin_password(
651652
*,
652653
name: Optional[str] = None,
653654
retry: OptionalRetry = gapic_v1.method.DEFAULT,
654-
timeout: Optional[float] = None,
655+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
655656
metadata: Sequence[Tuple[str, str]] = (),
656657
) -> managed_identities_service.ResetAdminPasswordResponse:
657658
r"""Resets a domain's administrator password.
@@ -757,7 +758,7 @@ def list_domains(
757758
*,
758759
parent: Optional[str] = None,
759760
retry: OptionalRetry = gapic_v1.method.DEFAULT,
760-
timeout: Optional[float] = None,
761+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
761762
metadata: Sequence[Tuple[str, str]] = (),
762763
) -> pagers.ListDomainsPager:
763764
r"""Lists domains in a project.
@@ -874,7 +875,7 @@ def get_domain(
874875
*,
875876
name: Optional[str] = None,
876877
retry: OptionalRetry = gapic_v1.method.DEFAULT,
877-
timeout: Optional[float] = None,
878+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
878879
metadata: Sequence[Tuple[str, str]] = (),
879880
) -> resource.Domain:
880881
r"""Gets information about a domain.
@@ -979,7 +980,7 @@ def update_domain(
979980
domain: Optional[resource.Domain] = None,
980981
update_mask: Optional[field_mask_pb2.FieldMask] = None,
981982
retry: OptionalRetry = gapic_v1.method.DEFAULT,
982-
timeout: Optional[float] = None,
983+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
983984
metadata: Sequence[Tuple[str, str]] = (),
984985
) -> operation.Operation:
985986
r"""Updates the metadata and configuration of a domain.
@@ -1120,7 +1121,7 @@ def delete_domain(
11201121
*,
11211122
name: Optional[str] = None,
11221123
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1123-
timeout: Optional[float] = None,
1124+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11241125
metadata: Sequence[Tuple[str, str]] = (),
11251126
) -> operation.Operation:
11261127
r"""Deletes a domain.
@@ -1247,7 +1248,7 @@ def attach_trust(
12471248
name: Optional[str] = None,
12481249
trust: Optional[resource.Trust] = None,
12491250
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1250-
timeout: Optional[float] = None,
1251+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12511252
metadata: Sequence[Tuple[str, str]] = (),
12521253
) -> operation.Operation:
12531254
r"""Adds an AD trust to a domain.
@@ -1384,7 +1385,7 @@ def reconfigure_trust(
13841385
target_domain_name: Optional[str] = None,
13851386
target_dns_ip_addresses: Optional[MutableSequence[str]] = None,
13861387
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1387-
timeout: Optional[float] = None,
1388+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13881389
metadata: Sequence[Tuple[str, str]] = (),
13891390
) -> operation.Operation:
13901391
r"""Updates the DNS conditional forwarder.
@@ -1527,7 +1528,7 @@ def detach_trust(
15271528
name: Optional[str] = None,
15281529
trust: Optional[resource.Trust] = None,
15291530
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1530-
timeout: Optional[float] = None,
1531+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15311532
metadata: Sequence[Tuple[str, str]] = (),
15321533
) -> operation.Operation:
15331534
r"""Removes an AD trust.
@@ -1665,7 +1666,7 @@ def validate_trust(
16651666
name: Optional[str] = None,
16661667
trust: Optional[resource.Trust] = None,
16671668
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1668-
timeout: Optional[float] = None,
1669+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16691670
metadata: Sequence[Tuple[str, str]] = (),
16701671
) -> operation.Operation:
16711672
r"""Validates a trust state, that the target domain is
@@ -1810,14 +1811,9 @@ def __exit__(self, type, value, traceback):
18101811
self.transport.close()
18111812

18121813

1813-
try:
1814-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1815-
gapic_version=pkg_resources.get_distribution(
1816-
"google-cloud-managed-identities",
1817-
).version,
1818-
)
1819-
except pkg_resources.DistributionNotFound:
1820-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1814+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1815+
gapic_version=package_version.__version__
1816+
)
18211817

18221818

18231819
__all__ = ("ManagedIdentitiesServiceClient",)

packages/google-cloud-managed-identities/google/cloud/managedidentities_v1/services/managed_identities_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.longrunning import operations_pb2 # type: ignore
2626
from google.oauth2 import service_account # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.managedidentities_v1 import gapic_version as package_version
2929
from google.cloud.managedidentities_v1.types import managed_identities_service, resource
3030

31-
try:
32-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33-
gapic_version=pkg_resources.get_distribution(
34-
"google-cloud-managed-identities",
35-
).version,
36-
)
37-
except pkg_resources.DistributionNotFound:
38-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
31+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32+
gapic_version=package_version.__version__
33+
)
3934

4035

4136
class ManagedIdentitiesServiceTransport(abc.ABC):

packages/google-cloud-managed-identities/release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"release-type": "python",
66
"extra-files": [
77
"google/cloud/managedidentities/gapic_version.py",
8+
"google/cloud/managedidentities_v1/gapic_version.py",
89
{
910
"type": "json",
1011
"path": "samples/generated_samples/snippet_metadata_google.cloud.managedidentities.v1.json",

packages/google-cloud-managed-identities/samples/generated_samples/managedidentities_v1_generated_managed_identities_service_attach_trust_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def sample_attach_trust():
5656

5757
print("Waiting for operation to complete...")
5858

59-
response = await operation.result()
59+
response = (await operation).result()
6060

6161
# Handle the response
6262
print(response)

packages/google-cloud-managed-identities/samples/generated_samples/managedidentities_v1_generated_managed_identities_service_create_microsoft_ad_domain_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def sample_create_microsoft_ad_domain():
5555

5656
print("Waiting for operation to complete...")
5757

58-
response = await operation.result()
58+
response = (await operation).result()
5959

6060
# Handle the response
6161
print(response)

packages/google-cloud-managed-identities/samples/generated_samples/managedidentities_v1_generated_managed_identities_service_delete_domain_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_delete_domain():
4848

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

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

packages/google-cloud-managed-identities/samples/generated_samples/managedidentities_v1_generated_managed_identities_service_detach_trust_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async def sample_detach_trust():
5656

5757
print("Waiting for operation to complete...")
5858

59-
response = await operation.result()
59+
response = (await operation).result()
6060

6161
# Handle the response
6262
print(response)

0 commit comments

Comments
 (0)