updateDestination method

Future<void> updateDestination({
  1. required String currentDeliveryStreamVersionId,
  2. required String deliveryStreamName,
  3. required String destinationId,
  4. AmazonOpenSearchServerlessDestinationUpdate? amazonOpenSearchServerlessDestinationUpdate,
  5. AmazonopensearchserviceDestinationUpdate? amazonopensearchserviceDestinationUpdate,
  6. ElasticsearchDestinationUpdate? elasticsearchDestinationUpdate,
  7. ExtendedS3DestinationUpdate? extendedS3DestinationUpdate,
  8. HttpEndpointDestinationUpdate? httpEndpointDestinationUpdate,
  9. IcebergDestinationUpdate? icebergDestinationUpdate,
  10. RedshiftDestinationUpdate? redshiftDestinationUpdate,
  11. S3DestinationUpdate? s3DestinationUpdate,
  12. SnowflakeDestinationUpdate? snowflakeDestinationUpdate,
  13. SplunkDestinationUpdate? splunkDestinationUpdate,
})

Updates the specified destination of the specified Firehose stream.

Use this operation to change the destination type (for example, to replace the Amazon S3 destination with Amazon Redshift) or change the parameters associated with a destination (for example, to change the bucket name of the Amazon S3 destination). The update might not occur immediately. The target Firehose stream remains active while the configurations are updated, so data writes to the Firehose stream can continue during this process. The updated configurations are usually effective within a few minutes.

Switching between Amazon OpenSearch Service and other services is not supported. For an Amazon OpenSearch Service destination, you can only update to another Amazon OpenSearch Service destination.

If the destination type is the same, Firehose merges the configuration parameters specified with the destination configuration that already exists on the delivery stream. If any of the parameters are not specified in the call, the existing values are retained. For example, in the Amazon S3 destination, if EncryptionConfiguration is not specified, then the existing EncryptionConfiguration is maintained on the destination.

If the destination type is not the same, for example, changing the destination from Amazon S3 to Amazon Redshift, Firehose does not merge any parameters. In this case, all parameters must be specified.

Firehose uses CurrentDeliveryStreamVersionId to avoid race conditions and conflicting merges. This is a required field, and the service updates the configuration only if the existing configuration has a version ID that matches. After the update is applied successfully, the version ID is updated, and can be retrieved using DescribeDeliveryStream. Use the new version ID to set CurrentDeliveryStreamVersionId in the next call.

May throw ConcurrentModificationException. May throw InvalidArgumentException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter currentDeliveryStreamVersionId : Obtain this value from the VersionId result of DeliveryStreamDescription. This value is required, and helps the service perform conditional operations. For example, if there is an interleaving update and this value is null, then the update destination fails. After the update is successful, the VersionId value is updated. The service then performs a merge of the old configuration with the new configuration.

Parameter deliveryStreamName : The name of the Firehose stream.

Parameter destinationId : The ID of the destination.

Parameter amazonOpenSearchServerlessDestinationUpdate : Describes an update for a destination in the Serverless offering for Amazon OpenSearch Service.

Parameter amazonopensearchserviceDestinationUpdate : Describes an update for a destination in Amazon OpenSearch Service.

Parameter elasticsearchDestinationUpdate : Describes an update for a destination in Amazon OpenSearch Service.

Parameter extendedS3DestinationUpdate : Describes an update for a destination in Amazon S3.

Parameter httpEndpointDestinationUpdate : Describes an update to the specified HTTP endpoint destination.

Parameter icebergDestinationUpdate : Describes an update for a destination in Apache Iceberg Tables.

Parameter redshiftDestinationUpdate : Describes an update for a destination in Amazon Redshift.

Parameter s3DestinationUpdate : [Deprecated] Describes an update for a destination in Amazon S3.

Parameter snowflakeDestinationUpdate : Update to the Snowflake destination configuration settings.

Parameter splunkDestinationUpdate : Describes an update for a destination in Splunk.

Implementation

Future<void> updateDestination({
  required String currentDeliveryStreamVersionId,
  required String deliveryStreamName,
  required String destinationId,
  AmazonOpenSearchServerlessDestinationUpdate?
      amazonOpenSearchServerlessDestinationUpdate,
  AmazonopensearchserviceDestinationUpdate?
      amazonopensearchserviceDestinationUpdate,
  ElasticsearchDestinationUpdate? elasticsearchDestinationUpdate,
  ExtendedS3DestinationUpdate? extendedS3DestinationUpdate,
  HttpEndpointDestinationUpdate? httpEndpointDestinationUpdate,
  IcebergDestinationUpdate? icebergDestinationUpdate,
  RedshiftDestinationUpdate? redshiftDestinationUpdate,
  S3DestinationUpdate? s3DestinationUpdate,
  SnowflakeDestinationUpdate? snowflakeDestinationUpdate,
  SplunkDestinationUpdate? splunkDestinationUpdate,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Firehose_20150804.UpdateDestination'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CurrentDeliveryStreamVersionId': currentDeliveryStreamVersionId,
      'DeliveryStreamName': deliveryStreamName,
      'DestinationId': destinationId,
      if (amazonOpenSearchServerlessDestinationUpdate != null)
        'AmazonOpenSearchServerlessDestinationUpdate':
            amazonOpenSearchServerlessDestinationUpdate,
      if (amazonopensearchserviceDestinationUpdate != null)
        'AmazonopensearchserviceDestinationUpdate':
            amazonopensearchserviceDestinationUpdate,
      if (elasticsearchDestinationUpdate != null)
        'ElasticsearchDestinationUpdate': elasticsearchDestinationUpdate,
      if (extendedS3DestinationUpdate != null)
        'ExtendedS3DestinationUpdate': extendedS3DestinationUpdate,
      if (httpEndpointDestinationUpdate != null)
        'HttpEndpointDestinationUpdate': httpEndpointDestinationUpdate,
      if (icebergDestinationUpdate != null)
        'IcebergDestinationUpdate': icebergDestinationUpdate,
      if (redshiftDestinationUpdate != null)
        'RedshiftDestinationUpdate': redshiftDestinationUpdate,
      if (s3DestinationUpdate != null)
        'S3DestinationUpdate': s3DestinationUpdate,
      if (snowflakeDestinationUpdate != null)
        'SnowflakeDestinationUpdate': snowflakeDestinationUpdate,
      if (splunkDestinationUpdate != null)
        'SplunkDestinationUpdate': splunkDestinationUpdate,
    },
  );
}