Gets information about custom key stores in the account and Region.
This operation is part of the custom key stores feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.
By default, this operation returns information about all custom key stores in the account and Region. To get only information about a particular custom key store, use either the CustomKeyStoreName or CustomKeyStoreId parameter (but not both).
To determine whether the custom key store is connected to its CloudHSM cluster or external key store proxy, use the ConnectionState element in the response. If an attempt to connect the custom key store failed, the ConnectionState value is FAILED and the ConnectionErrorCode element in the response indicates the cause of the failure. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.
Custom key stores have a DISCONNECTED connection state if the key store has never been connected or you used the DisconnectCustomKeyStore operation to disconnect it. Otherwise, the connection state is CONNECTED. If your custom key store connection state is CONNECTED but you are having trouble using it, verify that the backing store is active and available. For an CloudHSM key store, verify that the associated CloudHSM cluster is active and contains the minimum number of HSMs required for the operation, if any. For an external key store, verify that the external key store proxy and its associated external key manager are reachable and enabled.
For help repairing your CloudHSM key store, see the Troubleshooting CloudHSM key stores. For help repairing your external key store, see the Troubleshooting external key stores. Both topics are in the Key Management Service Developer Guide.
Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.
Required permissions: kms:DescribeCustomKeyStores (IAM policy)
Related operations:
Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.
Parameters:
-
custom_key_store_id
(Optional[CustomKeyStoreIdType], default:
None
)
–
Gets only information about the specified custom key store. Enter the key store ID.
By default, this operation gets information about all custom key stores in the account and Region. To limit the output to a particular custom key store, provide either the CustomKeyStoreId or CustomKeyStoreName parameter, but not both.
-
custom_key_store_name
(Optional[CustomKeyStoreNameType], default:
None
)
–
Gets only information about the specified custom key store. Enter the friendly name of the custom key store.
By default, this operation gets information about all custom key stores in the account and Region. To limit the output to a particular custom key store, provide either the CustomKeyStoreId or CustomKeyStoreName parameter, but not both.
-
limit
(Optional[LimitType], default:
None
)
–
Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.
-
marker
(Optional[MarkerType], default:
None
)
–
Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of NextMarker from the truncated response you just received.
Raises:
-
CustomKeyStoreNotFoundException
–
The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.
-
InvalidMarkerException
–
The request was rejected because the marker that specifies where pagination should next begin is not valid.
-
KMSInternalException
–
The request was rejected because an internal exception occurred. The request can be retried.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To get detailed information about custom key stores in the account and Region
This example gets detailed information about all AWS KMS custom key stores in an AWS account and Region. To get all key stores, do not enter a custom key store name or ID.
>>> client.describe_custom_key_stores()
Source code in docs_src/capo_kms/_services/kms.py
| def describe_custom_key_stores(
self,
*,
config_overrides: Optional[KMSClientConfig] = None,
custom_key_store_id: Optional[
"capo_kms.types.custom_key_store_id_type.CustomKeyStoreIdType"
] = None,
custom_key_store_name: Optional[
"capo_kms.types.custom_key_store_name_type.CustomKeyStoreNameType"
] = None,
limit: Optional["capo_kms.types.limit_type.LimitType"] = None,
marker: Optional["capo_kms.types.marker_type.MarkerType"] = None,
) -> "capo_kms.types.describe_custom_key_stores_response.DescribeCustomKeyStoresResponse":
"""<p>Gets information about <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html">custom key stores</a> in the account and Region.</p> <p> This operation is part of the custom key stores feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.</p> <p>By default, this operation returns information about all custom key stores in the account and Region. To get only information about a particular custom key store, use either the <code>CustomKeyStoreName</code> or <code>CustomKeyStoreId</code> parameter (but not both).</p> <p>To determine whether the custom key store is connected to its CloudHSM cluster or external key store proxy, use the <code>ConnectionState</code> element in the response. If an attempt to connect the custom key store failed, the <code>ConnectionState</code> value is <code>FAILED</code> and the <code>ConnectionErrorCode</code> element in the response indicates the cause of the failure. For help interpreting the <code>ConnectionErrorCode</code>, see <a>CustomKeyStoresListEntry</a>.</p> <p>Custom key stores have a <code>DISCONNECTED</code> connection state if the key store has never been connected or you used the <a>DisconnectCustomKeyStore</a> operation to disconnect it. Otherwise, the connection state is CONNECTED. If your custom key store connection state is <code>CONNECTED</code> but you are having trouble using it, verify that the backing store is active and available. For an CloudHSM key store, verify that the associated CloudHSM cluster is active and contains the minimum number of HSMs required for the operation, if any. For an external key store, verify that the external key store proxy and its associated external key manager are reachable and enabled.</p> <p> For help repairing your CloudHSM key store, see the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html">Troubleshooting CloudHSM key stores</a>. For help repairing your external key store, see the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/xks-troubleshooting.html">Troubleshooting external key stores</a>. Both topics are in the <i>Key Management Service Developer Guide</i>.</p> <p> <b>Cross-account use</b>: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.</p> <p> <b>Required permissions</b>: <a href="https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html">kms:DescribeCustomKeyStores</a> (IAM policy)</p> <p> <b>Related operations:</b> </p> <ul> <li> <p> <a>ConnectCustomKeyStore</a> </p> </li> <li> <p> <a>CreateCustomKeyStore</a> </p> </li> <li> <p> <a>DeleteCustomKeyStore</a> </p> </li> <li> <p> <a>DisconnectCustomKeyStore</a> </p> </li> <li> <p> <a>UpdateCustomKeyStore</a> </p> </li> </ul> <p> <b>Eventual consistency</b>: The KMS API follows an eventual consistency model. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/accessing-kms.html#programming-eventual-consistency">KMS eventual consistency</a>.</p>
Args:
custom_key_store_id: <p>Gets only information about the specified custom key store. Enter the key store ID.</p> <p>By default, this operation gets information about all custom key stores in the account and Region. To limit the output to a particular custom key store, provide either the <code>CustomKeyStoreId</code> or <code>CustomKeyStoreName</code> parameter, but not both.</p>
custom_key_store_name: <p>Gets only information about the specified custom key store. Enter the friendly name of the custom key store.</p> <p>By default, this operation gets information about all custom key stores in the account and Region. To limit the output to a particular custom key store, provide either the <code>CustomKeyStoreId</code> or <code>CustomKeyStoreName</code> parameter, but not both.</p>
limit: <p>Use this parameter to specify the maximum number of items to return. When this value is present, KMS does not return more than the specified number of items, but it might return fewer.</p>
marker: <p>Use this parameter in a subsequent request after you receive a response with truncated results. Set it to the value of <code>NextMarker</code> from the truncated response you just received.</p>
Raises:
capo_kms.errors.custom_key_store_not_found_exception.CustomKeyStoreNotFoundException: <p>The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.</p>
capo_kms.errors.invalid_marker_exception.InvalidMarkerException: <p>The request was rejected because the marker that specifies where pagination should next begin is not valid.</p>
capo_kms.errors.kms_internal_exception.KMSInternalException: <p>The request was rejected because an internal exception occurred. The request can be retried.</p>
capo_kms.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To get detailed information about custom key stores in the account and Region
This example gets detailed information about all AWS KMS custom key stores in an AWS account and Region. To get all key stores, do not enter a custom key store name or ID.
>>> client.describe_custom_key_stores()
"""
def _handler(
req: "OperationRequest[capo_kms.types.describe_custom_key_stores_request.DescribeCustomKeyStoresRequest]",
) -> OperationResponse[
"capo_kms.types.describe_custom_key_stores_response.DescribeCustomKeyStoresResponse"
]:
import capo_kms._operations.trent_service.describe_custom_key_stores
output, http_response = (
capo_kms._operations.trent_service.describe_custom_key_stores.describe_custom_key_stores(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_kms.types.describe_custom_key_stores_response.DescribeCustomKeyStoresResponse",
) -> dict[str, Any]:
import capo_kms.types.describe_custom_key_stores_response
return capo_kms.types.describe_custom_key_stores_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("DescribeCustomKeyStores", redact_output=_redact_output),
)
input_: capo_kms.types.describe_custom_key_stores_request.DescribeCustomKeyStoresRequest = {}
if custom_key_store_id is not None:
input_["custom_key_store_id"] = custom_key_store_id
if custom_key_store_name is not None:
input_["custom_key_store_name"] = custom_key_store_name
if limit is not None:
input_["limit"] = limit
if marker is not None:
input_["marker"] = marker
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|