createApplication method

Future<CreateApplicationResponse> createApplication({
  1. required String applicationName,
  2. required RuntimeEnvironment runtimeEnvironment,
  3. required String serviceExecutionRole,
  4. ApplicationConfiguration? applicationConfiguration,
  5. String? applicationDescription,
  6. List<CloudWatchLoggingOption>? cloudWatchLoggingOptions,
  7. List<Tag>? tags,
})

Creates a Kinesis Data Analytics application. For information about creating a Kinesis Data Analytics application, see Creating an Application.

May throw CodeValidationException. May throw ResourceInUseException. May throw LimitExceededException. May throw InvalidArgumentException. May throw InvalidRequestException. May throw TooManyTagsException. May throw ConcurrentModificationException.

Parameter applicationName : The name of your application (for example, sample-app).

Parameter runtimeEnvironment : The runtime environment for the application (SQL-1.0, FLINK-1_6, or FLINK-1_8).

Parameter serviceExecutionRole : The IAM role used by the application to access Kinesis data streams, Kinesis Data Firehose delivery streams, Amazon S3 objects, and other external resources.

Parameter applicationConfiguration : Use this parameter to configure the application.

Parameter applicationDescription : A summary description of the application.

Parameter cloudWatchLoggingOptions : Use this parameter to configure an Amazon CloudWatch log stream to monitor application configuration errors.

Parameter tags : A list of one or more tags to assign to the application. A tag is a key-value pair that identifies an application. Note that the maximum number of application tags includes system tags. The maximum number of user-defined application tags is 50. For more information, see Using Tagging.

Implementation

Future<CreateApplicationResponse> createApplication({
  required String applicationName,
  required RuntimeEnvironment runtimeEnvironment,
  required String serviceExecutionRole,
  ApplicationConfiguration? applicationConfiguration,
  String? applicationDescription,
  List<CloudWatchLoggingOption>? cloudWatchLoggingOptions,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(runtimeEnvironment, 'runtimeEnvironment');
  ArgumentError.checkNotNull(serviceExecutionRole, 'serviceExecutionRole');
  _s.validateStringLength(
    'serviceExecutionRole',
    serviceExecutionRole,
    1,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'applicationDescription',
    applicationDescription,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'KinesisAnalytics_20180523.CreateApplication'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'RuntimeEnvironment': runtimeEnvironment.toValue(),
      'ServiceExecutionRole': serviceExecutionRole,
      if (applicationConfiguration != null)
        'ApplicationConfiguration': applicationConfiguration,
      if (applicationDescription != null)
        'ApplicationDescription': applicationDescription,
      if (cloudWatchLoggingOptions != null)
        'CloudWatchLoggingOptions': cloudWatchLoggingOptions,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateApplicationResponse.fromJson(jsonResponse.body);
}