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": client_call_details.method, 

77 "request": grpc_request, 

78 "metadata": grpc_request["metadata"], 

79 }, 

80 ) 

81 

82 response = continuation(client_call_details, request) 

83 if logging_enabled: # pragma: NO COVER 

84 response_metadata = response.trailing_metadata() 

85 # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples 

86 metadata = ( 

87 dict([(k, str(v)) for k, v in response_metadata]) 

88 if response_metadata 

89 else None 

90 ) 

91 result = response.result() 

92 if isinstance(result, proto.Message): 

93 response_payload = type(result).to_json(result) 

94 elif isinstance(result, google.protobuf.message.Message): 

95 response_payload = MessageToJson(result) 

96 else: 

97 response_payload = f"{type(result).__name__}: {pickle.dumps(result)}" 

98 grpc_response = { 

99 "payload": response_payload, 

100 "metadata": metadata, 

101 "status": "OK", 

102 } 

103 _LOGGER.debug( 

104 f"Received response for {client_call_details.method}.", 

105 extra={ 

106 "serviceName": "google.logging.v2.ConfigServiceV2", 

107 "rpcName": client_call_details.method, 

108 "response": grpc_response, 

109 "metadata": grpc_response["metadata"], 

110 }, 

111 ) 

112 return response 

113 

114 

115class ConfigServiceV2GrpcTransport(ConfigServiceV2Transport): 

116 """gRPC backend transport for ConfigServiceV2. 

117 

118 Service for configuring sinks used to route log entries. 

119 

120 This class defines the same methods as the primary client, so the 

121 primary client can load the underlying transport implementation 

122 and call it. 

123 

124 It sends protocol buffers over the wire using gRPC (which is built on 

125 top of HTTP/2); the ``grpcio`` package must be installed. 

126 """ 

127 

128 _stubs: Dict[str, Callable] 

129 

130 def __init__( 

131 self, 

132 *, 

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

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

135 credentials_file: Optional[str] = None, 

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

137 channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None, 

138 api_mtls_endpoint: Optional[str] = None, 

139 client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, 

140 ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, 

141 client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, 

142 quota_project_id: Optional[str] = None, 

143 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, 

144 always_use_jwt_access: Optional[bool] = False, 

145 api_audience: Optional[str] = None, 

146 ) -> None: 

147 """Instantiate the transport. 

148 

149 Args: 

150 host (Optional[str]): 

151 The hostname to connect to (default: 'logging.googleapis.com'). 

152 credentials (Optional[google.auth.credentials.Credentials]): The 

153 authorization credentials to attach to requests. These 

154 credentials identify the application to the service; if none 

155 are specified, the client will attempt to ascertain the 

156 credentials from the environment. 

157 This argument is ignored if a ``channel`` instance is provided. 

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

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

160 This argument is ignored if a ``channel`` instance is provided. 

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]): 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. 

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

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

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

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

301 and quota. 

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

303 channel creation. 

304 Returns: 

305 grpc.Channel: A gRPC channel object. 

306 

307 Raises: 

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

309 and ``credentials_file`` are passed. 

310 """ 

311 

312 return grpc_helpers.create_channel( 

313 host, 

314 credentials=credentials, 

315 credentials_file=credentials_file, 

316 quota_project_id=quota_project_id, 

317 default_scopes=cls.AUTH_SCOPES, 

318 scopes=scopes, 

319 default_host=cls.DEFAULT_HOST, 

320 **kwargs, 

321 ) 

322 

323 @property 

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

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

326 return self._grpc_channel 

327 

328 @property 

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

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

331 

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

333 client. 

