Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py: 43%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

247 statements  

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]): 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 scopes (Optional(Sequence[str])): A list of scopes. This argument is 

161 ignored if a ``channel`` instance is provided. 

162 channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]): 

163 A ``Channel`` instance through which to make calls, or a Callable 

164 that constructs and returns one. If set to None, ``self.create_channel`` 

165 is used to create the channel. If a Callable is given, it will be called 

166 with the same arguments as used in ``self.create_channel``. 

167 api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. 

168 If provided, it overrides the ``host`` argument and tries to create 

169 a mutual TLS channel with client SSL credentials from 

170 ``client_cert_source`` or application default SSL credentials. 

171 client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): 

172 Deprecated. A callback to provide client SSL certificate bytes and 

173 private key bytes, both in PEM format. It is ignored if 

174 ``api_mtls_endpoint`` is None. 

175 ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials 

176 for the grpc channel. It is ignored if a ``channel`` instance is provided. 

177 client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): 

178 A callback to provide client certificate bytes and private key bytes, 

179 both in PEM format. It is used to configure a mutual TLS channel. It is 

180 ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided. 

181 quota_project_id (Optional[str]): An optional project to use for billing 

182 and quota. 

183 client_info (google.api_core.gapic_v1.client_info.ClientInfo): 

184 The client info used to send a user-agent string along with 

185 API requests. If ``None``, then default info will be used. 

186 Generally, you only need to set this if you're developing 

187 your own client library. 

188 always_use_jwt_access (Optional[bool]): Whether self signed JWT should 

189 be used for service account credentials. 

190 

191 Raises: 

192 google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport 

193 creation failed for any reason. 

194 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` 

195 and ``credentials_file`` are passed. 

196 """ 

197 self._grpc_channel = None 

198 self._ssl_channel_credentials = ssl_channel_credentials 

199 self._stubs: Dict[str, Callable] = {} 

200 self._operations_client: Optional[operations_v1.OperationsClient] = None 

201 

202 if api_mtls_endpoint: 

203 warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 

204 if client_cert_source: 

205 warnings.warn("client_cert_source is deprecated", DeprecationWarning) 

206 

207 if isinstance(channel, grpc.Channel): 

208 # Ignore credentials if a channel was passed. 

209 credentials = None 

210 self._ignore_credentials = True 

211 # If a channel was explicitly provided, set it. 

212 self._grpc_channel = channel 

213 self._ssl_channel_credentials = None 

214 

215 else: 

216 if api_mtls_endpoint: 

217 host = api_mtls_endpoint 

218 

219 # Create SSL credentials with client_cert_source or application 

220 # default SSL credentials. 

221 if client_cert_source: 

222 cert, key = client_cert_source() 

223 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 

224 certificate_chain=cert, private_key=key 

225 ) 

226 else: 

227 self._ssl_channel_credentials = SslCredentials().ssl_credentials 

228 

229 else: 

230 if client_cert_source_for_mtls and not ssl_channel_credentials: 

231 cert, key = client_cert_source_for_mtls() 

232 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 

233 certificate_chain=cert, private_key=key 

234 ) 

235 

236 # The base transport sets the host, credentials and scopes 

237 super().__init__( 

238 host=host, 

239 credentials=credentials, 

240 credentials_file=credentials_file, 

241 scopes=scopes, 

242 quota_project_id=quota_project_id, 

243 client_info=client_info, 

244 always_use_jwt_access=always_use_jwt_access, 

245 api_audience=api_audience, 

246 ) 

247 

248 if not self._grpc_channel: 

249 # initialize with the provided callable or the default channel 

250 channel_init = channel or type(self).create_channel 

251 self._grpc_channel = channel_init( 

252 self._host, 

253 # use the credentials which are saved 

254 credentials=self._credentials, 

255 # Set ``credentials_file`` to ``None`` here as 

256 # the credentials that we saved earlier should be used. 

257 credentials_file=None, 

258 scopes=self._scopes, 

259 ssl_credentials=self._ssl_channel_credentials, 

260 quota_project_id=quota_project_id, 

261 options=[ 

262 ("grpc.max_send_message_length", -1), 

263 ("grpc.max_receive_message_length", -1), 

264 ], 

265 ) 

266 

267 self._interceptor = _LoggingClientInterceptor() 

268 self._logged_channel = grpc.intercept_channel( 

269 self._grpc_channel, self._interceptor 

270 ) 

271 

272 # Wrap messages. This must be done after self._logged_channel exists 

273 self._prep_wrapped_messages(client_info) 

274 

275 @classmethod 

276 def create_channel( 

277 cls, 

278 host: str = "logging.googleapis.com", 

279 credentials: Optional[ga_credentials.Credentials] = None, 

280 credentials_file: Optional[str] = None, 

281 scopes: Optional[Sequence[str]] = None, 

282 quota_project_id: Optional[str] = None, 

283 **kwargs, 

284 ) -> grpc.Channel: 

285 """Create and return a gRPC channel object. 

286 Args: 

287 host (Optional[str]): The host for the channel to use. 

288 credentials (Optional[~.Credentials]): The 

289 authorization credentials to attach to requests. These 

290 credentials identify this application to the service. If 

291 none are specified, the client will attempt to ascertain 

292 the credentials from the environment. 

293 credentials_file (Optional[str]): A file with credentials that can 

294 be loaded with :func:`google.auth.load_credentials_from_file`. 

295 This argument is mutually exclusive with credentials. 

296 scopes (Optional[Sequence[str]]): A optional list of scopes needed for this 

297 service. These are only used when credentials are not specified and 

298 are passed to :func:`google.auth.default`. 

299 quota_project_id (Optional[str]): An optional project to use for billing 

300 and quota. 

301 kwargs (Optional[dict]): Keyword arguments, which are passed to the 

302 channel creation. 

303 Returns: 

304 grpc.Channel: A gRPC channel object. 

305 

306 Raises: 

307 google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` 

308 and ``credentials_file`` are passed. 

