Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.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

258 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 inspect 

17import json 

18import pickle 

19import logging as std_logging 

20import warnings 

21from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union 

22 

23from google.api_core import gapic_v1 

24from google.api_core import grpc_helpers_async 

25from google.api_core import exceptions as core_exceptions 

26from google.api_core import retry_async as retries 

27from google.api_core import operations_v1 

28from google.auth import credentials as ga_credentials # type: ignore 

29from google.auth.transport.grpc import SslCredentials # type: ignore 

30from google.protobuf.json_format import MessageToJson 

31import google.protobuf.message 

32 

33import grpc # type: ignore 

34import proto # type: ignore 

35from grpc.experimental import aio # type: ignore 

36 

37from google.cloud.logging_v2.types import logging_config 

38from google.longrunning import operations_pb2 # type: ignore 

39from google.protobuf import empty_pb2 # type: ignore 

40from .base import ConfigServiceV2Transport, DEFAULT_CLIENT_INFO 

41from .grpc import ConfigServiceV2GrpcTransport 

42 

43try: 

44 from google.api_core import client_logging # type: ignore 

45 

46 CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER 

47except ImportError: # pragma: NO COVER 

48 CLIENT_LOGGING_SUPPORTED = False 

49 

50_LOGGER = std_logging.getLogger(__name__) 

51 

52 

53class _LoggingClientAIOInterceptor( 

54 grpc.aio.UnaryUnaryClientInterceptor 

55): # pragma: NO COVER 

56 async def intercept_unary_unary(self, continuation, client_call_details, request): 

57 logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( 

58 std_logging.DEBUG 

59 ) 

60 if logging_enabled: # pragma: NO COVER 

61 request_metadata = client_call_details.metadata 

62 if isinstance(request, proto.Message): 

63 request_payload = type(request).to_json(request) 

64 elif isinstance(request, google.protobuf.message.Message): 

65 request_payload = MessageToJson(request) 

66 else: 

67 request_payload = f"{type(request).__name__}: {pickle.dumps(request)}" 

68 

69 request_metadata = { 

70 key: value.decode("utf-8") if isinstance(value, bytes) else value 

71 for key, value in request_metadata 

72 } 

73 grpc_request = { 

74 "payload": request_payload, 

75 "requestMethod": "grpc", 

76 "metadata": dict(request_metadata), 

77 } 

78 _LOGGER.debug( 

79 f"Sending request for {client_call_details.method}", 

80 extra={ 

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

82 "rpcName": str(client_call_details.method), 

83 "request": grpc_request, 

84 "metadata": grpc_request["metadata"], 

85 }, 

86 ) 

87 response = await continuation(client_call_details, request) 

88 if logging_enabled: # pragma: NO COVER 

89 response_metadata = await response.trailing_metadata() 

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

91 metadata = ( 

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

93 if response_metadata 

94 else None 

95 ) 

96 result = await response 

97 if isinstance(result, proto.Message): 

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

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

100 response_payload = MessageToJson(result) 

101 else: 

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

103 grpc_response = { 

104 "payload": response_payload, 

105 "metadata": metadata, 

106 "status": "OK", 

107 } 

108 _LOGGER.debug( 

109 f"Received response to rpc {client_call_details.method}.", 

110 extra={ 

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

112 "rpcName": str(client_call_details.method), 

113 "response": grpc_response, 

114 "metadata": grpc_response["metadata"], 

115 }, 

116 ) 

117 return response 

118 

119 

120class ConfigServiceV2GrpcAsyncIOTransport(ConfigServiceV2Transport): 

121 """gRPC AsyncIO backend transport for ConfigServiceV2. 

122 

123 Service for configuring sinks used to route log entries. 

124 

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

126 primary client can load the underlying transport implementation 

127 and call it. 

128 

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

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

131 """ 

132 

133 _grpc_channel: aio.Channel 

134 _stubs: Dict[str, Callable] = {} 

135 

136 @classmethod 

137 def create_channel( 

138 cls, 

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

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

141 credentials_file: Optional[str] = None, 

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

143 quota_project_id: Optional[str] = None, 

144 **kwargs, 

145 ) -> aio.Channel: 

146 """Create and return a gRPC AsyncIO channel object. 

147 Args: 

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

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

150 authorization credentials to attach to requests. These 

151 credentials identify this application to the service. If 

152 none are specified, the client will attempt to ascertain 

153 the credentials from the environment. 

154 credentials_file (Optional[str]): Deprecated. A file with credentials that can 

155 be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be 

156 removed in the next major version of this library. 

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

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

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

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

161 and quota. 

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

163 channel creation. 

164 Returns: 

165 aio.Channel: A gRPC AsyncIO channel object. 

166 """ 

167 

168 return grpc_helpers_async.create_channel( 

169 host, 

170 credentials=credentials, 

171 credentials_file=credentials_file, 

172 quota_project_id=quota_project_id, 

173 default_scopes=cls.AUTH_SCOPES, 

174 scopes=scopes, 

175 default_host=cls.DEFAULT_HOST, 

176 **kwargs, 

177 ) 

178 

179 def __init__( 

180 self, 

181 *, 

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

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

184 credentials_file: Optional[str] = None, 

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

186 channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None, 

187 api_mtls_endpoint: Optional[str] = None, 

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

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

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

191 quota_project_id: Optional[str] = None, 

192 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, 

193 always_use_jwt_access: Optional[bool] = False, 

194 api_audience: Optional[str] = None, 

195 ) -> None: 