334 """ 

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

336 if self._operations_client is None: 

337 self._operations_client = operations_v1.OperationsClient( 

338 self._logged_channel 

339 ) 

340 

341 # Return the client from cache. 

342 return self._operations_client 

343 

344 @property 

345 def list_buckets( 

346 self, 

347 ) -> Callable[ 

348 [logging_config.ListBucketsRequest], logging_config.ListBucketsResponse 

349 ]: 

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

351 

352 Lists log buckets. 

353 

354 Returns: 

355 Callable[[~.ListBucketsRequest], 

356 ~.ListBucketsResponse]: 

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

358 on the server. 

359 """ 

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

361 # the request. 

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

363 # to pass in the functions for each. 

364 if "list_buckets" not in self._stubs: 

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

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

367 request_serializer=logging_config.ListBucketsRequest.serialize, 

368 response_deserializer=logging_config.ListBucketsResponse.deserialize, 

369 ) 

370 return self._stubs["list_buckets"] 

371 

372 @property 

373 def get_bucket( 

374 self, 

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

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

377 

378 Gets a log bucket. 

379 

380 Returns: 

381 Callable[[~.GetBucketRequest], 

382 ~.LogBucket]: 

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

384 on the server. 

385 """ 

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

387 # the request. 

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

389 # to pass in the functions for each. 

390 if "get_bucket" not in self._stubs: 

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

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

393 request_serializer=logging_config.GetBucketRequest.serialize, 

394 response_deserializer=logging_config.LogBucket.deserialize, 

395 ) 

396 return self._stubs["get_bucket"] 

397 

398 @property 

399 def create_bucket_async( 

400 self, 

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

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

403 

404 Creates a log bucket asynchronously that can be used 

405 to store log entries. 

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

407 cannot be changed. 

408 

409 Returns: 

410 Callable[[~.CreateBucketRequest], 

411 ~.Operation]: 

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

413 on the server. 

414 """ 

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

416 # the request. 

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

418 # to pass in the functions for each. 

419 if "create_bucket_async" not in self._stubs: 

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

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

422 request_serializer=logging_config.CreateBucketRequest.serialize, 

423 response_deserializer=operations_pb2.Operation.FromString, 

424 ) 

425 return self._stubs["create_bucket_async"] 

426 

427 @property 

428 def update_bucket_async( 

429 self, 

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

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

432 

433 Updates a log bucket asynchronously. 

434 

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

436 then ``FAILED_PRECONDITION`` will be returned. 

437 

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

439 changed. 

440 

441 Returns: 

442 Callable[[~.UpdateBucketRequest], 

443 ~.Operation]: 

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

445 on the server. 

446 """ 

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

448 # the request. 

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

450 # to pass in the functions for each. 

451 if "update_bucket_async" not in self._stubs: 

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

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

454 request_serializer=logging_config.UpdateBucketRequest.serialize, 

455 response_deserializer=operations_pb2.Operation.FromString, 

456 ) 

457 return self._stubs["update_bucket_async"] 

458 

459 @property 

460 def create_bucket( 

461 self, 

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

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

464 

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

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

467 location cannot be changed. 

468 

469 Returns: 

470 Callable[[~.CreateBucketRequest], 

471 ~.LogBucket]: 

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

473 on the server. 

474 """ 

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

476 # the request. 

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

478 # to pass in the functions for each. 

479 if "create_bucket" not in self._stubs: 

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

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

482 request_serializer=logging_config.CreateBucketRequest.serialize, 

483 response_deserializer=logging_config.LogBucket.deserialize, 

484 ) 

485 return self._stubs["create_bucket"] 

486 

487 @property 