309 """ 

310 

311 return grpc_helpers.create_channel( 

312 host, 

313 credentials=credentials, 

314 credentials_file=credentials_file, 

315 quota_project_id=quota_project_id, 

316 default_scopes=cls.AUTH_SCOPES, 

317 scopes=scopes, 

318 default_host=cls.DEFAULT_HOST, 

319 **kwargs, 

320 ) 

321 

322 @property 

323 def grpc_channel(self) -> grpc.Channel: 

324 """Return the channel designed to connect to this service.""" 

325 return self._grpc_channel 

326 

327 @property 

328 def operations_client(self) -> operations_v1.OperationsClient: 

329 """Create the client designed to process long-running operations. 

330 

331 This property caches on the instance; repeated calls return the same 

332 client. 

333 """ 

334 # Quick check: Only create a new client if we do not already have one. 

335 if self._operations_client is None: 

336 self._operations_client = operations_v1.OperationsClient( 

337 self._logged_channel 

338 ) 

339 

340 # Return the client from cache. 

341 return self._operations_client 

342 

343 @property 

344 def list_buckets( 

345 self, 

346 ) -> Callable[ 

347 [logging_config.ListBucketsRequest], logging_config.ListBucketsResponse 

348 ]: 

349 r"""Return a callable for the list buckets method over gRPC. 

350 

351 Lists log buckets. 

352 

353 Returns: 

354 Callable[[~.ListBucketsRequest], 

355 ~.ListBucketsResponse]: 

356 A function that, when called, will call the underlying RPC 

357 on the server. 

358 """ 

359 # Generate a "stub function" on-the-fly which will actually make 

360 # the request. 

361 # gRPC handles serialization and deserialization, so we just need 

362 # to pass in the functions for each. 

363 if "list_buckets" not in self._stubs: 

364 self._stubs["list_buckets"] = self._logged_channel.unary_unary( 

365 "/google.logging.v2.ConfigServiceV2/ListBuckets", 

366 request_serializer=logging_config.ListBucketsRequest.serialize, 

367 response_deserializer=logging_config.ListBucketsResponse.deserialize, 

368 ) 

369 return self._stubs["list_buckets"] 

370 

371 @property 

372 def get_bucket( 

373 self, 

374 ) -> Callable[[logging_config.GetBucketRequest], logging_config.LogBucket]: 

375 r"""Return a callable for the get bucket method over gRPC. 

376 

377 Gets a log bucket. 

378 

379 Returns: 

380 Callable[[~.GetBucketRequest], 

381 ~.LogBucket]: 

382 A function that, when called, will call the underlying RPC 

383 on the server. 

384 """ 

385 # Generate a "stub function" on-the-fly which will actually make 

386 # the request. 

387 # gRPC handles serialization and deserialization, so we just need 

388 # to pass in the functions for each. 

389 if "get_bucket" not in self._stubs: 

390 self._stubs["get_bucket"] = self._logged_channel.unary_unary( 

391 "/google.logging.v2.ConfigServiceV2/GetBucket", 

392 request_serializer=logging_config.GetBucketRequest.serialize, 

393 response_deserializer=logging_config.LogBucket.deserialize, 

394 ) 

395 return self._stubs["get_bucket"] 

396 

397 @property 

398 def create_bucket_async( 

399 self, 

400 ) -> Callable[[logging_config.CreateBucketRequest], operations_pb2.Operation]: 

401 r"""Return a callable for the create bucket async method over gRPC. 

402 

403 Creates a log bucket asynchronously that can be used 

404 to store log entries. 

405 After a bucket has been created, the bucket's location 

406 cannot be changed. 

407 

408 Returns: 

409 Callable[[~.CreateBucketRequest], 

410 ~.Operation]: 

411 A function that, when called, will call the underlying RPC 

412 on the server. 

413 """ 

414 # Generate a "stub function" on-the-fly which will actually make 

415 # the request. 

416 # gRPC handles serialization and deserialization, so we just need 

417 # to pass in the functions for each. 

418 if "create_bucket_async" not in self._stubs: 

419 self._stubs["create_bucket_async"] = self._logged_channel.unary_unary( 

420 "/google.logging.v2.ConfigServiceV2/CreateBucketAsync", 

421 request_serializer=logging_config.CreateBucketRequest.serialize, 

422 response_deserializer=operations_pb2.Operation.FromString, 

423 ) 

424 return self._stubs["create_bucket_async"] 

425 

426 @property 

427 def update_bucket_async( 

428 self, 

429 ) -> Callable[[logging_config.UpdateBucketRequest], operations_pb2.Operation]: 

430 r"""Return a callable for the update bucket async method over gRPC. 

431 

432 Updates a log bucket asynchronously. 

433 

434 If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``, 

435 then ``FAILED_PRECONDITION`` will be returned. 

436 

437 After a bucket has been created, the bucket's location cannot be 

438 changed. 

439 

440 Returns: 

441 Callable[[~.UpdateBucketRequest], 

442 ~.Operation]: 

443 A function that, when called, will call the underlying RPC 

444 on the server. 

445 """ 

446 # Generate a "stub function" on-the-fly which will actually make 

447 # the request. 

448 # gRPC handles serialization and deserialization, so we just need 

449 # to pass in the functions for each. 

450 if "update_bucket_async" not in self._stubs: 

451 self._stubs["update_bucket_async"] = self._logged_channel.unary_unary( 

452 "/google.logging.v2.ConfigServiceV2/UpdateBucketAsync", 

453 request_serializer=logging_config.UpdateBucketRequest.serialize, 

454 response_deserializer=operations_pb2.Operation.FromString, 

455 ) 

456 return self._stubs["update_bucket_async"] 

457 

458 @property 

459 def create_bucket( 

460 self, 

461 ) -> Callable[[logging_config.CreateBucketRequest], logging_config.LogBucket]: 

462 r"""Return a callable for the create bucket method over gRPC. 

463 

464 Creates a log bucket that can be used to store log 

465 entries. After a bucket has been created, the bucket's 

466 location cannot be changed. 

467 

468 Returns: 

469 Callable[[~.CreateBucketRequest], 

470 ~.LogBucket]: 

