Skip to content

update_encryption_configuration async

update_encryption_configuration(
    encryption_type: EncryptionType,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    kms_access_role_arn: Optional[KmsAccessRoleArn] = None,
) -> UpdateEncryptionConfigurationResponse

Updates the encryption configuration. By default, Amazon Web Services IoT Core encrypts your data at rest using Amazon Web Services owned keys. Amazon Web Services IoT Core also supports symmetric customer managed keys from Key Management Service (KMS). With customer managed keys, you create, own, and manage the KMS keys in your Amazon Web Services account.

Before using this API, you must set up permissions for Amazon Web Services IoT Core to access KMS. For more information, see Data encryption at rest in the Amazon Web Services IoT Core Developer Guide.

Parameters:

  • encryption_type (EncryptionType) –

    The type of the KMS key.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The ARN of the customer managedKMS key.

  • kms_access_role_arn (Optional[KmsAccessRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role assumed by Amazon Web Services IoT Core to call KMS on behalf of the customer.

Raises:

Examples:

UpdateEncryptionConfiguration example This operation updates the encryption configuration.

>>> await client.update_encryption_configuration(encryption_type='CUSTOMER_MANAGED_KMS_KEY', kms_key_arn='arn:aws:iam:us-west-2:111122223333:role/myrole', kms_access_role_arn='arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab')
Source code in docs_src/capo_iot/_services/async_io_t.py
async def update_encryption_configuration(
    self,
    encryption_type: "capo_iot.types.encryption_type.EncryptionType",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    kms_key_arn: Optional["capo_iot.types.kms_key_arn.KmsKeyArn"] = None,
    kms_access_role_arn: Optional[
        "capo_iot.types.kms_access_role_arn.KmsAccessRoleArn"
    ] = None,
) -> "capo_iot.types.update_encryption_configuration_response.UpdateEncryptionConfigurationResponse":
    """<p>Updates the encryption configuration. By default, Amazon Web Services IoT Core encrypts your data at rest using Amazon Web Services owned keys. Amazon Web Services IoT Core also supports symmetric customer managed keys from Key Management Service (KMS). With customer managed keys, you create, own, and manage the KMS keys in your Amazon Web Services account. </p> <p>Before using this API, you must set up permissions for Amazon Web Services IoT Core to access KMS. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/encryption-at-rest.html">Data encryption at rest</a> in the <i>Amazon Web Services IoT Core Developer Guide</i>.</p>

    Args:
        encryption_type: <p>The type of the KMS key.</p>
        kms_key_arn: <p>The ARN of the customer managedKMS key.</p>
        kms_access_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role assumed by Amazon Web Services IoT Core to call KMS on behalf of the customer.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        UpdateEncryptionConfiguration example
        This operation updates the encryption configuration.

        >>> await client.update_encryption_configuration(encryption_type='CUSTOMER_MANAGED_KMS_KEY', kms_key_arn='arn:aws:iam:us-west-2:111122223333:role/myrole', kms_access_role_arn='arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.update_encryption_configuration_request.UpdateEncryptionConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.update_encryption_configuration_response.UpdateEncryptionConfigurationResponse"
    ]:
        import capo_iot._operations.aws_iot_service.update_encryption_configuration

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.update_encryption_configuration.async_update_encryption_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateEncryptionConfiguration")
    )
    input_: capo_iot.types.update_encryption_configuration_request.UpdateEncryptionConfigurationRequest = {
        "encryption_type": encryption_type
    }
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if kms_access_role_arn is not None:
        input_["kms_access_role_arn"] = kms_access_role_arn

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