Skip to content

get_instance_tpm_ek_pub async

get_instance_tpm_ek_pub(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    instance_id: Optional[InstanceId] = None,
    key_type: Optional[EkPubKeyType] = None,
    key_format: Optional[EkPubKeyFormat] = None,
    dry_run: Optional[Boolean] = None,
) -> GetInstanceTpmEkPubResult

Gets the public endorsement key associated with the Nitro Trusted Platform Module (NitroTPM) for the specified instance.

Parameters:

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the instance for which to get the public endorsement key.

  • key_type (Optional[EkPubKeyType], default: None ) –

    The required public endorsement key type.

  • key_format (Optional[EkPubKeyFormat], default: None ) –

    The required public endorsement key format. Specify der for a DER-encoded public key that is compatible with OpenSSL. Specify tpmt for a TPM 2.0 format that is compatible with tpm2-tools. The returned key is base64 encoded.

  • dry_run (Optional[Boolean], default: None ) –

    Specify this parameter to verify whether the request will succeed, without actually making the request. If the request will succeed, the response is DryRunOperation. Otherwise, the response is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def get_instance_tpm_ek_pub(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    key_type: Optional["capo_ec2.types.ek_pub_key_type.EkPubKeyType"] = None,
    key_format: Optional["capo_ec2.types.ek_pub_key_format.EkPubKeyFormat"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.get_instance_tpm_ek_pub_result.GetInstanceTpmEkPubResult":
    """<p>Gets the public endorsement key associated with the Nitro Trusted Platform Module (NitroTPM) for the specified instance.</p>

    Args:
        instance_id: <p>The ID of the instance for which to get the public endorsement key.</p>
        key_type: <p>The required public endorsement key type.</p>
        key_format: <p>The required public endorsement key format. Specify <code>der</code> for a DER-encoded public key that is compatible with OpenSSL. Specify <code>tpmt</code> for a TPM 2.0 format that is compatible with tpm2-tools. The returned key is base64 encoded.</p>
        dry_run: <p>Specify this parameter to verify whether the request will succeed, without actually making the request. If the request will succeed, the response is <code>DryRunOperation</code>. Otherwise, the response is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.get_instance_tpm_ek_pub_request.GetInstanceTpmEkPubRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.get_instance_tpm_ek_pub_result.GetInstanceTpmEkPubResult"
    ]:
        import capo_ec2._operations.amazon_ec2.get_instance_tpm_ek_pub

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.get_instance_tpm_ek_pub.async_get_instance_tpm_ek_pub(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_ec2.types.get_instance_tpm_ek_pub_result.GetInstanceTpmEkPubResult",
    ) -> dict[str, Any]:
        import capo_ec2.types.get_instance_tpm_ek_pub_result

        return capo_ec2.types.get_instance_tpm_ek_pub_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetInstanceTpmEkPub", redact_output=_redact_output),
    )
    input_: capo_ec2.types.get_instance_tpm_ek_pub_request.GetInstanceTpmEkPubRequest = {}
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if key_type is not None:
        input_["key_type"] = key_type
    if key_format is not None:
        input_["key_format"] = key_format
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output