471 A function that, when called, will call the underlying RPC 

472 on the server. 

473 """ 

474 # Generate a "stub function" on-the-fly which will actually make 

475 # the request. 

476 # gRPC handles serialization and deserialization, so we just need 

477 # to pass in the functions for each. 

478 if "create_bucket" not in self._stubs: 

479 self._stubs["create_bucket"] = self._logged_channel.unary_unary( 

480 "/google.logging.v2.ConfigServiceV2/CreateBucket", 

481 request_serializer=logging_config.CreateBucketRequest.serialize, 

482 response_deserializer=logging_config.LogBucket.deserialize, 

483 ) 

484 return self._stubs["create_bucket"] 

485 

486 @property 

487 def update_bucket( 

488 self, 

489 ) -> Callable[[logging_config.UpdateBucketRequest], logging_config.LogBucket]: 

490 r"""Return a callable for the update bucket method over gRPC. 

491 

492 Updates a log bucket. 

493 

494 If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``, 

495 then ``FAILED_PRECONDITION`` will be returned. 

496 

497 After a bucket has been created, the bucket's location cannot be 

498 changed. 

499 

500 Returns: 

501 Callable[[~.UpdateBucketRequest], 

502 ~.LogBucket]: 

503 A function that, when called, will call the underlying RPC 

504 on the server. 

505 """ 

506 # Generate a "stub function" on-the-fly which will actually make 

507 # the request. 

508 # gRPC handles serialization and deserialization, so we just need 

509 # to pass in the functions for each. 

510 if "update_bucket" not in self._stubs: 

511 self._stubs["update_bucket"] = self._logged_channel.unary_unary( 

512 "/google.logging.v2.ConfigServiceV2/UpdateBucket", 

513 request_serializer=logging_config.UpdateBucketRequest.serialize, 

514 response_deserializer=logging_config.LogBucket.deserialize, 

515 ) 

516 return self._stubs["update_bucket"] 

517 

518 @property 

519 def delete_bucket( 

520 self, 

521 ) -> Callable[[logging_config.DeleteBucketRequest], empty_pb2.Empty]: 

522 r"""Return a callable for the delete bucket method over gRPC. 

523 

524 Deletes a log bucket. 

525 

526 Changes the bucket's ``lifecycle_state`` to the 

527 ``DELETE_REQUESTED`` state. After 7 days, the bucket will be 

528 purged and all log entries in the bucket will be permanently 

529 deleted. 

530 

531 Returns: 

532 Callable[[~.DeleteBucketRequest], 

533 ~.Empty]: 

534 A function that, when called, will call the underlying RPC 

535 on the server. 

536 """ 

537 # Generate a "stub function" on-the-fly which will actually make 

538 # the request. 

539 # gRPC handles serialization and deserialization, so we just need 

540 # to pass in the functions for each. 

541 if "delete_bucket" not in self._stubs: 

542 self._stubs["delete_bucket"] = self._logged_channel.unary_unary( 

543 "/google.logging.v2.ConfigServiceV2/DeleteBucket", 

544 request_serializer=logging_config.DeleteBucketRequest.serialize, 

545 response_deserializer=empty_pb2.Empty.FromString, 

546 ) 

547 return self._stubs["delete_bucket"] 

548 

549 @property 

550 def undelete_bucket( 

551 self, 

552 ) -> Callable[[logging_config.UndeleteBucketRequest], empty_pb2.Empty]: 

553 r"""Return a callable for the undelete bucket method over gRPC. 

554 

555 Undeletes a log bucket. A bucket that has been 

556 deleted can be undeleted within the grace period of 7 

557 days. 

558 

559 Returns: 

560 Callable[[~.UndeleteBucketRequest], 

561 ~.Empty]: 

562 A function that, when called, will call the underlying RPC 

563 on the server. 

564 """ 

565 # Generate a "stub function" on-the-fly which will actually make 

566 # the request. 

567 # gRPC handles serialization and deserialization, so we just need 

568 # to pass in the functions for each. 

569 if "undelete_bucket" not in self._stubs: 

570 self._stubs["undelete_bucket"] = self._logged_channel.unary_unary( 

571 "/google.logging.v2.ConfigServiceV2/UndeleteBucket", 

572 request_serializer=logging_config.UndeleteBucketRequest.serialize, 

573 response_deserializer=empty_pb2.Empty.FromString, 

574 ) 

575 return self._stubs["undelete_bucket"] 

576 

577 @property 

578 def list_views( 

579 self, 

580 ) -> Callable[[logging_config.ListViewsRequest], logging_config.ListViewsResponse]: 

581 r"""Return a callable for the list views method over gRPC. 

582 

583 Lists views on a log bucket. 

584 

585 Returns: 

586 Callable[[~.ListViewsRequest], 

587 ~.ListViewsResponse]: 

588 A function that, when called, will call the underlying RPC 

589 on the server. 

590 """ 

591 # Generate a "stub function" on-the-fly which will actually make 

592 # the request. 

593 # gRPC handles serialization and deserialization, so we just need 

594 # to pass in the functions for each. 

595 if "list_views" not in self._stubs: 

596 self._stubs["list_views"] = self._logged_channel.unary_unary( 

597 "/google.logging.v2.ConfigServiceV2/ListViews", 

598 request_serializer=logging_config.ListViewsRequest.serialize, 

599 response_deserializer=logging_config.ListViewsResponse.deserialize, 

600 ) 

601 return self._stubs["list_views"] 

602 

603 @property 

604 def get_view( 

605 self, 

606 ) -> Callable[[logging_config.GetViewRequest], logging_config.LogView]: 

607 r"""Return a callable for the get view method over gRPC. 

608 

609 Gets a view on a log bucket.. 

610 

611 Returns: 

612 Callable[[~.GetViewRequest], 

613 ~.LogView]: 

614 A function that, when called, will call the underlying RPC 

615 on the server. 

