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#
16import logging
17import json # type: ignore
18
19from google.auth.transport.requests import AuthorizedSession # type: ignore
20from google.auth import credentials as ga_credentials # type: ignore
21from google.api_core import exceptions as core_exceptions
22from google.api_core import retry as retries
23from google.api_core import rest_helpers
24from google.api_core import rest_streaming
25from google.api_core import gapic_v1
26import google.protobuf
27
28from google.protobuf import json_format
29from google.iam.v1 import iam_policy_pb2 # type: ignore
30from google.iam.v1 import policy_pb2 # type: ignore
31
32from requests import __version__ as requests_version
33import dataclasses
34from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
35import warnings
36
37
38from google.protobuf import empty_pb2 # type: ignore
39from google.pubsub_v1.types import schema
40from google.pubsub_v1.types import schema as gp_schema
41
42
43from .rest_base import _BaseSchemaServiceRestTransport
44from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
45
46try:
47 OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
48except AttributeError: # pragma: NO COVER
49 OptionalRetry = Union[retries.Retry, object, None] # type: ignore
50
51try:
52 from google.api_core import client_logging # type: ignore
53
54 CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
55except ImportError: # pragma: NO COVER
56 CLIENT_LOGGING_SUPPORTED = False
57
58_LOGGER = logging.getLogger(__name__)
59
60DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
61 gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
62 grpc_version=None,
63 rest_version=f"requests@{requests_version}",
64)
65
66if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
67 DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
68
69
70class SchemaServiceRestInterceptor:
71 """Interceptor for SchemaService.
72
73 Interceptors are used to manipulate requests, request metadata, and responses
74 in arbitrary ways.
75 Example use cases include:
76 * Logging
77 * Verifying requests according to service or custom semantics
78 * Stripping extraneous information from responses
79
80 These use cases and more can be enabled by injecting an
81 instance of a custom subclass when constructing the SchemaServiceRestTransport.
82
83 .. code-block:: python
84 class MyCustomSchemaServiceInterceptor(SchemaServiceRestInterceptor):
85 def pre_commit_schema(self, request, metadata):
86 logging.log(f"Received request: {request}")
87 return request, metadata
88
89 def post_commit_schema(self, response):
90 logging.log(f"Received response: {response}")
91 return response
92
93 def pre_create_schema(self, request, metadata):
94 logging.log(f"Received request: {request}")
95 return request, metadata
96
97 def post_create_schema(self, response):
98 logging.log(f"Received response: {response}")
99 return response
100
101 def pre_delete_schema(self, request, metadata):
102 logging.log(f"Received request: {request}")
103 return request, metadata
104
105 def pre_delete_schema_revision(self, request, metadata):
106 logging.log(f"Received request: {request}")
107 return request, metadata
108
109 def post_delete_schema_revision(self, response):
110 logging.log(f"Received response: {response}")
111 return response
112
113 def pre_get_schema(self, request, metadata):
114 logging.log(f"Received request: {request}")
115 return request, metadata
116
117 def post_get_schema(self, response):
118 logging.log(f"Received response: {response}")
119 return response
120
121 def pre_list_schema_revisions(self, request, metadata):
122 logging.log(f"Received request: {request}")
123 return request, metadata
124
125 def post_list_schema_revisions(self, response):
126 logging.log(f"Received response: {response}")
127 return response
128
129 def pre_list_schemas(self, request, metadata):
130 logging.log(f"Received request: {request}")
131 return request, metadata
132
133 def post_list_schemas(self, response):
134 logging.log(f"Received response: {response}")
135 return response
136
137 def pre_rollback_schema(self, request, metadata):
138 logging.log(f"Received request: {request}")
139 return request, metadata
140
141 def post_rollback_schema(self, response):
142 logging.log(f"Received response: {response}")
143 return response
144
145 def pre_validate_message(self, request, metadata):
146 logging.log(f"Received request: {request}")
147 return request, metadata
148
149 def post_validate_message(self, response):
150 logging.log(f"Received response: {response}")
151 return response
152
153 def pre_validate_schema(self, request, metadata):
154 logging.log(f"Received request: {request}")
155 return request, metadata
156
157 def post_validate_schema(self, response):
158 logging.log(f"Received response: {response}")
159 return response
160
161 transport = SchemaServiceRestTransport(interceptor=MyCustomSchemaServiceInterceptor())
162 client = SchemaServiceClient(transport=transport)
163
164
165 """
166
167 def pre_commit_schema(
168 self,
169 request: gp_schema.CommitSchemaRequest,
170 metadata: Sequence[Tuple[str, Union[str, bytes]]],
171 ) -> Tuple[gp_schema.CommitSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
172 """Pre-rpc interceptor for commit_schema
173
174 Override in a subclass to manipulate the request or metadata
175 before they are sent to the SchemaService server.
176 """
177 return request, metadata
178
179 def post_commit_schema(self, response: gp_schema.Schema) -> gp_schema.Schema:
180 """Post-rpc interceptor for commit_schema
181
182 DEPRECATED. Please use the `post_commit_schema_with_metadata`
183 interceptor instead.
184
185 Override in a subclass to read or manipulate the response
186 after it is returned by the SchemaService server but before
187 it is returned to user code. This `post_commit_schema` interceptor runs
188 before the `post_commit_schema_with_metadata` interceptor.
189 """
190 return response
191
192 def post_commit_schema_with_metadata(
193 self,
194 response: gp_schema.Schema,
195 metadata: Sequence[Tuple[str, Union[str, bytes]]],
196 ) -> Tuple[gp_schema.Schema, Sequence[Tuple[str, Union[str, bytes]]]]:
197 """Post-rpc interceptor for commit_schema
198
199 Override in a subclass to read or manipulate the response or metadata after it
200 is returned by the SchemaService server but before it is returned to user code.
201
202 We recommend only using this `post_commit_schema_with_metadata`
203 interceptor in new development instead of the `post_commit_schema` interceptor.
204 When both interceptors are used, this `post_commit_schema_with_metadata` interceptor runs after the
205 `post_commit_schema` interceptor. The (possibly modified) response returned by
206 `post_commit_schema` will be passed to
207 `post_commit_schema_with_metadata`.
208 """
209 return response, metadata
210
211 def pre_create_schema(
212 self,
213 request: gp_schema.CreateSchemaRequest,
214 metadata: Sequence[Tuple[str, Union[str, bytes]]],
215 ) -> Tuple[gp_schema.CreateSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
216 """Pre-rpc interceptor for create_schema
217
218 Override in a subclass to manipulate the request or metadata
219 before they are sent to the SchemaService server.
220 """
221 return request, metadata
222
223 def post_create_schema(self, response: gp_schema.Schema) -> gp_schema.Schema:
224 """Post-rpc interceptor for create_schema
225
226 DEPRECATED. Please use the `post_create_schema_with_metadata`
227 interceptor instead.
228
229 Override in a subclass to read or manipulate the response
230 after it is returned by the SchemaService server but before
231 it is returned to user code. This `post_create_schema` interceptor runs
232 before the `post_create_schema_with_metadata` interceptor.
233 """
234 return response
235
236 def post_create_schema_with_metadata(
237 self,
238 response: gp_schema.Schema,
239 metadata: Sequence[Tuple[str, Union[str, bytes]]],
240 ) -> Tuple[gp_schema.Schema, Sequence[Tuple[str, Union[str, bytes]]]]:
241 """Post-rpc interceptor for create_schema
242
243 Override in a subclass to read or manipulate the response or metadata after it
244 is returned by the SchemaService server but before it is returned to user code.
245
246 We recommend only using this `post_create_schema_with_metadata`
247 interceptor in new development instead of the `post_create_schema` interceptor.
248 When both interceptors are used, this `post_create_schema_with_metadata` interceptor runs after the
249 `post_create_schema` interceptor. The (possibly modified) response returned by
250 `post_create_schema` will be passed to
251 `post_create_schema_with_metadata`.
252 """
253 return response, metadata
254
255 def pre_delete_schema(
256 self,
257 request: schema.DeleteSchemaRequest,
258 metadata: Sequence[Tuple[str, Union[str, bytes]]],
259 ) -> Tuple[schema.DeleteSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
260 """Pre-rpc interceptor for delete_schema
261
262 Override in a subclass to manipulate the request or metadata
263 before they are sent to the SchemaService server.
264 """
265 return request, metadata
266
267 def pre_delete_schema_revision(
268 self,
269 request: schema.DeleteSchemaRevisionRequest,
270 metadata: Sequence[Tuple[str, Union[str, bytes]]],
271 ) -> Tuple[
272 schema.DeleteSchemaRevisionRequest, Sequence[Tuple[str, Union[str, bytes]]]
273 ]:
274 """Pre-rpc interceptor for delete_schema_revision
275
276 Override in a subclass to manipulate the request or metadata
277 before they are sent to the SchemaService server.
278 """
279 return request, metadata
280
281 def post_delete_schema_revision(self, response: schema.Schema) -> schema.Schema:
282 """Post-rpc interceptor for delete_schema_revision
283
284 DEPRECATED. Please use the `post_delete_schema_revision_with_metadata`
285 interceptor instead.
286
287 Override in a subclass to read or manipulate the response
288 after it is returned by the SchemaService server but before
289 it is returned to user code. This `post_delete_schema_revision` interceptor runs
290 before the `post_delete_schema_revision_with_metadata` interceptor.
291 """
292 return response
293
294 def post_delete_schema_revision_with_metadata(
295 self, response: schema.Schema, metadata: Sequence[Tuple[str, Union[str, bytes]]]
296 ) -> Tuple[schema.Schema, Sequence[Tuple[str, Union[str, bytes]]]]:
297 """Post-rpc interceptor for delete_schema_revision
298
299 Override in a subclass to read or manipulate the response or metadata after it
300 is returned by the SchemaService server but before it is returned to user code.
301
302 We recommend only using this `post_delete_schema_revision_with_metadata`
303 interceptor in new development instead of the `post_delete_schema_revision` interceptor.
304 When both interceptors are used, this `post_delete_schema_revision_with_metadata` interceptor runs after the
305 `post_delete_schema_revision` interceptor. The (possibly modified) response returned by
306 `post_delete_schema_revision` will be passed to
307 `post_delete_schema_revision_with_metadata`.
308 """
309 return response, metadata
310
311 def pre_get_schema(
312 self,
313 request: schema.GetSchemaRequest,
314 metadata: Sequence[Tuple[str, Union[str, bytes]]],
315 ) -> Tuple[schema.GetSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
316 """Pre-rpc interceptor for get_schema
317
318 Override in a subclass to manipulate the request or metadata
319 before they are sent to the SchemaService server.
320 """
321 return request, metadata
322
323 def post_get_schema(self, response: schema.Schema) -> schema.Schema:
324 """Post-rpc interceptor for get_schema
325
326 DEPRECATED. Please use the `post_get_schema_with_metadata`
327 interceptor instead.
328
329 Override in a subclass to read or manipulate the response
330 after it is returned by the SchemaService server but before
331 it is returned to user code. This `post_get_schema` interceptor runs
332 before the `post_get_schema_with_metadata` interceptor.
333 """
334 return response
335
336 def post_get_schema_with_metadata(
337 self, response: schema.Schema, metadata: Sequence[Tuple[str, Union[str, bytes]]]
338 ) -> Tuple[schema.Schema, Sequence[Tuple[str, Union[str, bytes]]]]:
339 """Post-rpc interceptor for get_schema
340
341 Override in a subclass to read or manipulate the response or metadata after it
342 is returned by the SchemaService server but before it is returned to user code.
343
344 We recommend only using this `post_get_schema_with_metadata`
345 interceptor in new development instead of the `post_get_schema` interceptor.
346 When both interceptors are used, this `post_get_schema_with_metadata` interceptor runs after the
347 `post_get_schema` interceptor. The (possibly modified) response returned by
348 `post_get_schema` will be passed to
349 `post_get_schema_with_metadata`.
350 """
351 return response, metadata
352
353 def pre_list_schema_revisions(
354 self,
355 request: schema.ListSchemaRevisionsRequest,
356 metadata: Sequence[Tuple[str, Union[str, bytes]]],
357 ) -> Tuple[
358 schema.ListSchemaRevisionsRequest, Sequence[Tuple[str, Union[str, bytes]]]
359 ]:
360 """Pre-rpc interceptor for list_schema_revisions
361
362 Override in a subclass to manipulate the request or metadata
363 before they are sent to the SchemaService server.
364 """
365 return request, metadata
366
367 def post_list_schema_revisions(
368 self, response: schema.ListSchemaRevisionsResponse
369 ) -> schema.ListSchemaRevisionsResponse:
370 """Post-rpc interceptor for list_schema_revisions
371
372 DEPRECATED. Please use the `post_list_schema_revisions_with_metadata`
373 interceptor instead.
374
375 Override in a subclass to read or manipulate the response
376 after it is returned by the SchemaService server but before
377 it is returned to user code. This `post_list_schema_revisions` interceptor runs
378 before the `post_list_schema_revisions_with_metadata` interceptor.
379 """
380 return response
381
382 def post_list_schema_revisions_with_metadata(
383 self,
384 response: schema.ListSchemaRevisionsResponse,
385 metadata: Sequence[Tuple[str, Union[str, bytes]]],
386 ) -> Tuple[
387 schema.ListSchemaRevisionsResponse, Sequence[Tuple[str, Union[str, bytes]]]
388 ]:
389 """Post-rpc interceptor for list_schema_revisions
390
391 Override in a subclass to read or manipulate the response or metadata after it
392 is returned by the SchemaService server but before it is returned to user code.
393
394 We recommend only using this `post_list_schema_revisions_with_metadata`
395 interceptor in new development instead of the `post_list_schema_revisions` interceptor.
396 When both interceptors are used, this `post_list_schema_revisions_with_metadata` interceptor runs after the
397 `post_list_schema_revisions` interceptor. The (possibly modified) response returned by
398 `post_list_schema_revisions` will be passed to
399 `post_list_schema_revisions_with_metadata`.
400 """
401 return response, metadata
402
403 def pre_list_schemas(
404 self,
405 request: schema.ListSchemasRequest,
406 metadata: Sequence[Tuple[str, Union[str, bytes]]],
407 ) -> Tuple[schema.ListSchemasRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
408 """Pre-rpc interceptor for list_schemas
409
410 Override in a subclass to manipulate the request or metadata
411 before they are sent to the SchemaService server.
412 """
413 return request, metadata
414
415 def post_list_schemas(
416 self, response: schema.ListSchemasResponse
417 ) -> schema.ListSchemasResponse:
418 """Post-rpc interceptor for list_schemas
419
420 DEPRECATED. Please use the `post_list_schemas_with_metadata`
421 interceptor instead.
422
423 Override in a subclass to read or manipulate the response
424 after it is returned by the SchemaService server but before
425 it is returned to user code. This `post_list_schemas` interceptor runs
426 before the `post_list_schemas_with_metadata` interceptor.
427 """
428 return response
429
430 def post_list_schemas_with_metadata(
431 self,
432 response: schema.ListSchemasResponse,
433 metadata: Sequence[Tuple[str, Union[str, bytes]]],
434 ) -> Tuple[schema.ListSchemasResponse, Sequence[Tuple[str, Union[str, bytes]]]]:
435 """Post-rpc interceptor for list_schemas
436
437 Override in a subclass to read or manipulate the response or metadata after it
438 is returned by the SchemaService server but before it is returned to user code.
439
440 We recommend only using this `post_list_schemas_with_metadata`
441 interceptor in new development instead of the `post_list_schemas` interceptor.
442 When both interceptors are used, this `post_list_schemas_with_metadata` interceptor runs after the
443 `post_list_schemas` interceptor. The (possibly modified) response returned by
444 `post_list_schemas` will be passed to
445 `post_list_schemas_with_metadata`.
446 """
447 return response, metadata
448
449 def pre_rollback_schema(
450 self,
451 request: schema.RollbackSchemaRequest,
452 metadata: Sequence[Tuple[str, Union[str, bytes]]],
453 ) -> Tuple[schema.RollbackSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
454 """Pre-rpc interceptor for rollback_schema
455
456 Override in a subclass to manipulate the request or metadata
457 before they are sent to the SchemaService server.
458 """
459 return request, metadata
460
461 def post_rollback_schema(self, response: schema.Schema) -> schema.Schema:
462 """Post-rpc interceptor for rollback_schema
463
464 DEPRECATED. Please use the `post_rollback_schema_with_metadata`
465 interceptor instead.
466
467 Override in a subclass to read or manipulate the response
468 after it is returned by the SchemaService server but before
469 it is returned to user code. This `post_rollback_schema` interceptor runs
470 before the `post_rollback_schema_with_metadata` interceptor.
471 """
472 return response
473
474 def post_rollback_schema_with_metadata(
475 self, response: schema.Schema, metadata: Sequence[Tuple[str, Union[str, bytes]]]
476 ) -> Tuple[schema.Schema, Sequence[Tuple[str, Union[str, bytes]]]]:
477 """Post-rpc interceptor for rollback_schema
478
479 Override in a subclass to read or manipulate the response or metadata after it
480 is returned by the SchemaService server but before it is returned to user code.
481
482 We recommend only using this `post_rollback_schema_with_metadata`
483 interceptor in new development instead of the `post_rollback_schema` interceptor.
484 When both interceptors are used, this `post_rollback_schema_with_metadata` interceptor runs after the
485 `post_rollback_schema` interceptor. The (possibly modified) response returned by
486 `post_rollback_schema` will be passed to
487 `post_rollback_schema_with_metadata`.
488 """
489 return response, metadata
490
491 def pre_validate_message(
492 self,
493 request: schema.ValidateMessageRequest,
494 metadata: Sequence[Tuple[str, Union[str, bytes]]],
495 ) -> Tuple[schema.ValidateMessageRequest, Sequence[Tuple[str, Union[str, bytes]]]]:
496 """Pre-rpc interceptor for validate_message
497
498 Override in a subclass to manipulate the request or metadata
499 before they are sent to the SchemaService server.
500 """
501 return request, metadata
502
503 def post_validate_message(
504 self, response: schema.ValidateMessageResponse
505 ) -> schema.ValidateMessageResponse:
506 """Post-rpc interceptor for validate_message
507
508 DEPRECATED. Please use the `post_validate_message_with_metadata`
509 interceptor instead.
510
511 Override in a subclass to read or manipulate the response
512 after it is returned by the SchemaService server but before
513 it is returned to user code. This `post_validate_message` interceptor runs
514 before the `post_validate_message_with_metadata` interceptor.
515 """
516 return response
517
518 def post_validate_message_with_metadata(
519 self,
520 response: schema.ValidateMessageResponse,
521 metadata: Sequence[Tuple[str, Union[str, bytes]]],
522 ) -> Tuple[schema.ValidateMessageResponse, Sequence[Tuple[str, Union[str, bytes]]]]:
523 """Post-rpc interceptor for validate_message
524
525 Override in a subclass to read or manipulate the response or metadata after it
526 is returned by the SchemaService server but before it is returned to user code.
527
528 We recommend only using this `post_validate_message_with_metadata`
529 interceptor in new development instead of the `post_validate_message` interceptor.
530 When both interceptors are used, this `post_validate_message_with_metadata` interceptor runs after the
531 `post_validate_message` interceptor. The (possibly modified) response returned by
532 `post_validate_message` will be passed to
533 `post_validate_message_with_metadata`.
534 """
535 return response, metadata
536
537 def pre_validate_schema(
538 self,
539 request: gp_schema.ValidateSchemaRequest,
540 metadata: Sequence[Tuple[str, Union[str, bytes]]],
541 ) -> Tuple[
542 gp_schema.ValidateSchemaRequest, Sequence[Tuple[str, Union[str, bytes]]]
543 ]:
544 """Pre-rpc interceptor for validate_schema
545
546 Override in a subclass to manipulate the request or metadata
547 before they are sent to the SchemaService server.
548 """
549 return request, metadata
550
551 def post_validate_schema(
552 self, response: gp_schema.ValidateSchemaResponse
553 ) -> gp_schema.ValidateSchemaResponse:
554 """Post-rpc interceptor for validate_schema
555
556 DEPRECATED. Please use the `post_validate_schema_with_metadata`
557 interceptor instead.
558
559 Override in a subclass to read or manipulate the response
560 after it is returned by the SchemaService server but before
561 it is returned to user code. This `post_validate_schema` interceptor runs
562 before the `post_validate_schema_with_metadata` interceptor.
563 """
564 return response
565
566 def post_validate_schema_with_metadata(
567 self,
568 response: gp_schema.ValidateSchemaResponse,
569 metadata: Sequence[Tuple[str, Union[str, bytes]]],
570 ) -> Tuple[
571 gp_schema.ValidateSchemaResponse, Sequence[Tuple[str, Union[str, bytes]]]
572 ]:
573 """Post-rpc interceptor for validate_schema
574
575 Override in a subclass to read or manipulate the response or metadata after it
576 is returned by the SchemaService server but before it is returned to user code.
577
578 We recommend only using this `post_validate_schema_with_metadata`
579 interceptor in new development instead of the `post_validate_schema` interceptor.
580 When both interceptors are used, this `post_validate_schema_with_metadata` interceptor runs after the
581 `post_validate_schema` interceptor. The (possibly modified) response returned by
582 `post_validate_schema` will be passed to
583 `post_validate_schema_with_metadata`.
584 """
585 return response, metadata
586
587 def pre_get_iam_policy(
588 self,
589 request: iam_policy_pb2.GetIamPolicyRequest,
590 metadata: Sequence[Tuple[str, Union[str, bytes]]],
591 ) -> Tuple[
592 iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
593 ]:
594 """Pre-rpc interceptor for get_iam_policy
595
596 Override in a subclass to manipulate the request or metadata
597 before they are sent to the SchemaService server.
598 """
599 return request, metadata
600
601 def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
602 """Post-rpc interceptor for get_iam_policy
603
604 Override in a subclass to manipulate the response
605 after it is returned by the SchemaService server but before
606 it is returned to user code.
607 """
608 return response
609
610 def pre_set_iam_policy(
611 self,
612 request: iam_policy_pb2.SetIamPolicyRequest,
613 metadata: Sequence[Tuple[str, Union[str, bytes]]],
614 ) -> Tuple[
615 iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
616 ]:
617 """Pre-rpc interceptor for set_iam_policy
618
619 Override in a subclass to manipulate the request or metadata
620 before they are sent to the SchemaService server.
621 """
622 return request, metadata
623
624 def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
625 """Post-rpc interceptor for set_iam_policy
626
627 Override in a subclass to manipulate the response
628 after it is returned by the SchemaService server but before
629 it is returned to user code.
630 """
631 return response
632
633 def pre_test_iam_permissions(
634 self,
635 request: iam_policy_pb2.TestIamPermissionsRequest,
636 metadata: Sequence[Tuple[str, Union[str, bytes]]],
637 ) -> Tuple[
638 iam_policy_pb2.TestIamPermissionsRequest,
639 Sequence[Tuple[str, Union[str, bytes]]],
640 ]:
641 """Pre-rpc interceptor for test_iam_permissions
642
643 Override in a subclass to manipulate the request or metadata
644 before they are sent to the SchemaService server.
645 """
646 return request, metadata
647
648 def post_test_iam_permissions(
649 self, response: iam_policy_pb2.TestIamPermissionsResponse
650 ) -> iam_policy_pb2.TestIamPermissionsResponse:
651 """Post-rpc interceptor for test_iam_permissions
652
653 Override in a subclass to manipulate the response
654 after it is returned by the SchemaService server but before
655 it is returned to user code.
656 """
657 return response
658
659
660@dataclasses.dataclass
661class SchemaServiceRestStub:
662 _session: AuthorizedSession
663 _host: str
664 _interceptor: SchemaServiceRestInterceptor
665
666
667class SchemaServiceRestTransport(_BaseSchemaServiceRestTransport):
668 """REST backend synchronous transport for SchemaService.
669
670 Service for doing schema-related operations.
671
672 This class defines the same methods as the primary client, so the
673 primary client can load the underlying transport implementation
674 and call it.
675
676 It sends JSON representations of protocol buffers over HTTP/1.1
677 """
678
679 def __init__(
680 self,
681 *,
682 host: str = "pubsub.googleapis.com",
683 credentials: Optional[ga_credentials.Credentials] = None,
684 credentials_file: Optional[str] = None,
685 scopes: Optional[Sequence[str]] = None,
686 client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
687 quota_project_id: Optional[str] = None,
688 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
689 always_use_jwt_access: Optional[bool] = False,
690 url_scheme: str = "https",
691 interceptor: Optional[SchemaServiceRestInterceptor] = None,
692 api_audience: Optional[str] = None,
693 ) -> None:
694 """Instantiate the transport.
695
696 Args:
697 host (Optional[str]):
698 The hostname to connect to (default: 'pubsub.googleapis.com').
699 credentials (Optional[google.auth.credentials.Credentials]): The
700 authorization credentials to attach to requests. These
701 credentials identify the application to the service; if none
702 are specified, the client will attempt to ascertain the
703 credentials from the environment.
704
705 credentials_file (Optional[str]): A file with credentials that can
706 be loaded with :func:`google.auth.load_credentials_from_file`.
707 This argument is ignored if ``channel`` is provided.
708 scopes (Optional(Sequence[str])): A list of scopes. This argument is
709 ignored if ``channel`` is provided.
710 client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
711 certificate to configure mutual TLS HTTP channel. It is ignored
712 if ``channel`` is provided.
713 quota_project_id (Optional[str]): An optional project to use for billing
714 and quota.
715 client_info (google.api_core.gapic_v1.client_info.ClientInfo):
716 The client info used to send a user-agent string along with
717 API requests. If ``None``, then default info will be used.
718 Generally, you only need to set this if you are developing
719 your own client library.
720 always_use_jwt_access (Optional[bool]): Whether self signed JWT should
721 be used for service account credentials.
722 url_scheme: the protocol scheme for the API endpoint. Normally
723 "https", but for testing or local servers,
724 "http" can be specified.
725 """
726 # Run the base constructor
727 # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
728 # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
729 # credentials object
730 super().__init__(
731 host=host,
732 credentials=credentials,
733 client_info=client_info,
734 always_use_jwt_access=always_use_jwt_access,
735 url_scheme=url_scheme,
736 api_audience=api_audience,
737 )
738 self._session = AuthorizedSession(
739 self._credentials, default_host=self.DEFAULT_HOST
740 )
741 if client_cert_source_for_mtls:
742 self._session.configure_mtls_channel(client_cert_source_for_mtls)
743 self._interceptor = interceptor or SchemaServiceRestInterceptor()
744 self._prep_wrapped_messages(client_info)
745
746 class _CommitSchema(
747 _BaseSchemaServiceRestTransport._BaseCommitSchema, SchemaServiceRestStub
748 ):
749 def __hash__(self):
750 return hash("SchemaServiceRestTransport.CommitSchema")
751
752 @staticmethod
753 def _get_response(
754 host,
755 metadata,
756 query_params,
757 session,
758 timeout,
759 transcoded_request,
760 body=None,
761 ):
762 uri = transcoded_request["uri"]
763 method = transcoded_request["method"]
764 headers = dict(metadata)
765 headers["Content-Type"] = "application/json"
766 response = getattr(session, method)(
767 "{host}{uri}".format(host=host, uri=uri),
768 timeout=timeout,
769 headers=headers,
770 params=rest_helpers.flatten_query_params(query_params, strict=True),
771 data=body,
772 )
773 return response
774
775 def __call__(
776 self,
777 request: gp_schema.CommitSchemaRequest,
778 *,
779 retry: OptionalRetry = gapic_v1.method.DEFAULT,
780 timeout: Optional[float] = None,
781 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
782 ) -> gp_schema.Schema:
783 r"""Call the commit schema method over HTTP.
784
785 Args:
786 request (~.gp_schema.CommitSchemaRequest):
787 The request object. Request for CommitSchema method.
788 retry (google.api_core.retry.Retry): Designation of what errors, if any,
789 should be retried.
790 timeout (float): The timeout for this request.
791 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
792 sent along with the request as metadata. Normally, each value must be of type `str`,
793 but for metadata keys ending with the suffix `-bin`, the corresponding values must
794 be of type `bytes`.
795
796 Returns:
797 ~.gp_schema.Schema:
798 A schema resource.
799 """
800
801 http_options = (
802 _BaseSchemaServiceRestTransport._BaseCommitSchema._get_http_options()
803 )
804
805 request, metadata = self._interceptor.pre_commit_schema(request, metadata)
806 transcoded_request = _BaseSchemaServiceRestTransport._BaseCommitSchema._get_transcoded_request(
807 http_options, request
808 )
809
810 body = _BaseSchemaServiceRestTransport._BaseCommitSchema._get_request_body_json(
811 transcoded_request
812 )
813
814 # Jsonify the query params
815 query_params = _BaseSchemaServiceRestTransport._BaseCommitSchema._get_query_params_json(
816 transcoded_request
817 )
818
819 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
820 logging.DEBUG
821 ): # pragma: NO COVER
822 request_url = "{host}{uri}".format(
823 host=self._host, uri=transcoded_request["uri"]
824 )
825 method = transcoded_request["method"]
826 try:
827 request_payload = type(request).to_json(request)
828 except:
829 request_payload = None
830 http_request = {
831 "payload": request_payload,
832 "requestMethod": method,
833 "requestUrl": request_url,
834 "headers": dict(metadata),
835 }
836 _LOGGER.debug(
837 f"Sending request for google.pubsub_v1.SchemaServiceClient.CommitSchema",
838 extra={
839 "serviceName": "google.pubsub.v1.SchemaService",
840 "rpcName": "CommitSchema",
841 "httpRequest": http_request,
842 "metadata": http_request["headers"],
843 },
844 )
845
846 # Send the request
847 response = SchemaServiceRestTransport._CommitSchema._get_response(
848 self._host,
849 metadata,
850 query_params,
851 self._session,
852 timeout,
853 transcoded_request,
854 body,
855 )
856
857 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
858 # subclass.
859 if response.status_code >= 400:
860 raise core_exceptions.from_http_response(response)
861
862 # Return the response
863 resp = gp_schema.Schema()
864 pb_resp = gp_schema.Schema.pb(resp)
865
866 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
867
868 resp = self._interceptor.post_commit_schema(resp)
869 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
870 resp, _ = self._interceptor.post_commit_schema_with_metadata(
871 resp, response_metadata
872 )
873 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
874 logging.DEBUG
875 ): # pragma: NO COVER
876 try:
877 response_payload = gp_schema.Schema.to_json(response)
878 except:
879 response_payload = None
880 http_response = {
881 "payload": response_payload,
882 "headers": dict(response.headers),
883 "status": response.status_code,
884 }
885 _LOGGER.debug(
886 "Received response for google.pubsub_v1.SchemaServiceClient.commit_schema",
887 extra={
888 "serviceName": "google.pubsub.v1.SchemaService",
889 "rpcName": "CommitSchema",
890 "metadata": http_response["headers"],
891 "httpResponse": http_response,
892 },
893 )
894 return resp
895
896 class _CreateSchema(
897 _BaseSchemaServiceRestTransport._BaseCreateSchema, SchemaServiceRestStub
898 ):
899 def __hash__(self):
900 return hash("SchemaServiceRestTransport.CreateSchema")
901
902 @staticmethod
903 def _get_response(
904 host,
905 metadata,
906 query_params,
907 session,
908 timeout,
909 transcoded_request,
910 body=None,
911 ):
912 uri = transcoded_request["uri"]
913 method = transcoded_request["method"]
914 headers = dict(metadata)
915 headers["Content-Type"] = "application/json"
916 response = getattr(session, method)(
917 "{host}{uri}".format(host=host, uri=uri),
918 timeout=timeout,
919 headers=headers,
920 params=rest_helpers.flatten_query_params(query_params, strict=True),
921 data=body,
922 )
923 return response
924
925 def __call__(
926 self,
927 request: gp_schema.CreateSchemaRequest,
928 *,
929 retry: OptionalRetry = gapic_v1.method.DEFAULT,
930 timeout: Optional[float] = None,
931 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
932 ) -> gp_schema.Schema:
933 r"""Call the create schema method over HTTP.
934
935 Args:
936 request (~.gp_schema.CreateSchemaRequest):
937 The request object. Request for the CreateSchema method.
938 retry (google.api_core.retry.Retry): Designation of what errors, if any,
939 should be retried.
940 timeout (float): The timeout for this request.
941 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
942 sent along with the request as metadata. Normally, each value must be of type `str`,
943 but for metadata keys ending with the suffix `-bin`, the corresponding values must
944 be of type `bytes`.
945
946 Returns:
947 ~.gp_schema.Schema:
948 A schema resource.
949 """
950
951 http_options = (
952 _BaseSchemaServiceRestTransport._BaseCreateSchema._get_http_options()
953 )
954
955 request, metadata = self._interceptor.pre_create_schema(request, metadata)
956 transcoded_request = _BaseSchemaServiceRestTransport._BaseCreateSchema._get_transcoded_request(
957 http_options, request
958 )
959
960 body = _BaseSchemaServiceRestTransport._BaseCreateSchema._get_request_body_json(
961 transcoded_request
962 )
963
964 # Jsonify the query params
965 query_params = _BaseSchemaServiceRestTransport._BaseCreateSchema._get_query_params_json(
966 transcoded_request
967 )
968
969 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
970 logging.DEBUG
971 ): # pragma: NO COVER
972 request_url = "{host}{uri}".format(
973 host=self._host, uri=transcoded_request["uri"]
974 )
975 method = transcoded_request["method"]
976 try:
977 request_payload = type(request).to_json(request)
978 except:
979 request_payload = None
980 http_request = {
981 "payload": request_payload,
982 "requestMethod": method,
983 "requestUrl": request_url,
984 "headers": dict(metadata),
985 }
986 _LOGGER.debug(
987 f"Sending request for google.pubsub_v1.SchemaServiceClient.CreateSchema",
988 extra={
989 "serviceName": "google.pubsub.v1.SchemaService",
990 "rpcName": "CreateSchema",
991 "httpRequest": http_request,
992 "metadata": http_request["headers"],
993 },
994 )
995
996 # Send the request
997 response = SchemaServiceRestTransport._CreateSchema._get_response(
998 self._host,
999 metadata,
1000 query_params,
1001 self._session,
1002 timeout,
1003 transcoded_request,
1004 body,
1005 )
1006
1007 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1008 # subclass.
1009 if response.status_code >= 400:
1010 raise core_exceptions.from_http_response(response)
1011
1012 # Return the response
1013 resp = gp_schema.Schema()
1014 pb_resp = gp_schema.Schema.pb(resp)
1015
1016 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1017
1018 resp = self._interceptor.post_create_schema(resp)
1019 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1020 resp, _ = self._interceptor.post_create_schema_with_metadata(
1021 resp, response_metadata
1022 )
1023 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1024 logging.DEBUG
1025 ): # pragma: NO COVER
1026 try:
1027 response_payload = gp_schema.Schema.to_json(response)
1028 except:
1029 response_payload = None
1030 http_response = {
1031 "payload": response_payload,
1032 "headers": dict(response.headers),
1033 "status": response.status_code,
1034 }
1035 _LOGGER.debug(
1036 "Received response for google.pubsub_v1.SchemaServiceClient.create_schema",
1037 extra={
1038 "serviceName": "google.pubsub.v1.SchemaService",
1039 "rpcName": "CreateSchema",
1040 "metadata": http_response["headers"],
1041 "httpResponse": http_response,
1042 },
1043 )
1044 return resp
1045
1046 class _DeleteSchema(
1047 _BaseSchemaServiceRestTransport._BaseDeleteSchema, SchemaServiceRestStub
1048 ):
1049 def __hash__(self):
1050 return hash("SchemaServiceRestTransport.DeleteSchema")
1051
1052 @staticmethod
1053 def _get_response(
1054 host,
1055 metadata,
1056 query_params,
1057 session,
1058 timeout,
1059 transcoded_request,
1060 body=None,
1061 ):
1062 uri = transcoded_request["uri"]
1063 method = transcoded_request["method"]
1064 headers = dict(metadata)
1065 headers["Content-Type"] = "application/json"
1066 response = getattr(session, method)(
1067 "{host}{uri}".format(host=host, uri=uri),
1068 timeout=timeout,
1069 headers=headers,
1070 params=rest_helpers.flatten_query_params(query_params, strict=True),
1071 )
1072 return response
1073
1074 def __call__(
1075 self,
1076 request: schema.DeleteSchemaRequest,
1077 *,
1078 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1079 timeout: Optional[float] = None,
1080 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1081 ):
1082 r"""Call the delete schema method over HTTP.
1083
1084 Args:
1085 request (~.schema.DeleteSchemaRequest):
1086 The request object. Request for the ``DeleteSchema`` method.
1087 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1088 should be retried.
1089 timeout (float): The timeout for this request.
1090 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1091 sent along with the request as metadata. Normally, each value must be of type `str`,
1092 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1093 be of type `bytes`.
1094 """
1095
1096 http_options = (
1097 _BaseSchemaServiceRestTransport._BaseDeleteSchema._get_http_options()
1098 )
1099
1100 request, metadata = self._interceptor.pre_delete_schema(request, metadata)
1101 transcoded_request = _BaseSchemaServiceRestTransport._BaseDeleteSchema._get_transcoded_request(
1102 http_options, request
1103 )
1104
1105 # Jsonify the query params
1106 query_params = _BaseSchemaServiceRestTransport._BaseDeleteSchema._get_query_params_json(
1107 transcoded_request
1108 )
1109
1110 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1111 logging.DEBUG
1112 ): # pragma: NO COVER
1113 request_url = "{host}{uri}".format(
1114 host=self._host, uri=transcoded_request["uri"]
1115 )
1116 method = transcoded_request["method"]
1117 try:
1118 request_payload = json_format.MessageToJson(request)
1119 except:
1120 request_payload = None
1121 http_request = {
1122 "payload": request_payload,
1123 "requestMethod": method,
1124 "requestUrl": request_url,
1125 "headers": dict(metadata),
1126 }
1127 _LOGGER.debug(
1128 f"Sending request for google.pubsub_v1.SchemaServiceClient.DeleteSchema",
1129 extra={
1130 "serviceName": "google.pubsub.v1.SchemaService",
1131 "rpcName": "DeleteSchema",
1132 "httpRequest": http_request,
1133 "metadata": http_request["headers"],
1134 },
1135 )
1136
1137 # Send the request
1138 response = SchemaServiceRestTransport._DeleteSchema._get_response(
1139 self._host,
1140 metadata,
1141 query_params,
1142 self._session,
1143 timeout,
1144 transcoded_request,
1145 )
1146
1147 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1148 # subclass.
1149 if response.status_code >= 400:
1150 raise core_exceptions.from_http_response(response)
1151
1152 class _DeleteSchemaRevision(
1153 _BaseSchemaServiceRestTransport._BaseDeleteSchemaRevision, SchemaServiceRestStub
1154 ):
1155 def __hash__(self):
1156 return hash("SchemaServiceRestTransport.DeleteSchemaRevision")
1157
1158 @staticmethod
1159 def _get_response(
1160 host,
1161 metadata,
1162 query_params,
1163 session,
1164 timeout,
1165 transcoded_request,
1166 body=None,
1167 ):
1168 uri = transcoded_request["uri"]
1169 method = transcoded_request["method"]
1170 headers = dict(metadata)
1171 headers["Content-Type"] = "application/json"
1172 response = getattr(session, method)(
1173 "{host}{uri}".format(host=host, uri=uri),
1174 timeout=timeout,
1175 headers=headers,
1176 params=rest_helpers.flatten_query_params(query_params, strict=True),
1177 )
1178 return response
1179
1180 def __call__(
1181 self,
1182 request: schema.DeleteSchemaRevisionRequest,
1183 *,
1184 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1185 timeout: Optional[float] = None,
1186 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1187 ) -> schema.Schema:
1188 r"""Call the delete schema revision method over HTTP.
1189
1190 Args:
1191 request (~.schema.DeleteSchemaRevisionRequest):
1192 The request object. Request for the ``DeleteSchemaRevision`` method.
1193 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1194 should be retried.
1195 timeout (float): The timeout for this request.
1196 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1197 sent along with the request as metadata. Normally, each value must be of type `str`,
1198 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1199 be of type `bytes`.
1200
1201 Returns:
1202 ~.schema.Schema:
1203 A schema resource.
1204 """
1205
1206 http_options = (
1207 _BaseSchemaServiceRestTransport._BaseDeleteSchemaRevision._get_http_options()
1208 )
1209
1210 request, metadata = self._interceptor.pre_delete_schema_revision(
1211 request, metadata
1212 )
1213 transcoded_request = _BaseSchemaServiceRestTransport._BaseDeleteSchemaRevision._get_transcoded_request(
1214 http_options, request
1215 )
1216
1217 # Jsonify the query params
1218 query_params = _BaseSchemaServiceRestTransport._BaseDeleteSchemaRevision._get_query_params_json(
1219 transcoded_request
1220 )
1221
1222 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1223 logging.DEBUG
1224 ): # pragma: NO COVER
1225 request_url = "{host}{uri}".format(
1226 host=self._host, uri=transcoded_request["uri"]
1227 )
1228 method = transcoded_request["method"]
1229 try:
1230 request_payload = type(request).to_json(request)
1231 except:
1232 request_payload = None
1233 http_request = {
1234 "payload": request_payload,
1235 "requestMethod": method,
1236 "requestUrl": request_url,
1237 "headers": dict(metadata),
1238 }
1239 _LOGGER.debug(
1240 f"Sending request for google.pubsub_v1.SchemaServiceClient.DeleteSchemaRevision",
1241 extra={
1242 "serviceName": "google.pubsub.v1.SchemaService",
1243 "rpcName": "DeleteSchemaRevision",
1244 "httpRequest": http_request,
1245 "metadata": http_request["headers"],
1246 },
1247 )
1248
1249 # Send the request
1250 response = SchemaServiceRestTransport._DeleteSchemaRevision._get_response(
1251 self._host,
1252 metadata,
1253 query_params,
1254 self._session,
1255 timeout,
1256 transcoded_request,
1257 )
1258
1259 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1260 # subclass.
1261 if response.status_code >= 400:
1262 raise core_exceptions.from_http_response(response)
1263
1264 # Return the response
1265 resp = schema.Schema()
1266 pb_resp = schema.Schema.pb(resp)
1267
1268 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1269
1270 resp = self._interceptor.post_delete_schema_revision(resp)
1271 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1272 resp, _ = self._interceptor.post_delete_schema_revision_with_metadata(
1273 resp, response_metadata
1274 )
1275 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1276 logging.DEBUG
1277 ): # pragma: NO COVER
1278 try:
1279 response_payload = schema.Schema.to_json(response)
1280 except:
1281 response_payload = None
1282 http_response = {
1283 "payload": response_payload,
1284 "headers": dict(response.headers),
1285 "status": response.status_code,
1286 }
1287 _LOGGER.debug(
1288 "Received response for google.pubsub_v1.SchemaServiceClient.delete_schema_revision",
1289 extra={
1290 "serviceName": "google.pubsub.v1.SchemaService",
1291 "rpcName": "DeleteSchemaRevision",
1292 "metadata": http_response["headers"],
1293 "httpResponse": http_response,
1294 },
1295 )
1296 return resp
1297
1298 class _GetSchema(
1299 _BaseSchemaServiceRestTransport._BaseGetSchema, SchemaServiceRestStub
1300 ):
1301 def __hash__(self):
1302 return hash("SchemaServiceRestTransport.GetSchema")
1303
1304 @staticmethod
1305 def _get_response(
1306 host,
1307 metadata,
1308 query_params,
1309 session,
1310 timeout,
1311 transcoded_request,
1312 body=None,
1313 ):
1314 uri = transcoded_request["uri"]
1315 method = transcoded_request["method"]
1316 headers = dict(metadata)
1317 headers["Content-Type"] = "application/json"
1318 response = getattr(session, method)(
1319 "{host}{uri}".format(host=host, uri=uri),
1320 timeout=timeout,
1321 headers=headers,
1322 params=rest_helpers.flatten_query_params(query_params, strict=True),
1323 )
1324 return response
1325
1326 def __call__(
1327 self,
1328 request: schema.GetSchemaRequest,
1329 *,
1330 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1331 timeout: Optional[float] = None,
1332 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1333 ) -> schema.Schema:
1334 r"""Call the get schema method over HTTP.
1335
1336 Args:
1337 request (~.schema.GetSchemaRequest):
1338 The request object. Request for the GetSchema method.
1339 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1340 should be retried.
1341 timeout (float): The timeout for this request.
1342 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1343 sent along with the request as metadata. Normally, each value must be of type `str`,
1344 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1345 be of type `bytes`.
1346
1347 Returns:
1348 ~.schema.Schema:
1349 A schema resource.
1350 """
1351
1352 http_options = (
1353 _BaseSchemaServiceRestTransport._BaseGetSchema._get_http_options()
1354 )
1355
1356 request, metadata = self._interceptor.pre_get_schema(request, metadata)
1357 transcoded_request = (
1358 _BaseSchemaServiceRestTransport._BaseGetSchema._get_transcoded_request(
1359 http_options, request
1360 )
1361 )
1362
1363 # Jsonify the query params
1364 query_params = (
1365 _BaseSchemaServiceRestTransport._BaseGetSchema._get_query_params_json(
1366 transcoded_request
1367 )
1368 )
1369
1370 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1371 logging.DEBUG
1372 ): # pragma: NO COVER
1373 request_url = "{host}{uri}".format(
1374 host=self._host, uri=transcoded_request["uri"]
1375 )
1376 method = transcoded_request["method"]
1377 try:
1378 request_payload = type(request).to_json(request)
1379 except:
1380 request_payload = None
1381 http_request = {
1382 "payload": request_payload,
1383 "requestMethod": method,
1384 "requestUrl": request_url,
1385 "headers": dict(metadata),
1386 }
1387 _LOGGER.debug(
1388 f"Sending request for google.pubsub_v1.SchemaServiceClient.GetSchema",
1389 extra={
1390 "serviceName": "google.pubsub.v1.SchemaService",
1391 "rpcName": "GetSchema",
1392 "httpRequest": http_request,
1393 "metadata": http_request["headers"],
1394 },
1395 )
1396
1397 # Send the request
1398 response = SchemaServiceRestTransport._GetSchema._get_response(
1399 self._host,
1400 metadata,
1401 query_params,
1402 self._session,
1403 timeout,
1404 transcoded_request,
1405 )
1406
1407 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1408 # subclass.
1409 if response.status_code >= 400:
1410 raise core_exceptions.from_http_response(response)
1411
1412 # Return the response
1413 resp = schema.Schema()
1414 pb_resp = schema.Schema.pb(resp)
1415
1416 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1417
1418 resp = self._interceptor.post_get_schema(resp)
1419 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1420 resp, _ = self._interceptor.post_get_schema_with_metadata(
1421 resp, response_metadata
1422 )
1423 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1424 logging.DEBUG
1425 ): # pragma: NO COVER
1426 try:
1427 response_payload = schema.Schema.to_json(response)
1428 except:
1429 response_payload = None
1430 http_response = {
1431 "payload": response_payload,
1432 "headers": dict(response.headers),
1433 "status": response.status_code,
1434 }
1435 _LOGGER.debug(
1436 "Received response for google.pubsub_v1.SchemaServiceClient.get_schema",
1437 extra={
1438 "serviceName": "google.pubsub.v1.SchemaService",
1439 "rpcName": "GetSchema",
1440 "metadata": http_response["headers"],
1441 "httpResponse": http_response,
1442 },
1443 )
1444 return resp
1445
1446 class _ListSchemaRevisions(
1447 _BaseSchemaServiceRestTransport._BaseListSchemaRevisions, SchemaServiceRestStub
1448 ):
1449 def __hash__(self):
1450 return hash("SchemaServiceRestTransport.ListSchemaRevisions")
1451
1452 @staticmethod
1453 def _get_response(
1454 host,
1455 metadata,
1456 query_params,
1457 session,
1458 timeout,
1459 transcoded_request,
1460 body=None,
1461 ):
1462 uri = transcoded_request["uri"]
1463 method = transcoded_request["method"]
1464 headers = dict(metadata)
1465 headers["Content-Type"] = "application/json"
1466 response = getattr(session, method)(
1467 "{host}{uri}".format(host=host, uri=uri),
1468 timeout=timeout,
1469 headers=headers,
1470 params=rest_helpers.flatten_query_params(query_params, strict=True),
1471 )
1472 return response
1473
1474 def __call__(
1475 self,
1476 request: schema.ListSchemaRevisionsRequest,
1477 *,
1478 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1479 timeout: Optional[float] = None,
1480 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1481 ) -> schema.ListSchemaRevisionsResponse:
1482 r"""Call the list schema revisions method over HTTP.
1483
1484 Args:
1485 request (~.schema.ListSchemaRevisionsRequest):
1486 The request object. Request for the ``ListSchemaRevisions`` method.
1487 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1488 should be retried.
1489 timeout (float): The timeout for this request.
1490 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1491 sent along with the request as metadata. Normally, each value must be of type `str`,
1492 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1493 be of type `bytes`.
1494
1495 Returns:
1496 ~.schema.ListSchemaRevisionsResponse:
1497 Response for the ``ListSchemaRevisions`` method.
1498 """
1499
1500 http_options = (
1501 _BaseSchemaServiceRestTransport._BaseListSchemaRevisions._get_http_options()
1502 )
1503
1504 request, metadata = self._interceptor.pre_list_schema_revisions(
1505 request, metadata
1506 )
1507 transcoded_request = _BaseSchemaServiceRestTransport._BaseListSchemaRevisions._get_transcoded_request(
1508 http_options, request
1509 )
1510
1511 # Jsonify the query params
1512 query_params = _BaseSchemaServiceRestTransport._BaseListSchemaRevisions._get_query_params_json(
1513 transcoded_request
1514 )
1515
1516 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1517 logging.DEBUG
1518 ): # pragma: NO COVER
1519 request_url = "{host}{uri}".format(
1520 host=self._host, uri=transcoded_request["uri"]
1521 )
1522 method = transcoded_request["method"]
1523 try:
1524 request_payload = type(request).to_json(request)
1525 except:
1526 request_payload = None
1527 http_request = {
1528 "payload": request_payload,
1529 "requestMethod": method,
1530 "requestUrl": request_url,
1531 "headers": dict(metadata),
1532 }
1533 _LOGGER.debug(
1534 f"Sending request for google.pubsub_v1.SchemaServiceClient.ListSchemaRevisions",
1535 extra={
1536 "serviceName": "google.pubsub.v1.SchemaService",
1537 "rpcName": "ListSchemaRevisions",
1538 "httpRequest": http_request,
1539 "metadata": http_request["headers"],
1540 },
1541 )
1542
1543 # Send the request
1544 response = SchemaServiceRestTransport._ListSchemaRevisions._get_response(
1545 self._host,
1546 metadata,
1547 query_params,
1548 self._session,
1549 timeout,
1550 transcoded_request,
1551 )
1552
1553 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1554 # subclass.
1555 if response.status_code >= 400:
1556 raise core_exceptions.from_http_response(response)
1557
1558 # Return the response
1559 resp = schema.ListSchemaRevisionsResponse()
1560 pb_resp = schema.ListSchemaRevisionsResponse.pb(resp)
1561
1562 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1563
1564 resp = self._interceptor.post_list_schema_revisions(resp)
1565 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1566 resp, _ = self._interceptor.post_list_schema_revisions_with_metadata(
1567 resp, response_metadata
1568 )
1569 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1570 logging.DEBUG
1571 ): # pragma: NO COVER
1572 try:
1573 response_payload = schema.ListSchemaRevisionsResponse.to_json(
1574 response
1575 )
1576 except:
1577 response_payload = None
1578 http_response = {
1579 "payload": response_payload,
1580 "headers": dict(response.headers),
1581 "status": response.status_code,
1582 }
1583 _LOGGER.debug(
1584 "Received response for google.pubsub_v1.SchemaServiceClient.list_schema_revisions",
1585 extra={
1586 "serviceName": "google.pubsub.v1.SchemaService",
1587 "rpcName": "ListSchemaRevisions",
1588 "metadata": http_response["headers"],
1589 "httpResponse": http_response,
1590 },
1591 )
1592 return resp
1593
1594 class _ListSchemas(
1595 _BaseSchemaServiceRestTransport._BaseListSchemas, SchemaServiceRestStub
1596 ):
1597 def __hash__(self):
1598 return hash("SchemaServiceRestTransport.ListSchemas")
1599
1600 @staticmethod
1601 def _get_response(
1602 host,
1603 metadata,
1604 query_params,
1605 session,
1606 timeout,
1607 transcoded_request,
1608 body=None,
1609 ):
1610 uri = transcoded_request["uri"]
1611 method = transcoded_request["method"]
1612 headers = dict(metadata)
1613 headers["Content-Type"] = "application/json"
1614 response = getattr(session, method)(
1615 "{host}{uri}".format(host=host, uri=uri),
1616 timeout=timeout,
1617 headers=headers,
1618 params=rest_helpers.flatten_query_params(query_params, strict=True),
1619 )
1620 return response
1621
1622 def __call__(
1623 self,
1624 request: schema.ListSchemasRequest,
1625 *,
1626 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1627 timeout: Optional[float] = None,
1628 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1629 ) -> schema.ListSchemasResponse:
1630 r"""Call the list schemas method over HTTP.
1631
1632 Args:
1633 request (~.schema.ListSchemasRequest):
1634 The request object. Request for the ``ListSchemas`` method.
1635 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1636 should be retried.
1637 timeout (float): The timeout for this request.
1638 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1639 sent along with the request as metadata. Normally, each value must be of type `str`,
1640 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1641 be of type `bytes`.
1642
1643 Returns:
1644 ~.schema.ListSchemasResponse:
1645 Response for the ``ListSchemas`` method.
1646 """
1647
1648 http_options = (
1649 _BaseSchemaServiceRestTransport._BaseListSchemas._get_http_options()
1650 )
1651
1652 request, metadata = self._interceptor.pre_list_schemas(request, metadata)
1653 transcoded_request = _BaseSchemaServiceRestTransport._BaseListSchemas._get_transcoded_request(
1654 http_options, request
1655 )
1656
1657 # Jsonify the query params
1658 query_params = (
1659 _BaseSchemaServiceRestTransport._BaseListSchemas._get_query_params_json(
1660 transcoded_request
1661 )
1662 )
1663
1664 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1665 logging.DEBUG
1666 ): # pragma: NO COVER
1667 request_url = "{host}{uri}".format(
1668 host=self._host, uri=transcoded_request["uri"]
1669 )
1670 method = transcoded_request["method"]
1671 try:
1672 request_payload = type(request).to_json(request)
1673 except:
1674 request_payload = None
1675 http_request = {
1676 "payload": request_payload,
1677 "requestMethod": method,
1678 "requestUrl": request_url,
1679 "headers": dict(metadata),
1680 }
1681 _LOGGER.debug(
1682 f"Sending request for google.pubsub_v1.SchemaServiceClient.ListSchemas",
1683 extra={
1684 "serviceName": "google.pubsub.v1.SchemaService",
1685 "rpcName": "ListSchemas",
1686 "httpRequest": http_request,
1687 "metadata": http_request["headers"],
1688 },
1689 )
1690
1691 # Send the request
1692 response = SchemaServiceRestTransport._ListSchemas._get_response(
1693 self._host,
1694 metadata,
1695 query_params,
1696 self._session,
1697 timeout,
1698 transcoded_request,
1699 )
1700
1701 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1702 # subclass.
1703 if response.status_code >= 400:
1704 raise core_exceptions.from_http_response(response)
1705
1706 # Return the response
1707 resp = schema.ListSchemasResponse()
1708 pb_resp = schema.ListSchemasResponse.pb(resp)
1709
1710 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1711
1712 resp = self._interceptor.post_list_schemas(resp)
1713 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1714 resp, _ = self._interceptor.post_list_schemas_with_metadata(
1715 resp, response_metadata
1716 )
1717 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1718 logging.DEBUG
1719 ): # pragma: NO COVER
1720 try:
1721 response_payload = schema.ListSchemasResponse.to_json(response)
1722 except:
1723 response_payload = None
1724 http_response = {
1725 "payload": response_payload,
1726 "headers": dict(response.headers),
1727 "status": response.status_code,
1728 }
1729 _LOGGER.debug(
1730 "Received response for google.pubsub_v1.SchemaServiceClient.list_schemas",
1731 extra={
1732 "serviceName": "google.pubsub.v1.SchemaService",
1733 "rpcName": "ListSchemas",
1734 "metadata": http_response["headers"],
1735 "httpResponse": http_response,
1736 },
1737 )
1738 return resp
1739
1740 class _RollbackSchema(
1741 _BaseSchemaServiceRestTransport._BaseRollbackSchema, SchemaServiceRestStub
1742 ):
1743 def __hash__(self):
1744 return hash("SchemaServiceRestTransport.RollbackSchema")
1745
1746 @staticmethod
1747 def _get_response(
1748 host,
1749 metadata,
1750 query_params,
1751 session,
1752 timeout,
1753 transcoded_request,
1754 body=None,
1755 ):
1756 uri = transcoded_request["uri"]
1757 method = transcoded_request["method"]
1758 headers = dict(metadata)
1759 headers["Content-Type"] = "application/json"
1760 response = getattr(session, method)(
1761 "{host}{uri}".format(host=host, uri=uri),
1762 timeout=timeout,
1763 headers=headers,
1764 params=rest_helpers.flatten_query_params(query_params, strict=True),
1765 data=body,
1766 )
1767 return response
1768
1769 def __call__(
1770 self,
1771 request: schema.RollbackSchemaRequest,
1772 *,
1773 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1774 timeout: Optional[float] = None,
1775 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1776 ) -> schema.Schema:
1777 r"""Call the rollback schema method over HTTP.
1778
1779 Args:
1780 request (~.schema.RollbackSchemaRequest):
1781 The request object. Request for the ``RollbackSchema`` method.
1782 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1783 should be retried.
1784 timeout (float): The timeout for this request.
1785 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1786 sent along with the request as metadata. Normally, each value must be of type `str`,
1787 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1788 be of type `bytes`.
1789
1790 Returns:
1791 ~.schema.Schema:
1792 A schema resource.
1793 """
1794
1795 http_options = (
1796 _BaseSchemaServiceRestTransport._BaseRollbackSchema._get_http_options()
1797 )
1798
1799 request, metadata = self._interceptor.pre_rollback_schema(request, metadata)
1800 transcoded_request = _BaseSchemaServiceRestTransport._BaseRollbackSchema._get_transcoded_request(
1801 http_options, request
1802 )
1803
1804 body = _BaseSchemaServiceRestTransport._BaseRollbackSchema._get_request_body_json(
1805 transcoded_request
1806 )
1807
1808 # Jsonify the query params
1809 query_params = _BaseSchemaServiceRestTransport._BaseRollbackSchema._get_query_params_json(
1810 transcoded_request
1811 )
1812
1813 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1814 logging.DEBUG
1815 ): # pragma: NO COVER
1816 request_url = "{host}{uri}".format(
1817 host=self._host, uri=transcoded_request["uri"]
1818 )
1819 method = transcoded_request["method"]
1820 try:
1821 request_payload = type(request).to_json(request)
1822 except:
1823 request_payload = None
1824 http_request = {
1825 "payload": request_payload,
1826 "requestMethod": method,
1827 "requestUrl": request_url,
1828 "headers": dict(metadata),
1829 }
1830 _LOGGER.debug(
1831 f"Sending request for google.pubsub_v1.SchemaServiceClient.RollbackSchema",
1832 extra={
1833 "serviceName": "google.pubsub.v1.SchemaService",
1834 "rpcName": "RollbackSchema",
1835 "httpRequest": http_request,
1836 "metadata": http_request["headers"],
1837 },
1838 )
1839
1840 # Send the request
1841 response = SchemaServiceRestTransport._RollbackSchema._get_response(
1842 self._host,
1843 metadata,
1844 query_params,
1845 self._session,
1846 timeout,
1847 transcoded_request,
1848 body,
1849 )
1850
1851 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1852 # subclass.
1853 if response.status_code >= 400:
1854 raise core_exceptions.from_http_response(response)
1855
1856 # Return the response
1857 resp = schema.Schema()
1858 pb_resp = schema.Schema.pb(resp)
1859
1860 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
1861
1862 resp = self._interceptor.post_rollback_schema(resp)
1863 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
1864 resp, _ = self._interceptor.post_rollback_schema_with_metadata(
1865 resp, response_metadata
1866 )
1867 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1868 logging.DEBUG
1869 ): # pragma: NO COVER
1870 try:
1871 response_payload = schema.Schema.to_json(response)
1872 except:
1873 response_payload = None
1874 http_response = {
1875 "payload": response_payload,
1876 "headers": dict(response.headers),
1877 "status": response.status_code,
1878 }
1879 _LOGGER.debug(
1880 "Received response for google.pubsub_v1.SchemaServiceClient.rollback_schema",
1881 extra={
1882 "serviceName": "google.pubsub.v1.SchemaService",
1883 "rpcName": "RollbackSchema",
1884 "metadata": http_response["headers"],
1885 "httpResponse": http_response,
1886 },
1887 )
1888 return resp
1889
1890 class _ValidateMessage(
1891 _BaseSchemaServiceRestTransport._BaseValidateMessage, SchemaServiceRestStub
1892 ):
1893 def __hash__(self):
1894 return hash("SchemaServiceRestTransport.ValidateMessage")
1895
1896 @staticmethod
1897 def _get_response(
1898 host,
1899 metadata,
1900 query_params,
1901 session,
1902 timeout,
1903 transcoded_request,
1904 body=None,
1905 ):
1906 uri = transcoded_request["uri"]
1907 method = transcoded_request["method"]
1908 headers = dict(metadata)
1909 headers["Content-Type"] = "application/json"
1910 response = getattr(session, method)(
1911 "{host}{uri}".format(host=host, uri=uri),
1912 timeout=timeout,
1913 headers=headers,
1914 params=rest_helpers.flatten_query_params(query_params, strict=True),
1915 data=body,
1916 )
1917 return response
1918
1919 def __call__(
1920 self,
1921 request: schema.ValidateMessageRequest,
1922 *,
1923 retry: OptionalRetry = gapic_v1.method.DEFAULT,
1924 timeout: Optional[float] = None,
1925 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1926 ) -> schema.ValidateMessageResponse:
1927 r"""Call the validate message method over HTTP.
1928
1929 Args:
1930 request (~.schema.ValidateMessageRequest):
1931 The request object. Request for the ``ValidateMessage`` method.
1932 retry (google.api_core.retry.Retry): Designation of what errors, if any,
1933 should be retried.
1934 timeout (float): The timeout for this request.
1935 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1936 sent along with the request as metadata. Normally, each value must be of type `str`,
1937 but for metadata keys ending with the suffix `-bin`, the corresponding values must
1938 be of type `bytes`.
1939
1940 Returns:
1941 ~.schema.ValidateMessageResponse:
1942 Response for the ``ValidateMessage`` method. Empty for
1943 now.
1944
1945 """
1946
1947 http_options = (
1948 _BaseSchemaServiceRestTransport._BaseValidateMessage._get_http_options()
1949 )
1950
1951 request, metadata = self._interceptor.pre_validate_message(
1952 request, metadata
1953 )
1954 transcoded_request = _BaseSchemaServiceRestTransport._BaseValidateMessage._get_transcoded_request(
1955 http_options, request
1956 )
1957
1958 body = _BaseSchemaServiceRestTransport._BaseValidateMessage._get_request_body_json(
1959 transcoded_request
1960 )
1961
1962 # Jsonify the query params
1963 query_params = _BaseSchemaServiceRestTransport._BaseValidateMessage._get_query_params_json(
1964 transcoded_request
1965 )
1966
1967 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1968 logging.DEBUG
1969 ): # pragma: NO COVER
1970 request_url = "{host}{uri}".format(
1971 host=self._host, uri=transcoded_request["uri"]
1972 )
1973 method = transcoded_request["method"]
1974 try:
1975 request_payload = type(request).to_json(request)
1976 except:
1977 request_payload = None
1978 http_request = {
1979 "payload": request_payload,
1980 "requestMethod": method,
1981 "requestUrl": request_url,
1982 "headers": dict(metadata),
1983 }
1984 _LOGGER.debug(
1985 f"Sending request for google.pubsub_v1.SchemaServiceClient.ValidateMessage",
1986 extra={
1987 "serviceName": "google.pubsub.v1.SchemaService",
1988 "rpcName": "ValidateMessage",
1989 "httpRequest": http_request,
1990 "metadata": http_request["headers"],
1991 },
1992 )
1993
1994 # Send the request
1995 response = SchemaServiceRestTransport._ValidateMessage._get_response(
1996 self._host,
1997 metadata,
1998 query_params,
1999 self._session,
2000 timeout,
2001 transcoded_request,
2002 body,
2003 )
2004
2005 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2006 # subclass.
2007 if response.status_code >= 400:
2008 raise core_exceptions.from_http_response(response)
2009
2010 # Return the response
2011 resp = schema.ValidateMessageResponse()
2012 pb_resp = schema.ValidateMessageResponse.pb(resp)
2013
2014 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2015
2016 resp = self._interceptor.post_validate_message(resp)
2017 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2018 resp, _ = self._interceptor.post_validate_message_with_metadata(
2019 resp, response_metadata
2020 )
2021 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2022 logging.DEBUG
2023 ): # pragma: NO COVER
2024 try:
2025 response_payload = schema.ValidateMessageResponse.to_json(response)
2026 except:
2027 response_payload = None
2028 http_response = {
2029 "payload": response_payload,
2030 "headers": dict(response.headers),
2031 "status": response.status_code,
2032 }
2033 _LOGGER.debug(
2034 "Received response for google.pubsub_v1.SchemaServiceClient.validate_message",
2035 extra={
2036 "serviceName": "google.pubsub.v1.SchemaService",
2037 "rpcName": "ValidateMessage",
2038 "metadata": http_response["headers"],
2039 "httpResponse": http_response,
2040 },
2041 )
2042 return resp
2043
2044 class _ValidateSchema(
2045 _BaseSchemaServiceRestTransport._BaseValidateSchema, SchemaServiceRestStub
2046 ):
2047 def __hash__(self):
2048 return hash("SchemaServiceRestTransport.ValidateSchema")
2049
2050 @staticmethod
2051 def _get_response(
2052 host,
2053 metadata,
2054 query_params,
2055 session,
2056 timeout,
2057 transcoded_request,
2058 body=None,
2059 ):
2060 uri = transcoded_request["uri"]
2061 method = transcoded_request["method"]
2062 headers = dict(metadata)
2063 headers["Content-Type"] = "application/json"
2064 response = getattr(session, method)(
2065 "{host}{uri}".format(host=host, uri=uri),
2066 timeout=timeout,
2067 headers=headers,
2068 params=rest_helpers.flatten_query_params(query_params, strict=True),
2069 data=body,
2070 )
2071 return response
2072
2073 def __call__(
2074 self,
2075 request: gp_schema.ValidateSchemaRequest,
2076 *,
2077 retry: OptionalRetry = gapic_v1.method.DEFAULT,
2078 timeout: Optional[float] = None,
2079 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2080 ) -> gp_schema.ValidateSchemaResponse:
2081 r"""Call the validate schema method over HTTP.
2082
2083 Args:
2084 request (~.gp_schema.ValidateSchemaRequest):
2085 The request object. Request for the ``ValidateSchema`` method.
2086 retry (google.api_core.retry.Retry): Designation of what errors, if any,
2087 should be retried.
2088 timeout (float): The timeout for this request.
2089 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2090 sent along with the request as metadata. Normally, each value must be of type `str`,
2091 but for metadata keys ending with the suffix `-bin`, the corresponding values must
2092 be of type `bytes`.
2093
2094 Returns:
2095 ~.gp_schema.ValidateSchemaResponse:
2096 Response for the ``ValidateSchema`` method. Empty for
2097 now.
2098
2099 """
2100
2101 http_options = (
2102 _BaseSchemaServiceRestTransport._BaseValidateSchema._get_http_options()
2103 )
2104
2105 request, metadata = self._interceptor.pre_validate_schema(request, metadata)
2106 transcoded_request = _BaseSchemaServiceRestTransport._BaseValidateSchema._get_transcoded_request(
2107 http_options, request
2108 )
2109
2110 body = _BaseSchemaServiceRestTransport._BaseValidateSchema._get_request_body_json(
2111 transcoded_request
2112 )
2113
2114 # Jsonify the query params
2115 query_params = _BaseSchemaServiceRestTransport._BaseValidateSchema._get_query_params_json(
2116 transcoded_request
2117 )
2118
2119 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2120 logging.DEBUG
2121 ): # pragma: NO COVER
2122 request_url = "{host}{uri}".format(
2123 host=self._host, uri=transcoded_request["uri"]
2124 )
2125 method = transcoded_request["method"]
2126 try:
2127 request_payload = type(request).to_json(request)
2128 except:
2129 request_payload = None
2130 http_request = {
2131 "payload": request_payload,
2132 "requestMethod": method,
2133 "requestUrl": request_url,
2134 "headers": dict(metadata),
2135 }
2136 _LOGGER.debug(
2137 f"Sending request for google.pubsub_v1.SchemaServiceClient.ValidateSchema",
2138 extra={
2139 "serviceName": "google.pubsub.v1.SchemaService",
2140 "rpcName": "ValidateSchema",
2141 "httpRequest": http_request,
2142 "metadata": http_request["headers"],
2143 },
2144 )
2145
2146 # Send the request
2147 response = SchemaServiceRestTransport._ValidateSchema._get_response(
2148 self._host,
2149 metadata,
2150 query_params,
2151 self._session,
2152 timeout,
2153 transcoded_request,
2154 body,
2155 )
2156
2157 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2158 # subclass.
2159 if response.status_code >= 400:
2160 raise core_exceptions.from_http_response(response)
2161
2162 # Return the response
2163 resp = gp_schema.ValidateSchemaResponse()
2164 pb_resp = gp_schema.ValidateSchemaResponse.pb(resp)
2165
2166 json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
2167
2168 resp = self._interceptor.post_validate_schema(resp)
2169 response_metadata = [(k, str(v)) for k, v in response.headers.items()]
2170 resp, _ = self._interceptor.post_validate_schema_with_metadata(
2171 resp, response_metadata
2172 )
2173 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2174 logging.DEBUG
2175 ): # pragma: NO COVER
2176 try:
2177 response_payload = gp_schema.ValidateSchemaResponse.to_json(
2178 response
2179 )
2180 except:
2181 response_payload = None
2182 http_response = {
2183 "payload": response_payload,
2184 "headers": dict(response.headers),
2185 "status": response.status_code,
2186 }
2187 _LOGGER.debug(
2188 "Received response for google.pubsub_v1.SchemaServiceClient.validate_schema",
2189 extra={
2190 "serviceName": "google.pubsub.v1.SchemaService",
2191 "rpcName": "ValidateSchema",
2192 "metadata": http_response["headers"],
2193 "httpResponse": http_response,
2194 },
2195 )
2196 return resp
2197
2198 @property
2199 def commit_schema(
2200 self,
2201 ) -> Callable[[gp_schema.CommitSchemaRequest], gp_schema.Schema]:
2202 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2203 # In C++ this would require a dynamic_cast
2204 return self._CommitSchema(self._session, self._host, self._interceptor) # type: ignore
2205
2206 @property
2207 def create_schema(
2208 self,
2209 ) -> Callable[[gp_schema.CreateSchemaRequest], gp_schema.Schema]:
2210 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2211 # In C++ this would require a dynamic_cast
2212 return self._CreateSchema(self._session, self._host, self._interceptor) # type: ignore
2213
2214 @property
2215 def delete_schema(self) -> Callable[[schema.DeleteSchemaRequest], empty_pb2.Empty]:
2216 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2217 # In C++ this would require a dynamic_cast
2218 return self._DeleteSchema(self._session, self._host, self._interceptor) # type: ignore
2219
2220 @property
2221 def delete_schema_revision(
2222 self,
2223 ) -> Callable[[schema.DeleteSchemaRevisionRequest], schema.Schema]:
2224 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2225 # In C++ this would require a dynamic_cast
2226 return self._DeleteSchemaRevision(self._session, self._host, self._interceptor) # type: ignore
2227
2228 @property
2229 def get_schema(self) -> Callable[[schema.GetSchemaRequest], schema.Schema]:
2230 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2231 # In C++ this would require a dynamic_cast
2232 return self._GetSchema(self._session, self._host, self._interceptor) # type: ignore
2233
2234 @property
2235 def list_schema_revisions(
2236 self,
2237 ) -> Callable[
2238 [schema.ListSchemaRevisionsRequest], schema.ListSchemaRevisionsResponse
2239 ]:
2240 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2241 # In C++ this would require a dynamic_cast
2242 return self._ListSchemaRevisions(self._session, self._host, self._interceptor) # type: ignore
2243
2244 @property
2245 def list_schemas(
2246 self,
2247 ) -> Callable[[schema.ListSchemasRequest], schema.ListSchemasResponse]:
2248 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2249 # In C++ this would require a dynamic_cast
2250 return self._ListSchemas(self._session, self._host, self._interceptor) # type: ignore
2251
2252 @property
2253 def rollback_schema(
2254 self,
2255 ) -> Callable[[schema.RollbackSchemaRequest], schema.Schema]:
2256 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2257 # In C++ this would require a dynamic_cast
2258 return self._RollbackSchema(self._session, self._host, self._interceptor) # type: ignore
2259
2260 @property
2261 def validate_message(
2262 self,
2263 ) -> Callable[[schema.ValidateMessageRequest], schema.ValidateMessageResponse]:
2264 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2265 # In C++ this would require a dynamic_cast
2266 return self._ValidateMessage(self._session, self._host, self._interceptor) # type: ignore
2267
2268 @property
2269 def validate_schema(
2270 self,
2271 ) -> Callable[[gp_schema.ValidateSchemaRequest], gp_schema.ValidateSchemaResponse]:
2272 # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
2273 # In C++ this would require a dynamic_cast
2274 return self._ValidateSchema(self._session, self._host, self._interceptor) # type: ignore
2275
2276 @property
2277 def get_iam_policy(self):
2278 return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
2279
2280 class _GetIamPolicy(
2281 _BaseSchemaServiceRestTransport._BaseGetIamPolicy, SchemaServiceRestStub
2282 ):
2283 def __hash__(self):
2284 return hash("SchemaServiceRestTransport.GetIamPolicy")
2285
2286 @staticmethod
2287 def _get_response(
2288 host,
2289 metadata,
2290 query_params,
2291 session,
2292 timeout,
2293 transcoded_request,
2294 body=None,
2295 ):
2296 uri = transcoded_request["uri"]
2297 method = transcoded_request["method"]
2298 headers = dict(metadata)
2299 headers["Content-Type"] = "application/json"
2300 response = getattr(session, method)(
2301 "{host}{uri}".format(host=host, uri=uri),
2302 timeout=timeout,
2303 headers=headers,
2304 params=rest_helpers.flatten_query_params(query_params, strict=True),
2305 )
2306 return response
2307
2308 def __call__(
2309 self,
2310 request: iam_policy_pb2.GetIamPolicyRequest,
2311 *,
2312 retry: OptionalRetry = gapic_v1.method.DEFAULT,
2313 timeout: Optional[float] = None,
2314 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2315 ) -> policy_pb2.Policy:
2316 r"""Call the get iam policy method over HTTP.
2317
2318 Args:
2319 request (iam_policy_pb2.GetIamPolicyRequest):
2320 The request object for GetIamPolicy method.
2321 retry (google.api_core.retry.Retry): Designation of what errors, if any,
2322 should be retried.
2323 timeout (float): The timeout for this request.
2324 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2325 sent along with the request as metadata. Normally, each value must be of type `str`,
2326 but for metadata keys ending with the suffix `-bin`, the corresponding values must
2327 be of type `bytes`.
2328
2329 Returns:
2330 policy_pb2.Policy: Response from GetIamPolicy method.
2331 """
2332
2333 http_options = (
2334 _BaseSchemaServiceRestTransport._BaseGetIamPolicy._get_http_options()
2335 )
2336
2337 request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
2338 transcoded_request = _BaseSchemaServiceRestTransport._BaseGetIamPolicy._get_transcoded_request(
2339 http_options, request
2340 )
2341
2342 # Jsonify the query params
2343 query_params = _BaseSchemaServiceRestTransport._BaseGetIamPolicy._get_query_params_json(
2344 transcoded_request
2345 )
2346
2347 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2348 logging.DEBUG
2349 ): # pragma: NO COVER
2350 request_url = "{host}{uri}".format(
2351 host=self._host, uri=transcoded_request["uri"]
2352 )
2353 method = transcoded_request["method"]
2354 try:
2355 request_payload = json_format.MessageToJson(request)
2356 except:
2357 request_payload = None
2358 http_request = {
2359 "payload": request_payload,
2360 "requestMethod": method,
2361 "requestUrl": request_url,
2362 "headers": dict(metadata),
2363 }
2364 _LOGGER.debug(
2365 f"Sending request for google.pubsub_v1.SchemaServiceClient.GetIamPolicy",
2366 extra={
2367 "serviceName": "google.pubsub.v1.SchemaService",
2368 "rpcName": "GetIamPolicy",
2369 "httpRequest": http_request,
2370 "metadata": http_request["headers"],
2371 },
2372 )
2373
2374 # Send the request
2375 response = SchemaServiceRestTransport._GetIamPolicy._get_response(
2376 self._host,
2377 metadata,
2378 query_params,
2379 self._session,
2380 timeout,
2381 transcoded_request,
2382 )
2383
2384 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2385 # subclass.
2386 if response.status_code >= 400:
2387 raise core_exceptions.from_http_response(response)
2388
2389 content = response.content.decode("utf-8")
2390 resp = policy_pb2.Policy()
2391 resp = json_format.Parse(content, resp)
2392 resp = self._interceptor.post_get_iam_policy(resp)
2393 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2394 logging.DEBUG
2395 ): # pragma: NO COVER
2396 try:
2397 response_payload = json_format.MessageToJson(resp)
2398 except:
2399 response_payload = None
2400 http_response = {
2401 "payload": response_payload,
2402 "headers": dict(response.headers),
2403 "status": response.status_code,
2404 }
2405 _LOGGER.debug(
2406 "Received response for google.pubsub_v1.SchemaServiceAsyncClient.GetIamPolicy",
2407 extra={
2408 "serviceName": "google.pubsub.v1.SchemaService",
2409 "rpcName": "GetIamPolicy",
2410 "httpResponse": http_response,
2411 "metadata": http_response["headers"],
2412 },
2413 )
2414 return resp
2415
2416 @property
2417 def set_iam_policy(self):
2418 return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
2419
2420 class _SetIamPolicy(
2421 _BaseSchemaServiceRestTransport._BaseSetIamPolicy, SchemaServiceRestStub
2422 ):
2423 def __hash__(self):
2424 return hash("SchemaServiceRestTransport.SetIamPolicy")
2425
2426 @staticmethod
2427 def _get_response(
2428 host,
2429 metadata,
2430 query_params,
2431 session,
2432 timeout,
2433 transcoded_request,
2434 body=None,
2435 ):
2436 uri = transcoded_request["uri"]
2437 method = transcoded_request["method"]
2438 headers = dict(metadata)
2439 headers["Content-Type"] = "application/json"
2440 response = getattr(session, method)(
2441 "{host}{uri}".format(host=host, uri=uri),
2442 timeout=timeout,
2443 headers=headers,
2444 params=rest_helpers.flatten_query_params(query_params, strict=True),
2445 data=body,
2446 )
2447 return response
2448
2449 def __call__(
2450 self,
2451 request: iam_policy_pb2.SetIamPolicyRequest,
2452 *,
2453 retry: OptionalRetry = gapic_v1.method.DEFAULT,
2454 timeout: Optional[float] = None,
2455 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2456 ) -> policy_pb2.Policy:
2457 r"""Call the set iam policy method over HTTP.
2458
2459 Args:
2460 request (iam_policy_pb2.SetIamPolicyRequest):
2461 The request object for SetIamPolicy method.
2462 retry (google.api_core.retry.Retry): Designation of what errors, if any,
2463 should be retried.
2464 timeout (float): The timeout for this request.
2465 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2466 sent along with the request as metadata. Normally, each value must be of type `str`,
2467 but for metadata keys ending with the suffix `-bin`, the corresponding values must
2468 be of type `bytes`.
2469
2470 Returns:
2471 policy_pb2.Policy: Response from SetIamPolicy method.
2472 """
2473
2474 http_options = (
2475 _BaseSchemaServiceRestTransport._BaseSetIamPolicy._get_http_options()
2476 )
2477
2478 request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
2479 transcoded_request = _BaseSchemaServiceRestTransport._BaseSetIamPolicy._get_transcoded_request(
2480 http_options, request
2481 )
2482
2483 body = _BaseSchemaServiceRestTransport._BaseSetIamPolicy._get_request_body_json(
2484 transcoded_request
2485 )
2486
2487 # Jsonify the query params
2488 query_params = _BaseSchemaServiceRestTransport._BaseSetIamPolicy._get_query_params_json(
2489 transcoded_request
2490 )
2491
2492 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2493 logging.DEBUG
2494 ): # pragma: NO COVER
2495 request_url = "{host}{uri}".format(
2496 host=self._host, uri=transcoded_request["uri"]
2497 )
2498 method = transcoded_request["method"]
2499 try:
2500 request_payload = json_format.MessageToJson(request)
2501 except:
2502 request_payload = None
2503 http_request = {
2504 "payload": request_payload,
2505 "requestMethod": method,
2506 "requestUrl": request_url,
2507 "headers": dict(metadata),
2508 }
2509 _LOGGER.debug(
2510 f"Sending request for google.pubsub_v1.SchemaServiceClient.SetIamPolicy",
2511 extra={
2512 "serviceName": "google.pubsub.v1.SchemaService",
2513 "rpcName": "SetIamPolicy",
2514 "httpRequest": http_request,
2515 "metadata": http_request["headers"],
2516 },
2517 )
2518
2519 # Send the request
2520 response = SchemaServiceRestTransport._SetIamPolicy._get_response(
2521 self._host,
2522 metadata,
2523 query_params,
2524 self._session,
2525 timeout,
2526 transcoded_request,
2527 body,
2528 )
2529
2530 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2531 # subclass.
2532 if response.status_code >= 400:
2533 raise core_exceptions.from_http_response(response)
2534
2535 content = response.content.decode("utf-8")
2536 resp = policy_pb2.Policy()
2537 resp = json_format.Parse(content, resp)
2538 resp = self._interceptor.post_set_iam_policy(resp)
2539 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2540 logging.DEBUG
2541 ): # pragma: NO COVER
2542 try:
2543 response_payload = json_format.MessageToJson(resp)
2544 except:
2545 response_payload = None
2546 http_response = {
2547 "payload": response_payload,
2548 "headers": dict(response.headers),
2549 "status": response.status_code,
2550 }
2551 _LOGGER.debug(
2552 "Received response for google.pubsub_v1.SchemaServiceAsyncClient.SetIamPolicy",
2553 extra={
2554 "serviceName": "google.pubsub.v1.SchemaService",
2555 "rpcName": "SetIamPolicy",
2556 "httpResponse": http_response,
2557 "metadata": http_response["headers"],
2558 },
2559 )
2560 return resp
2561
2562 @property
2563 def test_iam_permissions(self):
2564 return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
2565
2566 class _TestIamPermissions(
2567 _BaseSchemaServiceRestTransport._BaseTestIamPermissions, SchemaServiceRestStub
2568 ):
2569 def __hash__(self):
2570 return hash("SchemaServiceRestTransport.TestIamPermissions")
2571
2572 @staticmethod
2573 def _get_response(
2574 host,
2575 metadata,
2576 query_params,
2577 session,
2578 timeout,
2579 transcoded_request,
2580 body=None,
2581 ):
2582 uri = transcoded_request["uri"]
2583 method = transcoded_request["method"]
2584 headers = dict(metadata)
2585 headers["Content-Type"] = "application/json"
2586 response = getattr(session, method)(
2587 "{host}{uri}".format(host=host, uri=uri),
2588 timeout=timeout,
2589 headers=headers,
2590 params=rest_helpers.flatten_query_params(query_params, strict=True),
2591 data=body,
2592 )
2593 return response
2594
2595 def __call__(
2596 self,
2597 request: iam_policy_pb2.TestIamPermissionsRequest,
2598 *,
2599 retry: OptionalRetry = gapic_v1.method.DEFAULT,
2600 timeout: Optional[float] = None,
2601 metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2602 ) -> iam_policy_pb2.TestIamPermissionsResponse:
2603 r"""Call the test iam permissions method over HTTP.
2604
2605 Args:
2606 request (iam_policy_pb2.TestIamPermissionsRequest):
2607 The request object for TestIamPermissions method.
2608 retry (google.api_core.retry.Retry): Designation of what errors, if any,
2609 should be retried.
2610 timeout (float): The timeout for this request.
2611 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2612 sent along with the request as metadata. Normally, each value must be of type `str`,
2613 but for metadata keys ending with the suffix `-bin`, the corresponding values must
2614 be of type `bytes`.
2615
2616 Returns:
2617 iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method.
2618 """
2619
2620 http_options = (
2621 _BaseSchemaServiceRestTransport._BaseTestIamPermissions._get_http_options()
2622 )
2623
2624 request, metadata = self._interceptor.pre_test_iam_permissions(
2625 request, metadata
2626 )
2627 transcoded_request = _BaseSchemaServiceRestTransport._BaseTestIamPermissions._get_transcoded_request(
2628 http_options, request
2629 )
2630
2631 body = _BaseSchemaServiceRestTransport._BaseTestIamPermissions._get_request_body_json(
2632 transcoded_request
2633 )
2634
2635 # Jsonify the query params
2636 query_params = _BaseSchemaServiceRestTransport._BaseTestIamPermissions._get_query_params_json(
2637 transcoded_request
2638 )
2639
2640 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2641 logging.DEBUG
2642 ): # pragma: NO COVER
2643 request_url = "{host}{uri}".format(
2644 host=self._host, uri=transcoded_request["uri"]
2645 )
2646 method = transcoded_request["method"]
2647 try:
2648 request_payload = json_format.MessageToJson(request)
2649 except:
2650 request_payload = None
2651 http_request = {
2652 "payload": request_payload,
2653 "requestMethod": method,
2654 "requestUrl": request_url,
2655 "headers": dict(metadata),
2656 }
2657 _LOGGER.debug(
2658 f"Sending request for google.pubsub_v1.SchemaServiceClient.TestIamPermissions",
2659 extra={
2660 "serviceName": "google.pubsub.v1.SchemaService",
2661 "rpcName": "TestIamPermissions",
2662 "httpRequest": http_request,
2663 "metadata": http_request["headers"],
2664 },
2665 )
2666
2667 # Send the request
2668 response = SchemaServiceRestTransport._TestIamPermissions._get_response(
2669 self._host,
2670 metadata,
2671 query_params,
2672 self._session,
2673 timeout,
2674 transcoded_request,
2675 body,
2676 )
2677
2678 # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
2679 # subclass.
2680 if response.status_code >= 400:
2681 raise core_exceptions.from_http_response(response)
2682
2683 content = response.content.decode("utf-8")
2684 resp = iam_policy_pb2.TestIamPermissionsResponse()
2685 resp = json_format.Parse(content, resp)
2686 resp = self._interceptor.post_test_iam_permissions(resp)
2687 if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2688 logging.DEBUG
2689 ): # pragma: NO COVER
2690 try:
2691 response_payload = json_format.MessageToJson(resp)
2692 except:
2693 response_payload = None
2694 http_response = {
2695 "payload": response_payload,
2696 "headers": dict(response.headers),
2697 "status": response.status_code,
2698 }
2699 _LOGGER.debug(
2700 "Received response for google.pubsub_v1.SchemaServiceAsyncClient.TestIamPermissions",
2701 extra={
2702 "serviceName": "google.pubsub.v1.SchemaService",
2703 "rpcName": "TestIamPermissions",
2704 "httpResponse": http_response,
2705 "metadata": http_response["headers"],
2706 },
2707 )
2708 return resp
2709
2710 @property
2711 def kind(self) -> str:
2712 return "rest"
2713
2714 def close(self):
2715 self._session.close()
2716
2717
2718__all__ = ("SchemaServiceRestTransport",)