google-cloud-maintenance-api 0.1.0__py3-none-any.whl

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.
Files changed (25) hide show
  1. google/cloud/maintenance_api/__init__.py +51 -0
  2. google/cloud/maintenance_api/gapic_version.py +16 -0
  3. google/cloud/maintenance_api/py.typed +2 -0
  4. google/cloud/maintenance_api_v1beta/__init__.py +46 -0
  5. google/cloud/maintenance_api_v1beta/gapic_metadata.json +73 -0
  6. google/cloud/maintenance_api_v1beta/gapic_version.py +16 -0
  7. google/cloud/maintenance_api_v1beta/py.typed +2 -0
  8. google/cloud/maintenance_api_v1beta/services/__init__.py +15 -0
  9. google/cloud/maintenance_api_v1beta/services/maintenance/__init__.py +22 -0
  10. google/cloud/maintenance_api_v1beta/services/maintenance/async_client.py +786 -0
  11. google/cloud/maintenance_api_v1beta/services/maintenance/client.py +1211 -0
  12. google/cloud/maintenance_api_v1beta/services/maintenance/pagers.py +361 -0
  13. google/cloud/maintenance_api_v1beta/services/maintenance/transports/__init__.py +36 -0
  14. google/cloud/maintenance_api_v1beta/services/maintenance/transports/base.py +234 -0
  15. google/cloud/maintenance_api_v1beta/services/maintenance/transports/grpc.py +456 -0
  16. google/cloud/maintenance_api_v1beta/services/maintenance/transports/grpc_asyncio.py +499 -0
  17. google/cloud/maintenance_api_v1beta/services/maintenance/transports/rest.py +1182 -0
  18. google/cloud/maintenance_api_v1beta/services/maintenance/transports/rest_base.py +283 -0
  19. google/cloud/maintenance_api_v1beta/types/__init__.py +38 -0
  20. google/cloud/maintenance_api_v1beta/types/maintenance_service.py +713 -0
  21. google_cloud_maintenance_api-0.1.0.dist-info/METADATA +239 -0
  22. google_cloud_maintenance_api-0.1.0.dist-info/RECORD +25 -0
  23. google_cloud_maintenance_api-0.1.0.dist-info/WHEEL +5 -0
  24. google_cloud_maintenance_api-0.1.0.dist-info/licenses/LICENSE +202 -0
  25. google_cloud_maintenance_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,283 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 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
