updateApplication method

Future<UpdateApplicationResponse> updateApplication({
  1. required String applicationName,
  2. required int currentApplicationVersionId,
  3. ApplicationConfigurationUpdate? applicationConfigurationUpdate,
  4. List<CloudWatchLoggingOptionUpdate>? cloudWatchLoggingOptionUpdates,
  5. RunConfigurationUpdate? runConfigurationUpdate,
  6. String? serviceExecutionRoleUpdate,
})

Updates an existing Kinesis Data Analytics application. Using this operation, you can update application code, input configuration, and output configuration.

Kinesis Data Analytics updates the ApplicationVersionId each time you update your application.

May throw CodeValidationException. May throw ResourceNotFoundException. May throw ResourceInUseException. May throw InvalidArgumentException. May throw ConcurrentModificationException. May throw InvalidRequestException. May throw InvalidApplicationConfigurationException.

Parameter applicationName : The name of the application to update.

Parameter currentApplicationVersionId : The current application version ID. You can retrieve the application version ID using DescribeApplication.

Parameter applicationConfigurationUpdate : Describes application configuration updates.

Parameter cloudWatchLoggingOptionUpdates : Describes application Amazon CloudWatch logging option updates. You can only update existing CloudWatch logging options with this action. To add a new CloudWatch logging option, use AddApplicationCloudWatchLoggingOption.

Parameter runConfigurationUpdate : Describes updates to the application's starting parameters.

Parameter serviceExecutionRoleUpdate : Describes updates to the service execution role.

Implementation

Future<UpdateApplicationResponse> updateApplication({
  required String applicationName,
  required int currentApplicationVersionId,
  ApplicationConfigurationUpdate? applicationConfigurationUpdate,
  List<CloudWatchLoggingOptionUpdate>? cloudWatchLoggingOptionUpdates,
  RunConfigurationUpdate? runConfigurationUpdate,
  String? serviceExecutionRoleUpdate,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      currentApplicationVersionId, 'currentApplicationVersionId');
  _s.validateNumRange(
    'currentApplicationVersionId',
    currentApplicationVersionId,
    1,
    999999999,
    isRequired: true,
  );
  _s.validateStringLength(
    'serviceExecutionRoleUpdate',
    serviceExecutionRoleUpdate,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'KinesisAnalytics_20180523.UpdateApplication'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'CurrentApplicationVersionId': currentApplicationVersionId,
      if (applicationConfigurationUpdate != null)
        'ApplicationConfigurationUpdate': applicationConfigurationUpdate,
      if (cloudWatchLoggingOptionUpdates != null)
        'CloudWatchLoggingOptionUpdates': cloudWatchLoggingOptionUpdates,
      if (runConfigurationUpdate != null)
        'RunConfigurationUpdate': runConfigurationUpdate,
      if (serviceExecutionRoleUpdate != null)
        'ServiceExecutionRoleUpdate': serviceExecutionRoleUpdate,
    },
  );

  return UpdateApplicationResponse.fromJson(jsonResponse.body);
}