488 def update_bucket( 

489 self, 

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

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

492 

493 Updates a log bucket. 

494 

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

496 then ``FAILED_PRECONDITION`` will be returned. 

497 

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

499 changed. 

500 

501 Returns: 

502 Callable[[~.UpdateBucketRequest], 

503 ~.LogBucket]: 

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

505 on the server. 

506 """ 

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

508 # the request. 

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

510 # to pass in the functions for each. 

511 if "update_bucket" not in self._stubs: 

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

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

514 request_serializer=logging_config.UpdateBucketRequest.serialize, 

515 response_deserializer=logging_config.LogBucket.deserialize, 

516 ) 

517 return self._stubs["update_bucket"] 

518 

519 @property 

520 def delete_bucket( 

521 self, 

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

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

524 

525 Deletes a log bucket. 

526 

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

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

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

530 deleted. 

531 

532 Returns: 

533 Callable[[~.DeleteBucketRequest], 

534 ~.Empty]: 

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

536 on the server. 

537 """ 

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

539 # the request. 

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

541 # to pass in the functions for each. 

542 if "delete_bucket" not in self._stubs: 

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

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

545 request_serializer=logging_config.DeleteBucketRequest.serialize, 

546 response_deserializer=empty_pb2.Empty.FromString, 

547 ) 

548 return self._stubs["delete_bucket"] 

549 

550 @property 

551 def undelete_bucket( 

552 self, 

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

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

555 

556 Undeletes a log bucket. A bucket that has been 

557 deleted can be undeleted within the grace period of 7 

558 days. 

559 

560 Returns: 

561 Callable[[~.UndeleteBucketRequest], 

562 ~.Empty]: 

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

564 on the server. 

565 """ 

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

567 # the request. 

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

569 # to pass in the functions for each. 

570 if "undelete_bucket" not in self._stubs: 

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

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

573 request_serializer=logging_config.UndeleteBucketRequest.serialize, 

574 response_deserializer=empty_pb2.Empty.FromString, 

575 ) 

576 return self._stubs["undelete_bucket"] 

577 

578 @property 

579 def list_views( 

580 self, 

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

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

583 

584 Lists views on a log bucket. 

585 

586 Returns: 

587 Callable[[~.ListViewsRequest], 

588 ~.ListViewsResponse]: 

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

590 on the server. 

591 """ 

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

593 # the request. 

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

595 # to pass in the functions for each. 

596 if "list_views" not in self._stubs: 

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

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

599 request_serializer=logging_config.ListViewsRequest.serialize, 

600 response_deserializer=logging_config.ListViewsResponse.deserialize, 

601 ) 

602 return self._stubs["list_views"] 

603 

604 @property 

605 def get_view( 

606 self, 

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

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

609 

610 Gets a view on a log bucket.. 

611 

612 Returns: 

613 Callable[[~.GetViewRequest], 

614 ~.LogView]: 

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

616 on the server. 

617 """ 

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

619 # the request. 

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

621 # to pass in the functions for each. 

622 if "get_view" not in self._stubs: 

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

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

625 request_serializer=logging_config.GetViewRequest.serialize, 

626 response_deserializer=logging_config.LogView.deserialize, 

627 ) 

628 return self._stubs["get_view"] 

629 

630 @property 

631 def create_view( 

632 self, 

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

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

635 

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

637 bucket may contain a maximum of 30 views. 

638 

639 Returns: 

640 Callable[[~.CreateViewRequest], 

641 ~.LogView]: 

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

643 on the server. 

644 """ 

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

646 # the request. 

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

648 # to pass in the functions for each. 

649 if "create_view" not in self._stubs: 

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

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

652 request_serializer=logging_config.CreateViewRequest.serialize, 

653 response_deserializer=logging_config.LogView.deserialize, 

654 ) 

655 return self._stubs["create_view"] 

656 

657 @property 

658 def update_view( 

659 self, 

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

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

662 

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

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

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

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

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

668 

669 Returns: 

670 Callable[[~.UpdateViewRequest], 

671 ~.LogView]: 

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

673 on the server. 

674 """ 

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

676 # the request. 

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

678 # to pass in the functions for each. 

679 if "update_view" not in self._stubs: 

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

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

682 request_serializer=logging_config.UpdateViewRequest.serialize, 

683 response_deserializer=logging_config.LogView.deserialize, 

684 ) 

685 return self._stubs["update_view"] 

686 

687 @property 

688 def delete_view( 

689 self, 

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

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

692 

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

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

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

696 minutes. 

697 

698 Returns: 

699 Callable[[~.DeleteViewRequest], 

700 ~.Empty]: 

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

702 on the server. 

703 """ 

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

705 # the request. 

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

707 # to pass in the functions for each. 

708 if "delete_view" not in self._stubs: 

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

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

711 request_serializer=logging_config.DeleteViewRequest.serialize, 

712 response_deserializer=empty_pb2.Empty.FromString, 

713 ) 

