google-cloud-maintenance-api 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_cloud_maintenance_api-0.3.0/google_cloud_maintenance_api.egg-info → google_cloud_maintenance_api-0.4.0}/PKG-INFO +6 -8
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/README.rst +2 -2
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api/gapic_version.py +1 -1
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/__init__.py +1 -0
- {google_cloud_maintenance_api-0.3.0/google/cloud/maintenance_api_v1beta → google_cloud_maintenance_api-0.4.0/google/cloud/maintenance_api_v1}/gapic_version.py +1 -1
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/async_client.py +30 -16
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/client.py +36 -27
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/pagers.py +4 -4
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/base.py +15 -6
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/grpc.py +17 -13
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/grpc_asyncio.py +16 -12
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/rest.py +17 -13
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/types/maintenance_service.py +10 -7
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/__init__.py +1 -0
- {google_cloud_maintenance_api-0.3.0/google/cloud/maintenance_api_v1 → google_cloud_maintenance_api-0.4.0/google/cloud/maintenance_api_v1beta}/gapic_version.py +1 -1
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/async_client.py +30 -16
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/client.py +36 -27
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/pagers.py +4 -4
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/base.py +15 -6
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/grpc.py +17 -13
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/grpc_asyncio.py +16 -12
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/rest.py +17 -13
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/types/maintenance_service.py +10 -7
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0/google_cloud_maintenance_api.egg-info}/PKG-INFO +6 -8
- google_cloud_maintenance_api-0.4.0/google_cloud_maintenance_api.egg-info/requires.txt +11 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/setup.py +3 -5
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/gapic/maintenance_api_v1/test_maintenance.py +183 -91
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/gapic/maintenance_api_v1beta/test_maintenance.py +183 -91
- google_cloud_maintenance_api-0.3.0/google_cloud_maintenance_api.egg-info/requires.txt +0 -11
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/LICENSE +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/MANIFEST.in +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api/py.typed +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/gapic_metadata.json +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/py.typed +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/services/maintenance/transports/rest_base.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1/types/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/gapic_metadata.json +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/py.typed +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/services/maintenance/transports/rest_base.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google/cloud/maintenance_api_v1beta/types/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google_cloud_maintenance_api.egg-info/SOURCES.txt +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google_cloud_maintenance_api.egg-info/dependency_links.txt +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google_cloud_maintenance_api.egg-info/not-zip-safe +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/google_cloud_maintenance_api.egg-info/top_level.txt +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/setup.cfg +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/gapic/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/gapic/maintenance_api_v1/__init__.py +0 -0
- {google_cloud_maintenance_api-0.3.0 → google_cloud_maintenance_api-0.4.0}/tests/unit/gapic/maintenance_api_v1beta/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-cloud-maintenance-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Google Cloud Maintenance Api API client library
|
|
5
5
|
Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-maintenance-api
|
|
6
6
|
Author: Google LLC
|
|
@@ -12,8 +12,6 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -22,15 +20,15 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
21
|
Classifier: Operating System :: OS Independent
|
|
24
22
|
Classifier: Topic :: Internet
|
|
25
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
26
24
|
License-File: LICENSE
|
|
27
|
-
Requires-Dist: google-api-core[grpc]
|
|
25
|
+
Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.0
|
|
28
26
|
Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
|
|
29
27
|
Requires-Dist: grpcio<2.0.0,>=1.33.2
|
|
30
28
|
Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
|
|
31
29
|
Requires-Dist: proto-plus<2.0.0,>=1.22.3
|
|
32
30
|
Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
|
|
33
|
-
Requires-Dist: protobuf
|
|
31
|
+
Requires-Dist: protobuf<8.0.0,>=4.25.8
|
|
34
32
|
Dynamic: author
|
|
35
33
|
Dynamic: author-email
|
|
36
34
|
Dynamic: classifier
|
|
@@ -106,14 +104,14 @@ Supported Python Versions
|
|
|
106
104
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
107
105
|
Python.
|
|
108
106
|
|
|
109
|
-
Python >= 3.
|
|
107
|
+
Python >= 3.9, including 3.14
|
|
110
108
|
|
|
111
109
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
112
110
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
113
111
|
|
|
114
112
|
Unsupported Python Versions
|
|
115
113
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
116
|
-
Python <= 3.
|
|
114
|
+
Python <= 3.8
|
|
117
115
|
|
|
118
116
|
If you are using an `end-of-life`_
|
|
119
117
|
version of Python, we recommend that you update as soon as possible to an actively supported version.
|
|
@@ -61,14 +61,14 @@ Supported Python Versions
|
|
|
61
61
|
Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
|
|
62
62
|
Python.
|
|
63
63
|
|
|
64
|
-
Python >= 3.
|
|
64
|
+
Python >= 3.9, including 3.14
|
|
65
65
|
|
|
66
66
|
.. _active: https://devguide.python.org/devcycle/#in-development-main-branch
|
|
67
67
|
.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
|
|
68
68
|
|
|
69
69
|
Unsupported Python Versions
|
|
70
70
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
71
|
-
Python <= 3.
|
|
71
|
+
Python <= 3.8
|
|
72
72
|
|
|
73
73
|
If you are using an `end-of-life`_
|
|
74
74
|
version of Python, we recommend that you update as soon as possible to an actively supported version.
|
|
@@ -28,6 +28,7 @@ else: # pragma: NO COVER
|
|
|
28
28
|
# this code path once we drop support for Python 3.7
|
|
29
29
|
import importlib_metadata as metadata
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
from .services.maintenance import MaintenanceAsyncClient, MaintenanceClient
|
|
32
33
|
from .types.maintenance_service import (
|
|
33
34
|
GetResourceMaintenanceRequest,
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
from collections import OrderedDict
|
|
17
16
|
import logging as std_logging
|
|
18
17
|
import re
|
|
18
|
+
from collections import OrderedDict
|
|
19
19
|
from typing import (
|
|
20
20
|
Callable,
|
|
21
21
|
Dict,
|
|
@@ -29,13 +29,13 @@ from typing import (
|
|
|
29
29
|
Union,
|
|
30
30
|
)
|
|
31
31
|
|
|
32
|
+
import google.protobuf
|
|
32
33
|
from google.api_core import exceptions as core_exceptions
|
|
33
34
|
from google.api_core import gapic_v1
|
|
34
35
|
from google.api_core import retry_async as retries
|
|
35
36
|
from google.api_core.client_options import ClientOptions
|
|
36
37
|
from google.auth import credentials as ga_credentials # type: ignore
|
|
37
38
|
from google.oauth2 import service_account # type: ignore
|
|
38
|
-
import google.protobuf
|
|
39
39
|
|
|
40
40
|
from google.cloud.maintenance_api_v1 import gapic_version as package_version
|
|
41
41
|
|
|
@@ -44,8 +44,8 @@ try:
|
|
|
44
44
|
except AttributeError: # pragma: NO COVER
|
|
45
45
|
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
|
|
46
46
|
|
|
47
|
+
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
|
|
47
48
|
from google.cloud.location import locations_pb2 # type: ignore
|
|
48
|
-
from google.protobuf import timestamp_pb2 # type: ignore
|
|
49
49
|
|
|
50
50
|
from google.cloud.maintenance_api_v1.services.maintenance import pagers
|
|
51
51
|
from google.cloud.maintenance_api_v1.types import maintenance_service
|
|
@@ -116,7 +116,10 @@ class MaintenanceAsyncClient:
|
|
|
116
116
|
Returns:
|
|
117
117
|
MaintenanceAsyncClient: The constructed client.
|
|
118
118
|
"""
|
|
119
|
-
|
|
119
|
+
sa_info_func = (
|
|
120
|
+
MaintenanceClient.from_service_account_info.__func__ # type: ignore
|
|
121
|
+
)
|
|
122
|
+
return sa_info_func(MaintenanceAsyncClient, info, *args, **kwargs)
|
|
120
123
|
|
|
121
124
|
@classmethod
|
|
122
125
|
def from_service_account_file(cls, filename: str, *args, **kwargs):
|
|
@@ -132,7 +135,10 @@ class MaintenanceAsyncClient:
|
|
|
132
135
|
Returns:
|
|
133
136
|
MaintenanceAsyncClient: The constructed client.
|
|
134
137
|
"""
|
|
135
|
-
|
|
138
|
+
sa_file_func = (
|
|
139
|
+
MaintenanceClient.from_service_account_file.__func__ # type: ignore
|
|
140
|
+
)
|
|
141
|
+
return sa_file_func(MaintenanceAsyncClient, filename, *args, **kwargs)
|
|
136
142
|
|
|
137
143
|
from_service_account_json = from_service_account_file
|
|
138
144
|
|
|
@@ -182,7 +188,7 @@ class MaintenanceAsyncClient:
|
|
|
182
188
|
return self._client.transport
|
|
183
189
|
|
|
184
190
|
@property
|
|
185
|
-
def api_endpoint(self):
|
|
191
|
+
def api_endpoint(self) -> str:
|
|
186
192
|
"""Return the API endpoint used by the client instance.
|
|
187
193
|
|
|
188
194
|
Returns:
|
|
@@ -662,7 +668,7 @@ class MaintenanceAsyncClient:
|
|
|
662
668
|
|
|
663
669
|
async def get_location(
|
|
664
670
|
self,
|
|
665
|
-
request: Optional[locations_pb2.GetLocationRequest] = None,
|
|
671
|
+
request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
|
|
666
672
|
*,
|
|
667
673
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
668
674
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
@@ -688,8 +694,12 @@ class MaintenanceAsyncClient:
|
|
|
688
694
|
# Create or coerce a protobuf request object.
|
|
689
695
|
# The request isn't a proto-plus wrapped type,
|
|
690
696
|
# so it must be constructed via keyword expansion.
|
|
691
|
-
if
|
|
692
|
-
|
|
697
|
+
if request is None:
|
|
698
|
+
request_pb = locations_pb2.GetLocationRequest()
|
|
699
|
+
elif isinstance(request, dict):
|
|
700
|
+
request_pb = locations_pb2.GetLocationRequest(**request)
|
|
701
|
+
else:
|
|
702
|
+
request_pb = request
|
|
693
703
|
|
|
694
704
|
# Wrap the RPC method; this adds retry and timeout information,
|
|
695
705
|
# and friendly error handling.
|
|
@@ -698,7 +708,7 @@ class MaintenanceAsyncClient:
|
|
|
698
708
|
# Certain fields should be provided within the metadata header;
|
|
699
709
|
# add these here.
|
|
700
710
|
metadata = tuple(metadata) + (
|
|
701
|
-
gapic_v1.routing_header.to_grpc_metadata((("name",
|
|
711
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
|
|
702
712
|
)
|
|
703
713
|
|
|
704
714
|
# Validate the universe domain.
|
|
@@ -706,7 +716,7 @@ class MaintenanceAsyncClient:
|
|
|
706
716
|
|
|
707
717
|
# Send the request.
|
|
708
718
|
response = await rpc(
|
|
709
|
-
|
|
719
|
+
request_pb,
|
|
710
720
|
retry=retry,
|
|
711
721
|
timeout=timeout,
|
|
712
722
|
metadata=metadata,
|
|
@@ -717,7 +727,7 @@ class MaintenanceAsyncClient:
|
|
|
717
727
|
|
|
718
728
|
async def list_locations(
|
|
719
729
|
self,
|
|
720
|
-
request: Optional[locations_pb2.ListLocationsRequest] = None,
|
|
730
|
+
request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None,
|
|
721
731
|
*,
|
|
722
732
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
723
733
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
@@ -743,8 +753,12 @@ class MaintenanceAsyncClient:
|
|
|
743
753
|
# Create or coerce a protobuf request object.
|
|
744
754
|
# The request isn't a proto-plus wrapped type,
|
|
745
755
|
# so it must be constructed via keyword expansion.
|
|
746
|
-
if
|
|
747
|
-
|
|
756
|
+
if request is None:
|
|
757
|
+
request_pb = locations_pb2.ListLocationsRequest()
|
|
758
|
+
elif isinstance(request, dict):
|
|
759
|
+
request_pb = locations_pb2.ListLocationsRequest(**request)
|
|
760
|
+
else:
|
|
761
|
+
request_pb = request
|
|
748
762
|
|
|
749
763
|
# Wrap the RPC method; this adds retry and timeout information,
|
|
750
764
|
# and friendly error handling.
|
|
@@ -753,7 +767,7 @@ class MaintenanceAsyncClient:
|
|
|
753
767
|
# Certain fields should be provided within the metadata header;
|
|
754
768
|
# add these here.
|
|
755
769
|
metadata = tuple(metadata) + (
|
|
756
|
-
gapic_v1.routing_header.to_grpc_metadata((("name",
|
|
770
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
|
|
757
771
|
)
|
|
758
772
|
|
|
759
773
|
# Validate the universe domain.
|
|
@@ -761,7 +775,7 @@ class MaintenanceAsyncClient:
|
|
|
761
775
|
|
|
762
776
|
# Send the request.
|
|
763
777
|
response = await rpc(
|
|
764
|
-
|
|
778
|
+
request_pb,
|
|
765
779
|
retry=retry,
|
|
766
780
|
timeout=timeout,
|
|
767
781
|
metadata=metadata,
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
#
|
|
16
|
-
from collections import OrderedDict
|
|
17
|
-
from http import HTTPStatus
|
|
18
16
|
import json
|
|
19
17
|
import logging as std_logging
|
|
20
18
|
import os
|
|
21
19
|
import re
|
|
20
|
+
import warnings
|
|
21
|
+
from collections import OrderedDict
|
|
22
|
+
from http import HTTPStatus
|
|
22
23
|
from typing import (
|
|
23
24
|
Callable,
|
|
24
25
|
Dict,
|
|
@@ -32,8 +33,8 @@ from typing import (
|
|
|
32
33
|
Union,
|
|
33
34
|
cast,
|
|
34
35
|
)
|
|
35
|
-
import warnings
|
|
36
36
|
|
|
37
|
+
import google.protobuf
|
|
37
38
|
from google.api_core import client_options as client_options_lib
|
|
38
39
|
from google.api_core import exceptions as core_exceptions
|
|
39
40
|
from google.api_core import gapic_v1
|
|
@@ -43,7 +44,6 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore
|
|
|
43
44
|
from google.auth.transport import mtls # type: ignore
|
|
44
45
|
from google.auth.transport.grpc import SslCredentials # type: ignore
|
|
45
46
|
from google.oauth2 import service_account # type: ignore
|
|
46
|
-
import google.protobuf
|
|
47
47
|
|
|
48
48
|
from google.cloud.maintenance_api_v1 import gapic_version as package_version
|
|
49
49
|
|
|
@@ -61,8 +61,8 @@ except ImportError: # pragma: NO COVER
|
|
|
61
61
|
|
|
62
62
|
_LOGGER = std_logging.getLogger(__name__)
|
|
63
63
|
|
|
64
|
+
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
|
|
64
65
|
from google.cloud.location import locations_pb2 # type: ignore
|
|
65
|
-
from google.protobuf import timestamp_pb2 # type: ignore
|
|
66
66
|
|
|
67
67
|
from google.cloud.maintenance_api_v1.services.maintenance import pagers
|
|
68
68
|
from google.cloud.maintenance_api_v1.types import maintenance_service
|
|
@@ -112,7 +112,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
112
112
|
"""Unified Maintenance service"""
|
|
113
113
|
|
|
114
114
|
@staticmethod
|
|
115
|
-
def _get_default_mtls_endpoint(api_endpoint):
|
|
115
|
+
def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
|
|
116
116
|
"""Converts api endpoint to mTLS endpoint.
|
|
117
117
|
|
|
118
118
|
Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
|
|
@@ -120,7 +120,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
120
120
|
Args:
|
|
121
121
|
api_endpoint (Optional[str]): the api endpoint to convert.
|
|
122
122
|
Returns:
|
|
123
|
-
str: converted mTLS api endpoint.
|
|
123
|
+
Optional[str]: converted mTLS api endpoint.
|
|
124
124
|
"""
|
|
125
125
|
if not api_endpoint:
|
|
126
126
|
return api_endpoint
|
|
@@ -130,6 +130,10 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
130
130
|
)
|
|
131
131
|
|
|
132
132
|
m = mtls_endpoint_re.match(api_endpoint)
|
|
133
|
+
if m is None:
|
|
134
|
+
# Could not parse api_endpoint; return as-is.
|
|
135
|
+
return api_endpoint
|
|
136
|
+
|
|
133
137
|
name, mtls, sandbox, googledomain = m.groups()
|
|
134
138
|
if mtls or not googledomain:
|
|
135
139
|
return api_endpoint
|
|
@@ -437,7 +441,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
437
441
|
@staticmethod
|
|
438
442
|
def _get_api_endpoint(
|
|
439
443
|
api_override, client_cert_source, universe_domain, use_mtls_endpoint
|
|
440
|
-
):
|
|
444
|
+
) -> str:
|
|
441
445
|
"""Return the API endpoint used by the client.
|
|
442
446
|
|
|
443
447
|
Args:
|
|
@@ -534,7 +538,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
534
538
|
error._details.append(json.dumps(cred_info))
|
|
535
539
|
|
|
536
540
|
@property
|
|
537
|
-
def api_endpoint(self):
|
|
541
|
+
def api_endpoint(self) -> str:
|
|
538
542
|
"""Return the API endpoint used by the client instance.
|
|
539
543
|
|
|
540
544
|
Returns:
|
|
@@ -621,18 +625,16 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
621
625
|
|
|
622
626
|
universe_domain_opt = getattr(self._client_options, "universe_domain", None)
|
|
623
627
|
|
|
624
|
-
(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
self._universe_domain_env,
|
|
628
|
-
) = MaintenanceClient._read_environment_variables()
|
|
628
|
+
self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
|
|
629
|
+
MaintenanceClient._read_environment_variables()
|
|
630
|
+
)
|
|
629
631
|
self._client_cert_source = MaintenanceClient._get_client_cert_source(
|
|
630
632
|
self._client_options.client_cert_source, self._use_client_cert
|
|
631
633
|
)
|
|
632
634
|
self._universe_domain = MaintenanceClient._get_universe_domain(
|
|
633
635
|
universe_domain_opt, self._universe_domain_env
|
|
634
636
|
)
|
|
635
|
-
self._api_endpoint =
|
|
637
|
+
self._api_endpoint: str = "" # updated below, depending on `transport`
|
|
636
638
|
|
|
637
639
|
# Initialize the universe domain validation.
|
|
638
640
|
self._is_universe_domain_valid = False
|
|
@@ -660,8 +662,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
660
662
|
)
|
|
661
663
|
if self._client_options.scopes:
|
|
662
664
|
raise ValueError(
|
|
663
|
-
"When providing a transport instance, provide its scopes "
|
|
664
|
-
"directly."
|
|
665
|
+
"When providing a transport instance, provide its scopes directly."
|
|
665
666
|
)
|
|
666
667
|
self._transport = cast(MaintenanceTransport, transport)
|
|
667
668
|
self._api_endpoint = self._transport.host
|
|
@@ -1104,7 +1105,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1104
1105
|
|
|
1105
1106
|
def get_location(
|
|
1106
1107
|
self,
|
|
1107
|
-
request: Optional[locations_pb2.GetLocationRequest] = None,
|
|
1108
|
+
request: Optional[Union[locations_pb2.GetLocationRequest, dict]] = None,
|
|
1108
1109
|
*,
|
|
1109
1110
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1110
1111
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
@@ -1130,8 +1131,12 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1130
1131
|
# Create or coerce a protobuf request object.
|
|
1131
1132
|
# The request isn't a proto-plus wrapped type,
|
|
1132
1133
|
# so it must be constructed via keyword expansion.
|
|
1133
|
-
if
|
|
1134
|
-
|
|
1134
|
+
if request is None:
|
|
1135
|
+
request_pb = locations_pb2.GetLocationRequest()
|
|
1136
|
+
elif isinstance(request, dict):
|
|
1137
|
+
request_pb = locations_pb2.GetLocationRequest(**request)
|
|
1138
|
+
else:
|
|
1139
|
+
request_pb = request
|
|
1135
1140
|
|
|
1136
1141
|
# Wrap the RPC method; this adds retry and timeout information,
|
|
1137
1142
|
# and friendly error handling.
|
|
@@ -1140,7 +1145,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1140
1145
|
# Certain fields should be provided within the metadata header;
|
|
1141
1146
|
# add these here.
|
|
1142
1147
|
metadata = tuple(metadata) + (
|
|
1143
|
-
gapic_v1.routing_header.to_grpc_metadata((("name",
|
|
1148
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
|
|
1144
1149
|
)
|
|
1145
1150
|
|
|
1146
1151
|
# Validate the universe domain.
|
|
@@ -1149,7 +1154,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1149
1154
|
try:
|
|
1150
1155
|
# Send the request.
|
|
1151
1156
|
response = rpc(
|
|
1152
|
-
|
|
1157
|
+
request_pb,
|
|
1153
1158
|
retry=retry,
|
|
1154
1159
|
timeout=timeout,
|
|
1155
1160
|
metadata=metadata,
|
|
@@ -1163,7 +1168,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1163
1168
|
|
|
1164
1169
|
def list_locations(
|
|
1165
1170
|
self,
|
|
1166
|
-
request: Optional[locations_pb2.ListLocationsRequest] = None,
|
|
1171
|
+
request: Optional[Union[locations_pb2.ListLocationsRequest, dict]] = None,
|
|
1167
1172
|
*,
|
|
1168
1173
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1169
1174
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
@@ -1189,8 +1194,12 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1189
1194
|
# Create or coerce a protobuf request object.
|
|
1190
1195
|
# The request isn't a proto-plus wrapped type,
|
|
1191
1196
|
# so it must be constructed via keyword expansion.
|
|
1192
|
-
if
|
|
1193
|
-
|
|
1197
|
+
if request is None:
|
|
1198
|
+
request_pb = locations_pb2.ListLocationsRequest()
|
|
1199
|
+
elif isinstance(request, dict):
|
|
1200
|
+
request_pb = locations_pb2.ListLocationsRequest(**request)
|
|
1201
|
+
else:
|
|
1202
|
+
request_pb = request
|
|
1194
1203
|
|
|
1195
1204
|
# Wrap the RPC method; this adds retry and timeout information,
|
|
1196
1205
|
# and friendly error handling.
|
|
@@ -1199,7 +1208,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1199
1208
|
# Certain fields should be provided within the metadata header;
|
|
1200
1209
|
# add these here.
|
|
1201
1210
|
metadata = tuple(metadata) + (
|
|
1202
|
-
gapic_v1.routing_header.to_grpc_metadata((("name",
|
|
1211
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
|
|
1203
1212
|
)
|
|
1204
1213
|
|
|
1205
1214
|
# Validate the universe domain.
|
|
@@ -1208,7 +1217,7 @@ class MaintenanceClient(metaclass=MaintenanceClientMeta):
|
|
|
1208
1217
|
try:
|
|
1209
1218
|
# Send the request.
|
|
1210
1219
|
response = rpc(
|
|
1211
|
-
|
|
1220
|
+
request_pb,
|
|
1212
1221
|
retry=retry,
|
|
1213
1222
|
timeout=timeout,
|
|
1214
1223
|
metadata=metadata,
|
|
@@ -67,7 +67,7 @@ class SummarizeMaintenancesPager:
|
|
|
67
67
|
*,
|
|
68
68
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
69
69
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
70
|
-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
|
|
70
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
71
71
|
):
|
|
72
72
|
"""Instantiate the pager.
|
|
73
73
|
|
|
@@ -145,7 +145,7 @@ class SummarizeMaintenancesAsyncPager:
|
|
|
145
145
|
*,
|
|
146
146
|
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
|
|
147
147
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
148
|
-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
|
|
148
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
149
149
|
):
|
|
150
150
|
"""Instantiates the pager.
|
|
151
151
|
|
|
@@ -227,7 +227,7 @@ class ListResourceMaintenancesPager:
|
|
|
227
227
|
*,
|
|
228
228
|
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
229
229
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
230
|
-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
|
|
230
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
231
231
|
):
|
|
232
232
|
"""Instantiate the pager.
|
|
233
233
|
|
|
@@ -305,7 +305,7 @@ class ListResourceMaintenancesAsyncPager:
|
|
|
305
305
|
*,
|
|
306
306
|
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
|
|
307
307
|
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
308
|
-
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
|
|
308
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
309
309
|
):
|
|
310
310
|
"""Instantiates the pager.
|
|
311
311
|
|
|
@@ -17,14 +17,14 @@ import abc
|
|
|
17
17
|
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
|
|
18
18
|
|
|
19
19
|
import google.api_core
|
|
20
|
+
import google.auth # type: ignore
|
|
21
|
+
import google.protobuf
|
|
20
22
|
from google.api_core import exceptions as core_exceptions
|
|
21
23
|
from google.api_core import gapic_v1
|
|
22
24
|
from google.api_core import retry as retries
|
|
23
|
-
import google.auth # type: ignore
|
|
24
25
|
from google.auth import credentials as ga_credentials # type: ignore
|
|
25
26
|
from google.cloud.location import locations_pb2 # type: ignore
|
|
26
27
|
from google.oauth2 import service_account # type: ignore
|
|
27
|
-
import google.protobuf
|
|
28
28
|
|
|
29
29
|
from google.cloud.maintenance_api_v1 import gapic_version as package_version
|
|
30
30
|
from google.cloud.maintenance_api_v1.types import maintenance_service
|
|
@@ -81,10 +81,12 @@ class MaintenanceTransport(abc.ABC):
|
|
|
81
81
|
your own client library.
|
|
82
82
|
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
83
83
|
be used for service account credentials.
|
|
84
|
+
api_audience (Optional[str]): The intended audience for the API calls
|
|
85
|
+
to the service that will be set when using certain 3rd party
|
|
86
|
+
authentication flows. Audience is typically a resource identifier.
|
|
87
|
+
If not set, the host value will be used as a default.
|
|
84
88
|
"""
|
|
85
89
|
|
|
86
|
-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
|
|
87
|
-
|
|
88
90
|
# Save the scopes.
|
|
89
91
|
self._scopes = scopes
|
|
90
92
|
if not hasattr(self, "_ignore_credentials"):
|
|
@@ -99,11 +101,16 @@ class MaintenanceTransport(abc.ABC):
|
|
|
99
101
|
|
|
100
102
|
if credentials_file is not None:
|
|
101
103
|
credentials, _ = google.auth.load_credentials_from_file(
|
|
102
|
-
credentials_file,
|
|
104
|
+
credentials_file,
|
|
105
|
+
scopes=scopes,
|
|
106
|
+
quota_project_id=quota_project_id,
|
|
107
|
+
default_scopes=self.AUTH_SCOPES,
|
|
103
108
|
)
|
|
104
109
|
elif credentials is None and not self._ignore_credentials:
|
|
105
110
|
credentials, _ = google.auth.default(
|
|
106
|
-
|
|
111
|
+
scopes=scopes,
|
|
112
|
+
quota_project_id=quota_project_id,
|
|
113
|
+
default_scopes=self.AUTH_SCOPES,
|
|
107
114
|
)
|
|
108
115
|
# Don't apply audience if the credentials file passed from user.
|
|
109
116
|
if hasattr(credentials, "with_gdch_audience"):
|
|
@@ -127,6 +134,8 @@ class MaintenanceTransport(abc.ABC):
|
|
|
127
134
|
host += ":443"
|
|
128
135
|
self._host = host
|
|
129
136
|
|
|
137
|
+
self._wrapped_methods: Dict[Callable, Callable] = {}
|
|
138
|
+
|
|
130
139
|
@property
|
|
131
140
|
def host(self):
|
|
132
141
|
return self._host
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
import json
|
|
17
17
|
import logging as std_logging
|
|
18
18
|
import pickle
|
|
19
|
-
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
|
|
20
19
|
import warnings
|
|
20
|
+
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
|
|
21
21
|
|
|
22
|
-
from google.api_core import gapic_v1, grpc_helpers
|
|
23
22
|
import google.auth # type: ignore
|
|
23
|
+
import google.protobuf.message
|
|
24
|
+
import grpc # type: ignore
|
|
25
|
+
import proto # type: ignore
|
|
26
|
+
from google.api_core import gapic_v1, grpc_helpers
|
|
24
27
|
from google.auth import credentials as ga_credentials # type: ignore
|
|
25
28
|
from google.auth.transport.grpc import SslCredentials # type: ignore
|
|
26
29
|
from google.cloud.location import locations_pb2 # type: ignore
|
|
27
30
|
from google.protobuf.json_format import MessageToJson
|
|
28
|
-
import google.protobuf.message
|
|
29
|
-
import grpc # type: ignore
|
|
30
|
-
import proto # type: ignore
|
|
31
31
|
|
|
32
32
|
from google.cloud.maintenance_api_v1.types import maintenance_service
|
|
33
33
|
|
|
@@ -55,7 +55,7 @@ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO
|
|
|
55
55
|
elif isinstance(request, google.protobuf.message.Message):
|
|
56
56
|
request_payload = MessageToJson(request)
|
|
57
57
|
else:
|
|
58
|
-
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
|
|
58
|
+
request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
|
|
59
59
|
|
|
60
60
|
request_metadata = {
|
|
61
61
|
key: value.decode("utf-8") if isinstance(value, bytes) else value
|
|
@@ -90,7 +90,7 @@ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO
|
|
|
90
90
|
elif isinstance(result, google.protobuf.message.Message):
|
|
91
91
|
response_payload = MessageToJson(result)
|
|
92
92
|
else:
|
|
93
|
-
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
|
|
93
|
+
response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
|
|
94
94
|
grpc_response = {
|
|
95
95
|
"payload": response_payload,
|
|
96
96
|
"metadata": metadata,
|
|
@@ -185,6 +185,10 @@ class MaintenanceGrpcTransport(MaintenanceTransport):
|
|
|
185
185
|
your own client library.
|
|
186
186
|
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
187
187
|
be used for service account credentials.
|
|
188
|
+
api_audience (Optional[str]): The intended audience for the API calls
|
|
189
|
+
to the service that will be set when using certain 3rd party
|
|
190
|
+
authentication flows. Audience is typically a resource identifier.
|
|
191
|
+
If not set, the host value will be used as a default.
|
|
188
192
|
|
|
189
193
|
Raises:
|
|
190
194
|
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
|
|
@@ -373,12 +377,12 @@ class MaintenanceGrpcTransport(MaintenanceTransport):
|
|
|
373
377
|
# gRPC handles serialization and deserialization, so we just need
|
|
374
378
|
# to pass in the functions for each.
|
|
375
379
|
if "list_resource_maintenances" not in self._stubs:
|
|
376
|
-
self._stubs[
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
self._stubs["list_resource_maintenances"] = (
|
|
381
|
+
self._logged_channel.unary_unary(
|
|
382
|
+
"/google.cloud.maintenance.api.v1.Maintenance/ListResourceMaintenances",
|
|
383
|
+
request_serializer=maintenance_service.ListResourceMaintenancesRequest.serialize,
|
|
384
|
+
response_deserializer=maintenance_service.ListResourceMaintenancesResponse.deserialize,
|
|
385
|
+
)
|
|
382
386
|
)
|
|
383
387
|
return self._stubs["list_resource_maintenances"]
|
|
384
388
|
|