13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
#
16
+ from google .api_core import gapic_v1
17
+ from google .api_core import retry as retries
18
+ from google .api_core import retry_async as retries_async
16
19
from typing import (
17
20
Any ,
18
21
AsyncIterator ,
22
25
Tuple ,
23
26
Optional ,
24
27
Iterator ,
28
+ Union ,
25
29
)
26
30
31
+ try :
32
+ OptionalRetry = Union [retries .Retry , gapic_v1 .method ._MethodDefault , None ]
33
+ OptionalAsyncRetry = Union [
34
+ retries_async .AsyncRetry , gapic_v1 .method ._MethodDefault , None
35
+ ]
36
+ except AttributeError : # pragma: NO COVER
37
+ OptionalRetry = Union [retries .Retry , object , None ] # type: ignore
38
+ OptionalAsyncRetry = Union [retries_async .AsyncRetry , object , None ] # type: ignore
39
+
27
40
from google .cloud .datastore_admin_v1 .types import datastore_admin
28
41
from google .cloud .datastore_admin_v1 .types import index
29
42
@@ -52,6 +65,8 @@ def __init__(
52
65
request : datastore_admin .ListIndexesRequest ,
53
66
response : datastore_admin .ListIndexesResponse ,
54
67
* ,
68
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
69
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
55
70
metadata : Sequence [Tuple [str , str ]] = ()
56
71
):
57
72
"""Instantiate the pager.
@@ -63,12 +78,17 @@ def __init__(
63
78
The initial request object.
64
79
response (google.cloud.datastore_admin_v1.types.ListIndexesResponse):
65
80
The initial response object.
81
+ retry (google.api_core.retry.Retry): Designation of what errors,
82
+ if any, should be retried.
83
+ timeout (float): The timeout for this request.
66
84
metadata (Sequence[Tuple[str, str]]): Strings which should be
67
85
sent along with the request as metadata.
68
86
"""
69
87
self ._method = method
70
88
self ._request = datastore_admin .ListIndexesRequest (request )
71
89
self ._response = response
90
+ self ._retry = retry
91
+ self ._timeout = timeout
72
92
self ._metadata = metadata
73
93
74
94
def __getattr__ (self , name : str ) -> Any :
@@ -79,7 +99,12 @@ def pages(self) -> Iterator[datastore_admin.ListIndexesResponse]:
79
99
yield self ._response
80
100
while self ._response .next_page_token :
81
101
self ._request .page_token = self ._response .next_page_token
82
- self ._response = self ._method (self ._request , metadata = self ._metadata )
102
+ self ._response = self ._method (
103
+ self ._request ,
104
+ retry = self ._retry ,
105
+ timeout = self ._timeout ,
106
+ metadata = self ._metadata ,
107
+ )
83
108
yield self ._response
84
109
85
110
def __iter__ (self ) -> Iterator [index .Index ]:
@@ -114,6 +139,8 @@ def __init__(
114
139
request : datastore_admin .ListIndexesRequest ,
115
140
response : datastore_admin .ListIndexesResponse ,
116
141
* ,
142
+ retry : OptionalAsyncRetry = gapic_v1 .method .DEFAULT ,
143
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
117
144
metadata : Sequence [Tuple [str , str ]] = ()
118
145
):
119
146
"""Instantiates the pager.
@@ -125,12 +152,17 @@ def __init__(
125
152
The initial request object.
126
153
response (google.cloud.datastore_admin_v1.types.ListIndexesResponse):
127
154
The initial response object.
155
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
156
+ if any, should be retried.
157
+ timeout (float): The timeout for this request.
128
158
metadata (Sequence[Tuple[str, str]]): Strings which should be
129
159
sent along with the request as metadata.
130
160
"""
131
161
self ._method = method
132
162
self ._request = datastore_admin .ListIndexesRequest (request )
133
163
self ._response = response
164
+ self ._retry = retry
165
+ self ._timeout = timeout
134
166
self ._metadata = metadata
135
167
136
168
def __getattr__ (self , name : str ) -> Any :
@@ -141,7 +173,12 @@ async def pages(self) -> AsyncIterator[datastore_admin.ListIndexesResponse]:
141
173
yield self ._response
142
174
while self ._response .next_page_token :
143
175
self ._request .page_token = self ._response .next_page_token
144
- self ._response = await self ._method (self ._request , metadata = self ._metadata )
176
+ self ._response = await self ._method (
177
+ self ._request ,
178
+ retry = self ._retry ,
179
+ timeout = self ._timeout ,
180
+ metadata = self ._metadata ,
181
+ )
145
182
yield self ._response
146
183
147
184
def __aiter__ (self ) -> AsyncIterator [index .Index ]:
0 commit comments