createApplication method

Future<CreateApplicationOutput> createApplication({
  1. required String applicationName,
  2. ComputePlatform? computePlatform,
  3. List<Tag>? tags,
})

Creates an application.

May throw ApplicationNameRequiredException. May throw InvalidApplicationNameException. May throw ApplicationAlreadyExistsException. May throw ApplicationLimitExceededException. May throw InvalidComputePlatformException. May throw InvalidTagsToAddException.

Parameter applicationName : The name of the application. This name must be unique with the applicable IAM user or AWS account.

Parameter computePlatform : The destination platform type for the deployment (Lambda, Server, or ECS).

Parameter tags : The metadata that you apply to CodeDeploy applications to help you organize and categorize them. Each tag consists of a key and an optional value, both of which you define.

Implementation

Future<CreateApplicationOutput> createApplication({
  required String applicationName,
  ComputePlatform? computePlatform,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    100,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeDeploy_20141006.CreateApplication'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'applicationName': applicationName,
      if (computePlatform != null)
        'computePlatform': computePlatform.toValue(),
      if (tags != null) 'tags': tags,
    },
  );

  return CreateApplicationOutput.fromJson(jsonResponse.body);
}