Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/async_client.py: 53%

116 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-06 06:03 +0000

1# -*- coding: utf-8 -*- 

2# Copyright 2022 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# 

16from collections import OrderedDict 

17import functools 

18import re 

19from typing import ( 

20 Dict, 

21 Mapping, 

22 MutableMapping, 

23 MutableSequence, 

24 Optional, 

25 Sequence, 

26 Tuple, 

27 Type, 

28 Union, 

29) 

30 

31from google.api_core import exceptions as core_exceptions 

32from google.api_core import gapic_v1 

33from google.api_core import retry as retries 

34from google.api_core.client_options import ClientOptions 

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

36from google.oauth2 import service_account # type: ignore 

37 

38from google.cloud.resourcemanager_v3 import gapic_version as package_version 

39 

40try: 

41 OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] 

42except AttributeError: # pragma: NO COVER 

43 OptionalRetry = Union[retries.Retry, object] # type: ignore 

44 

45from google.api_core import operation # type: ignore 

46from google.api_core import operation_async # type: ignore 

47from google.longrunning import operations_pb2 

48from google.protobuf import empty_pb2 # type: ignore 

49 

50from google.cloud.resourcemanager_v3.services.tag_bindings import pagers 

51from google.cloud.resourcemanager_v3.types import tag_bindings 

52 

53from .client import TagBindingsClient 

54from .transports.base import DEFAULT_CLIENT_INFO, TagBindingsTransport 

55from .transports.grpc_asyncio import TagBindingsGrpcAsyncIOTransport 

56 

57 

58class TagBindingsAsyncClient: 

59 """Allow users to create and manage TagBindings between 

60 TagValues and different Google Cloud resources throughout the 

61 GCP resource hierarchy. 

62 """ 

63 

64 _client: TagBindingsClient 

65 

66 DEFAULT_ENDPOINT = TagBindingsClient.DEFAULT_ENDPOINT 

67 DEFAULT_MTLS_ENDPOINT = TagBindingsClient.DEFAULT_MTLS_ENDPOINT 

68 

69 tag_binding_path = staticmethod(TagBindingsClient.tag_binding_path) 

70 parse_tag_binding_path = staticmethod(TagBindingsClient.parse_tag_binding_path) 

71 tag_key_path = staticmethod(TagBindingsClient.tag_key_path) 

72 parse_tag_key_path = staticmethod(TagBindingsClient.parse_tag_key_path) 

73 tag_value_path = staticmethod(TagBindingsClient.tag_value_path) 

74 parse_tag_value_path = staticmethod(TagBindingsClient.parse_tag_value_path) 

75 common_billing_account_path = staticmethod( 

76 TagBindingsClient.common_billing_account_path 

77 ) 

78 parse_common_billing_account_path = staticmethod( 

79 TagBindingsClient.parse_common_billing_account_path 

80 ) 

81 common_folder_path = staticmethod(TagBindingsClient.common_folder_path) 

82 parse_common_folder_path = staticmethod(TagBindingsClient.parse_common_folder_path) 

83 common_organization_path = staticmethod(TagBindingsClient.common_organization_path) 

84 parse_common_organization_path = staticmethod( 

85 TagBindingsClient.parse_common_organization_path 

86 ) 

87 common_project_path = staticmethod(TagBindingsClient.common_project_path) 

88 parse_common_project_path = staticmethod( 

89 TagBindingsClient.parse_common_project_path 

90 ) 

91 common_location_path = staticmethod(TagBindingsClient.common_location_path) 

92 parse_common_location_path = staticmethod( 

93 TagBindingsClient.parse_common_location_path 

94 ) 

95 

96 @classmethod 

97 def from_service_account_info(cls, info: dict, *args, **kwargs): 

98 """Creates an instance of this client using the provided credentials 

99 info. 

100 

101 Args: 

102 info (dict): The service account private key info. 

103 args: Additional arguments to pass to the constructor. 

104 kwargs: Additional arguments to pass to the constructor. 

105 

106 Returns: 

107 TagBindingsAsyncClient: The constructed client. 

108 """ 