196 """Instantiate the transport. 

197 

198 Args: 

199 host (Optional[str]): 

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

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

202 authorization credentials to attach to requests. These 

203 credentials identify the application to the service; if none 

204 are specified, the client will attempt to ascertain the 

205 credentials from the environment. 

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

207 credentials_file (Optional[str]): Deprecated. A file with credentials that can 

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

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

210 This argument will be removed in the next major version of this library. 

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

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

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

214 channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]): 

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

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

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

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

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

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

221 a mutual TLS channel with client SSL credentials from 

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

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

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

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

226 ``api_mtls_endpoint`` is None. 

227 ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials 

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

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

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

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

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

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

234 and quota. 

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

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

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

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

239 your own client library. 

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

241 be used for service account credentials. 

242 

243 Raises: 

244 google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport 

245 creation failed for any reason. 

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

247 and ``credentials_file`` are passed. 

248 """ 

249 self._grpc_channel = None 

250 self._ssl_channel_credentials = ssl_channel_credentials 

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

252 self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None 

253 

254 if api_mtls_endpoint: 

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

256 if client_cert_source: 

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

258 

259 if isinstance(channel, aio.Channel): 

260 # Ignore credentials if a channel was passed. 

261 credentials = None 

262 self._ignore_credentials = True 

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

264 self._grpc_channel = channel 

265 self._ssl_channel_credentials = None 

266 else: 

267 if api_mtls_endpoint: 

268 host = api_mtls_endpoint 

269 

270 # Create SSL credentials with client_cert_source or application 

271 # default SSL credentials. 

272 if client_cert_source: 

273 cert, key = client_cert_source() 

274 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 

275 certificate_chain=cert, private_key=key 

276 ) 

277 else: 

278 self._ssl_channel_credentials = SslCredentials().ssl_credentials 

279 

280 else: 

281 if client_cert_source_for_mtls and not ssl_channel_credentials: 

282 cert, key = client_cert_source_for_mtls() 

283 self._ssl_channel_credentials = grpc.ssl_channel_credentials( 

284 certificate_chain=cert, private_key=key 

285 ) 

286 

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

288 super().__init__( 

289 host=host, 

290 credentials=credentials, 

291 credentials_file=credentials_file, 

292 scopes=scopes, 

293 quota_project_id=quota_project_id, 

294 client_info=client_info, 

295 always_use_jwt_access=always_use_jwt_access, 

296 api_audience=api_audience, 

297 ) 

298 

299 if not self._grpc_channel: 

300 # initialize with the provided callable or the default channel 

301 channel_init = channel or type(self).create_channel 

302 self._grpc_channel = channel_init( 

303 self._host, 

304 # use the credentials which are saved 

305 credentials=self._credentials, 

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

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

308 credentials_file=None, 

309 scopes=self._scopes, 

310 ssl_credentials=self._ssl_channel_credentials, 

311 quota_project_id=quota_project_id, 

312 options=[ 

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

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

315 ], 

316 ) 

317 

318 self._interceptor = _LoggingClientAIOInterceptor() 

319 self._grpc_channel._unary_unary_interceptors.append(self._interceptor) 

320 self._logged_channel = self._grpc_channel 

321 self._wrap_with_kind = ( 

322 "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters 

323 ) 

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

325 self._prep_wrapped_messages(client_info) 

326 

327 @property 

328 def grpc_channel(self) -> aio.Channel: 

329 """Create the channel designed to connect to this service. 

330 

331 This property caches on the instance; repeated calls return 

332 the same channel. 

333 """ 

334 # Return the channel from cache. 

335 return self._grpc_channel 

336 

337 @property 

338 def operations_client(self) -> operations_v1.OperationsAsyncClient: 

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

340 

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

342 client. 

343 """ 

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

345 if self._operations_client is None: 

346 self._operations_client = operations_v1.OperationsAsyncClient( 

347 self._logged_channel 

348 ) 

349 

350 # Return the client from cache. 

351 return self._operations_client 

352 

353 @property 

354 def list_buckets( 

355 self, 

356 ) -> Callable[ 

357 [logging_config.ListBucketsRequest], 

358 Awaitable[logging_config.ListBucketsResponse], 

359 ]: 

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

361 

362 Lists log buckets. 

363 

364 Returns: 

365 Callable[[~.ListBucketsRequest], 

366 Awaitable[~.ListBucketsResponse]]: 

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

368 on the server. 

369 """ 

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

371 # the request. 

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

373 # to pass in the functions for each. 

374 if "list_buckets" not in self._stubs: 

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

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

377 request_serializer=logging_config.ListBucketsRequest.serialize, 

378 response_deserializer=logging_config.ListBucketsResponse.deserialize, 

379 ) 

380 return self._stubs["list_buckets"] 

381 

382 @property 

383 def get_bucket( 

384 self, 

385 ) -> Callable[ 

386 [logging_config.GetBucketRequest], Awaitable[logging_config.LogBucket] 

387 ]: 

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

389 

390 Gets a log bucket. 

391 

392 Returns: 

393 Callable[[~.GetBucketRequest], 

394 Awaitable[~.LogBucket]]: 

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

396 on the server. 

397 """ 

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

399 # the request. 

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

401 # to pass in the functions for each. 

402 if "get_bucket" not in self._stubs: 

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

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

405 request_serializer=logging_config.GetBucketRequest.serialize, 

406 response_deserializer=logging_config.LogBucket.deserialize, 

407 ) 

408 return self._stubs["get_bucket"] 

409 

410 @property 

411 def create_bucket_async( 

412 self, 

413 ) -> Callable[ 

414 [logging_config.CreateBucketRequest], Awaitable[operations_pb2.Operation] 

415 ]: 

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

417 

418 Creates a log bucket asynchronously that can be used 

419 to store log entries. 

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

421 cannot be changed. 

422 

423 Returns: 

424 Callable[[~.CreateBucketRequest], 

425 Awaitable[~.Operation]]: 

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

427 on the server. 

428 """ 

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

