putEncryptionConfiguration method

Future<PutEncryptionConfigurationResponse> putEncryptionConfiguration({
  1. required EncryptionType encryptionType,
  2. String? kmsKeyId,
})

Creates or updates the encryption configuration. Amazon Web Services IoT FleetWise can encrypt your data and resources using an Amazon Web Services managed key. Or, you can use a KMS key that you own and manage. For more information, see Data encryption in the Amazon Web Services IoT FleetWise Developer Guide.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter encryptionType : The type of encryption. Choose KMS_BASED_ENCRYPTION to use a KMS key or FLEETWISE_DEFAULT_ENCRYPTION to use an Amazon Web Services managed key.

Parameter kmsKeyId : The ID of the KMS key that is used for encryption.

Implementation

Future<PutEncryptionConfigurationResponse> putEncryptionConfiguration({
  required EncryptionType encryptionType,
  String? kmsKeyId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.PutEncryptionConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'encryptionType': encryptionType.value,
      if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
    },
  );

  return PutEncryptionConfigurationResponse.fromJson(jsonResponse.body);
}