109 return TagBindingsClient.from_service_account_info.__func__(TagBindingsAsyncClient, info, *args, **kwargs) # type: ignore 

110 

111 @classmethod 

112 def from_service_account_file(cls, filename: str, *args, **kwargs): 

113 """Creates an instance of this client using the provided credentials 

114 file. 

115 

116 Args: 

117 filename (str): The path to the service account private key json 

118 file. 

119 args: Additional arguments to pass to the constructor. 

120 kwargs: Additional arguments to pass to the constructor. 

121 

122 Returns: 

123 TagBindingsAsyncClient: The constructed client. 

124 """ 

125 return TagBindingsClient.from_service_account_file.__func__(TagBindingsAsyncClient, filename, *args, **kwargs) # type: ignore 

126 

127 from_service_account_json = from_service_account_file 

128 

129 @classmethod 

130 def get_mtls_endpoint_and_cert_source( 

131 cls, client_options: Optional[ClientOptions] = None 

132 ): 

133 """Return the API endpoint and client cert source for mutual TLS. 

134 

135 The client cert source is determined in the following order: 

136 (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the 

137 client cert source is None. 

138 (2) if `client_options.client_cert_source` is provided, use the provided one; if the 

139 default client cert source exists, use the default one; otherwise the client cert 

140 source is None. 

141 

142 The API endpoint is determined in the following order: 

143 (1) if `client_options.api_endpoint` if provided, use the provided one. 

144 (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the 

145 default mTLS endpoint; if the environment variable is "never", use the default API 

146 endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise 

147 use the default API endpoint. 

148 

149 More details can be found at https://google.aip.dev/auth/4114. 

150 

151 Args: 

152 client_options (google.api_core.client_options.ClientOptions): Custom options for the 

153 client. Only the `api_endpoint` and `client_cert_source` properties may be used 

154 in this method. 

155 

156 Returns: 

157 Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the 

158 client cert source to use. 

159 

160 Raises: 

161 google.auth.exceptions.MutualTLSChannelError: If any errors happen. 

162 """ 

163 return TagBindingsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore 

164 

165 @property 

166 def transport(self) -> TagBindingsTransport: 

167 """Returns the transport used by the client instance. 

168 

169 Returns: 

170 TagBindingsTransport: The transport used by the client instance. 

171 """ 

172 return self._client.transport 

173 

174 get_transport_class = functools.partial( 

175 type(TagBindingsClient).get_transport_class, type(TagBindingsClient) 

176 ) 

177 

178 def __init__( 

179 self, 

180 *, 

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

182 transport: Union[str, TagBindingsTransport] = "grpc_asyncio", 

183 client_options: Optional[ClientOptions] = None, 

184 client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, 

185 ) -> None: 

186 """Instantiates the tag bindings client. 

187 

188 Args: 

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

190 authorization credentials to attach to requests. These 

191 credentials identify the application to the service; if none 

192 are specified, the client will attempt to ascertain the 

193 credentials from the environment. 

194 transport (Union[str, ~.TagBindingsTransport]): The 

195 transport to use. If set to None, a transport is chosen 

196 automatically. 

197 client_options (ClientOptions): Custom options for the client. It 

198 won't take effect if a ``transport`` instance is provided. 

199 (1) The ``api_endpoint`` property can be used to override the 

200 default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT 

201 environment variable can also be used to override the endpoint: 

202 "always" (always use the default mTLS endpoint), "never" (always 

203 use the default regular endpoint) and "auto" (auto switch to the 

204 default mTLS endpoint if client certificate is present, this is 

205 the default value). However, the ``api_endpoint`` property takes 

206 precedence if provided. 

207 (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable 

208 is "true", then the ``client_cert_source`` property can be used 

209 to provide client certificate for mutual TLS transport. If 

210 not provided, the default SSL client certificate will be used if 

211 present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not 

212 set, no client certificate will be used. 

213 

214 Raises: 

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

216 creation failed for any reason. 

217 """ 