430 # the request. 

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

432 # to pass in the functions for each. 

433 if "create_bucket_async" not in self._stubs: 

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

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

436 request_serializer=logging_config.CreateBucketRequest.serialize, 

437 response_deserializer=operations_pb2.Operation.FromString, 

438 ) 

439 return self._stubs["create_bucket_async"] 

440 

441 @property 

442 def update_bucket_async( 

443 self, 

444 ) -> Callable[ 

445 [logging_config.UpdateBucketRequest], Awaitable[operations_pb2.Operation] 

446 ]: 

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

448 

449 Updates a log bucket asynchronously. 

450 

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

452 then ``FAILED_PRECONDITION`` will be returned. 

453 

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

455 changed. 

456 

457 Returns: 

458 Callable[[~.UpdateBucketRequest], 

459 Awaitable[~.Operation]]: 

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

461 on the server. 

462 """ 

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

464 # the request. 

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

466 # to pass in the functions for each. 

467 if "update_bucket_async" not in self._stubs: 

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

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

470 request_serializer=logging_config.UpdateBucketRequest.serialize, 

471 response_deserializer=operations_pb2.Operation.FromString, 

472 ) 

473 return self._stubs["update_bucket_async"] 

474 

475 @property 

476 def create_bucket( 

477 self, 

478 ) -> Callable[ 

479 [logging_config.CreateBucketRequest], Awaitable[logging_config.LogBucket] 

480 ]: 

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

482 

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

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

485 location cannot be changed. 

486 

487 Returns: 

488 Callable[[~.CreateBucketRequest], 

489 Awaitable[~.LogBucket]]: 

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

491 on the server. 

492 """ 

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

494 # the request. 

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

496 # to pass in the functions for each. 

497 if "create_bucket" not in self._stubs: 

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

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

500 request_serializer=logging_config.CreateBucketRequest.serialize, 

501 response_deserializer=logging_config.LogBucket.deserialize, 

502 ) 

503 return self._stubs["create_bucket"] 

504 

505 @property 

506 def update_bucket( 

507 self, 

508 ) -> Callable[ 

509 [logging_config.UpdateBucketRequest], Awaitable[logging_config.LogBucket] 

510 ]: 

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

512 

513 Updates a log bucket. 

514 

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

516 then ``FAILED_PRECONDITION`` will be returned. 

517 

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

519 changed. 

520 

521 Returns: 

522 Callable[[~.UpdateBucketRequest], 

523 Awaitable[~.LogBucket]]: 

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

525 on the server. 

526 """ 

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

528 # the request. 

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

530 # to pass in the functions for each. 

531 if "update_bucket" not in self._stubs: 

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

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

534 request_serializer=logging_config.UpdateBucketRequest.serialize, 

535 response_deserializer=logging_config.LogBucket.deserialize, 

536 ) 

537 return self._stubs["update_bucket"] 

538 

539 @property 

540 def delete_bucket( 

541 self, 

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

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

544 

545 Deletes a log bucket. 

546 

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

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

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

550 deleted. 

551 

552 Returns: 

553 Callable[[~.DeleteBucketRequest], 

554 Awaitable[~.Empty]]: 

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

556 on the server. 

557 """ 

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

559 # the request. 

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

561 # to pass in the functions for each. 

562 if "delete_bucket" not in self._stubs: 

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

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

565 request_serializer=logging_config.DeleteBucketRequest.serialize, 

566 response_deserializer=empty_pb2.Empty.FromString, 

567 ) 

568 return self._stubs["delete_bucket"] 

569 

570 @property 

571 def undelete_bucket( 

572 self, 

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

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

575 

576 Undeletes a log bucket. A bucket that has been 

577 deleted can be undeleted within the grace period of 7 

578 days. 

579 

580 Returns: 

581 Callable[[~.UndeleteBucketRequest], 

582 Awaitable[~.Empty]]: 

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

584 on the server. 

585 """ 

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

587 # the request. 

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

589 # to pass in the functions for each. 

590 if "undelete_bucket" not in self._stubs: 

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

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

593 request_serializer=logging_config.UndeleteBucketRequest.serialize, 

594 response_deserializer=empty_pb2.Empty.FromString, 

595 ) 

596 return self._stubs["undelete_bucket"] 

597 

598 @property 

599 def list_views( 

600 self, 

601 ) -> Callable[ 

602 [logging_config.ListViewsRequest], Awaitable[logging_config.ListViewsResponse] 

603 ]: 

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

605 

606 Lists views on a log bucket. 

607 

608 Returns: 

609 Callable[[~.ListViewsRequest], 

610 Awaitable[~.ListViewsResponse]]: 

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

612 on the server. 

613 """ 

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

615 # the request. 

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

617 # to pass in the functions for each. 

618 if "list_views" not in self._stubs: 

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

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

621 request_serializer=logging_config.ListViewsRequest.serialize, 

622 response_deserializer=logging_config.ListViewsResponse.deserialize, 

623 ) 

624 return self._stubs["list_views"] 

625 

626 @property 

