Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.
Parameters:
-
id
(Arn)
–
The ID or Amazon Resource Name (ARN) of the namespace that you want to delete.
Raises:
-
DuplicateRequest
–
The operation is already in progress.
-
InvalidInput
–
One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.
-
NamespaceNotFound
–
No namespace exists with the specified ID.
-
ResourceInUse
–
The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Example: Delete namespace
Example: Delete namespace
>>> await client.delete_namespace(id='ns-ylexjili4cdxy3xm')
Delete namespace using namespace ARN
Deletes a namespace using a namespace ARN instead of namespace ID, useful when working with shared namespaces.
>>> await client.delete_namespace(id='arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-abcd1234xmpl5678')
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
| async def delete_namespace(
self,
id: "capo_servicediscovery.types.arn.Arn",
*,
config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> (
"capo_servicediscovery.types.delete_namespace_response.DeleteNamespaceResponse"
):
"""<p>Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.</p>
Args:
id: <p>The ID or Amazon Resource Name (ARN) of the namespace that you want to delete.</p>
Raises:
capo_servicediscovery.errors.duplicate_request.DuplicateRequest: <p>The operation is already in progress.</p>
capo_servicediscovery.errors.invalid_input.InvalidInput: <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.</p>
capo_servicediscovery.errors.namespace_not_found.NamespaceNotFound: <p>No namespace exists with the specified ID.</p>
capo_servicediscovery.errors.resource_in_use.ResourceInUse: <p>The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.</p>
capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Example: Delete namespace
Example: Delete namespace
>>> await client.delete_namespace(id='ns-ylexjili4cdxy3xm')
Delete namespace using namespace ARN
Deletes a namespace using a namespace ARN instead of namespace ID, useful when working with shared namespaces.
>>> await client.delete_namespace(id='arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-abcd1234xmpl5678')
"""
async def _handler(
req: "AsyncOperationRequest[capo_servicediscovery.types.delete_namespace_request.DeleteNamespaceRequest]",
) -> AsyncOperationResponse[
"capo_servicediscovery.types.delete_namespace_response.DeleteNamespaceResponse"
]:
import capo_servicediscovery._operations.route53_auto_naming_v20170314.delete_namespace
(
output,
http_response,
) = await capo_servicediscovery._operations.route53_auto_naming_v20170314.delete_namespace.async_delete_namespace(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteNamespace")
)
input_: capo_servicediscovery.types.delete_namespace_request.DeleteNamespaceRequest = {
"id": id
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|