218 self._client = TagBindingsClient( 

219 credentials=credentials, 

220 transport=transport, 

221 client_options=client_options, 

222 client_info=client_info, 

223 ) 

224 

225 async def list_tag_bindings( 

226 self, 

227 request: Optional[Union[tag_bindings.ListTagBindingsRequest, dict]] = None, 

228 *, 

229 parent: Optional[str] = None, 

230 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

231 timeout: Union[float, object] = gapic_v1.method.DEFAULT, 

232 metadata: Sequence[Tuple[str, str]] = (), 

233 ) -> pagers.ListTagBindingsAsyncPager: 

234 r"""Lists the TagBindings for the given Google Cloud resource, as 

235 specified with ``parent``. 

236 

237 NOTE: The ``parent`` field is expected to be a full resource 

238 name: 

239 https://cloud.google.com/apis/design/resource_names#full_resource_name 

240 

241 .. code-block:: python 

242 

243 # This snippet has been automatically generated and should be regarded as a 

244 # code template only. 

245 # It will require modifications to work: 

246 # - It may require correct/in-range values for request initialization. 

247 # - It may require specifying regional endpoints when creating the service 

248 # client as shown in: 

249 # https://googleapis.dev/python/google-api-core/latest/client_options.html 

250 from google.cloud import resourcemanager_v3 

251 

252 async def sample_list_tag_bindings(): 

253 # Create a client 

254 client = resourcemanager_v3.TagBindingsAsyncClient() 

255 

256 # Initialize request argument(s) 

257 request = resourcemanager_v3.ListTagBindingsRequest( 

258 parent="parent_value", 

259 ) 

260 

261 # Make the request 

262 page_result = client.list_tag_bindings(request=request) 

263 

264 # Handle the response 

265 async for response in page_result: 

266 print(response) 

267 

268 Args: 

269 request (Optional[Union[google.cloud.resourcemanager_v3.types.ListTagBindingsRequest, dict]]): 

270 The request object. The request message to list all 

271 TagBindings for a parent. 

272 parent (:class:`str`): 

273 Required. The full resource name of a 

274 resource for which you want to list 

275 existing TagBindings. E.g. 

276 "//cloudresourcemanager.googleapis.com/projects/123" 

277 

278 This corresponds to the ``parent`` field 

279 on the ``request`` instance; if ``request`` is provided, this 

280 should not be set. 

281 retry (google.api_core.retry.Retry): Designation of what errors, if any, 

282 should be retried. 

283 timeout (float): The timeout for this request. 

284 metadata (Sequence[Tuple[str, str]]): Strings which should be 

285 sent along with the request as metadata. 

286 

287 Returns: 

288 google.cloud.resourcemanager_v3.services.tag_bindings.pagers.ListTagBindingsAsyncPager: 

289 The ListTagBindings response. 

290 Iterating over this object will yield 

291 results and resolve additional pages 

292 automatically. 

293 

294 """ 

295 # Create or coerce a protobuf request object. 

296 # Quick check: If we got a request object, we should *not* have 

297 # gotten any keyword arguments that map to the request. 

298 has_flattened_params = any([parent]) 

299 if request is not None and has_flattened_params: 

300 raise ValueError( 

301 "If the `request` argument is set, then none of " 

302 "the individual field arguments should be set." 

303 ) 

304 

305 request = tag_bindings.ListTagBindingsRequest(request) 

306 

307 # If we have keyword arguments corresponding to fields on the 

308 # request, apply these. 

309 if parent is not None: 

310 request.parent = parent 

311 

312 # Wrap the RPC method; this adds retry and timeout information, 

313 # and friendly error handling. 