627 def get_view( 

628 self, 

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

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

631 

632 Gets a view on a log bucket.. 

633 

634 Returns: 

635 Callable[[~.GetViewRequest], 

636 Awaitable[~.LogView]]: 

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

638 on the server. 

639 """ 

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

641 # the request. 

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

643 # to pass in the functions for each. 

644 if "get_view" not in self._stubs: 

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

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

647 request_serializer=logging_config.GetViewRequest.serialize, 

648 response_deserializer=logging_config.LogView.deserialize, 

649 ) 

650 return self._stubs["get_view"] 

651 

652 @property 

653 def create_view( 

654 self, 

655 ) -> Callable[ 

656 [logging_config.CreateViewRequest], Awaitable[logging_config.LogView] 

657 ]: 

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

659 

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

661 bucket may contain a maximum of 30 views. 

662 

663 Returns: 

664 Callable[[~.CreateViewRequest], 

665 Awaitable[~.LogView]]: 

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

667 on the server. 

668 """ 

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

670 # the request. 

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

672 # to pass in the functions for each. 

673 if "create_view" not in self._stubs: 

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

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

676 request_serializer=logging_config.CreateViewRequest.serialize, 

677 response_deserializer=logging_config.LogView.deserialize, 

678 ) 

679 return self._stubs["create_view"] 

680 

681 @property 

682 def update_view( 

683 self, 

684 ) -> Callable[ 

685 [logging_config.UpdateViewRequest], Awaitable[logging_config.LogView] 

686 ]: 

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

688 

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

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

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

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

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

694 

695 Returns: 

696 Callable[[~.UpdateViewRequest], 

697 Awaitable[~.LogView]]: 

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

699 on the server. 

700 """ 

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

702 # the request. 

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

704 # to pass in the functions for each. 

705 if "update_view" not in self._stubs: 

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

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

708 request_serializer=logging_config.UpdateViewRequest.serialize, 

709 response_deserializer=logging_config.LogView.deserialize, 

710 ) 

711 return self._stubs["update_view"] 

712 

713 @property 

714 def delete_view( 

715 self, 

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

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

718 

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

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

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

722 minutes. 

723 

724 Returns: 

725 Callable[[~.DeleteViewRequest], 

726 Awaitable[~.Empty]]: 

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 "delete_view" not in self._stubs: 

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

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

737 request_serializer=logging_config.DeleteViewRequest.serialize, 

738 response_deserializer=empty_pb2.Empty.FromString, 

739 ) 

740 return self._stubs["delete_view"] 

741 

742 @property 

743 def list_sinks( 

744 self, 

745 ) -> Callable[ 

746 [logging_config.ListSinksRequest], Awaitable[logging_config.ListSinksResponse] 

747 ]: 

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

749 

750 Lists sinks. 

751 

752 Returns: 

753 Callable[[~.ListSinksRequest], 

754 Awaitable[~.ListSinksResponse]]: 

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

756 on the server. 

757 """ 

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

759 # the request. 

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

761 # to pass in the functions for each. 

762 if "list_sinks" not in self._stubs: 

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

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

765 request_serializer=logging_config.ListSinksRequest.serialize, 

766 response_deserializer=logging_config.ListSinksResponse.deserialize, 

767 ) 

768 return self._stubs["list_sinks"] 

769 

770 @property 

771 def get_sink( 

772 self, 

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

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

775 

776 Gets a sink. 

777 

778 Returns: 

779 Callable[[~.GetSinkRequest], 

780 Awaitable[~.LogSink]]: 

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

782 on the server. 

783 """ 

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

785 # the request. 

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

787 # to pass in the functions for each. 

788 if "get_sink" not in self._stubs: 

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

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

791 request_serializer=logging_config.GetSinkRequest.serialize, 

792 response_deserializer=logging_config.LogSink.deserialize, 

793 ) 

794 return self._stubs["get_sink"] 

795 

796 @property 

797 def create_sink( 

798 self, 

799 ) -> Callable[ 

800 [logging_config.CreateSinkRequest], Awaitable[logging_config.LogSink] 

801 ]: 

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

803 

804 Creates a sink that exports specified log entries to a 

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

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

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

808 entries only from the resource owning the sink. 

809 

810 Returns: 

811 Callable[[~.CreateSinkRequest], 

812 Awaitable[~.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 "create_sink" not in self._stubs: 

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

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

823 request_serializer=logging_config.CreateSinkRequest.serialize, 

824 response_deserializer=logging_config.LogSink.deserialize, 

825 ) 

826 return self._stubs["create_sink"] 

827 

828 @property 

829 def update_sink( 

830 self, 

831 ) -> Callable[ 

832 [logging_config.UpdateSinkRequest], Awaitable[logging_config.LogSink] 

833 ]: 

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

835 

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

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

838 and ``filter``. 

839 

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

841 the ``unique_writer_identity`` field. 

842 

843 Returns: 

844 Callable[[~.UpdateSinkRequest], 

845 Awaitable[~.LogSink]]: 

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

847 on the server. 

848 """ 

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

850 # the request. 

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

852 # to pass in the functions for each. 

853 if "update_sink" not in self._stubs: 

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

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

856 request_serializer=logging_config.UpdateSinkRequest.serialize, 

857 response_deserializer=logging_config.LogSink.deserialize, 

858 ) 

859 return self._stubs["update_sink"] 

860 

861 @property 

862 def delete_sink( 

863 self, 

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

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

866 

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

868 then that service account is also deleted. 

869 

870 Returns: 

871 Callable[[~.DeleteSinkRequest], 

872 Awaitable[~.Empty]]: 

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

874 on the server. 

875 """ 

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

877 # the request. 

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

879 # to pass in the functions for each. 

880 if "delete_sink" not in self._stubs: 

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

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

883 request_serializer=logging_config.DeleteSinkRequest.serialize, 

884 response_deserializer=empty_pb2.Empty.FromString, 

885 ) 

886 return self._stubs["delete_sink"] 

887 

888 @property 

889 def create_link( 

890 self, 

891 ) -> Callable[ 

892 [logging_config.CreateLinkRequest], Awaitable[operations_pb2.Operation] 

893 ]: 

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

895 

896 Asynchronously creates a linked dataset in BigQuery 

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

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

899 only contain one link. 

900 

901 Returns: 

902 Callable[[~.CreateLinkRequest], 

903 Awaitable[~.Operation]]: 

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

905 on the server. 

906 """ 

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

908 # the request. 

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

910 # to pass in the functions for each. 

911 if "create_link" not in self._stubs: 

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

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

914 request_serializer=logging_config.CreateLinkRequest.serialize, 

915 response_deserializer=operations_pb2.Operation.FromString, 

916 ) 

