createApplication method

Future<CreateApplicationResponse> createApplication({
  1. required String resourceGroupName,
  2. bool? cWEMonitorEnabled,
  3. bool? opsCenterEnabled,
  4. String? opsItemSNSTopicArn,
  5. List<Tag>? tags,
})

Adds an application that is created from a resource group.

May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ValidationException. May throw InternalServerException. May throw TagsAlreadyExistException. May throw AccessDeniedException.

Parameter resourceGroupName : The name of the resource group.

Parameter cWEMonitorEnabled : Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.

Parameter opsCenterEnabled : When set to true, creates opsItems for any problems detected on an application.

Parameter opsItemSNSTopicArn : The SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.

Parameter tags : List of tags to add to the application. tag key (Key) and an associated tag value (Value). The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.

Implementation

Future<CreateApplicationResponse> createApplication({
  required String resourceGroupName,
  bool? cWEMonitorEnabled,
  bool? opsCenterEnabled,
  String? opsItemSNSTopicArn,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(resourceGroupName, 'resourceGroupName');
  _s.validateStringLength(
    'resourceGroupName',
    resourceGroupName,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'opsItemSNSTopicArn',
    opsItemSNSTopicArn,
    20,
    300,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'EC2WindowsBarleyService.CreateApplication'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceGroupName': resourceGroupName,
      if (cWEMonitorEnabled != null) 'CWEMonitorEnabled': cWEMonitorEnabled,
      if (opsCenterEnabled != null) 'OpsCenterEnabled': opsCenterEnabled,
      if (opsItemSNSTopicArn != null)
        'OpsItemSNSTopicArn': opsItemSNSTopicArn,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateApplicationResponse.fromJson(jsonResponse.body);
}