Skip to content

list_public_keys

list_public_keys(
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
    start_time: Optional[Date] = None,
    end_time: Optional[Date] = None,
    next_token: Optional[String] = None,
) -> ListPublicKeysResponse

Returns all public keys whose private keys were used to sign the digest files within the specified time range. The public key is needed to validate digest files that were signed with its corresponding private key.

CloudTrail uses different private and public key pairs per Region. Each digest file is signed with a private key unique to its Region. When you validate a digest file from a specific Region, you must look in the same Region for its corresponding public key.

Parameters:

  • start_time (Optional[Date], default: None ) –

    Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.

  • end_time (Optional[Date], default: None ) –

    Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.

  • next_token (Optional[String], default: None ) –

    Reserved for future use.

Raises:

Source code in docs_src/capo_cloudtrail/_services/cloud_trail.py
def list_public_keys(
    self,
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
    start_time: Optional["capo_cloudtrail.types.date.Date"] = None,
    end_time: Optional["capo_cloudtrail.types.date.Date"] = None,
    next_token: Optional["capo_cloudtrail.types.string.String"] = None,
) -> "capo_cloudtrail.types.list_public_keys_response.ListPublicKeysResponse":
    """<p>Returns all public keys whose private keys were used to sign the digest files within the specified time range. The public key is needed to validate digest files that were signed with its corresponding private key.</p> <note> <p>CloudTrail uses different private and public key pairs per Region. Each digest file is signed with a private key unique to its Region. When you validate a digest file from a specific Region, you must look in the same Region for its corresponding public key.</p> </note>

    Args:
        start_time: <p>Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.</p>
        end_time: <p>Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.</p>
        next_token: <p>Reserved for future use.</p>

    Raises:
        capo_cloudtrail.errors.invalid_time_range_exception.InvalidTimeRangeException: <p>Occurs if the timestamp values are not valid. Either the start time occurs after the end time, or the time range is outside the range of possible values.</p>
        capo_cloudtrail.errors.invalid_token_exception.InvalidTokenException: <p>Reserved for future use.</p>
        capo_cloudtrail.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>This exception is thrown when the requested operation is not permitted.</p>
        capo_cloudtrail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>This exception is thrown when the requested operation is not supported.</p>
        capo_cloudtrail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudtrail.types.list_public_keys_request.ListPublicKeysRequest]",
    ) -> OperationResponse[
        "capo_cloudtrail.types.list_public_keys_response.ListPublicKeysResponse"
    ]:
        import capo_cloudtrail._operations.cloud_trail_20131101.list_public_keys

        output, http_response = (
            capo_cloudtrail._operations.cloud_trail_20131101.list_public_keys.list_public_keys(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPublicKeys")
    )
    input_: capo_cloudtrail.types.list_public_keys_request.ListPublicKeysRequest = {}
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output