616 """ 

617 # Generate a "stub function" on-the-fly which will actually make 

618 # the request. 

619 # gRPC handles serialization and deserialization, so we just need 

620 # to pass in the functions for each. 

621 if "get_view" not in self._stubs: 

622 self._stubs["get_view"] = self._logged_channel.unary_unary( 

623 "/google.logging.v2.ConfigServiceV2/GetView", 

624 request_serializer=logging_config.GetViewRequest.serialize, 

625 response_deserializer=logging_config.LogView.deserialize, 

626 ) 

627 return self._stubs["get_view"] 

628 

629 @property 

630 def create_view( 

631 self, 

632 ) -> Callable[[logging_config.CreateViewRequest], logging_config.LogView]: 

633 r"""Return a callable for the create view method over gRPC. 

634 

635 Creates a view over log entries in a log bucket. A 

636 bucket may contain a maximum of 30 views. 

637 

638 Returns: 

639 Callable[[~.CreateViewRequest], 

640 ~.LogView]: 

641 A function that, when called, will call the underlying RPC 

642 on the server. 

643 """ 

644 # Generate a "stub function" on-the-fly which will actually make 

645 # the request. 

646 # gRPC handles serialization and deserialization, so we just need 

647 # to pass in the functions for each. 

648 if "create_view" not in self._stubs: 

649 self._stubs["create_view"] = self._logged_channel.unary_unary( 

650 "/google.logging.v2.ConfigServiceV2/CreateView", 

651 request_serializer=logging_config.CreateViewRequest.serialize, 

652 response_deserializer=logging_config.LogView.deserialize, 

653 ) 

654 return self._stubs["create_view"] 

655 

656 @property 

657 def update_view( 

658 self, 

659 ) -> Callable[[logging_config.UpdateViewRequest], logging_config.LogView]: 

660 r"""Return a callable for the update view method over gRPC. 

661 

662 Updates a view on a log bucket. This method replaces the 

663 following fields in the existing view with values from the new 

664 view: ``filter``. If an ``UNAVAILABLE`` error is returned, this 

665 indicates that system is not in a state where it can update the 

666 view. If this occurs, please try again in a few minutes. 

667 

668 Returns: 

669 Callable[[~.UpdateViewRequest], 

670 ~.LogView]: 

671 A function that, when called, will call the underlying RPC 

672 on the server. 

673 """ 

674 # Generate a "stub function" on-the-fly which will actually make 

675 # the request. 

676 # gRPC handles serialization and deserialization, so we just need 

677 # to pass in the functions for each. 

678 if "update_view" not in self._stubs: 

679 self._stubs["update_view"] = self._logged_channel.unary_unary( 

680 "/google.logging.v2.ConfigServiceV2/UpdateView", 

681 request_serializer=logging_config.UpdateViewRequest.serialize, 

682 response_deserializer=logging_config.LogView.deserialize, 

683 ) 

684 return self._stubs["update_view"] 

685 

686 @property 

687 def delete_view( 

688 self, 

689 ) -> Callable[[logging_config.DeleteViewRequest], empty_pb2.Empty]: 

690 r"""Return a callable for the delete view method over gRPC. 

691 

692 Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is 

693 returned, this indicates that system is not in a state where it 

694 can delete the view. If this occurs, please try again in a few 

695 minutes. 

696 

697 Returns: 

698 Callable[[~.DeleteViewRequest], 

699 ~.Empty]: 

700 A function that, when called, will call the underlying RPC 

701 on the server. 

702 """ 

703 # Generate a "stub function" on-the-fly which will actually make 

704 # the request. 

705 # gRPC handles serialization and deserialization, so we just need 

706 # to pass in the functions for each. 

707 if "delete_view" not in self._stubs: 

708 self._stubs["delete_view"] = self._logged_channel.unary_unary( 

709 "/google.logging.v2.ConfigServiceV2/DeleteView", 

710 request_serializer=logging_config.DeleteViewRequest.serialize, 

711 response_deserializer=empty_pb2.Empty.FromString, 

712 ) 

713 return self._stubs["delete_view"] 

714 

715 @property 

716 def list_sinks( 

717 self, 

718 ) -> Callable[[logging_config.ListSinksRequest], logging_config.ListSinksResponse]: 

719 r"""Return a callable for the list sinks method over gRPC. 

720 

721 Lists sinks. 

722 

723 Returns: 

724 Callable[[~.ListSinksRequest], 

725 ~.ListSinksResponse]: 

726 A function that, when called, will call the underlying RPC 

727 on the server. 

728 """ 

729 # Generate a "stub function" on-the-fly which will actually make 

730 # the request. 

731 # gRPC handles serialization and deserialization, so we just need 

732 # to pass in the functions for each. 

733 if "list_sinks" not in self._stubs: 

734 self._stubs["list_sinks"] = self._logged_channel.unary_unary( 

735 "/google.logging.v2.ConfigServiceV2/ListSinks", 

736 request_serializer=logging_config.ListSinksRequest.serialize, 

737 response_deserializer=logging_config.ListSinksResponse.deserialize, 

738 ) 

739 return self._stubs["list_sinks"] 

740 

741 @property 

742 def get_sink( 

743 self, 

744 ) -> Callable[[logging_config.GetSinkRequest], logging_config.LogSink]: 

745 r"""Return a callable for the get sink method over gRPC. 

746 

747 Gets a sink. 

748 

749 Returns: 

750 Callable[[~.GetSinkRequest], 

751 ~.LogSink]: 

752 A function that, when called, will call the underlying RPC 

753 on the server. 

754 """ 

755 # Generate a "stub function" on-the-fly which will actually make 

756 # the request. 

757 # gRPC handles serialization and deserialization, so we just need 

758 # to pass in the functions for each. 

759 if "get_sink" not in self._stubs: 

760 self._stubs["get_sink"] = self._logged_channel.unary_unary( 

761 "/google.logging.v2.ConfigServiceV2/GetSink", 

762 request_serializer=logging_config.GetSinkRequest.serialize, 

763 response_deserializer=logging_config.LogSink.deserialize, 

764 ) 

765 return self._stubs["get_sink"] 

766 

767 @property 

768 def create_sink( 

769 self, 

770 ) -> Callable[[logging_config.CreateSinkRequest], logging_config.LogSink]: 

771 r"""Return a callable for the create sink method over gRPC. 

