16
16
17
17
PollingReturnType_co = TypeVar ("PollingReturnType_co" , covariant = True )
18
18
19
- # The correct success response should be "Succeeded", but this has already shipped.
20
- _FINISHED = frozenset (["success" , "canceled" , "failed" ])
19
+ # The correct success response should be "Succeeded", but this has already shipped. Handle "Succeeded" just in case.
20
+ _FINISHED = frozenset (["succeeded" , " success" , "canceled" , "failed" ])
21
21
22
22
23
23
def _finished (status ):
@@ -71,6 +71,27 @@ def parse_resource(
71
71
return None # type: ignore
72
72
73
73
74
+ class NoPollingMixin (LROBasePolling ):
75
+ def finished (self ) -> bool :
76
+ """Is this polling finished?
77
+
78
+ :rtype: bool
79
+ :return: Whether this polling is finished
80
+ """
81
+ return True
82
+
83
+ def status (self ) -> str :
84
+ """Return the current status.
85
+
86
+ :rtype: str
87
+ :return: The current status
88
+ """
89
+ return "succeeded"
90
+
91
+ def result (self , * args , ** kwargs ):
92
+ return self .resource ()
93
+
94
+
74
95
class SecurityDomainDownloadPolling (OperationResourcePolling ):
75
96
def __init__ (self ) -> None :
76
97
self ._polling_url = ""
@@ -121,7 +142,9 @@ def get_long_running_output(pipeline_response):
121
142
response_headers ["Azure-AsyncOperation" ] = deserializer ._deserialize ( # pylint: disable=protected-access
122
143
"str" , response .headers .get ("Azure-AsyncOperation" )
123
144
)
124
- response_headers ["Retry-After" ] = deserializer ._deserialize ("int" , response .headers .get ("Retry-After" )) # pylint: disable=protected-access
145
+ response_headers ["Retry-After" ] = deserializer ._deserialize (
146
+ "int" , response .headers .get ("Retry-After" )
147
+ ) # pylint: disable=protected-access
125
148
126
149
return _deserialize (SecurityDomainObject , response .json ())
127
150
@@ -137,6 +160,10 @@ def resource(self) -> SecurityDomainObject:
137
160
return cast (SecurityDomainObject , self .parse_resource (self ._initial_response ))
138
161
139
162
163
+ class SecurityDomainDownloadNoPolling (SecurityDomainDownloadPollingMethod , NoPollingMixin ):
164
+ pass
165
+
166
+
140
167
class SecurityDomainUploadPolling (SecurityDomainDownloadPolling ):
141
168
def set_initial_status (self , pipeline_response : "PipelineResponse" ) -> str :
142
169
response : HttpResponse = pipeline_response .http_response
@@ -175,7 +202,9 @@ def get_long_running_output(pipeline_response):
175
202
response_headers ["Azure-AsyncOperation" ] = deserializer ._deserialize ( # pylint: disable=protected-access
176
203
"str" , response .headers .get ("Azure-AsyncOperation" )
177
204
)
178
- response_headers ["Retry-After" ] = deserializer ._deserialize ("int" , response .headers .get ("Retry-After" )) # pylint: disable=protected-access
205
+ response_headers ["Retry-After" ] = deserializer ._deserialize (
206
+ "int" , response .headers .get ("Retry-After" )
207
+ ) # pylint: disable=protected-access
179
208
180
209
return _deserialize (SecurityDomainOperationStatus , response .json ())
181
210
@@ -188,3 +217,13 @@ def resource(self) -> SecurityDomainOperationStatus:
188
217
:return: The built resource.
189
218
"""
190
219
return cast (SecurityDomainOperationStatus , self .parse_resource (self ._pipeline_response ))
220
+
221
+
222
+ class SecurityDomainUploadNoPolling (SecurityDomainUploadPollingMethod , NoPollingMixin ):
223
+ def resource (self ) -> SecurityDomainOperationStatus :
224
+ """Return the built resource.
225
+
226
+ :rtype: any
227
+ :return: The built resource.
228
+ """
229
+ return cast (SecurityDomainOperationStatus , self .parse_resource (self ._initial_response ))
0 commit comments