Deletes the specified portfolio.
You cannot delete a portfolio if it was shared with you or if it has associated products, users, constraints, or shared accounts.
A delegated admin is authorized to invoke this command.
Parameters:
-
accept_language
(Optional[AcceptLanguage], default:
None
)
–
The language code.
-
jp - Japanese
-
zh - Chinese
-
id
(Id)
–
The portfolio identifier.
Raises:
-
InvalidParametersException
–
One or more parameters provided to the operation are not valid.
-
ResourceInUseException
–
A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
-
ResourceNotFoundException
–
The specified resource was not found.
-
TagOptionNotMigratedException
–
An operation requiring TagOptions failed because the TagOptions migration process has not been performed for this account. Use the Amazon Web Services Management Console to perform the migration process before retrying the operation.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_service_catalog/_services/async_service_catalog.py
| async def delete_portfolio(
self,
id: "capo_service_catalog.types.id.Id",
*,
config_overrides: Optional[AsyncServiceCatalogClientConfig] = None,
accept_language: Optional[
"capo_service_catalog.types.accept_language.AcceptLanguage"
] = None,
) -> "capo_service_catalog.types.delete_portfolio_output.DeletePortfolioOutput":
"""<p>Deletes the specified portfolio.</p> <p>You cannot delete a portfolio if it was shared with you or if it has associated products, users, constraints, or shared accounts.</p> <p>A delegated admin is authorized to invoke this command.</p>
Args:
accept_language: <p>The language code.</p> <ul> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - Chinese</p> </li> </ul>
id: <p>The portfolio identifier.</p>
Raises:
capo_service_catalog.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the operation are not valid.</p>
capo_service_catalog.errors.resource_in_use_exception.ResourceInUseException: <p>A resource that is currently in use. Ensure that the resource is not in use and retry the operation.</p>
capo_service_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
capo_service_catalog.errors.tag_option_not_migrated_exception.TagOptionNotMigratedException: <p>An operation requiring TagOptions failed because the TagOptions migration process has not been performed for this account. Use the Amazon Web Services Management Console to perform the migration process before retrying the operation.</p>
capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_service_catalog.types.delete_portfolio_input.DeletePortfolioInput]",
) -> AsyncOperationResponse[
"capo_service_catalog.types.delete_portfolio_output.DeletePortfolioOutput"
]:
import capo_service_catalog._operations.aws242_service_catalog_service.delete_portfolio
(
output,
http_response,
) = await capo_service_catalog._operations.aws242_service_catalog_service.delete_portfolio.async_delete_portfolio(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeletePortfolio")
)
input_: capo_service_catalog.types.delete_portfolio_input.DeletePortfolioInput = {
"id": id
}
if accept_language is not None:
input_["accept_language"] = accept_language
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|