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

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

244 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# 

16from google.api_core import gapic_v1 

17from google.api_core import retry as retries 

18from google.api_core import retry_async as retries_async 

19from typing import ( 

20 Any, 

21 AsyncIterator, 

22 Awaitable, 

23 Callable, 

24 Sequence, 

25 Tuple, 

26 Optional, 

27 Iterator, 

28 Union, 

29) 

30 

31try: 

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

33 OptionalAsyncRetry = Union[ 

34 retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None 

35 ] 

36except AttributeError: # pragma: NO COVER 

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

38 OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore 

39 

40from google.cloud.logging_v2.types import logging_config 

41 

42 

43class ListBucketsPager: 

44 """A pager for iterating through ``list_buckets`` requests. 

45 

46 This class thinly wraps an initial 

47 :class:`google.cloud.logging_v2.types.ListBucketsResponse` object, and 

48 provides an ``__iter__`` method to iterate through its 

49 ``buckets`` field. 

50 

51 If there are more pages, the ``__iter__`` method will make additional 

52 ``ListBuckets`` requests and continue to iterate 

53 through the ``buckets`` field on the 

54 corresponding responses. 

55 

56 All the usual :class:`google.cloud.logging_v2.types.ListBucketsResponse` 

57 attributes are available on the pager. If multiple requests are made, only 

58 the most recent response is retained, and thus used for attribute lookup. 

59 """ 

60 

61 def __init__( 

62 self, 

63 method: Callable[..., logging_config.ListBucketsResponse], 

64 request: logging_config.ListBucketsRequest, 

65 response: logging_config.ListBucketsResponse, 

66 *, 

67 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

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

69 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

70 ): 

71 """Instantiate the pager. 

72 

73 Args: 

74 method (Callable): The method that was originally called, and 

75 which instantiated this pager. 

76 request (google.cloud.logging_v2.types.ListBucketsRequest): 

77 The initial request object. 

78 response (google.cloud.logging_v2.types.ListBucketsResponse): 

79 The initial response object. 

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

81 if any, should be retried. 

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

83 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

84 sent along with the request as metadata. Normally, each value must be of type `str`, 

85 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

86 be of type `bytes`. 

87 """ 

88 self._method = method 

89 self._request = logging_config.ListBucketsRequest(request) 

90 self._response = response 

91 self._retry = retry 

92 self._timeout = timeout 

93 self._metadata = metadata 

94 

95 def __getattr__(self, name: str) -> Any: 

96 return getattr(self._response, name) 

97 

98 @property 

99 def pages(self) -> Iterator[logging_config.ListBucketsResponse]: 

100 yield self._response 

101 while self._response.next_page_token: 

102 self._request.page_token = self._response.next_page_token 

103 self._response = self._method( 

104 self._request, 

105 retry=self._retry, 

106 timeout=self._timeout, 

107 metadata=self._metadata, 

108 ) 

109 yield self._response 

110 

111 def __iter__(self) -> Iterator[logging_config.LogBucket]: 

112 for page in self.pages: 

113 yield from page.buckets 

114 

115 def __repr__(self) -> str: 

116 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

117 

118 

119class ListBucketsAsyncPager: 

120 """A pager for iterating through ``list_buckets`` requests. 

121 

122 This class thinly wraps an initial 

123 :class:`google.cloud.logging_v2.types.ListBucketsResponse` object, and 

124 provides an ``__aiter__`` method to iterate through its 

125 ``buckets`` field. 

126 

127 If there are more pages, the ``__aiter__`` method will make additional 

128 ``ListBuckets`` requests and continue to iterate 

129 through the ``buckets`` field on the 

130 corresponding responses. 

131 

132 All the usual :class:`google.cloud.logging_v2.types.ListBucketsResponse` 

133 attributes are available on the pager. If multiple requests are made, only 

134 the most recent response is retained, and thus used for attribute lookup. 

135 """ 

136 

137 def __init__( 

138 self, 

139 method: Callable[..., Awaitable[logging_config.ListBucketsResponse]], 

140 request: logging_config.ListBucketsRequest, 

141 response: logging_config.ListBucketsResponse, 

142 *, 

143 retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, 

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

145 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

146 ): 