714 return self._stubs["delete_view"] 

715 

716 @property 

717 def list_sinks( 

718 self, 

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

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

721 

722 Lists sinks. 

723 

724 Returns: 

725 Callable[[~.ListSinksRequest], 

726 ~.ListSinksResponse]: 

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

728 on the server. 

729 """ 

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

731 # the request. 

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

733 # to pass in the functions for each. 

734 if "list_sinks" not in self._stubs: 

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

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

737 request_serializer=logging_config.ListSinksRequest.serialize, 

738 response_deserializer=logging_config.ListSinksResponse.deserialize, 

739 ) 

740 return self._stubs["list_sinks"] 

741 

742 @property 

743 def get_sink( 

744 self, 

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

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

747 

748 Gets a sink. 

749 

750 Returns: 

751 Callable[[~.GetSinkRequest], 

752 ~.LogSink]: 

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

754 on the server. 

755 """ 

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

757 # the request. 

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

759 # to pass in the functions for each. 

760 if "get_sink" not in self._stubs: 

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

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

763 request_serializer=logging_config.GetSinkRequest.serialize, 

764 response_deserializer=logging_config.LogSink.deserialize, 

765 ) 

766 return self._stubs["get_sink"] 

767 

768 @property 

769 def create_sink( 

770 self, 

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

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

773 

774 Creates a sink that exports specified log entries to a 

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

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

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

778 entries only from the resource owning the sink. 

779 

780 Returns: 

781 Callable[[~.CreateSinkRequest], 

782 ~.LogSink]: 

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

784 on the server. 

785 """ 

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

787 # the request. 

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

789 # to pass in the functions for each. 

790 if "create_sink" not in self._stubs: 

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

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

793 request_serializer=logging_config.CreateSinkRequest.serialize, 

794 response_deserializer=logging_config.LogSink.deserialize, 

795 ) 

796 return self._stubs["create_sink"] 

797 

798 @property 

799 def update_sink( 

800 self, 

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

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

803 

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

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

806 and ``filter``. 

807 

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

809 the ``unique_writer_identity`` field. 

810 

811 Returns: 

812 Callable[[~.UpdateSinkRequest], 

813 ~.LogSink]: 

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

815 on the server. 

816 """ 

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

818 # the request. 

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

820 # to pass in the functions for each. 

821 if "update_sink" not in self._stubs: 

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

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

824 request_serializer=logging_config.UpdateSinkRequest.serialize, 

825 response_deserializer=logging_config.LogSink.deserialize, 

826 ) 

827 return self._stubs["update_sink"] 

828 

829 @property 

830 def delete_sink( 

831 self, 

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

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

834 

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

836 then that service account is also deleted. 

837 

838 Returns: 

839 Callable[[~.DeleteSinkRequest], 

840 ~.Empty]: 

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

842 on the server. 

843 """ 

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

845 # the request. 

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

847 # to pass in the functions for each. 

848 if "delete_sink" not in self._stubs: 

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

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

851 request_serializer=logging_config.DeleteSinkRequest.serialize, 

852 response_deserializer=empty_pb2.Empty.FromString, 

853 ) 

854 return self._stubs["delete_sink"] 

855 

856 @property 

857 def create_link( 

858 self, 

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

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

861 

862 Asynchronously creates a linked dataset in BigQuery 

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

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

865 only contain one link. 

866 

867 Returns: 

868 Callable[[~.CreateLinkRequest], 

869 ~.Operation]: 

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

871 on the server. 

872 """ 

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

874 # the request. 

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

876 # to pass in the functions for each. 

877 if "create_link" not in self._stubs: 

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

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

880 request_serializer=logging_config.CreateLinkRequest.serialize, 

881 response_deserializer=operations_pb2.Operation.FromString, 

882 ) 