917 return self._stubs["create_link"] 

918 

919 @property 

920 def delete_link( 

921 self, 

922 ) -> Callable[ 

923 [logging_config.DeleteLinkRequest], Awaitable[operations_pb2.Operation] 

924 ]: 

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

926 

927 Deletes a link. This will also delete the 

928 corresponding BigQuery linked dataset. 

929 

930 Returns: 

931 Callable[[~.DeleteLinkRequest], 

932 Awaitable[~.Operation]]: 

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

934 on the server. 

935 """ 

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

937 # the request. 

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

939 # to pass in the functions for each. 

940 if "delete_link" not in self._stubs: 

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

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

943 request_serializer=logging_config.DeleteLinkRequest.serialize, 

944 response_deserializer=operations_pb2.Operation.FromString, 

945 ) 

946 return self._stubs["delete_link"] 

947 

948 @property 

949 def list_links( 

950 self, 

951 ) -> Callable[ 

952 [logging_config.ListLinksRequest], Awaitable[logging_config.ListLinksResponse] 

953 ]: 

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

955 

956 Lists links. 

957 

958 Returns: 

959 Callable[[~.ListLinksRequest], 

960 Awaitable[~.ListLinksResponse]]: 

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

962 on the server. 

963 """ 

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

965 # the request. 

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

967 # to pass in the functions for each. 

968 if "list_links" not in self._stubs: 

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

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

971 request_serializer=logging_config.ListLinksRequest.serialize, 

972 response_deserializer=logging_config.ListLinksResponse.deserialize, 

973 ) 

974 return self._stubs["list_links"] 

975 

976 @property 

977 def get_link( 

978 self, 

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

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

981 

982 Gets a link. 

983 

984 Returns: 

985 Callable[[~.GetLinkRequest], 

986 Awaitable[~.Link]]: 

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

988 on the server. 

989 """ 

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

991 # the request. 

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

993 # to pass in the functions for each. 

994 if "get_link" not in self._stubs: 

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

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

997 request_serializer=logging_config.GetLinkRequest.serialize, 

998 response_deserializer=logging_config.Link.deserialize, 

999 ) 

1000 return self._stubs["get_link"] 

1001 

1002 @property 

1003 def list_exclusions( 

1004 self, 

1005 ) -> Callable[ 

1006 [logging_config.ListExclusionsRequest], 

1007 Awaitable[logging_config.ListExclusionsResponse], 

1008 ]: 

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

1010 

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

1012 resource. 

1013 

1014 Returns: 

1015 Callable[[~.ListExclusionsRequest], 

1016 Awaitable[~.ListExclusionsResponse]]: 

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

1018 on the server. 

1019 """ 

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

1021 # the request. 

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

1023 # to pass in the functions for each. 

1024 if "list_exclusions" not in self._stubs: 

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

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

1027 request_serializer=logging_config.ListExclusionsRequest.serialize, 

1028 response_deserializer=logging_config.ListExclusionsResponse.deserialize, 

1029 ) 

1030 return self._stubs["list_exclusions"] 

1031 

1032 @property 

1033 def get_exclusion( 

1034 self, 

1035 ) -> Callable[ 

1036 [logging_config.GetExclusionRequest], Awaitable[logging_config.LogExclusion] 

1037 ]: 

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

1039 

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

1041 

1042 Returns: 

1043 Callable[[~.GetExclusionRequest], 

1044 Awaitable[~.LogExclusion]]: 

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

1046 on the server. 

1047 """ 

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

1049 # the request. 

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

1051 # to pass in the functions for each. 

1052 if "get_exclusion" not in self._stubs: 

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

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

1055 request_serializer=logging_config.GetExclusionRequest.serialize, 

1056 response_deserializer=logging_config.LogExclusion.deserialize, 

1057 ) 

1058 return self._stubs["get_exclusion"] 

1059 

1060 @property 

1061 def create_exclusion( 

1062 self, 

1063 ) -> Callable[ 

1064 [logging_config.CreateExclusionRequest], Awaitable[logging_config.LogExclusion] 

1065 ]: 

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

1067 

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

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

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

1071 

1072 Returns: 

1073 Callable[[~.CreateExclusionRequest], 

1074 Awaitable[~.LogExclusion]]: 

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

1076 on the server. 

1077 """ 

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

1079 # the request. 

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

1081 # to pass in the functions for each. 

1082 if "create_exclusion" not in self._stubs: 

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

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

1085 request_serializer=logging_config.CreateExclusionRequest.serialize, 

1086 response_deserializer=logging_config.LogExclusion.deserialize, 

1087 ) 

1088 return self._stubs["create_exclusion"] 

1089 

1090 @property 

1091 def update_exclusion( 

1092 self, 

1093 ) -> Callable[ 

1094 [logging_config.UpdateExclusionRequest], Awaitable[logging_config.LogExclusion] 

1095 ]: 

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

1097 

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

1099 \_Default sink. 

1100 

1101 Returns: 

1102 Callable[[~.UpdateExclusionRequest], 

1103 Awaitable[~.LogExclusion]]: 

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

1105 on the server. 