147 """Instantiates the pager. 

148 

149 Args: 

150 method (Callable): The method that was originally called, and 

151 which instantiated this pager. 

152 request (google.cloud.logging_v2.types.ListBucketsRequest): 

153 The initial request object. 

154 response (google.cloud.logging_v2.types.ListBucketsResponse): 

155 The initial response object. 

156 retry (google.api_core.retry.AsyncRetry): Designation of what errors, 

157 if any, should be retried. 

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

159 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

160 sent along with the request as metadata. Normally, each value must be of type `str`, 

161 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

162 be of type `bytes`. 

163 """ 

164 self._method = method 

165 self._request = logging_config.ListBucketsRequest(request) 

166 self._response = response 

167 self._retry = retry 

168 self._timeout = timeout 

169 self._metadata = metadata 

170 

171 def __getattr__(self, name: str) -> Any: 

172 return getattr(self._response, name) 

173 

174 @property 

175 async def pages(self) -> AsyncIterator[logging_config.ListBucketsResponse]: 

176 yield self._response 

177 while self._response.next_page_token: 

178 self._request.page_token = self._response.next_page_token 

179 self._response = await self._method( 

180 self._request, 

181 retry=self._retry, 

182 timeout=self._timeout, 

183 metadata=self._metadata, 

184 ) 

185 yield self._response 

186 

187 def __aiter__(self) -> AsyncIterator[logging_config.LogBucket]: 

188 async def async_generator(): 

189 async for page in self.pages: 

190 for response in page.buckets: 

191 yield response 

192 

193 return async_generator() 

194 

195 def __repr__(self) -> str: 

196 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

197 

198 

199class ListViewsPager: 

200 """A pager for iterating through ``list_views`` requests. 

201 

202 This class thinly wraps an initial 

203 :class:`google.cloud.logging_v2.types.ListViewsResponse` object, and 

204 provides an ``__iter__`` method to iterate through its 

205 ``views`` field. 

206 

207 If there are more pages, the ``__iter__`` method will make additional 

208 ``ListViews`` requests and continue to iterate 

209 through the ``views`` field on the 

210 corresponding responses. 

211 

212 All the usual :class:`google.cloud.logging_v2.types.ListViewsResponse` 

213 attributes are available on the pager. If multiple requests are made, only 

214 the most recent response is retained, and thus used for attribute lookup. 

215 """ 

216 

217 def __init__( 

218 self, 

219 method: Callable[..., logging_config.ListViewsResponse], 

220 request: logging_config.ListViewsRequest, 

221 response: logging_config.ListViewsResponse, 

222 *, 

223 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

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

225 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

226 ): 

227 """Instantiate the pager. 

228 

229 Args: 

230 method (Callable): The method that was originally called, and 

231 which instantiated this pager. 

232 request (google.cloud.logging_v2.types.ListViewsRequest): 

233 The initial request object. 

234 response (google.cloud.logging_v2.types.ListViewsResponse): 

235 The initial response object. 

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

237 if any, should be retried. 

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

239 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

240 sent along with the request as metadata. Normally, each value must be of type `str`, 

241 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

242 be of type `bytes`. 

243 """ 

244 self._method = method 

245 self._request = logging_config.ListViewsRequest(request) 

246 self._response = response 

247 self._retry = retry 

248 self._timeout = timeout 

249 self._metadata = metadata 

250 

251 def __getattr__(self, name: str) -> Any: 

252 return getattr(self._response, name) 

253 

254 @property 

255 def pages(self) -> Iterator[logging_config.ListViewsResponse]: 

256 yield self._response 

257 while self._response.next_page_token: 

258 self._request.page_token = self._response.next_page_token 

259 self._response = self._method( 

260 self._request, 

261 retry=self._retry, 

262 timeout=self._timeout, 

263 metadata=self._metadata, 

264 ) 

265 yield self._response 

266 

267 def __iter__(self) -> Iterator[logging_config.LogView]: 

268 for page in self.pages: 

269 yield from page.views 

270 

271 def __repr__(self) -> str: 

272 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

273 

274 

275class ListViewsAsyncPager: 

276 """A pager for iterating through ``list_views`` requests. 

277 

278 This class thinly wraps an initial 

279 :class:`google.cloud.logging_v2.types.ListViewsResponse` object, and 

280 provides an ``__aiter__`` method to iterate through its 

281 ``views`` field. 

282 

283 If there are more pages, the ``__aiter__`` method will make additional 

284 ``ListViews`` requests and continue to iterate 

285 through the ``views`` field on the 

286 corresponding responses. 

287 

288 All the usual :class:`google.cloud.logging_v2.types.ListViewsResponse` 

289 attributes are available on the pager. If multiple requests are made, only 

290 the most recent response is retained, and thus used for attribute lookup. 

291 """ 