314 rpc = gapic_v1.method_async.wrap_method( 

315 self._client._transport.list_tag_bindings, 

316 default_retry=retries.Retry( 

317 initial=0.1, 

318 maximum=60.0, 

319 multiplier=1.3, 

320 predicate=retries.if_exception_type( 

321 core_exceptions.ServiceUnavailable, 

322 ), 

323 deadline=60.0, 

324 ), 

325 default_timeout=60.0, 

326 client_info=DEFAULT_CLIENT_INFO, 

327 ) 

328 

329 # Send the request. 

330 response = await rpc( 

331 request, 

332 retry=retry, 

333 timeout=timeout, 

334 metadata=metadata, 

335 ) 

336 

337 # This method is paged; wrap the response in a pager, which provides 

338 # an `__aiter__` convenience method. 

339 response = pagers.ListTagBindingsAsyncPager( 

340 method=rpc, 

341 request=request, 

342 response=response, 

343 metadata=metadata, 

344 ) 

345 

346 # Done; return the response. 

347 return response 

348 

349 async def create_tag_binding( 

350 self, 

351 request: Optional[Union[tag_bindings.CreateTagBindingRequest, dict]] = None, 

352 *, 

353 tag_binding: Optional[tag_bindings.TagBinding] = None, 

354 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

355 timeout: Union[float, object] = gapic_v1.method.DEFAULT, 

356 metadata: Sequence[Tuple[str, str]] = (), 

357 ) -> operation_async.AsyncOperation: 

358 r"""Creates a TagBinding between a TagValue and a Google 

359 Cloud resource. 

360 

361 .. code-block:: python 

362 

363 # This snippet has been automatically generated and should be regarded as a 

364 # code template only. 

365 # It will require modifications to work: 

366 # - It may require correct/in-range values for request initialization. 

367 # - It may require specifying regional endpoints when creating the service 

368 # client as shown in: 

369 # https://googleapis.dev/python/google-api-core/latest/client_options.html 

370 from google.cloud import resourcemanager_v3 

371 

372 async def sample_create_tag_binding(): 

373 # Create a client 

374 client = resourcemanager_v3.TagBindingsAsyncClient() 

375 

376 # Initialize request argument(s) 

377 request = resourcemanager_v3.CreateTagBindingRequest( 

378 ) 

379 

380 # Make the request 

381 operation = client.create_tag_binding(request=request) 

382 

383 print("Waiting for operation to complete...") 

384 

385 response = (await operation).result() 

386 

387 # Handle the response 

388 print(response) 

389 

390 Args: 

391 request (Optional[Union[google.cloud.resourcemanager_v3.types.CreateTagBindingRequest, dict]]): 

392 The request object. The request message to create a 

393 TagBinding. 

394 tag_binding (:class:`google.cloud.resourcemanager_v3.types.TagBinding`): 

395 Required. The TagBinding to be 

396 created. 

397 

398 This corresponds to the ``tag_binding`` field 

399 on the ``request`` instance; if ``request`` is provided, this 

400 should not be set. 

401 retry (google.api_core.retry.Retry): Designation of what errors, if any, 

402 should be retried. 

403 timeout (float): The timeout for this request. 

404 metadata (Sequence[Tuple[str, str]]): Strings which should be 

405 sent along with the request as metadata. 

406 

407 Returns: 

408 google.api_core.operation_async.AsyncOperation: 

409 An object representing a long-running operation. 

410 

411 The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagBinding` A TagBinding represents a connection between a TagValue and a cloud 

412 resource Once a TagBinding is created, the TagValue 

413 is applied to all the descendants of the Google Cloud 

414 resource. 

415 

416 """ 

417 # Create or coerce a protobuf request object. 

418 # Quick check: If we got a request object, we should *not* have 

419 # gotten any keyword arguments that map to the request. 

420 has_flattened_params = any([tag_binding]) 

421 if request is not None and has_flattened_params: 

