updateDestination method

Future<void> updateDestination({
  1. required String currentDeliveryStreamVersionId,
  2. required String deliveryStreamName,
  3. required String destinationId,
  4. ElasticsearchDestinationUpdate? elasticsearchDestinationUpdate,
  5. ExtendedS3DestinationUpdate? extendedS3DestinationUpdate,
  6. HttpEndpointDestinationUpdate? httpEndpointDestinationUpdate,
  7. RedshiftDestinationUpdate? redshiftDestinationUpdate,
  8. S3DestinationUpdate? s3DestinationUpdate,
  9. SplunkDestinationUpdate? splunkDestinationUpdate,
})

Updates the specified destination of the specified delivery 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 delivery stream remains active while the configurations are updated, so data writes to the delivery stream can continue during this process. The updated configurations are usually effective within a few minutes.

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

If the destination type is the same, Kinesis Data 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, Kinesis Data Firehose does not merge any parameters. In this case, all parameters must be specified.

Kinesis Data 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 InvalidArgumentException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ConcurrentModificationException.

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 delivery stream.

Parameter destinationId : The ID of the destination.

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

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

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

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

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

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

Implementation

Future<void> updateDestination({
  required String currentDeliveryStreamVersionId,
  required String deliveryStreamName,
  required String destinationId,
  ElasticsearchDestinationUpdate? elasticsearchDestinationUpdate,
  ExtendedS3DestinationUpdate? extendedS3DestinationUpdate,
  HttpEndpointDestinationUpdate? httpEndpointDestinationUpdate,
  RedshiftDestinationUpdate? redshiftDestinationUpdate,
  S3DestinationUpdate? s3DestinationUpdate,
  SplunkDestinationUpdate? splunkDestinationUpdate,
}) async {
  ArgumentError.checkNotNull(
      currentDeliveryStreamVersionId, 'currentDeliveryStreamVersionId');
  _s.validateStringLength(
    'currentDeliveryStreamVersionId',
    currentDeliveryStreamVersionId,
    1,
    50,
    isRequired: true,
  );
  ArgumentError.checkNotNull(deliveryStreamName, 'deliveryStreamName');
  _s.validateStringLength(
    'deliveryStreamName',
    deliveryStreamName,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(destinationId, 'destinationId');
  _s.validateStringLength(
    'destinationId',
    destinationId,
    1,
    100,
    isRequired: true,
  );
  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 (elasticsearchDestinationUpdate != null)
        'ElasticsearchDestinationUpdate': elasticsearchDestinationUpdate,
      if (extendedS3DestinationUpdate != null)
        'ExtendedS3DestinationUpdate': extendedS3DestinationUpdate,
      if (httpEndpointDestinationUpdate != null)
        'HttpEndpointDestinationUpdate': httpEndpointDestinationUpdate,
      if (redshiftDestinationUpdate != null)
        'RedshiftDestinationUpdate': redshiftDestinationUpdate,
      if (s3DestinationUpdate != null)
        'S3DestinationUpdate': s3DestinationUpdate,
      if (splunkDestinationUpdate != null)
        'SplunkDestinationUpdate': splunkDestinationUpdate,
    },
  );
}