883 return self._stubs["create_link"] 

884 

885 @property 

886 def delete_link( 

887 self, 

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

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

890 

891 Deletes a link. This will also delete the 

892 corresponding BigQuery linked dataset. 

893 

894 Returns: 

895 Callable[[~.DeleteLinkRequest], 

896 ~.Operation]: 

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

898 on the server. 

899 """ 

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

901 # the request. 

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

903 # to pass in the functions for each. 

904 if "delete_link" not in self._stubs: 

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

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

907 request_serializer=logging_config.DeleteLinkRequest.serialize, 

908 response_deserializer=operations_pb2.Operation.FromString, 

909 ) 

910 return self._stubs["delete_link"] 

911 

912 @property 

913 def list_links( 

914 self, 

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

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

917 

918 Lists links. 

919 

920 Returns: 

921 Callable[[~.ListLinksRequest], 

922 ~.ListLinksResponse]: 

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

924 on the server. 

925 """ 

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

927 # the request. 

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

929 # to pass in the functions for each. 

930 if "list_links" not in self._stubs: 

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

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

933 request_serializer=logging_config.ListLinksRequest.serialize, 

934 response_deserializer=logging_config.ListLinksResponse.deserialize, 

935 ) 

936 return self._stubs["list_links"] 

937 

938 @property 

939 def get_link( 

940 self, 

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

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

943 

944 Gets a link. 

945 

946 Returns: 

947 Callable[[~.GetLinkRequest], 

948 ~.Link]: 

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

950 on the server. 

951 """ 

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

953 # the request. 

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

955 # to pass in the functions for each. 

956 if "get_link" not in self._stubs: 

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

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

959 request_serializer=logging_config.GetLinkRequest.serialize, 

960 response_deserializer=logging_config.Link.deserialize, 

961 ) 

962 return self._stubs["get_link"] 

963 

964 @property 

965 def list_exclusions( 

966 self, 

967 ) -> Callable[ 

968 [logging_config.ListExclusionsRequest], logging_config.ListExclusionsResponse 

969 ]: 

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

971 

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

973 resource. 

974 

975 Returns: 

976 Callable[[~.ListExclusionsRequest], 

977 ~.ListExclusionsResponse]: 

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

979 on the server. 

980 """ 

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

982 # the request. 

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

984 # to pass in the functions for each. 

985 if "list_exclusions" not in self._stubs: 

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

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

988 request_serializer=logging_config.ListExclusionsRequest.serialize, 

989 response_deserializer=logging_config.ListExclusionsResponse.deserialize, 

990 ) 

991 return self._stubs["list_exclusions"] 

992 

993 @property 

994 def get_exclusion( 

995 self, 

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

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

998 

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

1000 

1001 Returns: 

1002 Callable[[~.GetExclusionRequest], 

1003 ~.LogExclusion]: 

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

1005 on the server. 

1006 """ 

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

1008 # the request. 

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

1010 # to pass in the functions for each. 

1011 if "get_exclusion" not in self._stubs: 

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

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

1014 request_serializer=logging_config.GetExclusionRequest.serialize, 

1015 response_deserializer=logging_config.LogExclusion.deserialize, 

1016 ) 

1017 return self._stubs["get_exclusion"] 

1018 

1019 @property 

1020 def create_exclusion( 

1021 self, 

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

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

1024 

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

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

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

1028 

1029 Returns: 

1030 Callable[[~.CreateExclusionRequest], 

1031 ~.LogExclusion]: 

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

1033 on the server. 

1034 """ 

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

1036 # the request. 

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

1038 # to pass in the functions for each. 

1039 if "create_exclusion" not in self._stubs: 

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

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

1042 request_serializer=logging_config.CreateExclusionRequest.serialize, 

1043 response_deserializer=logging_config.LogExclusion.deserialize, 

1044 ) 