422 raise ValueError( 

423 "If the `request` argument is set, then none of " 

424 "the individual field arguments should be set." 

425 ) 

426 

427 request = tag_bindings.CreateTagBindingRequest(request) 

428 

429 # If we have keyword arguments corresponding to fields on the 

430 # request, apply these. 

431 if tag_binding is not None: 

432 request.tag_binding = tag_binding 

433 

434 # Wrap the RPC method; this adds retry and timeout information, 

435 # and friendly error handling. 

436 rpc = gapic_v1.method_async.wrap_method( 

437 self._client._transport.create_tag_binding, 

438 default_timeout=60.0, 

439 client_info=DEFAULT_CLIENT_INFO, 

440 ) 

441 

442 # Send the request. 

443 response = await rpc( 

444 request, 

445 retry=retry, 

446 timeout=timeout, 

447 metadata=metadata, 

448 ) 

449 

450 # Wrap the response in an operation future. 

451 response = operation_async.from_gapic( 

452 response, 

453 self._client._transport.operations_client, 

454 tag_bindings.TagBinding, 

455 metadata_type=tag_bindings.CreateTagBindingMetadata, 

456 ) 

457 

458 # Done; return the response. 

459 return response 

460 

461 async def delete_tag_binding( 

462 self, 

463 request: Optional[Union[tag_bindings.DeleteTagBindingRequest, dict]] = None, 

464 *, 

465 name: Optional[str] = None, 

466 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

467 timeout: Union[float, object] = gapic_v1.method.DEFAULT, 

468 metadata: Sequence[Tuple[str, str]] = (), 

469 ) -> operation_async.AsyncOperation: 

470 r"""Deletes a TagBinding. 

471 

472 .. code-block:: python 

473 

474 # This snippet has been automatically generated and should be regarded as a 

475 # code template only. 

476 # It will require modifications to work: 

477 # - It may require correct/in-range values for request initialization. 

478 # - It may require specifying regional endpoints when creating the service 

479 # client as shown in: 

480 # https://googleapis.dev/python/google-api-core/latest/client_options.html 

481 from google.cloud import resourcemanager_v3 

482 

483 async def sample_delete_tag_binding(): 

484 # Create a client 

485 client = resourcemanager_v3.TagBindingsAsyncClient() 

486 

487 # Initialize request argument(s) 

488 request = resourcemanager_v3.DeleteTagBindingRequest( 

489 name="name_value", 

490 ) 

491 

492 # Make the request 

493 operation = client.delete_tag_binding(request=request) 

494 

495 print("Waiting for operation to complete...") 

496 

497 response = (await operation).result() 

498 

499 # Handle the response 

500 print(response) 

501 

502 Args: 

503 request (Optional[Union[google.cloud.resourcemanager_v3.types.DeleteTagBindingRequest, dict]]): 

504 The request object. The request message to delete a 

505 TagBinding. 

506 name (:class:`str`): 

507 Required. The name of the TagBinding. This is a String 

508 of the form: ``tagBindings/{id}`` (e.g. 

509 ``tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456``). 

510 

511 This corresponds to the ``name`` field 

512 on the ``request`` instance; if ``request`` is provided, this 

513 should not be set. 

514 retry (google.api_core.retry.Retry): Designation of what errors, if any, 

515 should be retried. 

516 timeout (float): The timeout for this request. 

517 metadata (Sequence[Tuple[str, str]]): Strings which should be 

518 sent along with the request as metadata. 

519 

520 Returns: 

521 google.api_core.operation_async.AsyncOperation: 

522 An object representing a long-running operation. 

523 

524 The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated 

525 empty messages in your APIs. A typical example is to 

526 use it as the request or the response type of an API 

527 method. For instance: 

528 

529 service Foo { 

530 rpc Bar(google.protobuf.Empty) returns 

531 (google.protobuf.Empty); 

532 

533 } 

534 

535 """ 

536 # Create or coerce a protobuf request object. 