772 

773 Creates a sink that exports specified log entries to a 

774 destination. The export of newly-ingested log entries begins 

775 immediately, unless the sink's ``writer_identity`` is not 

776 permitted to write to the destination. A sink can export log 

777 entries only from the resource owning the sink. 

778 

779 Returns: 

780 Callable[[~.CreateSinkRequest], 

781 ~.LogSink]: 

782 A function that, when called, will call the underlying RPC 

783 on the server. 

784 """ 

785 # Generate a "stub function" on-the-fly which will actually make 

786 # the request. 

787 # gRPC handles serialization and deserialization, so we just need 

788 # to pass in the functions for each. 

789 if "create_sink" not in self._stubs: 

790 self._stubs["create_sink"] = self._logged_channel.unary_unary( 

791 "/google.logging.v2.ConfigServiceV2/CreateSink", 

792 request_serializer=logging_config.CreateSinkRequest.serialize, 

793 response_deserializer=logging_config.LogSink.deserialize, 

794 ) 

795 return self._stubs["create_sink"] 

796 

797 @property 

798 def update_sink( 

799 self, 

800 ) -> Callable[[logging_config.UpdateSinkRequest], logging_config.LogSink]: 

801 r"""Return a callable for the update sink method over gRPC. 

802 

803 Updates a sink. This method replaces the following fields in the 

804 existing sink with values from the new sink: ``destination``, 

805 and ``filter``. 

806 

807 The updated sink might also have a new ``writer_identity``; see 

808 the ``unique_writer_identity`` field. 

809 

810 Returns: 

811 Callable[[~.UpdateSinkRequest], 

812 ~.LogSink]: 

813 A function that, when called, will call the underlying RPC 

814 on the server. 

815 """ 

816 # Generate a "stub function" on-the-fly which will actually make 

817 # the request. 

818 # gRPC handles serialization and deserialization, so we just need 

819 # to pass in the functions for each. 

820 if "update_sink" not in self._stubs: 

821 self._stubs["update_sink"] = self._logged_channel.unary_unary( 

822 "/google.logging.v2.ConfigServiceV2/UpdateSink", 

823 request_serializer=logging_config.UpdateSinkRequest.serialize, 

824 response_deserializer=logging_config.LogSink.deserialize, 

825 ) 

826 return self._stubs["update_sink"] 

827 

828 @property 

829 def delete_sink( 

830 self, 

831 ) -> Callable[[logging_config.DeleteSinkRequest], empty_pb2.Empty]: 

832 r"""Return a callable for the delete sink method over gRPC. 

833 

834 Deletes a sink. If the sink has a unique ``writer_identity``, 

835 then that service account is also deleted. 

836 

837 Returns: 

838 Callable[[~.DeleteSinkRequest], 

839 ~.Empty]: 

840 A function that, when called, will call the underlying RPC 

841 on the server. 

842 """ 

843 # Generate a "stub function" on-the-fly which will actually make 

844 # the request. 

845 # gRPC handles serialization and deserialization, so we just need 

846 # to pass in the functions for each. 

847 if "delete_sink" not in self._stubs: 

848 self._stubs["delete_sink"] = self._logged_channel.unary_unary( 

849 "/google.logging.v2.ConfigServiceV2/DeleteSink", 

850 request_serializer=logging_config.DeleteSinkRequest.serialize, 

851 response_deserializer=empty_pb2.Empty.FromString, 

852 ) 

853 return self._stubs["delete_sink"] 

854 

855 @property 

856 def create_link( 

857 self, 

858 ) -> Callable[[logging_config.CreateLinkRequest], operations_pb2.Operation]: 

859 r"""Return a callable for the create link method over gRPC. 

860 

861 Asynchronously creates a linked dataset in BigQuery 

862 which makes it possible to use BigQuery to read the logs 

863 stored in the log bucket. A log bucket may currently 

864 only contain one link. 

865 

866 Returns: 

867 Callable[[~.CreateLinkRequest], 

868 ~.Operation]: 

869 A function that, when called, will call the underlying RPC 

870 on the server. 

871 """ 

872 # Generate a "stub function" on-the-fly which will actually make 

873 # the request. 

874 # gRPC handles serialization and deserialization, so we just need 

875 # to pass in the functions for each. 

876 if "create_link" not in self._stubs: 

877 self._stubs["create_link"] = self._logged_channel.unary_unary( 

878 "/google.logging.v2.ConfigServiceV2/CreateLink", 

879 request_serializer=logging_config.CreateLinkRequest.serialize, 

880 response_deserializer=operations_pb2.Operation.FromString, 

881 ) 

882 return self._stubs["create_link"] 

883 

884 @property 

885 def delete_link( 

886 self, 

887 ) -> Callable[[logging_config.DeleteLinkRequest], operations_pb2.Operation]: 

888 r"""Return a callable for the delete link method over gRPC. 

889 

890 Deletes a link. This will also delete the 

891 corresponding BigQuery linked dataset. 

892 

893 Returns: 

894 Callable[[~.DeleteLinkRequest], 

895 ~.Operation]: 

896 A function that, when called, will call the underlying RPC 

897 on the server. 

898 """ 

899 # Generate a "stub function" on-the-fly which will actually make 

900 # the request. 

901 # gRPC handles serialization and deserialization, so we just need 

902 # to pass in the functions for each. 

903 if "delete_link" not in self._stubs: 

904 self._stubs["delete_link"] = self._logged_channel.unary_unary( 

905 "/google.logging.v2.ConfigServiceV2/DeleteLink", 

906 request_serializer=logging_config.DeleteLinkRequest.serialize, 

907 response_deserializer=operations_pb2.Operation.FromString, 

908 ) 

909 return self._stubs["delete_link"] 

910 

911 @property 

912 def list_links( 

913 self, 

914 ) -> Callable[[logging_config.ListLinksRequest], logging_config.ListLinksResponse]: 

915 r"""Return a callable for the list links method over gRPC. 