292 

293 def __init__( 

294 self, 

295 method: Callable[..., Awaitable[logging_config.ListViewsResponse]], 

296 request: logging_config.ListViewsRequest, 

297 response: logging_config.ListViewsResponse, 

298 *, 

299 retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, 

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

301 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

302 ): 

303 """Instantiates the pager. 

304 

305 Args: 

306 method (Callable): The method that was originally called, and 

307 which instantiated this pager. 

308 request (google.cloud.logging_v2.types.ListViewsRequest): 

309 The initial request object. 

310 response (google.cloud.logging_v2.types.ListViewsResponse): 

311 The initial response object. 

312 retry (google.api_core.retry.AsyncRetry): Designation of what errors, 

313 if any, should be retried. 

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

315 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

316 sent along with the request as metadata. Normally, each value must be of type `str`, 

317 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

318 be of type `bytes`. 

319 """ 

320 self._method = method 

321 self._request = logging_config.ListViewsRequest(request) 

322 self._response = response 

323 self._retry = retry 

324 self._timeout = timeout 

325 self._metadata = metadata 

326 

327 def __getattr__(self, name: str) -> Any: 

328 return getattr(self._response, name) 

329 

330 @property 

331 async def pages(self) -> AsyncIterator[logging_config.ListViewsResponse]: 

332 yield self._response 

333 while self._response.next_page_token: 

334 self._request.page_token = self._response.next_page_token 

335 self._response = await self._method( 

336 self._request, 

337 retry=self._retry, 

338 timeout=self._timeout, 

339 metadata=self._metadata, 

340 ) 

341 yield self._response 

342 

343 def __aiter__(self) -> AsyncIterator[logging_config.LogView]: 

344 async def async_generator(): 

345 async for page in self.pages: 

346 for response in page.views: 

347 yield response 

348 

349 return async_generator() 

350 

351 def __repr__(self) -> str: 

352 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

353 

354 

355class ListSinksPager: 

356 """A pager for iterating through ``list_sinks`` requests. 

357 

358 This class thinly wraps an initial 

359 :class:`google.cloud.logging_v2.types.ListSinksResponse` object, and 

360 provides an ``__iter__`` method to iterate through its 

361 ``sinks`` field. 

362 

363 If there are more pages, the ``__iter__`` method will make additional 

364 ``ListSinks`` requests and continue to iterate 

365 through the ``sinks`` field on the 

366 corresponding responses. 

367 

368 All the usual :class:`google.cloud.logging_v2.types.ListSinksResponse` 

369 attributes are available on the pager. If multiple requests are made, only 

370 the most recent response is retained, and thus used for attribute lookup. 

371 """ 

372 

373 def __init__( 

374 self, 

375 method: Callable[..., logging_config.ListSinksResponse], 

376 request: logging_config.ListSinksRequest, 

377 response: logging_config.ListSinksResponse, 

378 *, 

379 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

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

381 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

382 ): 

383 """Instantiate the pager. 

384 

385 Args: 

386 method (Callable): The method that was originally called, and 

387 which instantiated this pager. 

388 request (google.cloud.logging_v2.types.ListSinksRequest): 

389 The initial request object. 

390 response (google.cloud.logging_v2.types.ListSinksResponse): 

391 The initial response object. 

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

393 if any, should be retried. 

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

395 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

396 sent along with the request as metadata. Normally, each value must be of type `str`, 

397 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

398 be of type `bytes`. 

399 """ 

400 self._method = method 

401 self._request = logging_config.ListSinksRequest(request) 

402 self._response = response 

403 self._retry = retry 

404 self._timeout = timeout 

405 self._metadata = metadata 

406 

407 def __getattr__(self, name: str) -> Any: 

408 return getattr(self._response, name) 

409 

410 @property 

411 def pages(self) -> Iterator[logging_config.ListSinksResponse]: 

412 yield self._response 

413 while self._response.next_page_token: 

414 self._request.page_token = self._response.next_page_token 

415 self._response = self._method( 

416 self._request, 

417 retry=self._retry, 

418 timeout=self._timeout, 

419 metadata=self._metadata, 

420 ) 

421 yield self._response 

422 

423 def __iter__(self) -> Iterator[logging_config.LogSink]: 

424 for page in self.pages: 

425 yield from page.sinks 

426 

427 def __repr__(self) -> str: 

428 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

429 

430 