537 # Quick check: If we got a request object, we should *not* have 

538 # gotten any keyword arguments that map to the request. 

539 has_flattened_params = any([name]) 

540 if request is not None and has_flattened_params: 

541 raise ValueError( 

542 "If the `request` argument is set, then none of " 

543 "the individual field arguments should be set." 

544 ) 

545 

546 request = tag_bindings.DeleteTagBindingRequest(request) 

547 

548 # If we have keyword arguments corresponding to fields on the 

549 # request, apply these. 

550 if name is not None: 

551 request.name = name 

552 

553 # Wrap the RPC method; this adds retry and timeout information, 

554 # and friendly error handling. 

555 rpc = gapic_v1.method_async.wrap_method( 

556 self._client._transport.delete_tag_binding, 

557 default_timeout=60.0, 

558 client_info=DEFAULT_CLIENT_INFO, 

559 ) 

560 

561 # Certain fields should be provided within the metadata header; 

562 # add these here. 

563 metadata = tuple(metadata) + ( 

564 gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 

565 ) 

566 

567 # Send the request. 

568 response = await rpc( 

569 request, 

570 retry=retry, 

571 timeout=timeout, 

572 metadata=metadata, 

573 ) 

574 

575 # Wrap the response in an operation future. 

576 response = operation_async.from_gapic( 

577 response, 

578 self._client._transport.operations_client, 

579 empty_pb2.Empty, 

580 metadata_type=tag_bindings.DeleteTagBindingMetadata, 

581 ) 

582 

583 # Done; return the response. 

584 return response 

585 

586 async def list_effective_tags( 

587 self, 

588 request: Optional[Union[tag_bindings.ListEffectiveTagsRequest, dict]] = None, 

589 *, 

590 parent: Optional[str] = None, 

591 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

592 timeout: Union[float, object] = gapic_v1.method.DEFAULT, 

593 metadata: Sequence[Tuple[str, str]] = (), 

594 ) -> pagers.ListEffectiveTagsAsyncPager: 

595 r"""Return a list of effective tags for the given Google Cloud 

596 resource, as specified in ``parent``. 

597 

598 .. code-block:: python 

599 

600 # This snippet has been automatically generated and should be regarded as a 

601 # code template only. 

602 # It will require modifications to work: 

603 # - It may require correct/in-range values for request initialization. 

604 # - It may require specifying regional endpoints when creating the service 

605 # client as shown in: 

606 # https://googleapis.dev/python/google-api-core/latest/client_options.html 

607 from google.cloud import resourcemanager_v3 

608 

609 async def sample_list_effective_tags(): 

610 # Create a client 

611 client = resourcemanager_v3.TagBindingsAsyncClient() 

612 

613 # Initialize request argument(s) 

614 request = resourcemanager_v3.ListEffectiveTagsRequest( 

615 parent="parent_value", 

616 ) 

617 

618 # Make the request 

619 page_result = client.list_effective_tags(request=request) 

620 

621 # Handle the response 

622 async for response in page_result: 

623 print(response) 

624 

625 Args: 

626 request (Optional[Union[google.cloud.resourcemanager_v3.types.ListEffectiveTagsRequest, dict]]): 

627 The request object. The request message to 

628 ListEffectiveTags 

629 parent (:class:`str`): 

630 Required. The full resource name of a 

631 resource for which you want to list the 

632 effective tags. E.g. 

633 "//cloudresourcemanager.googleapis.com/projects/123" 

634 

635 This corresponds to the ``parent`` field 

636 on the ``request`` instance; if ``request`` is provided, this 

637 should not be set. 

638 retry (google.api_core.retry.Retry): Designation of what errors, if any, 

639 should be retried. 

640 timeout (float): The timeout for this request. 

641 metadata (Sequence[Tuple[str, str]]): Strings which should be 

642 sent along with the request as metadata. 

643 

644 Returns: 

645 google.cloud.resourcemanager_v3.services.tag_bindings.pagers.ListEffectiveTagsAsyncPager: 

646 The response of ListEffectiveTags. 

647 Iterating over this object will yield 

648 results and resolve additional pages 

649 automatically. 

650 

651 """ 