1045 return self._stubs["create_exclusion"] 

1046 

1047 @property 

1048 def update_exclusion( 

1049 self, 

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

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

1052 

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

1054 \_Default sink. 

1055 

1056 Returns: 

1057 Callable[[~.UpdateExclusionRequest], 

1058 ~.LogExclusion]: 

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

1060 on the server. 

1061 """ 

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

1063 # the request. 

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

1065 # to pass in the functions for each. 

1066 if "update_exclusion" not in self._stubs: 

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

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

1069 request_serializer=logging_config.UpdateExclusionRequest.serialize, 

1070 response_deserializer=logging_config.LogExclusion.deserialize, 

1071 ) 

1072 return self._stubs["update_exclusion"] 

1073 

1074 @property 

1075 def delete_exclusion( 

1076 self, 

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

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

1079 

1080 Deletes an exclusion in the \_Default sink. 

1081 

1082 Returns: 

1083 Callable[[~.DeleteExclusionRequest], 

1084 ~.Empty]: 

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

1086 on the server. 

1087 """ 

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

1089 # the request. 

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

1091 # to pass in the functions for each. 

1092 if "delete_exclusion" not in self._stubs: 

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

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

1095 request_serializer=logging_config.DeleteExclusionRequest.serialize, 

1096 response_deserializer=empty_pb2.Empty.FromString, 

1097 ) 

1098 return self._stubs["delete_exclusion"] 

1099 

1100 @property 

1101 def get_cmek_settings( 

1102 self, 

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

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

1105 

1106 Gets the Logging CMEK settings for the given resource. 

1107 

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

1109 projects, folders, organizations and billing accounts. Once 

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

1111 folders in the Google Cloud organization. 

1112 

1113 See `Enabling CMEK for Log 

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

1115 for more information. 

1116 

1117 Returns: 

1118 Callable[[~.GetCmekSettingsRequest], 

1119 ~.CmekSettings]: 

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

1121 on the server. 

1122 """ 

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

1124 # the request. 

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

1126 # to pass in the functions for each. 

1127 if "get_cmek_settings" not in self._stubs: 

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

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

1130 request_serializer=logging_config.GetCmekSettingsRequest.serialize, 

1131 response_deserializer=logging_config.CmekSettings.deserialize, 

1132 ) 

1133 return self._stubs["get_cmek_settings"] 

1134 

1135 @property 

1136 def update_cmek_settings( 

1137 self, 

1138 ) -> Callable[ 

1139 [logging_config.UpdateCmekSettingsRequest], logging_config.CmekSettings 

1140 ]: 

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

1142 

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

1144 

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

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

1147 all projects and folders in the Google Cloud organization. 

1148 

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

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

1151 associated service account does not have the required 

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

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

1154 

1155 See `Enabling CMEK for Log 

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

1157 for more information. 

1158 

1159 Returns: 

1160 Callable[[~.UpdateCmekSettingsRequest], 

1161 ~.CmekSettings]: 

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

1163 on the server. 

1164 """ 

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

1166 # the request. 

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

1168 # to pass in the functions for each. 

1169 if "update_cmek_settings" not in self._stubs: 

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

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

1172 request_serializer=logging_config.UpdateCmekSettingsRequest.serialize, 

1173 response_deserializer=logging_config.CmekSettings.deserialize, 

1174 ) 

1175 return self._stubs["update_cmek_settings"] 

1176 

1177 @property 

1178 def get_settings( 

1179 self, 

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

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

1182 

1183 Gets the Log Router settings for the given resource. 

1184 

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

1186 projects, folders, organizations and billing accounts. Currently 

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

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

1189 Google Cloud organization. 

1190 

1191 See `Enabling CMEK for Log 

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

1193 for more information. 

1194 

1195 Returns: 

1196 Callable[[~.GetSettingsRequest], 

1197 ~.Settings]: 

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

1199 on the server. 

1200 """ 

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

1202 # the request. 

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

1204 # to pass in the functions for each. 

1205 if "get_settings" not in self._stubs: 

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

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

1208 request_serializer=logging_config.GetSettingsRequest.serialize, 

1209 response_deserializer=logging_config.Settings.deserialize, 

1210 ) 

