addApplicationVpcConfiguration method

Future<AddApplicationVpcConfigurationResponse> addApplicationVpcConfiguration({
  1. required String applicationName,
  2. required VpcConfiguration vpcConfiguration,
  3. String? conditionalToken,
  4. int? currentApplicationVersionId,
})

Adds a Virtual Private Cloud (VPC) configuration to the application. Applications can use VPCs to store and access resources securely.

Note the following about VPC configurations for Managed Service for Apache Flink applications:

  • VPC configurations are not supported for SQL applications.
  • When a VPC is added to a Managed Service for Apache Flink application, the application can no longer be accessed from the Internet directly. To enable Internet access to the application, add an Internet gateway to your VPC.

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

Parameter applicationName : The name of an existing application.

Parameter vpcConfiguration : Description of the VPC to add to the application.

Parameter conditionalToken : A value you use to implement strong concurrency for application updates. You must provide the ApplicationVersionID or the ConditionalToken. You get the application's current ConditionalToken using DescribeApplication. For better concurrency support, use the ConditionalToken parameter instead of CurrentApplicationVersionId.

Parameter currentApplicationVersionId : The version of the application to which you want to add the VPC configuration. You must provide the CurrentApplicationVersionId or the ConditionalToken. You can use the DescribeApplication operation to get the current application version. If the version specified is not the current version, the ConcurrentModificationException is returned. For better concurrency support, use the ConditionalToken parameter instead of CurrentApplicationVersionId.

Implementation

Future<AddApplicationVpcConfigurationResponse>
    addApplicationVpcConfiguration({
  required String applicationName,
  required VpcConfiguration vpcConfiguration,
  String? conditionalToken,
  int? currentApplicationVersionId,
}) async {
  _s.validateNumRange(
    'currentApplicationVersionId',
    currentApplicationVersionId,
    1,
    999999999,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'KinesisAnalytics_20180523.AddApplicationVpcConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ApplicationName': applicationName,
      'VpcConfiguration': vpcConfiguration,
      if (conditionalToken != null) 'ConditionalToken': conditionalToken,
      if (currentApplicationVersionId != null)
        'CurrentApplicationVersionId': currentApplicationVersionId,
    },
  );

  return AddApplicationVpcConfigurationResponse.fromJson(jsonResponse.body);
}