431class ListSinksAsyncPager: 

432 """A pager for iterating through ``list_sinks`` requests. 

433 

434 This class thinly wraps an initial 

435 :class:`google.cloud.logging_v2.types.ListSinksResponse` object, and 

436 provides an ``__aiter__`` method to iterate through its 

437 ``sinks`` field. 

438 

439 If there are more pages, the ``__aiter__`` method will make additional 

440 ``ListSinks`` requests and continue to iterate 

441 through the ``sinks`` field on the 

442 corresponding responses. 

443 

444 All the usual :class:`google.cloud.logging_v2.types.ListSinksResponse` 

445 attributes are available on the pager. If multiple requests are made, only 

446 the most recent response is retained, and thus used for attribute lookup. 

447 """ 

448 

449 def __init__( 

450 self, 

451 method: Callable[..., Awaitable[logging_config.ListSinksResponse]], 

452 request: logging_config.ListSinksRequest, 

453 response: logging_config.ListSinksResponse, 

454 *, 

455 retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, 

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

457 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

458 ): 

459 """Instantiates the pager. 

460 

461 Args: 

462 method (Callable): The method that was originally called, and 

463 which instantiated this pager. 

464 request (google.cloud.logging_v2.types.ListSinksRequest): 

465 The initial request object. 

466 response (google.cloud.logging_v2.types.ListSinksResponse): 

467 The initial response object. 

468 retry (google.api_core.retry.AsyncRetry): Designation of what errors, 

469 if any, should be retried. 

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

471 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

472 sent along with the request as metadata. Normally, each value must be of type `str`, 

473 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

474 be of type `bytes`. 

475 """ 

476 self._method = method 

477 self._request = logging_config.ListSinksRequest(request) 

478 self._response = response 

479 self._retry = retry 

480 self._timeout = timeout 

481 self._metadata = metadata 

482 

483 def __getattr__(self, name: str) -> Any: 

484 return getattr(self._response, name) 

485 

486 @property 

487 async def pages(self) -> AsyncIterator[logging_config.ListSinksResponse]: 

488 yield self._response 

489 while self._response.next_page_token: 

490 self._request.page_token = self._response.next_page_token 

491 self._response = await self._method( 

492 self._request, 

493 retry=self._retry, 

494 timeout=self._timeout, 

495 metadata=self._metadata, 

496 ) 

497 yield self._response 

498 

499 def __aiter__(self) -> AsyncIterator[logging_config.LogSink]: 

500 async def async_generator(): 

501 async for page in self.pages: 

502 for response in page.sinks: 

503 yield response 

504 

505 return async_generator() 

506 

507 def __repr__(self) -> str: 

508 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

509 

510 

511class ListLinksPager: 

512 """A pager for iterating through ``list_links`` requests. 

513 

514 This class thinly wraps an initial 

515 :class:`google.cloud.logging_v2.types.ListLinksResponse` object, and 

516 provides an ``__iter__`` method to iterate through its 

517 ``links`` field. 

518 

519 If there are more pages, the ``__iter__`` method will make additional 

520 ``ListLinks`` requests and continue to iterate 

521 through the ``links`` field on the 

522 corresponding responses. 

523 

524 All the usual :class:`google.cloud.logging_v2.types.ListLinksResponse` 

525 attributes are available on the pager. If multiple requests are made, only 

526 the most recent response is retained, and thus used for attribute lookup. 

527 """ 

528 

529 def __init__( 

530 self, 

531 method: Callable[..., logging_config.ListLinksResponse], 

532 request: logging_config.ListLinksRequest, 

533 response: logging_config.ListLinksResponse, 

534 *, 

535 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

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

537 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

538 ): 

539 """Instantiate the pager. 

540 

541 Args: 

542 method (Callable): The method that was originally called, and 

543 which instantiated this pager. 

544 request (google.cloud.logging_v2.types.ListLinksRequest): 

545 The initial request object. 

546 response (google.cloud.logging_v2.types.ListLinksResponse): 

547 The initial response object. 

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

549 if any, should be retried. 

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

551 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

552 sent along with the request as metadata. Normally, each value must be of type `str`, 

553 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

554 be of type `bytes`. 

555 """ 

556 self._method = method 

557 self._request = logging_config.ListLinksRequest(request) 

558 self._response = response 

559 self._retry = retry 

560 self._timeout = timeout 

561 self._metadata = metadata 

562 

563 def __getattr__(self, name: str) -> Any: 

