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 json
17import logging as std_logging
18import pickle
19import warnings
20from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
22from google.api_core import grpc_helpers
23from google.api_core import operations_v1
24from google.api_core import gapic_v1
25import google.auth # type: ignore
26from google.auth import credentials as ga_credentials # type: ignore
27from google.auth.transport.grpc import SslCredentials # type: ignore
28from google.protobuf.json_format import MessageToJson
29import google.protobuf.message
30
31import grpc # type: ignore
32import proto # type: ignore
33
34from google.cloud.logging_v2.types import logging_config
35from google.longrunning import operations_pb2 # type: ignore
36from google.protobuf import empty_pb2 # type: ignore
37from .base import ConfigServiceV2Transport, DEFAULT_CLIENT_INFO
38
39try:
40 from google.api_core import client_logging # type: ignore
41
42 CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
43except ImportError: # pragma: NO COVER
44 CLIENT_LOGGING_SUPPORTED = False
45
46_LOGGER = std_logging.getLogger(__name__)
47
48
49class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
50 def intercept_unary_unary(self, continuation, client_call_details, request):
51 logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
52 std_logging.DEBUG
53 )
54 if logging_enabled: # pragma: NO COVER
55 request_metadata = client_call_details.metadata
56 if isinstance(request, proto.Message):
57 request_payload = type(request).to_json(request)
58 elif isinstance(request, google.protobuf.message.Message):
59 request_payload = MessageToJson(request)
60 else:
61 request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
62
63 request_metadata = {
64 key: value.decode("utf-8") if isinstance(value, bytes) else value
65 for key, value in request_metadata
66 }
67 grpc_request = {
68 "payload": request_payload,
69 "requestMethod": "grpc",
70 "metadata": dict(request_metadata),
71 }
72 _LOGGER.debug(
73 f"Sending request for {client_call_details.method}",
74 extra={
75 "serviceName": "google.logging.v2.ConfigServiceV2",
76 "rpcName": str(client_call_details.method),
77 "request": grpc_request,
78 "metadata": grpc_request["metadata"],
79 },
80 )
81 response = continuation(client_call_details, request)
82 if logging_enabled: # pragma: NO COVER
83 response_metadata = response.trailing_metadata()
84 # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
85 metadata = (
86 dict([(k, str(v)) for k, v in response_metadata])
87 if response_metadata
88 else None
89 )
90 result = response.result()
91 if isinstance(result, proto.Message):
92 response_payload = type(result).to_json(result)
93 elif isinstance(result, google.protobuf.message.Message):
94 response_payload = MessageToJson(result)
95 else:
96 response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
97 grpc_response = {
98 "payload": response_payload,
99 "metadata": metadata,
100 "status": "OK",
101 }
102 _LOGGER.debug(
103 f"Received response for {client_call_details.method}.",
104 extra={
105 "serviceName": "google.logging.v2.ConfigServiceV2",
106 "rpcName": client_call_details.method,
107 "response": grpc_response,
108 "metadata": grpc_response["metadata"],
109 },
110 )
111 return response
112
113
114class ConfigServiceV2GrpcTransport(ConfigServiceV2Transport):
115 """gRPC backend transport for ConfigServiceV2.
116
117 Service for configuring sinks used to route log entries.
118
119 This class defines the same methods as the primary client, so the
120 primary client can load the underlying transport implementation
121 and call it.
122
123 It sends protocol buffers over the wire using gRPC (which is built on
124 top of HTTP/2); the ``grpcio`` package must be installed.
125 """
126
127 _stubs: Dict[str, Callable]
128
129 def __init__(
130 self,
131 *,
132 host: str = "logging.googleapis.com",
133 credentials: Optional[ga_credentials.Credentials] = None,
134 credentials_file: Optional[str] = None,
135 scopes: Optional[Sequence[str]] = None,
136 channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
137 api_mtls_endpoint: Optional[str] = None,
138 client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
139 ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
140 client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
141 quota_project_id: Optional[str] = None,
142 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
143 always_use_jwt_access: Optional[bool] = False,
144 api_audience: Optional[str] = None,
145 ) -> None:
146 """Instantiate the transport.
147
148 Args:
149 host (Optional[str]):
150 The hostname to connect to (default: 'logging.googleapis.com').
151 credentials (Optional[google.auth.credentials.Credentials]): The
152 authorization credentials to attach to requests. These
153 credentials identify the application to the service; if none
154 are specified, the client will attempt to ascertain the
155 credentials from the environment.
156 This argument is ignored if a ``channel`` instance is provided.
157 credentials_file (Optional[str]): Deprecated. A file with credentials that can
158 be loaded with :func:`google.auth.load_credentials_from_file`.
159 This argument is ignored if a ``channel`` instance is provided.
160 This argument will be removed in the next major version of this library.
161 scopes (Optional(Sequence[str])): A list of scopes. This argument is
162 ignored if a ``channel`` instance is provided.
163 channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
164 A ``Channel`` instance through which to make calls, or a Callable
165 that constructs and returns one. If set to None, ``self.create_channel``
166 is used to create the channel. If a Callable is given, it will be called
167 with the same arguments as used in ``self.create_channel``.
168 api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
169 If provided, it overrides the ``host`` argument and tries to create
170 a mutual TLS channel with client SSL credentials from
171 ``client_cert_source`` or application default SSL credentials.
172 client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
173 Deprecated. A callback to provide client SSL certificate bytes and
174 private key bytes, both in PEM format. It is ignored if
175 ``api_mtls_endpoint`` is None.
176 ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
177 for the grpc channel. It is ignored if a ``channel`` instance is provided.
178 client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
179 A callback to provide client certificate bytes and private key bytes,
180 both in PEM format. It is used to configure a mutual TLS channel. It is
181 ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
182 quota_project_id (Optional[str]): An optional project to use for billing
183 and quota.
184 client_info (google.api_core.gapic_v1.client_info.ClientInfo):
185 The client info used to send a user-agent string along with
186 API requests. If ``None``, then default info will be used.
187 Generally, you only need to set this if you're developing
188 your own client library.
189 always_use_jwt_access (Optional[bool]): Whether self signed JWT should
190 be used for service account credentials.
191
192 Raises:
193 google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
194 creation failed for any reason.
195 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
196 and ``credentials_file`` are passed.
197 """
198 self._grpc_channel = None
199 self._ssl_channel_credentials = ssl_channel_credentials
200 self._stubs: Dict[str, Callable] = {}
201 self._operations_client: Optional[operations_v1.OperationsClient] = None
202
203 if api_mtls_endpoint:
204 warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
205 if client_cert_source:
206 warnings.warn("client_cert_source is deprecated", DeprecationWarning)
207
208 if isinstance(channel, grpc.Channel):
209 # Ignore credentials if a channel was passed.
210 credentials = None
211 self._ignore_credentials = True
212 # If a channel was explicitly provided, set it.
213 self._grpc_channel = channel
214 self._ssl_channel_credentials = None
215
216 else:
217 if api_mtls_endpoint:
218 host = api_mtls_endpoint
219
220 # Create SSL credentials with client_cert_source or application
221 # default SSL credentials.
222 if client_cert_source:
223 cert, key = client_cert_source()
224 self._ssl_channel_credentials = grpc.ssl_channel_credentials(
225 certificate_chain=cert, private_key=key
226 )
227 else:
228 self._ssl_channel_credentials = SslCredentials().ssl_credentials
229
230 else:
231 if client_cert_source_for_mtls and not ssl_channel_credentials:
232 cert, key = client_cert_source_for_mtls()
233 self._ssl_channel_credentials = grpc.ssl_channel_credentials(
234 certificate_chain=cert, private_key=key
235 )
236
237 # The base transport sets the host, credentials and scopes
238 super().__init__(
239 host=host,
240 credentials=credentials,
241 credentials_file=credentials_file,
242 scopes=scopes,
243 quota_project_id=quota_project_id,
244 client_info=client_info,
245 always_use_jwt_access=always_use_jwt_access,
246 api_audience=api_audience,
247 )
248
249 if not self._grpc_channel:
250 # initialize with the provided callable or the default channel
251 channel_init = channel or type(self).create_channel
252 self._grpc_channel = channel_init(
253 self._host,
254 # use the credentials which are saved
255 credentials=self._credentials,
256 # Set ``credentials_file`` to ``None`` here as
257 # the credentials that we saved earlier should be used.
258 credentials_file=None,
259 scopes=self._scopes,
260 ssl_credentials=self._ssl_channel_credentials,
261 quota_project_id=quota_project_id,
262 options=[
263 ("grpc.max_send_message_length", -1),
264 ("grpc.max_receive_message_length", -1),
265 ],
266 )
267
268 self._interceptor = _LoggingClientInterceptor()
269 self._logged_channel = grpc.intercept_channel(
270 self._grpc_channel, self._interceptor
271 )
272
273 # Wrap messages. This must be done after self._logged_channel exists
274 self._prep_wrapped_messages(client_info)
275
276 @classmethod
277 def create_channel(
278 cls,
279 host: str = "logging.googleapis.com",
280 credentials: Optional[ga_credentials.Credentials] = None,
281 credentials_file: Optional[str] = None,
282 scopes: Optional[Sequence[str]] = None,
283 quota_project_id: Optional[str] = None,
284 **kwargs,
285 ) -> grpc.Channel:
286 """Create and return a gRPC channel object.
287 Args:
288 host (Optional[str]): The host for the channel to use.
289 credentials (Optional[~.Credentials]): The
290 authorization credentials to attach to requests. These
291 credentials identify this application to the service. If
292 none are specified, the client will attempt to ascertain
293 the credentials from the environment.
294 credentials_file (Optional[str]): Deprecated. A file with credentials that can
295 be loaded with :func:`google.auth.load_credentials_from_file`.
296 This argument is mutually exclusive with credentials. This argument will be
297 removed in the next major version of this library.
298 scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
299 service. These are only used when credentials are not specified and
300 are passed to :func:`google.auth.default`.
301 quota_project_id (Optional[str]): An optional project to use for billing
302 and quota.
303 kwargs (Optional[dict]): Keyword arguments, which are passed to the
304 channel creation.
305 Returns:
306 grpc.Channel: A gRPC channel object.
307
308 Raises:
309 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
310 and ``credentials_file`` are passed.
311 """
312
313 return grpc_helpers.create_channel(
314 host,
315 credentials=credentials,
316 credentials_file=credentials_file,
317 quota_project_id=quota_project_id,
318 default_scopes=cls.AUTH_SCOPES,
319 scopes=scopes,
320 default_host=cls.DEFAULT_HOST,
321 **kwargs,
322 )
323
324 @property
325 def grpc_channel(self) -> grpc.Channel:
326 """Return the channel designed to connect to this service."""
327 return self._grpc_channel
328
329 @property
330 def operations_client(self) -> operations_v1.OperationsClient:
331 """Create the client designed to process long-running operations.
332
333 This property caches on the instance; repeated calls return the same
334 client.
335 """
336 # Quick check: Only create a new client if we do not already have one.
337 if self._operations_client is None:
338 self._operations_client = operations_v1.OperationsClient(
339 self._logged_channel
340 )
341
342 # Return the client from cache.
343 return self._operations_client
344
345 @property
346 def list_buckets(
347 self,
348 ) -> Callable[
349 [logging_config.ListBucketsRequest], logging_config.ListBucketsResponse
350 ]:
351 r"""Return a callable for the list buckets method over gRPC.
352
353 Lists log buckets.
354
355 Returns:
356 Callable[[~.ListBucketsRequest],
357 ~.ListBucketsResponse]:
358 A function that, when called, will call the underlying RPC
359 on the server.
360 """
361 # Generate a "stub function" on-the-fly which will actually make
362 # the request.
363 # gRPC handles serialization and deserialization, so we just need
364 # to pass in the functions for each.
365 if "list_buckets" not in self._stubs:
366 self._stubs["list_buckets"] = self._logged_channel.unary_unary(
367 "/google.logging.v2.ConfigServiceV2/ListBuckets",
368 request_serializer=logging_config.ListBucketsRequest.serialize,
369 response_deserializer=logging_config.ListBucketsResponse.deserialize,
370 )
371 return self._stubs["list_buckets"]
372
373 @property
374 def get_bucket(
375 self,
376 ) -> Callable[[logging_config.GetBucketRequest], logging_config.LogBucket]:
377 r"""Return a callable for the get bucket method over gRPC.
378
379 Gets a log bucket.
380
381 Returns:
382 Callable[[~.GetBucketRequest],
383 ~.LogBucket]:
384 A function that, when called, will call the underlying RPC
385 on the server.
386 """
387 # Generate a "stub function" on-the-fly which will actually make
388 # the request.
389 # gRPC handles serialization and deserialization, so we just need
390 # to pass in the functions for each.
391 if "get_bucket" not in self._stubs:
392 self._stubs["get_bucket"] = self._logged_channel.unary_unary(
393 "/google.logging.v2.ConfigServiceV2/GetBucket",
394 request_serializer=logging_config.GetBucketRequest.serialize,
395 response_deserializer=logging_config.LogBucket.deserialize,
396 )
397 return self._stubs["get_bucket"]
398
399 @property
400 def create_bucket_async(
401 self,
402 ) -> Callable[[logging_config.CreateBucketRequest], operations_pb2.Operation]:
403 r"""Return a callable for the create bucket async method over gRPC.
404
405 Creates a log bucket asynchronously that can be used
406 to store log entries.
407 After a bucket has been created, the bucket's location
408 cannot be changed.
409
410 Returns:
411 Callable[[~.CreateBucketRequest],
412 ~.Operation]:
413 A function that, when called, will call the underlying RPC
414 on the server.
415 """
416 # Generate a "stub function" on-the-fly which will actually make
417 # the request.
418 # gRPC handles serialization and deserialization, so we just need
419 # to pass in the functions for each.
420 if "create_bucket_async" not in self._stubs:
421 self._stubs["create_bucket_async"] = self._logged_channel.unary_unary(
422 "/google.logging.v2.ConfigServiceV2/CreateBucketAsync",
423 request_serializer=logging_config.CreateBucketRequest.serialize,
424 response_deserializer=operations_pb2.Operation.FromString,
425 )
426 return self._stubs["create_bucket_async"]
427
428 @property
429 def update_bucket_async(
430 self,
431 ) -> Callable[[logging_config.UpdateBucketRequest], operations_pb2.Operation]:
432 r"""Return a callable for the update bucket async method over gRPC.
433
434 Updates a log bucket asynchronously.
435
436 If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
437 then ``FAILED_PRECONDITION`` will be returned.
438
439 After a bucket has been created, the bucket's location cannot be
440 changed.
441
442 Returns:
443 Callable[[~.UpdateBucketRequest],
444 ~.Operation]:
445 A function that, when called, will call the underlying RPC
446 on the server.
447 """
448 # Generate a "stub function" on-the-fly which will actually make
449 # the request.
450 # gRPC handles serialization and deserialization, so we just need
451 # to pass in the functions for each.
452 if "update_bucket_async" not in self._stubs:
453 self._stubs["update_bucket_async"] = self._logged_channel.unary_unary(
454 "/google.logging.v2.ConfigServiceV2/UpdateBucketAsync",
455 request_serializer=logging_config.UpdateBucketRequest.serialize,
456 response_deserializer=operations_pb2.Operation.FromString,
457 )
458 return self._stubs["update_bucket_async"]
459
460 @property
461 def create_bucket(
462 self,
463 ) -> Callable[[logging_config.CreateBucketRequest], logging_config.LogBucket]:
464 r"""Return a callable for the create bucket method over gRPC.
465
466 Creates a log bucket that can be used to store log
467 entries. After a bucket has been created, the bucket's
468 location cannot be changed.
469
470 Returns:
471 Callable[[~.CreateBucketRequest],
472 ~.LogBucket]:
473 A function that, when called, will call the underlying RPC
474 on the server.
475 """
476 # Generate a "stub function" on-the-fly which will actually make
477 # the request.
478 # gRPC handles serialization and deserialization, so we just need
479 # to pass in the functions for each.
480 if "create_bucket" not in self._stubs:
481 self._stubs["create_bucket"] = self._logged_channel.unary_unary(
482 "/google.logging.v2.ConfigServiceV2/CreateBucket",
483 request_serializer=logging_config.CreateBucketRequest.serialize,
484 response_deserializer=logging_config.LogBucket.deserialize,
485 )
486 return self._stubs["create_bucket"]
487
488 @property
489 def update_bucket(
490 self,
491 ) -> Callable[[logging_config.UpdateBucketRequest], logging_config.LogBucket]:
492 r"""Return a callable for the update bucket method over gRPC.
493
494 Updates a log bucket.
495
496 If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
497 then ``FAILED_PRECONDITION`` will be returned.
498
499 After a bucket has been created, the bucket's location cannot be
500 changed.
501
502 Returns:
503 Callable[[~.UpdateBucketRequest],
504 ~.LogBucket]:
505 A function that, when called, will call the underlying RPC
506 on the server.
507 """
508 # Generate a "stub function" on-the-fly which will actually make
509 # the request.
510 # gRPC handles serialization and deserialization, so we just need
511 # to pass in the functions for each.
512 if "update_bucket" not in self._stubs:
513 self._stubs["update_bucket"] = self._logged_channel.unary_unary(
514 "/google.logging.v2.ConfigServiceV2/UpdateBucket",
515 request_serializer=logging_config.UpdateBucketRequest.serialize,
516 response_deserializer=logging_config.LogBucket.deserialize,
517 )
518 return self._stubs["update_bucket"]
519
520 @property
521 def delete_bucket(
522 self,
523 ) -> Callable[[logging_config.DeleteBucketRequest], empty_pb2.Empty]:
524 r"""Return a callable for the delete bucket method over gRPC.
525
526 Deletes a log bucket.
527
528 Changes the bucket's ``lifecycle_state`` to the
529 ``DELETE_REQUESTED`` state. After 7 days, the bucket will be
530 purged and all log entries in the bucket will be permanently
531 deleted.
532
533 Returns:
534 Callable[[~.DeleteBucketRequest],
535 ~.Empty]:
536 A function that, when called, will call the underlying RPC
537 on the server.
538 """
539 # Generate a "stub function" on-the-fly which will actually make
540 # the request.
541 # gRPC handles serialization and deserialization, so we just need
542 # to pass in the functions for each.
543 if "delete_bucket" not in self._stubs:
544 self._stubs["delete_bucket"] = self._logged_channel.unary_unary(
545 "/google.logging.v2.ConfigServiceV2/DeleteBucket",
546 request_serializer=logging_config.DeleteBucketRequest.serialize,
547 response_deserializer=empty_pb2.Empty.FromString,
548 )
549 return self._stubs["delete_bucket"]
550
551 @property
552 def undelete_bucket(
553 self,
554 ) -> Callable[[logging_config.UndeleteBucketRequest], empty_pb2.Empty]:
555 r"""Return a callable for the undelete bucket method over gRPC.
556
557 Undeletes a log bucket. A bucket that has been
558 deleted can be undeleted within the grace period of 7
559 days.
560
561 Returns:
562 Callable[[~.UndeleteBucketRequest],
563 ~.Empty]:
564 A function that, when called, will call the underlying RPC
565 on the server.
566 """
567 # Generate a "stub function" on-the-fly which will actually make
568 # the request.
569 # gRPC handles serialization and deserialization, so we just need
570 # to pass in the functions for each.
571 if "undelete_bucket" not in self._stubs:
572 self._stubs["undelete_bucket"] = self._logged_channel.unary_unary(
573 "/google.logging.v2.ConfigServiceV2/UndeleteBucket",
574 request_serializer=logging_config.UndeleteBucketRequest.serialize,
575 response_deserializer=empty_pb2.Empty.FromString,
576 )
577 return self._stubs["undelete_bucket"]
578
579 @property
580 def list_views(
581 self,
582 ) -> Callable[[logging_config.ListViewsRequest], logging_config.ListViewsResponse]:
583 r"""Return a callable for the list views method over gRPC.
584
585 Lists views on a log bucket.
586
587 Returns:
588 Callable[[~.ListViewsRequest],
589 ~.ListViewsResponse]:
590 A function that, when called, will call the underlying RPC
591 on the server.
592 """
593 # Generate a "stub function" on-the-fly which will actually make
594 # the request.
595 # gRPC handles serialization and deserialization, so we just need
596 # to pass in the functions for each.
597 if "list_views" not in self._stubs:
598 self._stubs["list_views"] = self._logged_channel.unary_unary(
599 "/google.logging.v2.ConfigServiceV2/ListViews",
600 request_serializer=logging_config.ListViewsRequest.serialize,
601 response_deserializer=logging_config.ListViewsResponse.deserialize,
602 )
603 return self._stubs["list_views"]
604
605 @property
606 def get_view(
607 self,
608 ) -> Callable[[logging_config.GetViewRequest], logging_config.LogView]:
609 r"""Return a callable for the get view method over gRPC.
610
611 Gets a view on a log bucket..
612
613 Returns:
614 Callable[[~.GetViewRequest],
615 ~.LogView]:
616 A function that, when called, will call the underlying RPC
617 on the server.
618 """
619 # Generate a "stub function" on-the-fly which will actually make
620 # the request.
621 # gRPC handles serialization and deserialization, so we just need
622 # to pass in the functions for each.
623 if "get_view" not in self._stubs:
624 self._stubs["get_view"] = self._logged_channel.unary_unary(
625 "/google.logging.v2.ConfigServiceV2/GetView",
626 request_serializer=logging_config.GetViewRequest.serialize,
627 response_deserializer=logging_config.LogView.deserialize,
628 )
629 return self._stubs["get_view"]
630
631 @property
632 def create_view(
633 self,
634 ) -> Callable[[logging_config.CreateViewRequest], logging_config.LogView]:
635 r"""Return a callable for the create view method over gRPC.
636
637 Creates a view over log entries in a log bucket. A
638 bucket may contain a maximum of 30 views.
639
640 Returns:
641 Callable[[~.CreateViewRequest],
642 ~.LogView]:
643 A function that, when called, will call the underlying RPC
644 on the server.
645 """
646 # Generate a "stub function" on-the-fly which will actually make
647 # the request.
648 # gRPC handles serialization and deserialization, so we just need
649 # to pass in the functions for each.
650 if "create_view" not in self._stubs:
651 self._stubs["create_view"] = self._logged_channel.unary_unary(
652 "/google.logging.v2.ConfigServiceV2/CreateView",
653 request_serializer=logging_config.CreateViewRequest.serialize,
654 response_deserializer=logging_config.LogView.deserialize,
655 )
656 return self._stubs["create_view"]
657
658 @property
659 def update_view(
660 self,
661 ) -> Callable[[logging_config.UpdateViewRequest], logging_config.LogView]:
662 r"""Return a callable for the update view method over gRPC.
663
664 Updates a view on a log bucket. This method replaces the
665 following fields in the existing view with values from the new
666 view: ``filter``. If an ``UNAVAILABLE`` error is returned, this
667 indicates that system is not in a state where it can update the
668 view. If this occurs, please try again in a few minutes.
669
670 Returns:
671 Callable[[~.UpdateViewRequest],
672 ~.LogView]:
673 A function that, when called, will call the underlying RPC
674 on the server.
675 """
676 # Generate a "stub function" on-the-fly which will actually make
677 # the request.
678 # gRPC handles serialization and deserialization, so we just need
679 # to pass in the functions for each.
680 if "update_view" not in self._stubs:
681 self._stubs["update_view"] = self._logged_channel.unary_unary(
682 "/google.logging.v2.ConfigServiceV2/UpdateView",
683 request_serializer=logging_config.UpdateViewRequest.serialize,
684 response_deserializer=logging_config.LogView.deserialize,
685 )
686 return self._stubs["update_view"]
687
688 @property
689 def delete_view(
690 self,
691 ) -> Callable[[logging_config.DeleteViewRequest], empty_pb2.Empty]:
692 r"""Return a callable for the delete view method over gRPC.
693
694 Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is
695 returned, this indicates that system is not in a state where it
696 can delete the view. If this occurs, please try again in a few
697 minutes.
698
699 Returns:
700 Callable[[~.DeleteViewRequest],
701 ~.Empty]:
702 A function that, when called, will call the underlying RPC
703 on the server.
704 """
705 # Generate a "stub function" on-the-fly which will actually make
706 # the request.
707 # gRPC handles serialization and deserialization, so we just need
708 # to pass in the functions for each.
709 if "delete_view" not in self._stubs:
710 self._stubs["delete_view"] = self._logged_channel.unary_unary(
711 "/google.logging.v2.ConfigServiceV2/DeleteView",
712 request_serializer=logging_config.DeleteViewRequest.serialize,
713 response_deserializer=empty_pb2.Empty.FromString,
714 )
715 return self._stubs["delete_view"]
716
717 @property
718 def list_sinks(
719 self,
720 ) -> Callable[[logging_config.ListSinksRequest], logging_config.ListSinksResponse]:
721 r"""Return a callable for the list sinks method over gRPC.
722
723 Lists sinks.
724
725 Returns:
726 Callable[[~.ListSinksRequest],
727 ~.ListSinksResponse]:
728 A function that, when called, will call the underlying RPC
729 on the server.
730 """
731 # Generate a "stub function" on-the-fly which will actually make
732 # the request.
733 # gRPC handles serialization and deserialization, so we just need
734 # to pass in the functions for each.
735 if "list_sinks" not in self._stubs:
736 self._stubs["list_sinks"] = self._logged_channel.unary_unary(
737 "/google.logging.v2.ConfigServiceV2/ListSinks",
738 request_serializer=logging_config.ListSinksRequest.serialize,
739 response_deserializer=logging_config.ListSinksResponse.deserialize,
740 )
741 return self._stubs["list_sinks"]
742
743 @property
744 def get_sink(
745 self,
746 ) -> Callable[[logging_config.GetSinkRequest], logging_config.LogSink]:
747 r"""Return a callable for the get sink method over gRPC.
748
749 Gets a sink.
750
751 Returns:
752 Callable[[~.GetSinkRequest],
753 ~.LogSink]:
754 A function that, when called, will call the underlying RPC
755 on the server.
756 """
757 # Generate a "stub function" on-the-fly which will actually make
758 # the request.
759 # gRPC handles serialization and deserialization, so we just need
760 # to pass in the functions for each.
761 if "get_sink" not in self._stubs:
762 self._stubs["get_sink"] = self._logged_channel.unary_unary(
763 "/google.logging.v2.ConfigServiceV2/GetSink",
764 request_serializer=logging_config.GetSinkRequest.serialize,
765 response_deserializer=logging_config.LogSink.deserialize,
766 )
767 return self._stubs["get_sink"]
768
769 @property
770 def create_sink(
771 self,
772 ) -> Callable[[logging_config.CreateSinkRequest], logging_config.LogSink]:
773 r"""Return a callable for the create sink method over gRPC.
774
775 Creates a sink that exports specified log entries to a
776 destination. The export of newly-ingested log entries begins
777 immediately, unless the sink's ``writer_identity`` is not
778 permitted to write to the destination. A sink can export log
779 entries only from the resource owning the sink.
780
781 Returns:
782 Callable[[~.CreateSinkRequest],
783 ~.LogSink]:
784 A function that, when called, will call the underlying RPC
785 on the server.
786 """
787 # Generate a "stub function" on-the-fly which will actually make
788 # the request.
789 # gRPC handles serialization and deserialization, so we just need
790 # to pass in the functions for each.
791 if "create_sink" not in self._stubs:
792 self._stubs["create_sink"] = self._logged_channel.unary_unary(
793 "/google.logging.v2.ConfigServiceV2/CreateSink",
794 request_serializer=logging_config.CreateSinkRequest.serialize,
795 response_deserializer=logging_config.LogSink.deserialize,
796 )
797 return self._stubs["create_sink"]
798
799 @property
800 def update_sink(
801 self,
802 ) -> Callable[[logging_config.UpdateSinkRequest], logging_config.LogSink]:
803 r"""Return a callable for the update sink method over gRPC.
804
805 Updates a sink. This method replaces the following fields in the
806 existing sink with values from the new sink: ``destination``,
807 and ``filter``.
808
809 The updated sink might also have a new ``writer_identity``; see
810 the ``unique_writer_identity`` field.
811
812 Returns:
813 Callable[[~.UpdateSinkRequest],
814 ~.LogSink]:
815 A function that, when called, will call the underlying RPC
816 on the server.
817 """
818 # Generate a "stub function" on-the-fly which will actually make
819 # the request.
820 # gRPC handles serialization and deserialization, so we just need
821 # to pass in the functions for each.
822 if "update_sink" not in self._stubs:
823 self._stubs["update_sink"] = self._logged_channel.unary_unary(
824 "/google.logging.v2.ConfigServiceV2/UpdateSink",
825 request_serializer=logging_config.UpdateSinkRequest.serialize,
826 response_deserializer=logging_config.LogSink.deserialize,
827 )
828 return self._stubs["update_sink"]
829
830 @property
831 def delete_sink(
832 self,
833 ) -> Callable[[logging_config.DeleteSinkRequest], empty_pb2.Empty]:
834 r"""Return a callable for the delete sink method over gRPC.
835
836 Deletes a sink. If the sink has a unique ``writer_identity``,
837 then that service account is also deleted.
838
839 Returns:
840 Callable[[~.DeleteSinkRequest],
841 ~.Empty]:
842 A function that, when called, will call the underlying RPC
843 on the server.
844 """
845 # Generate a "stub function" on-the-fly which will actually make
846 # the request.
847 # gRPC handles serialization and deserialization, so we just need
848 # to pass in the functions for each.
849 if "delete_sink" not in self._stubs:
850 self._stubs["delete_sink"] = self._logged_channel.unary_unary(
851 "/google.logging.v2.ConfigServiceV2/DeleteSink",
852 request_serializer=logging_config.DeleteSinkRequest.serialize,
853 response_deserializer=empty_pb2.Empty.FromString,
854 )
855 return self._stubs["delete_sink"]
856
857 @property
858 def create_link(
859 self,
860 ) -> Callable[[logging_config.CreateLinkRequest], operations_pb2.Operation]:
861 r"""Return a callable for the create link method over gRPC.
862
863 Asynchronously creates a linked dataset in BigQuery
864 which makes it possible to use BigQuery to read the logs
865 stored in the log bucket. A log bucket may currently
866 only contain one link.
867
868 Returns:
869 Callable[[~.CreateLinkRequest],
870 ~.Operation]:
871 A function that, when called, will call the underlying RPC
872 on the server.
873 """
874 # Generate a "stub function" on-the-fly which will actually make
875 # the request.
876 # gRPC handles serialization and deserialization, so we just need
877 # to pass in the functions for each.
878 if "create_link" not in self._stubs:
879 self._stubs["create_link"] = self._logged_channel.unary_unary(
880 "/google.logging.v2.ConfigServiceV2/CreateLink",
881 request_serializer=logging_config.CreateLinkRequest.serialize,
882 response_deserializer=operations_pb2.Operation.FromString,
883 )
884 return self._stubs["create_link"]
885
886 @property
887 def delete_link(
888 self,
889 ) -> Callable[[logging_config.DeleteLinkRequest], operations_pb2.Operation]:
890 r"""Return a callable for the delete link method over gRPC.
891
892 Deletes a link. This will also delete the
893 corresponding BigQuery linked dataset.
894
895 Returns:
896 Callable[[~.DeleteLinkRequest],
897 ~.Operation]:
898 A function that, when called, will call the underlying RPC
899 on the server.
900 """
901 # Generate a "stub function" on-the-fly which will actually make
902 # the request.
903 # gRPC handles serialization and deserialization, so we just need
904 # to pass in the functions for each.
905 if "delete_link" not in self._stubs:
906 self._stubs["delete_link"] = self._logged_channel.unary_unary(
907 "/google.logging.v2.ConfigServiceV2/DeleteLink",
908 request_serializer=logging_config.DeleteLinkRequest.serialize,
909 response_deserializer=operations_pb2.Operation.FromString,
910 )
911 return self._stubs["delete_link"]
912
913 @property
914 def list_links(
915 self,
916 ) -> Callable[[logging_config.ListLinksRequest], logging_config.ListLinksResponse]:
917 r"""Return a callable for the list links method over gRPC.
918
919 Lists links.
920
921 Returns:
922 Callable[[~.ListLinksRequest],
923 ~.ListLinksResponse]:
924 A function that, when called, will call the underlying RPC
925 on the server.
926 """
927 # Generate a "stub function" on-the-fly which will actually make
928 # the request.
929 # gRPC handles serialization and deserialization, so we just need
930 # to pass in the functions for each.
931 if "list_links" not in self._stubs:
932 self._stubs["list_links"] = self._logged_channel.unary_unary(
933 "/google.logging.v2.ConfigServiceV2/ListLinks",
934 request_serializer=logging_config.ListLinksRequest.serialize,
935 response_deserializer=logging_config.ListLinksResponse.deserialize,
936 )
937 return self._stubs["list_links"]
938
939 @property
940 def get_link(
941 self,
942 ) -> Callable[[logging_config.GetLinkRequest], logging_config.Link]:
943 r"""Return a callable for the get link method over gRPC.
944
945 Gets a link.
946
947 Returns:
948 Callable[[~.GetLinkRequest],
949 ~.Link]:
950 A function that, when called, will call the underlying RPC
951 on the server.
952 """
953 # Generate a "stub function" on-the-fly which will actually make
954 # the request.
955 # gRPC handles serialization and deserialization, so we just need
956 # to pass in the functions for each.
957 if "get_link" not in self._stubs:
958 self._stubs["get_link"] = self._logged_channel.unary_unary(
959 "/google.logging.v2.ConfigServiceV2/GetLink",
960 request_serializer=logging_config.GetLinkRequest.serialize,
961 response_deserializer=logging_config.Link.deserialize,
962 )
963 return self._stubs["get_link"]
964
965 @property
966 def list_exclusions(
967 self,
968 ) -> Callable[
969 [logging_config.ListExclusionsRequest], logging_config.ListExclusionsResponse
970 ]:
971 r"""Return a callable for the list exclusions method over gRPC.
972
973 Lists all the exclusions on the \_Default sink in a parent
974 resource.
975
976 Returns:
977 Callable[[~.ListExclusionsRequest],
978 ~.ListExclusionsResponse]:
979 A function that, when called, will call the underlying RPC
980 on the server.
981 """
982 # Generate a "stub function" on-the-fly which will actually make
983 # the request.
984 # gRPC handles serialization and deserialization, so we just need
985 # to pass in the functions for each.
986 if "list_exclusions" not in self._stubs:
987 self._stubs["list_exclusions"] = self._logged_channel.unary_unary(
988 "/google.logging.v2.ConfigServiceV2/ListExclusions",
989 request_serializer=logging_config.ListExclusionsRequest.serialize,
990 response_deserializer=logging_config.ListExclusionsResponse.deserialize,
991 )
992 return self._stubs["list_exclusions"]
993
994 @property
995 def get_exclusion(
996 self,
997 ) -> Callable[[logging_config.GetExclusionRequest], logging_config.LogExclusion]:
998 r"""Return a callable for the get exclusion method over gRPC.
999
1000 Gets the description of an exclusion in the \_Default sink.
1001
1002 Returns:
1003 Callable[[~.GetExclusionRequest],
1004 ~.LogExclusion]:
1005 A function that, when called, will call the underlying RPC
1006 on the server.
1007 """
1008 # Generate a "stub function" on-the-fly which will actually make
1009 # the request.
1010 # gRPC handles serialization and deserialization, so we just need
1011 # to pass in the functions for each.
1012 if "get_exclusion" not in self._stubs:
1013 self._stubs["get_exclusion"] = self._logged_channel.unary_unary(
1014 "/google.logging.v2.ConfigServiceV2/GetExclusion",
1015 request_serializer=logging_config.GetExclusionRequest.serialize,
1016 response_deserializer=logging_config.LogExclusion.deserialize,
1017 )
1018 return self._stubs["get_exclusion"]
1019
1020 @property
1021 def create_exclusion(
1022 self,
1023 ) -> Callable[[logging_config.CreateExclusionRequest], logging_config.LogExclusion]:
1024 r"""Return a callable for the create exclusion method over gRPC.
1025
1026 Creates a new exclusion in the \_Default sink in a specified
1027 parent resource. Only log entries belonging to that resource can
1028 be excluded. You can have up to 10 exclusions in a resource.
1029
1030 Returns:
1031 Callable[[~.CreateExclusionRequest],
1032 ~.LogExclusion]:
1033 A function that, when called, will call the underlying RPC
1034 on the server.
1035 """
1036 # Generate a "stub function" on-the-fly which will actually make
1037 # the request.
1038 # gRPC handles serialization and deserialization, so we just need
1039 # to pass in the functions for each.
1040 if "create_exclusion" not in self._stubs:
1041 self._stubs["create_exclusion"] = self._logged_channel.unary_unary(
1042 "/google.logging.v2.ConfigServiceV2/CreateExclusion",
1043 request_serializer=logging_config.CreateExclusionRequest.serialize,
1044 response_deserializer=logging_config.LogExclusion.deserialize,
1045 )
1046 return self._stubs["create_exclusion"]
1047
1048 @property
1049 def update_exclusion(
1050 self,
1051 ) -> Callable[[logging_config.UpdateExclusionRequest], logging_config.LogExclusion]:
1052 r"""Return a callable for the update exclusion method over gRPC.
1053
1054 Changes one or more properties of an existing exclusion in the
1055 \_Default sink.
1056
1057 Returns:
1058 Callable[[~.UpdateExclusionRequest],
1059 ~.LogExclusion]:
1060 A function that, when called, will call the underlying RPC
1061 on the server.
1062 """
1063 # Generate a "stub function" on-the-fly which will actually make
1064 # the request.
1065 # gRPC handles serialization and deserialization, so we just need
1066 # to pass in the functions for each.
1067 if "update_exclusion" not in self._stubs:
1068 self._stubs["update_exclusion"] = self._logged_channel.unary_unary(
1069 "/google.logging.v2.ConfigServiceV2/UpdateExclusion",
1070 request_serializer=logging_config.UpdateExclusionRequest.serialize,
1071 response_deserializer=logging_config.LogExclusion.deserialize,
1072 )
1073 return self._stubs["update_exclusion"]
1074
1075 @property
1076 def delete_exclusion(
1077 self,
1078 ) -> Callable[[logging_config.DeleteExclusionRequest], empty_pb2.Empty]:
1079 r"""Return a callable for the delete exclusion method over gRPC.
1080
1081 Deletes an exclusion in the \_Default sink.
1082
1083 Returns:
1084 Callable[[~.DeleteExclusionRequest],
1085 ~.Empty]:
1086 A function that, when called, will call the underlying RPC
1087 on the server.
1088 """
1089 # Generate a "stub function" on-the-fly which will actually make
1090 # the request.
1091 # gRPC handles serialization and deserialization, so we just need
1092 # to pass in the functions for each.
1093 if "delete_exclusion" not in self._stubs:
1094 self._stubs["delete_exclusion"] = self._logged_channel.unary_unary(
1095 "/google.logging.v2.ConfigServiceV2/DeleteExclusion",
1096 request_serializer=logging_config.DeleteExclusionRequest.serialize,
1097 response_deserializer=empty_pb2.Empty.FromString,
1098 )
1099 return self._stubs["delete_exclusion"]
1100
1101 @property
1102 def get_cmek_settings(
1103 self,
1104 ) -> Callable[[logging_config.GetCmekSettingsRequest], logging_config.CmekSettings]:
1105 r"""Return a callable for the get cmek settings method over gRPC.
1106
1107 Gets the Logging CMEK settings for the given resource.
1108
1109 Note: CMEK for the Log Router can be configured for Google Cloud
1110 projects, folders, organizations and billing accounts. Once
1111 configured for an organization, it applies to all projects and
1112 folders in the Google Cloud organization.
1113
1114 See `Enabling CMEK for Log
1115 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__
1116 for more information.
1117
1118 Returns:
1119 Callable[[~.GetCmekSettingsRequest],
1120 ~.CmekSettings]:
1121 A function that, when called, will call the underlying RPC
1122 on the server.
1123 """
1124 # Generate a "stub function" on-the-fly which will actually make
1125 # the request.
1126 # gRPC handles serialization and deserialization, so we just need
1127 # to pass in the functions for each.
1128 if "get_cmek_settings" not in self._stubs:
1129 self._stubs["get_cmek_settings"] = self._logged_channel.unary_unary(
1130 "/google.logging.v2.ConfigServiceV2/GetCmekSettings",
1131 request_serializer=logging_config.GetCmekSettingsRequest.serialize,
1132 response_deserializer=logging_config.CmekSettings.deserialize,
1133 )
1134 return self._stubs["get_cmek_settings"]
1135
1136 @property
1137 def update_cmek_settings(
1138 self,
1139 ) -> Callable[
1140 [logging_config.UpdateCmekSettingsRequest], logging_config.CmekSettings
1141 ]:
1142 r"""Return a callable for the update cmek settings method over gRPC.
1143
1144 Updates the Log Router CMEK settings for the given resource.
1145
1146 Note: CMEK for the Log Router can currently only be configured
1147 for Google Cloud organizations. Once configured, it applies to
1148 all projects and folders in the Google Cloud organization.
1149
1150 [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]
1151 will fail if 1) ``kms_key_name`` is invalid, or 2) the
1152 associated service account does not have the required
1153 ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
1154 the key, or 3) access to the key is disabled.
1155
1156 See `Enabling CMEK for Log
1157 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__
1158 for more information.
1159
1160 Returns:
1161 Callable[[~.UpdateCmekSettingsRequest],
1162 ~.CmekSettings]:
1163 A function that, when called, will call the underlying RPC
1164 on the server.
1165 """
1166 # Generate a "stub function" on-the-fly which will actually make
1167 # the request.
1168 # gRPC handles serialization and deserialization, so we just need
1169 # to pass in the functions for each.
1170 if "update_cmek_settings" not in self._stubs:
1171 self._stubs["update_cmek_settings"] = self._logged_channel.unary_unary(
1172 "/google.logging.v2.ConfigServiceV2/UpdateCmekSettings",
1173 request_serializer=logging_config.UpdateCmekSettingsRequest.serialize,
1174 response_deserializer=logging_config.CmekSettings.deserialize,
1175 )
1176 return self._stubs["update_cmek_settings"]
1177
1178 @property
1179 def get_settings(
1180 self,
1181 ) -> Callable[[logging_config.GetSettingsRequest], logging_config.Settings]:
1182 r"""Return a callable for the get settings method over gRPC.
1183
1184 Gets the Log Router settings for the given resource.
1185
1186 Note: Settings for the Log Router can be get for Google Cloud
1187 projects, folders, organizations and billing accounts. Currently
1188 it can only be configured for organizations. Once configured for
1189 an organization, it applies to all projects and folders in the
1190 Google Cloud organization.
1191
1192 See `Enabling CMEK for Log
1193 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__
1194 for more information.
1195
1196 Returns:
1197 Callable[[~.GetSettingsRequest],
1198 ~.Settings]:
1199 A function that, when called, will call the underlying RPC
1200 on the server.
1201 """
1202 # Generate a "stub function" on-the-fly which will actually make
1203 # the request.
1204 # gRPC handles serialization and deserialization, so we just need
1205 # to pass in the functions for each.
1206 if "get_settings" not in self._stubs:
1207 self._stubs["get_settings"] = self._logged_channel.unary_unary(
1208 "/google.logging.v2.ConfigServiceV2/GetSettings",
1209 request_serializer=logging_config.GetSettingsRequest.serialize,
1210 response_deserializer=logging_config.Settings.deserialize,
1211 )
1212 return self._stubs["get_settings"]
1213
1214 @property
1215 def update_settings(
1216 self,
1217 ) -> Callable[[logging_config.UpdateSettingsRequest], logging_config.Settings]:
1218 r"""Return a callable for the update settings method over gRPC.
1219
1220 Updates the Log Router settings for the given resource.
1221
1222 Note: Settings for the Log Router can currently only be
1223 configured for Google Cloud organizations. Once configured, it
1224 applies to all projects and folders in the Google Cloud
1225 organization.
1226
1227 [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]
1228 will fail if 1) ``kms_key_name`` is invalid, or 2) the
1229 associated service account does not have the required
1230 ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
1231 the key, or 3) access to the key is disabled. 4) ``location_id``
1232 is not supported by Logging. 5) ``location_id`` violate
1233 OrgPolicy.
1234
1235 See `Enabling CMEK for Log
1236 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__
1237 for more information.
1238
1239 Returns:
1240 Callable[[~.UpdateSettingsRequest],
1241 ~.Settings]:
1242 A function that, when called, will call the underlying RPC
1243 on the server.
1244 """
1245 # Generate a "stub function" on-the-fly which will actually make
1246 # the request.
1247 # gRPC handles serialization and deserialization, so we just need
1248 # to pass in the functions for each.
1249 if "update_settings" not in self._stubs:
1250 self._stubs["update_settings"] = self._logged_channel.unary_unary(
1251 "/google.logging.v2.ConfigServiceV2/UpdateSettings",
1252 request_serializer=logging_config.UpdateSettingsRequest.serialize,
1253 response_deserializer=logging_config.Settings.deserialize,
1254 )
1255 return self._stubs["update_settings"]
1256
1257 @property
1258 def copy_log_entries(
1259 self,
1260 ) -> Callable[[logging_config.CopyLogEntriesRequest], operations_pb2.Operation]:
1261 r"""Return a callable for the copy log entries method over gRPC.
1262
1263 Copies a set of log entries from a log bucket to a
1264 Cloud Storage bucket.
1265
1266 Returns:
1267 Callable[[~.CopyLogEntriesRequest],
1268 ~.Operation]:
1269 A function that, when called, will call the underlying RPC
1270 on the server.
1271 """
1272 # Generate a "stub function" on-the-fly which will actually make
1273 # the request.
1274 # gRPC handles serialization and deserialization, so we just need
1275 # to pass in the functions for each.
1276 if "copy_log_entries" not in self._stubs:
1277 self._stubs["copy_log_entries"] = self._logged_channel.unary_unary(
1278 "/google.logging.v2.ConfigServiceV2/CopyLogEntries",
1279 request_serializer=logging_config.CopyLogEntriesRequest.serialize,
1280 response_deserializer=operations_pb2.Operation.FromString,
1281 )
1282 return self._stubs["copy_log_entries"]
1283
1284 def close(self):
1285 self._logged_channel.close()
1286
1287 @property
1288 def cancel_operation(
1289 self,
1290 ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
1291 r"""Return a callable for the cancel_operation method over gRPC."""
1292 # Generate a "stub function" on-the-fly which will actually make
1293 # the request.
1294 # gRPC handles serialization and deserialization, so we just need
1295 # to pass in the functions for each.
1296 if "cancel_operation" not in self._stubs:
1297 self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
1298 "/google.longrunning.Operations/CancelOperation",
1299 request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
1300 response_deserializer=None,
1301 )
1302 return self._stubs["cancel_operation"]
1303
1304 @property
1305 def get_operation(
1306 self,
1307 ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
1308 r"""Return a callable for the get_operation method over gRPC."""
1309 # Generate a "stub function" on-the-fly which will actually make
1310 # the request.
1311 # gRPC handles serialization and deserialization, so we just need
1312 # to pass in the functions for each.
1313 if "get_operation" not in self._stubs:
1314 self._stubs["get_operation"] = self._logged_channel.unary_unary(
1315 "/google.longrunning.Operations/GetOperation",
1316 request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
1317 response_deserializer=operations_pb2.Operation.FromString,
1318 )
1319 return self._stubs["get_operation"]
1320
1321 @property
1322 def list_operations(
1323 self,
1324 ) -> Callable[
1325 [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
1326 ]:
1327 r"""Return a callable for the list_operations method over gRPC."""
1328 # Generate a "stub function" on-the-fly which will actually make
1329 # the request.
1330 # gRPC handles serialization and deserialization, so we just need
1331 # to pass in the functions for each.
1332 if "list_operations" not in self._stubs:
1333 self._stubs["list_operations"] = self._logged_channel.unary_unary(
1334 "/google.longrunning.Operations/ListOperations",
1335 request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
1336 response_deserializer=operations_pb2.ListOperationsResponse.FromString,
1337 )
1338 return self._stubs["list_operations"]
1339
1340 @property
1341 def kind(self) -> str:
1342 return "grpc"
1343
1344
1345__all__ = ("ConfigServiceV2GrpcTransport",)