Skip to content

Commit 4ae3f55

Browse files
committed
Upload LROPoller[None]
1 parent 139f484 commit 4ae3f55

5 files changed

Lines changed: 19 additions & 22 deletions

File tree

sdk/keyvault/azure-keyvault-securitydomain/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,12 @@ assert transfer_key.transfer_key_jwk
138138

139139
`begin_upload` can be used by a `SecurityDomainClient` to restore a different managed HSM with a security domain, for
140140
example for disaster recovery. Like the download operation this will activate a provisioned managed HSM, but the poller
141-
will return the activation status instead of the security domain object.
141+
will return None if successful (and an error if unsuccessful) instead of the security domain object.
142142

143143
```python
144144
from azure.keyvault.securitydomain.models import SecurityDomainOperationStatus
145145

146146
result: SecurityDomainOperationStatus = upload_client.begin_upload(security_domain=result).result()
147-
assert result.status.lower() == "success"
148147
print("The managed HSM has been successfully restored with the security domain.")
149148
```
150149

sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/_internal/async_polling.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,15 @@ def initialize(
146146
:raises: HttpResponseError if initial status is incorrect LRO state
147147
"""
148148

149-
def get_long_running_output(pipeline_response):
150-
response = pipeline_response.http_response
151-
return _deserialize(SecurityDomainOperationStatus, response.json())
149+
def get_long_running_output(_):
150+
return None
152151

153152
super().initialize(client, initial_response, get_long_running_output)
154153

155-
def resource(self) -> SecurityDomainOperationStatus:
154+
def resource(self) -> None:
156155
"""Return the built resource.
157156
158157
:rtype: any
159158
:return: The built resource.
160159
"""
161-
return cast(SecurityDomainOperationStatus, self.parse_resource(self._pipeline_response))
160+
return None

sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/_internal/polling.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,15 @@ def initialize(
186186
:raises: HttpResponseError if initial status is incorrect LRO state
187187
"""
188188

189-
def get_long_running_output(pipeline_response):
190-
response = pipeline_response.http_response
191-
return _deserialize(SecurityDomainOperationStatus, response.json())
189+
def get_long_running_output(_):
190+
return None
192191

193192
super().initialize(client, initial_response, get_long_running_output)
194193

195-
def resource(self) -> SecurityDomainOperationStatus:
194+
def resource(self) -> None:
196195
"""Return the built resource.
197196
198197
:rtype: any
199198
:return: The built resource.
200199
"""
201-
return cast(SecurityDomainOperationStatus, self.parse_resource(self._pipeline_response))
200+
return None

sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def begin_upload(
195195
*,
196196
content_type: str = "application/json",
197197
**kwargs: Any,
198-
) -> LROPoller[SecurityDomainOperationStatus]: ...
198+
) -> LROPoller[None]: ...
199199

200200
@overload
201201
@distributed_trace
@@ -205,7 +205,7 @@ def begin_upload(
205205
*,
206206
content_type: str = "application/json",
207207
**kwargs: Any,
208-
) -> LROPoller[SecurityDomainOperationStatus]: ...
208+
) -> LROPoller[None]: ...
209209

210210
@overload
211211
@distributed_trace
@@ -215,7 +215,7 @@ def begin_upload(
215215
*,
216216
content_type: str = "application/json",
217217
**kwargs: Any,
218-
) -> LROPoller[SecurityDomainOperationStatus]: ...
218+
) -> LROPoller[None]: ...
219219

220220
@distributed_trace
221221
def begin_upload(
@@ -224,7 +224,7 @@ def begin_upload(
224224
*,
225225
content_type: str = "application/json",
226226
**kwargs: Any,
227-
) -> LROPoller[SecurityDomainOperationStatus]:
227+
) -> LROPoller[None]:
228228
"""Restore the provided Security Domain.
229229
230230
:param security_domain: The Security Domain to be restored. Required in one of the following types:
@@ -244,7 +244,7 @@ def begin_upload(
244244
polling_method = SecurityDomainUploadPollingMethod(
245245
lro_algorithms=[SecurityDomainUploadPolling()], timeout=delay
246246
)
247-
return super()._begin_upload(
247+
return super()._begin_upload( # type: ignore[return-value]
248248
security_domain,
249249
content_type=content_type,
250250
polling=polling_method,

sdk/keyvault/azure-keyvault-securitydomain/azure/keyvault/securitydomain/aio/_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def begin_upload(
155155
*,
156156
content_type: str = "application/json",
157157
**kwargs: Any,
158-
) -> AsyncLROPoller[SecurityDomainOperationStatus]: ...
158+
) -> AsyncLROPoller[None]: ...
159159

160160
@overload
161161
@distributed_trace_async
@@ -165,7 +165,7 @@ async def begin_upload(
165165
*,
166166
content_type: str = "application/json",
167167
**kwargs: Any,
168-
) -> AsyncLROPoller[SecurityDomainOperationStatus]: ...
168+
) -> AsyncLROPoller[None]: ...
169169

170170
@overload
171171
@distributed_trace_async
@@ -175,7 +175,7 @@ async def begin_upload(
175175
*,
176176
content_type: str = "application/json",
177177
**kwargs: Any,
178-
) -> AsyncLROPoller[SecurityDomainOperationStatus]: ...
178+
) -> AsyncLROPoller[None]: ...
179179

180180
@distributed_trace_async
181181
async def begin_upload(
@@ -184,7 +184,7 @@ async def begin_upload(
184184
*,
185185
content_type: str = "application/json",
186186
**kwargs: Any,
187-
) -> AsyncLROPoller[SecurityDomainOperationStatus]:
187+
) -> AsyncLROPoller[None]:
188188
"""Restore the provided Security Domain.
189189
190190
:param security_domain: The Security Domain to be restored. Required in one of the following types:
@@ -204,7 +204,7 @@ async def begin_upload(
204204
polling_method = AsyncSecurityDomainUploadPollingMethod(
205205
lro_algorithms=[SecurityDomainUploadPolling()], timeout=delay
206206
)
207-
return await super()._begin_upload(
207+
return await super()._begin_upload( # type: ignore[return-value]
208208
security_domain,
209209
content_type=content_type,
210210
polling=polling_method,

0 commit comments

Comments
 (0)