1106 """ 

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

1108 # the request. 

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

1110 # to pass in the functions for each. 

1111 if "update_exclusion" not in self._stubs: 

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

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

1114 request_serializer=logging_config.UpdateExclusionRequest.serialize, 

1115 response_deserializer=logging_config.LogExclusion.deserialize, 

1116 ) 

1117 return self._stubs["update_exclusion"] 

1118 

1119 @property 

1120 def delete_exclusion( 

1121 self, 

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

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

1124 

1125 Deletes an exclusion in the \_Default sink. 

1126 

1127 Returns: 

1128 Callable[[~.DeleteExclusionRequest], 

1129 Awaitable[~.Empty]]: 

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

1131 on the server. 

1132 """ 

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

1134 # the request. 

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

1136 # to pass in the functions for each. 

1137 if "delete_exclusion" not in self._stubs: 

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

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

1140 request_serializer=logging_config.DeleteExclusionRequest.serialize, 

1141 response_deserializer=empty_pb2.Empty.FromString, 

1142 ) 

1143 return self._stubs["delete_exclusion"] 

1144 

1145 @property 

1146 def get_cmek_settings( 

1147 self, 

1148 ) -> Callable[ 

1149 [logging_config.GetCmekSettingsRequest], Awaitable[logging_config.CmekSettings] 

1150 ]: 

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

1152 

1153 Gets the Logging CMEK settings for the given resource. 

1154 

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

1156 projects, folders, organizations and billing accounts. Once 

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

1158 folders in the Google Cloud organization. 

1159 

1160 See `Enabling CMEK for Log 

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

1162 for more information. 

1163 

1164 Returns: 

1165 Callable[[~.GetCmekSettingsRequest], 

1166 Awaitable[~.CmekSettings]]: 

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

1168 on the server. 

1169 """ 

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

1171 # the request. 

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

1173 # to pass in the functions for each. 

1174 if "get_cmek_settings" not in self._stubs: 

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

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

1177 request_serializer=logging_config.GetCmekSettingsRequest.serialize, 

1178 response_deserializer=logging_config.CmekSettings.deserialize, 

1179 ) 

1180 return self._stubs["get_cmek_settings"] 

1181 

1182 @property 

1183 def update_cmek_settings( 

1184 self, 

1185 ) -> Callable[ 

1186 [logging_config.UpdateCmekSettingsRequest], 

1187 Awaitable[logging_config.CmekSettings], 

1188 ]: 

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

1190 

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

1192 

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

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

1195 all projects and folders in the Google Cloud organization. 

1196 

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

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

1199 associated service account does not have the required 

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

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

1202 

1203 See `Enabling CMEK for Log 

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

1205 for more information. 

1206 

1207 Returns: 

1208 Callable[[~.UpdateCmekSettingsRequest], 

1209 Awaitable[~.CmekSettings]]: 

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

1211 on the server. 

1212 """ 

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

1214 # the request. 

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

1216 # to pass in the functions for each. 

1217 if "update_cmek_settings" not in self._stubs: 

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

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

1220 request_serializer=logging_config.UpdateCmekSettingsRequest.serialize, 

1221 response_deserializer=logging_config.CmekSettings.deserialize, 

1222 ) 

1223 return self._stubs["update_cmek_settings"] 

1224 

1225 @property 

1226 def get_settings( 

1227 self, 

1228 ) -> Callable[ 

1229 [logging_config.GetSettingsRequest], Awaitable[logging_config.Settings] 

1230 ]: 

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

1232 

1233 Gets the Log Router settings for the given resource. 

1234 

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

1236 projects, folders, organizations and billing accounts. Currently 

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

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

1239 Google Cloud organization. 

1240 

1241 See `Enabling CMEK for Log 

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

1243 for more information. 

1244 

1245 Returns: 

1246 Callable[[~.GetSettingsRequest], 

1247 Awaitable[~.Settings]]: 

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

1249 on the server. 

1250 """ 

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

1252 # the request. 

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

1254 # to pass in the functions for each. 

1255 if "get_settings" not in self._stubs: 

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

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

1258 request_serializer=logging_config.GetSettingsRequest.serialize, 

1259 response_deserializer=logging_config.Settings.deserialize, 

1260 ) 

1261 return self._stubs["get_settings"] 

1262 

1263 @property 

1264 def update_settings( 

1265 self, 

1266 ) -> Callable[ 

1267 [logging_config.UpdateSettingsRequest], Awaitable[logging_config.Settings] 

1268 ]: 

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

1270 

1271 Updates the Log Router settings for the given resource. 

1272 

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

1274 configured for Google Cloud organizations. Once configured, it 

1275 applies to all projects and folders in the Google Cloud 

1276 organization. 

1277 

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

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

1280 associated service account does not have the required 

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

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

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

1284 OrgPolicy. 

1285 