564 return getattr(self._response, name) 

565 

566 @property 

567 def pages(self) -> Iterator[logging_config.ListLinksResponse]: 

568 yield self._response 

569 while self._response.next_page_token: 

570 self._request.page_token = self._response.next_page_token 

571 self._response = self._method( 

572 self._request, 

573 retry=self._retry, 

574 timeout=self._timeout, 

575 metadata=self._metadata, 

576 ) 

577 yield self._response 

578 

579 def __iter__(self) -> Iterator[logging_config.Link]: 

580 for page in self.pages: 

581 yield from page.links 

582 

583 def __repr__(self) -> str: 

584 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

585 

586 

587class ListLinksAsyncPager: 

588 """A pager for iterating through ``list_links`` requests. 

589 

590 This class thinly wraps an initial 

591 :class:`google.cloud.logging_v2.types.ListLinksResponse` object, and 

592 provides an ``__aiter__`` method to iterate through its 

593 ``links`` field. 

594 

595 If there are more pages, the ``__aiter__`` method will make additional 

596 ``ListLinks`` requests and continue to iterate 

597 through the ``links`` field on the 

598 corresponding responses. 

599 

600 All the usual :class:`google.cloud.logging_v2.types.ListLinksResponse` 

601 attributes are available on the pager. If multiple requests are made, only 

602 the most recent response is retained, and thus used for attribute lookup. 

603 """ 

604 

605 def __init__( 

606 self, 

607 method: Callable[..., Awaitable[logging_config.ListLinksResponse]], 

608 request: logging_config.ListLinksRequest, 

609 response: logging_config.ListLinksResponse, 

610 *, 

611 retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, 

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

613 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

614 ): 

615 """Instantiates the pager. 

616 

617 Args: 

618 method (Callable): The method that was originally called, and 

619 which instantiated this pager. 

620 request (google.cloud.logging_v2.types.ListLinksRequest): 

621 The initial request object. 

622 response (google.cloud.logging_v2.types.ListLinksResponse): 

623 The initial response object. 

624 retry (google.api_core.retry.AsyncRetry): Designation of what errors, 

625 if any, should be retried. 

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

627 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

628 sent along with the request as metadata. Normally, each value must be of type `str`, 

629 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

630 be of type `bytes`. 

631 """ 

632 self._method = method 

633 self._request = logging_config.ListLinksRequest(request) 

634 self._response = response 

635 self._retry = retry 

636 self._timeout = timeout 

637 self._metadata = metadata 

638 

639 def __getattr__(self, name: str) -> Any: 

640 return getattr(self._response, name) 

641 

642 @property 

643 async def pages(self) -> AsyncIterator[logging_config.ListLinksResponse]: 

644 yield self._response 

645 while self._response.next_page_token: 

646 self._request.page_token = self._response.next_page_token 

647 self._response = await self._method( 

648 self._request, 

649 retry=self._retry, 

650 timeout=self._timeout, 

651 metadata=self._metadata, 

652 ) 

653 yield self._response 

654 

655 def __aiter__(self) -> AsyncIterator[logging_config.Link]: 

656 async def async_generator(): 

657 async for page in self.pages: 

658 for response in page.links: 

659 yield response 

660 

661 return async_generator() 

662 

663 def __repr__(self) -> str: 

664 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

665 

666 

667class ListExclusionsPager: 

668 """A pager for iterating through ``list_exclusions`` requests. 

669 

670 This class thinly wraps an initial 

671 :class:`google.cloud.logging_v2.types.ListExclusionsResponse` object, and 

672 provides an ``__iter__`` method to iterate through its 

673 ``exclusions`` field. 

674 

675 If there are more pages, the ``__iter__`` method will make additional 

676 ``ListExclusions`` requests and continue to iterate 

677 through the ``exclusions`` field on the 

678 corresponding responses. 

679 

680 All the usual :class:`google.cloud.logging_v2.types.ListExclusionsResponse` 

681 attributes are available on the pager. If multiple requests are made, only 

682 the most recent response is retained, and thus used for attribute lookup. 

683 """ 

684 

685 def __init__( 

686 self, 

687 method: Callable[..., logging_config.ListExclusionsResponse], 

688 request: logging_config.ListExclusionsRequest, 

689 response: logging_config.ListExclusionsResponse, 

690 *, 

691 retry: OptionalRetry = gapic_v1.method.DEFAULT, 

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

693 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

694 ): 