+ import json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api_core import gapic_v1, path_template
21
+ from google.cloud.location import locations_pb2 # type: ignore
22
+ from google.protobuf import json_format
23
+
24
+ from google.cloud.maintenance_api_v1beta.types import maintenance_service
25
+
26
+ from .base import DEFAULT_CLIENT_INFO, MaintenanceTransport
27
+
28
+
29
+ class _BaseMaintenanceRestTransport(MaintenanceTransport):
30
+ """Base REST backend transport for Maintenance.
31
+
32
+ Note: This class is not meant to be used directly. Use its sync and
33
+ async sub-classes instead.
34
+
35
+ This class defines the same methods as the primary client, so the
36
+ primary client can load the underlying transport implementation
37
+ and call it.
38
+
39
+ It sends JSON representations of protocol buffers over HTTP/1.1
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ *,
45
+ host: str = "maintenance.googleapis.com",
46
+ credentials: Optional[Any] = None,
47
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
48
+ always_use_jwt_access: Optional[bool] = False,
49
+ url_scheme: str = "https",
50
+ api_audience: Optional[str] = None,
51
+ ) -> None:
52
+ """Instantiate the transport.
53
+ Args:
54
+ host (Optional[str]):
55
+ The hostname to connect to (default: 'maintenance.googleapis.com').
56
+ credentials (Optional[Any]): The
57
+ authorization credentials to attach to requests. These
58
+ credentials identify the application to the service; if none
59
+ are specified, the client will attempt to ascertain the
60
+ credentials from the environment.
61
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
62
+ The client info used to send a user-agent string along with
63
+ API requests. If ``None``, then default info will be used.
64
+ Generally, you only need to set this if you are developing
65
+ your own client library.
66
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
67
+ be used for service account credentials.
68
+ url_scheme: the protocol scheme for the API endpoint. Normally
69
+ "https", but for testing or local servers,
70
+ "http" can be specified.
71
+ """
72
+ # Run the base constructor
73
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
74
+ if maybe_url_match is None:
75
+ raise ValueError(
76
+ f"Unexpected hostname structure: {host}"
77
+ ) # pragma: NO COVER
78
+
79
+ url_match_items = maybe_url_match.groupdict()
80
+
81
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
82
+
83
+ super().__init__(
84
+ host=host,
85
+ credentials=credentials,
86
+ client_info=client_info,
87
+ always_use_jwt_access=always_use_jwt_access,
88
+ api_audience=api_audience,
89
+ )
90
+
91
+ class _BaseGetResourceMaintenance:
92
+ def __hash__(self): # pragma: NO COVER
93
+ return NotImplementedError("__hash__ must be implemented.")
94
+
95
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
96
+
97
+ @classmethod
98
+ def _get_unset_required_fields(cls, message_dict):
99
+ return {
100
+ k: v
101
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
102
+ if k not in message_dict
103
+ }
104
+
105
+ @staticmethod
106
+ def _get_http_options():
107
+ http_options: List[Dict[str, str]] = [
108
+ {
109
+ "method": "get",
110
+ "uri": "/v1beta/{name=projects/*/locations/*/resourceMaintenances/*}",
111
+ },
112
+ ]
113
+ return http_options
114
+
115
+ @staticmethod
116
+ def _get_transcoded_request(http_options, request):
117
+ pb_request = maintenance_service.GetResourceMaintenanceRequest.pb(request)
118
+ transcoded_request = path_template.transcode(http_options, pb_request)
119
+ return transcoded_request
120
+
121
+ @staticmethod
122
+ def _get_query_params_json(transcoded_request):
123
+ query_params = json.loads(
124
+ json_format.MessageToJson(
125
+ transcoded_request["query_params"],
126
+ use_integers_for_enums=True,
127
+ )
128
+ )
129
+ query_params.update(
130
+ _BaseMaintenanceRestTransport._BaseGetResourceMaintenance._get_unset_required_fields(
131
+ query_params
132
+ )
133
+ )
134
+
135
+ query_params["$alt"] = "json;enum-encoding=int"
136
+ return query_params
137
+
138
+ class _BaseListResourceMaintenances:
139
+ def __hash__(self): # pragma: NO COVER
140
+ return NotImplementedError("__hash__ must be implemented.")
141
+
142
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
143
+
144
+ @classmethod
145
+ def _get_unset_required_fields(cls, message_dict):
146
+ return {
147
+ k: v
148
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
149
+ if k not in message_dict
150
+ }
151
+
152
+ @staticmethod
153
+ def _get_http_options():
154
+ http_options: List[Dict[str, str]] = [
155
+ {
156
+ "method": "get",
157
+ "uri": "/v1beta/{parent=projects/*/locations/*}/resourceMaintenances",
158
+ },
159
+ ]
160
+ return http_options
161
+
162
+ @staticmethod
163
+ def _get_transcoded_request(http_options, request):
164
+ pb_request = maintenance_service.ListResourceMaintenancesRequest.pb(request)
165
+ transcoded_request = path_template.transcode(http_options, pb_request)
166
+ return transcoded_request
167
+
168
+ @staticmethod
169
+ def _get_query_params_json(transcoded_request):
170
+ query_params = json.loads(
171
+ json_format.MessageToJson(
172
+ transcoded_request["query_params"],
173
+ use_integers_for_enums=True,
174
+ )
175
+ )
176
+ query_params.update(
177
+ _BaseMaintenanceRestTransport._BaseListResourceMaintenances._get_unset_required_fields(
178
+ query_params
179
+ )
180
+ )
181
+
182
+ query_params["$alt"] = "json;enum-encoding=int"
183
+ return query_params
184
+
185
+ class _BaseSummarizeMaintenances:
186
+ def __hash__(self): # pragma: NO COVER
187
+ return NotImplementedError("__hash__ must be implemented.")
188
+
189
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
190
+
191
+ @classmethod
192
+ def _get_unset_required_fields(cls, message_dict):
193
+ return {
194
+ k: v
195
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
196
+ if k not in message_dict
197
+ }
198
+
199
+ @staticmethod
200
+ def _get_http_options():
201
+ http_options: List[Dict[str, str]] = [
202
+ {
203
+ "method": "get",
204
+ "uri": "/v1beta/{parent=projects/*/locations/*}/resourceMaintenances:summarize",
205
+ },
206
+ ]
207
+ return http_options
208
+
209
+ @staticmethod
210
+ def _get_transcoded_request(http_options, request):
211
+ pb_request = maintenance_service.SummarizeMaintenancesRequest.pb(request)
212
+ transcoded_request = path_template.transcode(http_options, pb_request)
213
+ return transcoded_request
214
+
215
+ @staticmethod
216
+ def _get_query_params_json(transcoded_request):
217
+ query_params = json.loads(
218
+ json_format.MessageToJson(
219
+ transcoded_request["query_params"],
220
+ use_integers_for_enums=True,
221
+ )
222
+ )
223
+ query_params.update(
224
+ _BaseMaintenanceRestTransport._BaseSummarizeMaintenances._get_unset_required_fields(
225
+ query_params
226
+ )
227
+ )
228
+
229
+ query_params["$alt"] = "json;enum-encoding=int"
230
+ return query_params
231
+
232
+ class _BaseGetLocation:
233
+ def __hash__(self): # pragma: NO COVER
234
+ return NotImplementedError("__hash__ must be implemented.")
235
+
236
+ @staticmethod
237
+ def _get_http_options():
238
+ http_options: List[Dict[str, str]] = [
239
+ {
240
+ "method": "get",
241
+ "uri": "/v1beta/{name=projects/*/locations/*}",
242
+ },
243
+ ]
244
+ return http_options
245
+
246
+ @staticmethod
247
+ def _get_transcoded_request(http_options, request):
248
+ request_kwargs = json_format.MessageToDict(request)
249
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
250
+ return transcoded_request
251
+
252
+ @staticmethod
253
+ def _get_query_params_json(transcoded_request):
254
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
255
+ return query_params
256
+
257
+ class _BaseListLocations:
258
+ def __hash__(self): # pragma: NO COVER
259
+ return NotImplementedError("__hash__ must be implemented.")
260
+
261
+ @staticmethod
262
+ def _get_http_options():
263
+ http_options: List[Dict[str, str]] = [
264
+ {
265
+ "method": "get",
266
+ "uri": "/v1beta/{name=projects/*}/locations",
267
+ },
268
+ ]
269
+ return http_options
270
+
271
+ @staticmethod
272
+ def _get_transcoded_request(http_options, request):
273
+ request_kwargs = json_format.MessageToDict(request)
274
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
275
+ return transcoded_request
276
+
277
+ @staticmethod
278
+ def _get_query_params_json(transcoded_request):
279
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
280
+ return query_params
281
+
282
+
283
+ __all__ = ("_BaseMaintenanceRestTransport",)
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 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
+ from .maintenance_service import (
17
+ GetResourceMaintenanceRequest,
18
+ ListResourceMaintenancesRequest,
19
+ ListResourceMaintenancesResponse,
20
+ MaintenanceCategory,
21
+ MaintenanceControl,
22
+ MaintenanceSummary,
23
+ ResourceMaintenance,
24
+ SummarizeMaintenancesRequest,
25
+ SummarizeMaintenancesResponse,
26
+ )
27
+
28
+ __all__ = (
29
+ "GetResourceMaintenanceRequest",
30
+ "ListResourceMaintenancesRequest",
31
+ "ListResourceMaintenancesResponse",
32
+ "MaintenanceControl",
33
+ "MaintenanceSummary",
34
+ "ResourceMaintenance",
35
+ "SummarizeMaintenancesRequest",
36
+ "SummarizeMaintenancesResponse",
37
+ "MaintenanceCategory",
38
+ )