916 

917 Lists links. 

918 

919 Returns: 

920 Callable[[~.ListLinksRequest], 

921 ~.ListLinksResponse]: 

922 A function that, when called, will call the underlying RPC 

923 on the server. 

924 """ 

925 # Generate a "stub function" on-the-fly which will actually make 

926 # the request. 

927 # gRPC handles serialization and deserialization, so we just need 

928 # to pass in the functions for each. 

929 if "list_links" not in self._stubs: 

930 self._stubs["list_links"] = self._logged_channel.unary_unary( 

931 "/google.logging.v2.ConfigServiceV2/ListLinks", 

932 request_serializer=logging_config.ListLinksRequest.serialize, 

933 response_deserializer=logging_config.ListLinksResponse.deserialize, 

934 ) 

935 return self._stubs["list_links"] 

936 

937 @property 

938 def get_link( 

939 self, 

940 ) -> Callable[[logging_config.GetLinkRequest], logging_config.Link]: 

941 r"""Return a callable for the get link method over gRPC. 

942 

943 Gets a link. 

944 

945 Returns: 

946 Callable[[~.GetLinkRequest], 

947 ~.Link]: 

948 A function that, when called, will call the underlying RPC 

949 on the server. 

950 """ 

951 # Generate a "stub function" on-the-fly which will actually make 

952 # the request. 

953 # gRPC handles serialization and deserialization, so we just need 

954 # to pass in the functions for each. 

955 if "get_link" not in self._stubs: 

956 self._stubs["get_link"] = self._logged_channel.unary_unary( 

957 "/google.logging.v2.ConfigServiceV2/GetLink", 

958 request_serializer=logging_config.GetLinkRequest.serialize, 

959 response_deserializer=logging_config.Link.deserialize, 

960 ) 

961 return self._stubs["get_link"] 

962 

963 @property 

964 def list_exclusions( 

965 self, 

966 ) -> Callable[ 

967 [logging_config.ListExclusionsRequest], logging_config.ListExclusionsResponse 

968 ]: 

969 r"""Return a callable for the list exclusions method over gRPC. 

970 

971 Lists all the exclusions on the \_Default sink in a parent 

972 resource. 

973 

974 Returns: 

975 Callable[[~.ListExclusionsRequest], 

976 ~.ListExclusionsResponse]: 

977 A function that, when called, will call the underlying RPC 

978 on the server. 

979 """ 

980 # Generate a "stub function" on-the-fly which will actually make 

981 # the request. 

982 # gRPC handles serialization and deserialization, so we just need 

983 # to pass in the functions for each. 

984 if "list_exclusions" not in self._stubs: 

985 self._stubs["list_exclusions"] = self._logged_channel.unary_unary( 

986 "/google.logging.v2.ConfigServiceV2/ListExclusions", 

987 request_serializer=logging_config.ListExclusionsRequest.serialize, 

988 response_deserializer=logging_config.ListExclusionsResponse.deserialize, 

989 ) 

990 return self._stubs["list_exclusions"] 

991 

992 @property 

993 def get_exclusion( 

994 self, 

995 ) -> Callable[[logging_config.GetExclusionRequest], logging_config.LogExclusion]: 

996 r"""Return a callable for the get exclusion method over gRPC. 

997 

998 Gets the description of an exclusion in the \_Default sink. 

999 

1000 Returns: 

1001 Callable[[~.GetExclusionRequest], 

1002 ~.LogExclusion]: 

1003 A function that, when called, will call the underlying RPC 

1004 on the server. 

1005 """ 

1006 # Generate a "stub function" on-the-fly which will actually make 

1007 # the request. 

1008 # gRPC handles serialization and deserialization, so we just need 

1009 # to pass in the functions for each. 

1010 if "get_exclusion" not in self._stubs: 

1011 self._stubs["get_exclusion"] = self._logged_channel.unary_unary( 

1012 "/google.logging.v2.ConfigServiceV2/GetExclusion", 

1013 request_serializer=logging_config.GetExclusionRequest.serialize, 

1014 response_deserializer=logging_config.LogExclusion.deserialize, 

1015 ) 

1016 return self._stubs["get_exclusion"] 

1017 

1018 @property 

1019 def create_exclusion( 

1020 self, 

1021 ) -> Callable[[logging_config.CreateExclusionRequest], logging_config.LogExclusion]: 

1022 r"""Return a callable for the create exclusion method over gRPC. 

1023 

1024 Creates a new exclusion in the \_Default sink in a specified 

1025 parent resource. Only log entries belonging to that resource can 

1026 be excluded. You can have up to 10 exclusions in a resource. 

1027 

1028 Returns: 

1029 Callable[[~.CreateExclusionRequest], 

1030 ~.LogExclusion]: 

1031 A function that, when called, will call the underlying RPC 

1032 on the server. 

1033 """ 

1034 # Generate a "stub function" on-the-fly which will actually make 

1035 # the request. 

1036 # gRPC handles serialization and deserialization, so we just need 

1037 # to pass in the functions for each. 

1038 if "create_exclusion" not in self._stubs: 

1039 self._stubs["create_exclusion"] = self._logged_channel.unary_unary( 

1040 "/google.logging.v2.ConfigServiceV2/CreateExclusion", 

1041 request_serializer=logging_config.CreateExclusionRequest.serialize, 

1042 response_deserializer=logging_config.LogExclusion.deserialize, 

1043 ) 

1044 return self._stubs["create_exclusion"] 

1045 

1046 @property 

1047 def update_exclusion( 

1048 self, 

1049 ) -> Callable[[logging_config.UpdateExclusionRequest], logging_config.LogExclusion]: 

1050 r"""Return a callable for the update exclusion method over gRPC. 

1051 

1052 Changes one or more properties of an existing exclusion in the 

1053 \_Default sink. 

1054 

1055 Returns: 

1056 Callable[[~.UpdateExclusionRequest], 

1057 ~.LogExclusion]: 

1058 A function that, when called, will call the underlying RPC 

1059 on the server. 