652 # Create or coerce a protobuf request object. 

653 # Quick check: If we got a request object, we should *not* have 

654 # gotten any keyword arguments that map to the request. 

655 has_flattened_params = any([parent]) 

656 if request is not None and has_flattened_params: 

657 raise ValueError( 

658 "If the `request` argument is set, then none of " 

659 "the individual field arguments should be set." 

660 ) 

661 

662 request = tag_bindings.ListEffectiveTagsRequest(request) 

663 

664 # If we have keyword arguments corresponding to fields on the 

665 # request, apply these. 

666 if parent is not None: 

667 request.parent = parent 

668 

669 # Wrap the RPC method; this adds retry and timeout information, 

670 # and friendly error handling. 

671 rpc = gapic_v1.method_async.wrap_method( 

672 self._client._transport.list_effective_tags, 

673 default_timeout=None, 

674 client_info=DEFAULT_CLIENT_INFO, 

675 ) 

676 

677 # Send the request. 

678 response = await rpc( 

679 request, 

680 retry=retry, 

681 timeout=timeout, 

682 metadata=metadata, 

683 ) 

684 

685 # This method is paged; wrap the response in a pager, which provides 

686 # an `__aiter__` convenience method. 

687 response = pagers.ListEffectiveTagsAsyncPager( 

688 method=rpc, 

689 request=request, 

690 response=response, 

691 metadata=metadata, 

692 ) 

693 

694 # Done; return the response. 

695 return response 

696 

697 async def get_operation( 

698 self, 

699 request: Optional[operations_pb2.GetOperationRequest] = None, 

700 *, 

701 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

702 timeout: Union[float, object] = gapic_v1.method.DEFAULT, 

703 metadata: Sequence[Tuple[str, str]] = (), 

704 ) -> operations_pb2.Operation: 

705 r"""Gets the latest state of a long-running operation. 

706 

707 Args: 

708 request (:class:`~.operations_pb2.GetOperationRequest`): 

709 The request object. Request message for 

710 `GetOperation` method. 

711 retry (google.api_core.retry.Retry): Designation of what errors, 

712 if any, should be retried. 

713 timeout (float): The timeout for this request. 

714 metadata (Sequence[Tuple[str, str]]): Strings which should be 

715 sent along with the request as metadata. 

716 Returns: 

717 ~.operations_pb2.Operation: 

718 An ``Operation`` object. 

719 """ 

720 # Create or coerce a protobuf request object. 

721 # The request isn't a proto-plus wrapped type, 

722 # so it must be constructed via keyword expansion. 

723 if isinstance(request, dict): 

724 request = operations_pb2.GetOperationRequest(**request) 

725 

726 # Wrap the RPC method; this adds retry and timeout information, 

727 # and friendly error handling. 

728 rpc = gapic_v1.method.wrap_method( 

729 self._client._transport.get_operation, 

730 default_timeout=None, 

731 client_info=DEFAULT_CLIENT_INFO, 

732 ) 

733 

734 # Certain fields should be provided within the metadata header; 

735 # add these here. 

736 metadata = tuple(metadata) + ( 

737 gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 

738 ) 

739 

740 # Send the request. 

741 response = await rpc( 

742 request, 

743 retry=retry, 

744 timeout=timeout, 

745 metadata=metadata, 

746 ) 

747 

748 # Done; return the response. 

749 return response 

750 

751 async def __aenter__(self): 

752 return self 

753 

754 async def __aexit__(self, exc_type, exc, tb): 

755 await self.transport.close() 

756 

757 

758DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 

759 gapic_version=package_version.__version__ 

760) 

761 

762 

763__all__ = ("TagBindingsAsyncClient",)