695 """Instantiate the pager. 

696 

697 Args: 

698 method (Callable): The method that was originally called, and 

699 which instantiated this pager. 

700 request (google.cloud.logging_v2.types.ListExclusionsRequest): 

701 The initial request object. 

702 response (google.cloud.logging_v2.types.ListExclusionsResponse): 

703 The initial response object. 

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

705 if any, should be retried. 

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

707 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

708 sent along with the request as metadata. Normally, each value must be of type `str`, 

709 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

710 be of type `bytes`. 

711 """ 

712 self._method = method 

713 self._request = logging_config.ListExclusionsRequest(request) 

714 self._response = response 

715 self._retry = retry 

716 self._timeout = timeout 

717 self._metadata = metadata 

718 

719 def __getattr__(self, name: str) -> Any: 

720 return getattr(self._response, name) 

721 

722 @property 

723 def pages(self) -> Iterator[logging_config.ListExclusionsResponse]: 

724 yield self._response 

725 while self._response.next_page_token: 

726 self._request.page_token = self._response.next_page_token 

727 self._response = self._method( 

728 self._request, 

729 retry=self._retry, 

730 timeout=self._timeout, 

731 metadata=self._metadata, 

732 ) 

733 yield self._response 

734 

735 def __iter__(self) -> Iterator[logging_config.LogExclusion]: 

736 for page in self.pages: 

737 yield from page.exclusions 

738 

739 def __repr__(self) -> str: 

740 return "{0}<{1!r}>".format(self.__class__.__name__, self._response) 

741 

742 

743class ListExclusionsAsyncPager: 

744 """A pager for iterating through ``list_exclusions`` requests. 

745 

746 This class thinly wraps an initial 

747 :class:`google.cloud.logging_v2.types.ListExclusionsResponse` object, and 

748 provides an ``__aiter__`` method to iterate through its 

749 ``exclusions`` field. 

750 

751 If there are more pages, the ``__aiter__`` method will make additional 

752 ``ListExclusions`` requests and continue to iterate 

753 through the ``exclusions`` field on the 

754 corresponding responses. 

755 

756 All the usual :class:`google.cloud.logging_v2.types.ListExclusionsResponse` 

757 attributes are available on the pager. If multiple requests are made, only 

758 the most recent response is retained, and thus used for attribute lookup. 

759 """ 

760 

761 def __init__( 

762 self, 

763 method: Callable[..., Awaitable[logging_config.ListExclusionsResponse]], 

764 request: logging_config.ListExclusionsRequest, 

765 response: logging_config.ListExclusionsResponse, 

766 *, 

767 retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT, 

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

769 metadata: Sequence[Tuple[str, Union[str, bytes]]] = () 

770 ): 

771 """Instantiates the pager. 

772 

773 Args: 

774 method (Callable): The method that was originally called, and 

775 which instantiated this pager. 

776 request (google.cloud.logging_v2.types.ListExclusionsRequest): 

777 The initial request object. 

778 response (google.cloud.logging_v2.types.ListExclusionsResponse): 

779 The initial response object. 

780 retry (google.api_core.retry.AsyncRetry): Designation of what errors, 

781 if any, should be retried. 

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

783 metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 

784 sent along with the request as metadata. Normally, each value must be of type `str`, 

785 but for metadata keys ending with the suffix `-bin`, the corresponding values must 

786 be of type `bytes`. 

787 """ 

788 self._method = method 

789 self._request = logging_config.ListExclusionsRequest(request) 

790 self._response = response 

791 self._retry = retry 

792 self._timeout = timeout 

793 self._metadata = metadata 

794 

795 def __getattr__(self, name: str) -> Any: 

796 return getattr(self._response, name) 

797 

798 @property 

799 async def pages(self) -> AsyncIterator[logging_config.ListExclusionsResponse]: 

800 yield self._response 

801 while self._response.next_page_token: 

802 self._request.page_token = self._response.next_page_token 

803 self._response = await self._method( 

804 self._request, 

805 retry=self._retry, 

806 timeout=self._timeout, 

807 metadata=self._metadata, 

808 ) 

809 yield self._response 

810 

811 def __aiter__(self) -> AsyncIterator[logging_config.LogExclusion]: 

812 async def async_generator(): 

813 async for page in self.pages: 

814 for response in page.exclusions: 

815 yield response 

816 

817 return async_generator() 

818 

819 def __repr__(self) -> str: 

820 return "{0}<{1!r}>".format(self.__class__.__name__, self._response)