1286 See `Enabling CMEK for Log 

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

1288 for more information. 

1289 

1290 Returns: 

1291 Callable[[~.UpdateSettingsRequest], 

1292 Awaitable[~.Settings]]: 

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

1294 on the server. 

1295 """ 

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

1297 # the request. 

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

1299 # to pass in the functions for each. 

1300 if "update_settings" not in self._stubs: 

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

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

1303 request_serializer=logging_config.UpdateSettingsRequest.serialize, 

1304 response_deserializer=logging_config.Settings.deserialize, 

1305 ) 

1306 return self._stubs["update_settings"] 

1307 

1308 @property 

1309 def copy_log_entries( 

1310 self, 

1311 ) -> Callable[ 

1312 [logging_config.CopyLogEntriesRequest], Awaitable[operations_pb2.Operation] 

1313 ]: 

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

1315 

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

1317 Cloud Storage bucket. 

1318 

1319 Returns: 

1320 Callable[[~.CopyLogEntriesRequest], 

1321 Awaitable[~.Operation]]: 

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

1323 on the server. 

1324 """ 

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

1326 # the request. 

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

1328 # to pass in the functions for each. 

1329 if "copy_log_entries" not in self._stubs: 

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

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

1332 request_serializer=logging_config.CopyLogEntriesRequest.serialize, 

1333 response_deserializer=operations_pb2.Operation.FromString, 

1334 ) 

1335 return self._stubs["copy_log_entries"] 

1336 

1337 def _prep_wrapped_messages(self, client_info): 

1338 """Precompute the wrapped methods, overriding the base class method to use async wrappers.""" 

1339 self._wrapped_methods = { 

1340 self.list_buckets: self._wrap_method( 

1341 self.list_buckets, 

1342 default_timeout=None, 

1343 client_info=client_info, 

1344 ), 

1345 self.get_bucket: self._wrap_method( 

1346 self.get_bucket, 

1347 default_timeout=None, 

1348 client_info=client_info, 

1349 ), 

1350 self.create_bucket_async: self._wrap_method( 

1351 self.create_bucket_async, 

1352 default_timeout=None, 

1353 client_info=client_info, 

1354 ), 

1355 self.update_bucket_async: self._wrap_method( 

1356 self.update_bucket_async, 

1357 default_timeout=None, 

1358 client_info=client_info, 

1359 ), 

1360 self.create_bucket: self._wrap_method( 

1361 self.create_bucket, 

1362 default_timeout=None, 

1363 client_info=client_info, 

1364 ), 

1365 self.update_bucket: self._wrap_method( 

1366 self.update_bucket, 

1367 default_timeout=None, 

1368 client_info=client_info, 

1369 ), 

1370 self.delete_bucket: self._wrap_method( 

1371 self.delete_bucket, 

1372 default_timeout=None, 

1373 client_info=client_info, 

1374 ), 

1375 self.undelete_bucket: self._wrap_method( 

1376 self.undelete_bucket, 

1377 default_timeout=None, 

1378 client_info=client_info, 

1379 ), 

1380 self.list_views: self._wrap_method( 

1381 self.list_views, 

1382 default_timeout=None, 

1383 client_info=client_info, 

1384 ), 

1385 self.get_view: self._wrap_method( 

1386 self.get_view, 

1387 default_timeout=None, 

1388 client_info=client_info, 

1389 ), 

1390 self.create_view: self._wrap_method( 

1391 self.create_view, 

1392 default_timeout=None, 

1393 client_info=client_info, 

1394 ), 

1395 self.update_view: self._wrap_method( 

1396 self.update_view, 

1397 default_timeout=None, 

1398 client_info=client_info, 

1399 ), 

1400 self.delete_view: self._wrap_method( 

1401 self.delete_view, 

1402 default_timeout=None, 

1403 client_info=client_info, 

1404 ), 

1405 self.list_sinks: self._wrap_method( 

1406 self.list_sinks, 

1407 default_retry=retries.AsyncRetry( 

1408 initial=0.1, 

1409 maximum=60.0, 

1410 multiplier=1.3, 

1411 predicate=retries.if_exception_type( 

1412 core_exceptions.DeadlineExceeded, 

1413 core_exceptions.InternalServerError, 

1414 core_exceptions.ServiceUnavailable, 

1415 ), 

1416 deadline=60.0, 

1417 ), 

1418 default_timeout=60.0, 

1419 client_info=client_info, 

1420 ), 

1421 self.get_sink: self._wrap_method( 

1422 self.get_sink, 

1423 default_retry=retries.AsyncRetry( 

1424 initial=0.1, 

1425 maximum=60.0, 

1426 multiplier=1.3, 

1427 predicate=retries.if_exception_type( 

1428 core_exceptions.DeadlineExceeded, 

1429 core_exceptions.InternalServerError, 

1430 core_exceptions.ServiceUnavailable, 

1431 ), 

1432 deadline=60.0, 

1433 ), 

1434 default_timeout=60.0, 

1435 client_info=client_info, 

1436 ), 

1437 self.create_sink: self._wrap_method( 

1438 self.create_sink, 

1439 default_timeout=120.0, 

1440 client_info=client_info, 

1441 ), 

1442 self.update_sink: self._wrap_method( 

1443 self.update_sink, 

1444 default_retry=retries.AsyncRetry( 

1445 initial=0.1, 

1446 maximum=60.0, 

1447 multiplier=1.3, 

1448 predicate=retries.if_exception_type( 

1449 core_exceptions.DeadlineExceeded, 

1450 core_exceptions.InternalServerError, 

1451 core_exceptions.ServiceUnavailable, 

1452 ), 

1453 deadline=60.0, 

1454 ), 

1455 default_timeout=60.0, 

1456 client_info=client_info, 

1457 ), 

1458 self.delete_sink: self._wrap_method( 

1459 self.delete_sink, 

1460 default_retry=retries.AsyncRetry( 

1461 initial=0.1, 

1462 maximum=60.0, 

1463 multiplier=1.3, 

1464 predicate=retries.if_exception_type( 

1465 core_exceptions.DeadlineExceeded, 

1466 core_exceptions.InternalServerError, 

1467 core_exceptions.ServiceUnavailable, 

1468 ), 

1469 deadline=60.0, 

1470 ), 

1471 default_timeout=60.0, 

1472 client_info=client_info, 

1473 ), 

1474 self.create_link: self._wrap_method( 

1475 self.create_link, 

1476 default_timeout=None, 

1477 client_info=client_info, 

1478 ), 

1479 self.delete_link: self._wrap_method( 

1480 self.delete_link, 

1481 default_timeout=None, 

1482 client_info=client_info, 

1483 ), 

1484 self.list_links: self._wrap_method( 

1485 self.list_links, 

1486 default_timeout=None, 

1487 client_info=client_info, 

1488 ), 

1489 self.get_link: self._wrap_method( 

1490 self.get_link, 

1491 default_timeout=None, 

1492 client_info=client_info, 

1493 ), 

1494 self.list_exclusions: self._wrap_method( 

1495 self.list_exclusions, 

1496 default_retry=retries.AsyncRetry( 

1497 initial=0.1, 

1498 maximum=60.0, 

1499 multiplier=1.3, 

1500 predicate=retries.if_exception_type( 

1501 core_exceptions.DeadlineExceeded, 

1502 core_exceptions.InternalServerError, 

1503 core_exceptions.ServiceUnavailable, 

1504 ), 

1505 deadline=60.0, 

1506 ), 

1507 default_timeout=60.0, 

1508 client_info=client_info, 

1509 ), 

1510 self.get_exclusion: self._wrap_method( 

1511 self.get_exclusion, 

1512 default_retry=retries.AsyncRetry( 

1513 initial=0.1, 

1514 maximum=60.0, 

1515 multiplier=1.3, 

1516 predicate=retries.if_exception_type( 

1517 core_exceptions.DeadlineExceeded, 

1518 core_exceptions.InternalServerError, 

1519 core_exceptions.ServiceUnavailable, 

1520 ), 

1521 deadline=60.0, 

1522 ), 

1523 default_timeout=60.0, 

1524 client_info=client_info, 

1525 ), 

1526 self.create_exclusion: self._wrap_method( 

1527 self.create_exclusion, 

1528 default_timeout=120.0, 

1529 client_info=client_info, 

1530 ), 

1531 self.update_exclusion: self._wrap_method( 

1532 self.update_exclusion, 

1533 default_timeout=120.0, 

1534 client_info=client_info, 

1535 ), 

1536 self.delete_exclusion: self._wrap_method( 

1537 self.delete_exclusion, 

1538 default_retry=retries.AsyncRetry( 

1539 initial=0.1, 

1540 maximum=60.0, 

1541 multiplier=1.3, 

1542 predicate=retries.if_exception_type( 

1543 core_exceptions.DeadlineExceeded, 

1544 core_exceptions.InternalServerError, 

1545 core_exceptions.ServiceUnavailable, 

1546 ), 

1547 deadline=60.0, 

1548 ), 

1549 default_timeout=60.0, 

1550 client_info=client_info, 

1551 ), 

1552 self.get_cmek_settings: self._wrap_method( 

1553 self.get_cmek_settings, 

1554 default_timeout=None, 

1555 client_info=client_info, 

1556 ), 

1557 self.update_cmek_settings: self._wrap_method( 

1558 self.update_cmek_settings, 

1559 default_timeout=None, 

1560 client_info=client_info, 

1561 ), 

1562 self.get_settings: self._wrap_method( 

1563 self.get_settings, 

1564 default_timeout=None, 

1565 client_info=client_info, 

1566 ), 

1567 self.update_settings: self._wrap_method( 

1568 self.update_settings, 

1569 default_timeout=None, 

1570 client_info=client_info, 

1571 ), 

1572 self.copy_log_entries: self._wrap_method( 

1573 self.copy_log_entries, 

1574 default_timeout=None, 

1575 client_info=client_info, 

1576 ), 

1577 self.cancel_operation: self._wrap_method( 

1578 self.cancel_operation, 

1579 default_timeout=None, 

1580 client_info=client_info, 

1581 ), 

1582 self.get_operation: self._wrap_method( 

1583 self.get_operation, 

1584 default_timeout=None, 

1585 client_info=client_info, 

1586 ), 

1587 self.list_operations: self._wrap_method( 

1588 self.list_operations, 

1589 default_timeout=None, 

1590 client_info=client_info, 

1591 ), 

1592 } 

1593 

1594 def _wrap_method(self, func, *args, **kwargs): 

1595 if self._wrap_with_kind: # pragma: NO COVER 

1596 kwargs["kind"] = self.kind 

1597 return gapic_v1.method_async.wrap_method(func, *args, **kwargs) 

1598 

1599 def close(self): 

1600 return self._logged_channel.close() 

1601 

1602 @property 

1603 def kind(self) -> str: 

1604 return "grpc_asyncio" 

1605 

1606 @property 

1607 def cancel_operation( 

1608 self, 

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

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

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

1612 # the request. 

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

1614 # to pass in the functions for each. 

1615 if "cancel_operation" not in self._stubs: 

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

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

1618 request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, 

1619 response_deserializer=None, 

1620 ) 

1621 return self._stubs["cancel_operation"] 

1622 

1623 @property 

1624 def get_operation( 

1625 self, 

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

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

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

1629 # the request. 

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

1631 # to pass in the functions for each. 

1632 if "get_operation" not in self._stubs: 

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

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

1635 request_serializer=operations_pb2.GetOperationRequest.SerializeToString, 

1636 response_deserializer=operations_pb2.Operation.FromString, 

1637 ) 

1638 return self._stubs["get_operation"] 

1639 

1640 @property 

1641 def list_operations( 

1642 self, 

1643 ) -> Callable[ 

1644 [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse 

1645 ]: 

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

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

1648 # the request. 

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

1650 # to pass in the functions for each. 

1651 if "list_operations" not in self._stubs: 

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

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

1654 request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, 

1655 response_deserializer=operations_pb2.ListOperationsResponse.FromString, 

1656 ) 

1657 return self._stubs["list_operations"] 

1658 

1659 

1660__all__ = ("ConfigServiceV2GrpcAsyncIOTransport",)