Use this operation to delete a workforce.
If you want to create a new workforce in an Amazon Web Services Region where a workforce already exists, use this operation to delete the existing workforce and then use CreateWorkforce to create a new workforce.
If a private workforce contains one or more work teams, you must use the DeleteWorkteam operation to delete all work teams before you delete the workforce. If you try to delete a workforce that contains one or more work teams, you will receive a ResourceInUse error.
Parameters:
Raises:
Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
| async def delete_workforce(
self,
*,
config_overrides: Optional[AsyncSageMakerClientConfig] = None,
workforce_name: Optional[
"capo_sagemaker.types.workforce_name.WorkforceName"
] = None,
) -> "capo_sagemaker.types.delete_workforce_response.DeleteWorkforceResponse":
"""<p>Use this operation to delete a workforce.</p> <p>If you want to create a new workforce in an Amazon Web Services Region where a workforce already exists, use this operation to delete the existing workforce and then use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateWorkforce.html">CreateWorkforce</a> to create a new workforce.</p> <important> <p>If a private workforce contains one or more work teams, you must use the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DeleteWorkteam.html">DeleteWorkteam</a> operation to delete all work teams before you delete the workforce. If you try to delete a workforce that contains one or more work teams, you will receive a <code>ResourceInUse</code> error.</p> </important>
Args:
workforce_name: <p>The name of the workforce.</p>
Raises:
capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sagemaker.types.delete_workforce_request.DeleteWorkforceRequest]",
) -> AsyncOperationResponse[
"capo_sagemaker.types.delete_workforce_response.DeleteWorkforceResponse"
]:
import capo_sagemaker._operations.sage_maker.delete_workforce
(
output,
http_response,
) = await capo_sagemaker._operations.sage_maker.delete_workforce.async_delete_workforce(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteWorkforce")
)
input_: capo_sagemaker.types.delete_workforce_request.DeleteWorkforceRequest = {}
if workforce_name is not None:
input_["workforce_name"] = workforce_name
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|