1060 """ 

1061 # Generate a "stub function" on-the-fly which will actually make 

1062 # the request. 

1063 # gRPC handles serialization and deserialization, so we just need 

1064 # to pass in the functions for each. 

1065 if "update_exclusion" not in self._stubs: 

1066 self._stubs["update_exclusion"] = self._logged_channel.unary_unary( 

1067 "/google.logging.v2.ConfigServiceV2/UpdateExclusion", 

1068 request_serializer=logging_config.UpdateExclusionRequest.serialize, 

1069 response_deserializer=logging_config.LogExclusion.deserialize, 

1070 ) 

1071 return self._stubs["update_exclusion"] 

1072 

1073 @property 

1074 def delete_exclusion( 

1075 self, 

1076 ) -> Callable[[logging_config.DeleteExclusionRequest], empty_pb2.Empty]: 

1077 r"""Return a callable for the delete exclusion method over gRPC. 

1078 

1079 Deletes an exclusion in the \_Default sink. 

1080 

1081 Returns: 

1082 Callable[[~.DeleteExclusionRequest], 

1083 ~.Empty]: 

1084 A function that, when called, will call the underlying RPC 

1085 on the server. 

1086 """ 

1087 # Generate a "stub function" on-the-fly which will actually make 

1088 # the request. 

1089 # gRPC handles serialization and deserialization, so we just need 

1090 # to pass in the functions for each. 

1091 if "delete_exclusion" not in self._stubs: 

1092 self._stubs["delete_exclusion"] = self._logged_channel.unary_unary( 

1093 "/google.logging.v2.ConfigServiceV2/DeleteExclusion", 

1094 request_serializer=logging_config.DeleteExclusionRequest.serialize, 

1095 response_deserializer=empty_pb2.Empty.FromString, 

1096 ) 

1097 return self._stubs["delete_exclusion"] 

1098 

1099 @property 

1100 def get_cmek_settings( 

1101 self, 

1102 ) -> Callable[[logging_config.GetCmekSettingsRequest], logging_config.CmekSettings]: 

1103 r"""Return a callable for the get cmek settings method over gRPC. 

1104 

1105 Gets the Logging CMEK settings for the given resource. 

1106 

1107 Note: CMEK for the Log Router can be configured for Google Cloud 

1108 projects, folders, organizations and billing accounts. Once 

1109 configured for an organization, it applies to all projects and 

1110 folders in the Google Cloud organization. 

1111 

1112 See `Enabling CMEK for Log 

1113 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 

1114 for more information. 

1115 

1116 Returns: 

1117 Callable[[~.GetCmekSettingsRequest], 

1118 ~.CmekSettings]: 

1119 A function that, when called, will call the underlying RPC 

1120 on the server. 

1121 """ 

1122 # Generate a "stub function" on-the-fly which will actually make 

1123 # the request. 

1124 # gRPC handles serialization and deserialization, so we just need 

1125 # to pass in the functions for each. 

1126 if "get_cmek_settings" not in self._stubs: 

1127 self._stubs["get_cmek_settings"] = self._logged_channel.unary_unary( 

1128 "/google.logging.v2.ConfigServiceV2/GetCmekSettings", 

1129 request_serializer=logging_config.GetCmekSettingsRequest.serialize, 

1130 response_deserializer=logging_config.CmekSettings.deserialize, 

1131 ) 

1132 return self._stubs["get_cmek_settings"] 

1133 

1134 @property 

1135 def update_cmek_settings( 

1136 self, 

1137 ) -> Callable[ 

1138 [logging_config.UpdateCmekSettingsRequest], logging_config.CmekSettings 

1139 ]: 

1140 r"""Return a callable for the update cmek settings method over gRPC. 

1141 

1142 Updates the Log Router CMEK settings for the given resource. 

1143 

1144 Note: CMEK for the Log Router can currently only be configured 

1145 for Google Cloud organizations. Once configured, it applies to 

1146 all projects and folders in the Google Cloud organization. 

1147 

1148 [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] 

1149 will fail if 1) ``kms_key_name`` is invalid, or 2) the 

1150 associated service account does not have the required 

1151 ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for 

1152 the key, or 3) access to the key is disabled. 

1153 

1154 See `Enabling CMEK for Log 

1155 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 

1156 for more information. 

1157 

1158 Returns: 

1159 Callable[[~.UpdateCmekSettingsRequest], 

1160 ~.CmekSettings]: 

1161 A function that, when called, will call the underlying RPC 

1162 on the server. 

1163 """ 

1164 # Generate a "stub function" on-the-fly which will actually make 

1165 # the request. 

1166 # gRPC handles serialization and deserialization, so we just need 

1167 # to pass in the functions for each. 

1168 if "update_cmek_settings" not in self._stubs: 

1169 self._stubs["update_cmek_settings"] = self._logged_channel.unary_unary( 

1170 "/google.logging.v2.ConfigServiceV2/UpdateCmekSettings", 

1171 request_serializer=logging_config.UpdateCmekSettingsRequest.serialize, 

1172 response_deserializer=logging_config.CmekSettings.deserialize, 

1173 ) 

1174 return self._stubs["update_cmek_settings"] 

1175 

1176 @property 

1177 def get_settings( 

1178 self, 

1179 ) -> Callable[[logging_config.GetSettingsRequest], logging_config.Settings]: 

1180 r"""Return a callable for the get settings method over gRPC. 

1181 

1182 Gets the Log Router settings for the given resource. 

1183 

1184 Note: Settings for the Log Router can be get for Google Cloud 

1185 projects, folders, organizations and billing accounts. Currently 

1186 it can only be configured for organizations. Once configured for 

1187 an organization, it applies to all projects and folders in the 

1188 Google Cloud organization. 

1189 