1211 return self._stubs["get_settings"] 

1212 

1213 @property 

1214 def update_settings( 

1215 self, 

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

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

1218 

1219 Updates the Log Router settings for the given resource. 

1220 

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

1222 configured for Google Cloud organizations. Once configured, it 

1223 applies to all projects and folders in the Google Cloud 

1224 organization. 

1225 

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

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

1228 associated service account does not have the required 

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

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

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

1232 OrgPolicy. 

1233 

1234 See `Enabling CMEK for Log 

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

1236 for more information. 

1237 

1238 Returns: 

1239 Callable[[~.UpdateSettingsRequest], 

1240 ~.Settings]: 

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

1242 on the server. 

1243 """ 

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

1245 # the request. 

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

1247 # to pass in the functions for each. 

1248 if "update_settings" not in self._stubs: 

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

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

1251 request_serializer=logging_config.UpdateSettingsRequest.serialize, 

1252 response_deserializer=logging_config.Settings.deserialize, 

1253 ) 

1254 return self._stubs["update_settings"] 

1255 

1256 @property 

1257 def copy_log_entries( 

1258 self, 

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

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

1261 

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

1263 Cloud Storage bucket. 

1264 

1265 Returns: 

1266 Callable[[~.CopyLogEntriesRequest], 

1267 ~.Operation]: 

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

1269 on the server. 

1270 """ 

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

1272 # the request. 

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

1274 # to pass in the functions for each. 

1275 if "copy_log_entries" not in self._stubs: 

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

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

1278 request_serializer=logging_config.CopyLogEntriesRequest.serialize, 

1279 response_deserializer=operations_pb2.Operation.FromString, 

1280 ) 

1281 return self._stubs["copy_log_entries"] 

1282 

1283 def close(self): 

1284 self._logged_channel.close() 

1285 

1286 @property 

1287 def cancel_operation( 

1288 self, 

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

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

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

1292 # the request. 

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

1294 # to pass in the functions for each. 

1295 if "cancel_operation" not in self._stubs: 

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

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

1298 request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, 

1299 response_deserializer=None, 

1300 ) 

1301 return self._stubs["cancel_operation"] 

1302 

1303 @property 

1304 def get_operation( 

1305 self, 

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

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

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

1309 # the request. 

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

1311 # to pass in the functions for each. 

1312 if "get_operation" not in self._stubs: 

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

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

1315 request_serializer=operations_pb2.GetOperationRequest.SerializeToString, 

1316 response_deserializer=operations_pb2.Operation.FromString, 

1317 ) 

1318 return self._stubs["get_operation"] 

1319 

1320 @property 

1321 def list_operations( 

1322 self, 

1323 ) -> Callable[ 

1324 [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse 

1325 ]: 

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

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

1328 # the request. 

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

1330 # to pass in the functions for each. 

1331 if "list_operations" not in self._stubs: 

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

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

1334 request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, 

1335 response_deserializer=operations_pb2.ListOperationsResponse.FromString, 

1336 ) 

1337 return self._stubs["list_operations"] 

1338 

1339 @property 

1340 def kind(self) -> str: 

1341 return "grpc" 

1342 

1343 

1344__all__ = ("ConfigServiceV2GrpcTransport",)