Deletes the specified API key. The API key must have been deactivated more than 90 days previously.
For more information, see Use API keys to authenticate in the Amazon Location Service Developer Guide.
Parameters:
-
key_name
(ResourceName)
–
The name of the API key to delete.
-
force_delete
(Optional[bool], default:
None
)
–
ForceDelete bypasses an API key's expiry conditions and deletes the key. Set the parameter true to delete the key or to false to not preemptively delete the API key.
Valid values: true, or false.
Required: No
This action is irreversible. Only use ForceDelete if you are certain the key is no longer in use.
Raises:
Source code in docs_src/capo_location/_services/location.py
| def delete_key(
self,
key_name: "capo_location.types.resource_name.ResourceName",
*,
config_overrides: Optional[LocationClientConfig] = None,
force_delete: Optional[bool] = None,
) -> "capo_location.types.delete_key_response.DeleteKeyResponse":
"""<p>Deletes the specified API key. The API key must have been deactivated more than 90 days previously.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html">Use API keys to authenticate</a> in the <i>Amazon Location Service Developer Guide</i>.</p>
Args:
key_name: <p>The name of the API key to delete.</p>
force_delete: <p>ForceDelete bypasses an API key's expiry conditions and deletes the key. Set the parameter <code>true</code> to delete the key or to <code>false</code> to not preemptively delete the API key.</p> <p>Valid values: <code>true</code>, or <code>false</code>.</p> <p>Required: No</p> <note> <p>This action is irreversible. Only use ForceDelete if you are certain the key is no longer in use.</p> </note>
Raises:
capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
capo_location.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource that you've entered was not found in your AWS account.</p>
capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_location.types.delete_key_request.DeleteKeyRequest]",
) -> OperationResponse[
"capo_location.types.delete_key_response.DeleteKeyResponse"
]:
import capo_location._operations.location_service.delete_key
output, http_response = (
capo_location._operations.location_service.delete_key.delete_key(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteKey")
)
input_: capo_location.types.delete_key_request.DeleteKeyRequest = {
"key_name": key_name
}
if force_delete is not None:
input_["force_delete"] = force_delete
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|