1190 See `Enabling CMEK for Log 

1191 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 

1192 for more information. 

1193 

1194 Returns: 

1195 Callable[[~.GetSettingsRequest], 

1196 ~.Settings]: 

1197 A function that, when called, will call the underlying RPC 

1198 on the server. 

1199 """ 

1200 # Generate a "stub function" on-the-fly which will actually make 

1201 # the request. 

1202 # gRPC handles serialization and deserialization, so we just need 

1203 # to pass in the functions for each. 

1204 if "get_settings" not in self._stubs: 

1205 self._stubs["get_settings"] = self._logged_channel.unary_unary( 

1206 "/google.logging.v2.ConfigServiceV2/GetSettings", 

1207 request_serializer=logging_config.GetSettingsRequest.serialize, 

1208 response_deserializer=logging_config.Settings.deserialize, 

1209 ) 

1210 return self._stubs["get_settings"] 

1211 

1212 @property 

1213 def update_settings( 

1214 self, 

1215 ) -> Callable[[logging_config.UpdateSettingsRequest], logging_config.Settings]: 

1216 r"""Return a callable for the update settings method over gRPC. 

1217 

1218 Updates the Log Router settings for the given resource. 

1219 

1220 Note: Settings for the Log Router can currently only be 

1221 configured for Google Cloud organizations. Once configured, it 

1222 applies to all projects and folders in the Google Cloud 

1223 organization. 

1224 

1225 [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] 

1226 will fail if 1) ``kms_key_name`` is invalid, or 2) the 

1227 associated service account does not have the required 

1228 ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for 

1229 the key, or 3) access to the key is disabled. 4) ``location_id`` 

1230 is not supported by Logging. 5) ``location_id`` violate 

1231 OrgPolicy. 

1232 

1233 See `Enabling CMEK for Log 

1234 Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 

1235 for more information. 

1236 

1237 Returns: 

1238 Callable[[~.UpdateSettingsRequest], 

1239 ~.Settings]: 

1240 A function that, when called, will call the underlying RPC 

1241 on the server. 

1242 """ 

1243 # Generate a "stub function" on-the-fly which will actually make 

1244 # the request. 

1245 # gRPC handles serialization and deserialization, so we just need 

1246 # to pass in the functions for each. 

1247 if "update_settings" not in self._stubs: 

1248 self._stubs["update_settings"] = self._logged_channel.unary_unary( 

1249 "/google.logging.v2.ConfigServiceV2/UpdateSettings", 

1250 request_serializer=logging_config.UpdateSettingsRequest.serialize, 

1251 response_deserializer=logging_config.Settings.deserialize, 

1252 ) 

1253 return self._stubs["update_settings"] 

1254 

1255 @property 

1256 def copy_log_entries( 

1257 self, 

1258 ) -> Callable[[logging_config.CopyLogEntriesRequest], operations_pb2.Operation]: 

1259 r"""Return a callable for the copy log entries method over gRPC. 

1260 

1261 Copies a set of log entries from a log bucket to a 

1262 Cloud Storage bucket. 

1263 

1264 Returns: 

1265 Callable[[~.CopyLogEntriesRequest], 

1266 ~.Operation]: 

1267 A function that, when called, will call the underlying RPC 

1268 on the server. 

1269 """ 

1270 # Generate a "stub function" on-the-fly which will actually make 

1271 # the request. 

1272 # gRPC handles serialization and deserialization, so we just need 

1273 # to pass in the functions for each. 

1274 if "copy_log_entries" not in self._stubs: 

1275 self._stubs["copy_log_entries"] = self._logged_channel.unary_unary( 

1276 "/google.logging.v2.ConfigServiceV2/CopyLogEntries", 

1277 request_serializer=logging_config.CopyLogEntriesRequest.serialize, 

1278 response_deserializer=operations_pb2.Operation.FromString, 

1279 ) 

1280 return self._stubs["copy_log_entries"] 

1281 

1282 def close(self): 

1283 self._logged_channel.close() 

1284 

1285 @property 

1286 def cancel_operation( 

1287 self, 

1288 ) -> Callable[[operations_pb2.CancelOperationRequest], None]: 

1289 r"""Return a callable for the cancel_operation method over gRPC.""" 

1290 # Generate a "stub function" on-the-fly which will actually make 

1291 # the request. 

1292 # gRPC handles serialization and deserialization, so we just need 

1293 # to pass in the functions for each. 

1294 if "cancel_operation" not in self._stubs: 

1295 self._stubs["cancel_operation"] = self._logged_channel.unary_unary( 

1296 "/google.longrunning.Operations/CancelOperation", 

1297 request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, 

1298 response_deserializer=None, 

1299 ) 

1300 return self._stubs["cancel_operation"] 

1301 

1302 @property 

1303 def get_operation( 

1304 self, 

1305 ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: 

1306 r"""Return a callable for the get_operation method over gRPC.""" 

1307 # Generate a "stub function" on-the-fly which will actually make 

1308 # the request. 

1309 # gRPC handles serialization and deserialization, so we just need 

1310 # to pass in the functions for each. 

1311 if "get_operation" not in self._stubs: 

1312 self._stubs["get_operation"] = self._logged_channel.unary_unary( 

1313 "/google.longrunning.Operations/GetOperation", 

1314 request_serializer=operations_pb2.GetOperationRequest.SerializeToString, 

1315 response_deserializer=operations_pb2.Operation.FromString, 

1316 ) 

1317 return self._stubs["get_operation"] 

1318 

1319 @property 

1320 def list_operations( 

1321 self, 

1322 ) -> Callable[ 

1323 [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse 

1324 ]: 

1325 r"""Return a callable for the list_operations method over gRPC.""" 

1326 # Generate a "stub function" on-the-fly which will actually make 

1327 # the request. 

1328 # gRPC handles serialization and deserialization, so we just need 

1329 # to pass in the functions for each. 

1330 if "list_operations" not in self._stubs: 

1331 self._stubs["list_operations"] = self._logged_channel.unary_unary( 

1332 "/google.longrunning.Operations/ListOperations", 

1333 request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, 

1334 response_deserializer=operations_pb2.ListOperationsResponse.FromString, 

1335 ) 

1336 return self._stubs["list_operations"] 

1337 

1338 @property 

1339 def kind(self) -> str: 

1340 return "grpc" 

1341 

1342 

1343__all__ = ("ConfigServiceV2GrpcTransport",)