createDeploymentGroup method

Future<CreateDeploymentGroupOutput> createDeploymentGroup({
  1. required String applicationName,
  2. required String deploymentGroupName,
  3. required String serviceRoleArn,
  4. AlarmConfiguration? alarmConfiguration,
  5. AutoRollbackConfiguration? autoRollbackConfiguration,
  6. List<String>? autoScalingGroups,
  7. BlueGreenDeploymentConfiguration? blueGreenDeploymentConfiguration,
  8. String? deploymentConfigName,
  9. DeploymentStyle? deploymentStyle,
  10. List<EC2TagFilter>? ec2TagFilters,
  11. EC2TagSet? ec2TagSet,
  12. List<ECSService>? ecsServices,
  13. LoadBalancerInfo? loadBalancerInfo,
  14. List<TagFilter>? onPremisesInstanceTagFilters,
  15. OnPremisesTagSet? onPremisesTagSet,
  16. OutdatedInstancesStrategy? outdatedInstancesStrategy,
  17. List<Tag>? tags,
  18. bool? terminationHookEnabled,
  19. List<TriggerConfig>? triggerConfigurations,
})

Creates a deployment group to which application revisions are deployed.

May throw AlarmsLimitExceededException. May throw ApplicationDoesNotExistException. May throw ApplicationNameRequiredException. May throw DeploymentConfigDoesNotExistException. May throw DeploymentGroupAlreadyExistsException. May throw DeploymentGroupLimitExceededException. May throw DeploymentGroupNameRequiredException. May throw ECSServiceMappingLimitExceededException. May throw InvalidAlarmConfigException. May throw InvalidApplicationNameException. May throw InvalidAutoRollbackConfigException. May throw InvalidAutoScalingGroupException. May throw InvalidBlueGreenDeploymentConfigurationException. May throw InvalidDeploymentConfigNameException. May throw InvalidDeploymentGroupNameException. May throw InvalidDeploymentStyleException. May throw InvalidEC2TagCombinationException. May throw InvalidEC2TagException. May throw InvalidECSServiceException. May throw InvalidInputException. May throw InvalidLoadBalancerInfoException. May throw InvalidOnPremisesTagCombinationException. May throw InvalidRoleException. May throw InvalidTagException. May throw InvalidTagsToAddException. May throw InvalidTargetGroupPairException. May throw InvalidTrafficRoutingConfigurationException. May throw InvalidTriggerConfigException. May throw LifecycleHookLimitExceededException. May throw RoleRequiredException. May throw TagSetListLimitExceededException. May throw ThrottlingException. May throw TriggerTargetsLimitExceededException.

Parameter applicationName : The name of an CodeDeploy application associated with the user or Amazon Web Services account.

Parameter deploymentGroupName : The name of a new deployment group for the specified application.

Parameter serviceRoleArn : A service role Amazon Resource Name (ARN) that allows CodeDeploy to act on the user's behalf when interacting with Amazon Web Services services.

Parameter alarmConfiguration : Information to add about Amazon CloudWatch alarms when the deployment group is created.

Parameter autoRollbackConfiguration : Configuration information for an automatic rollback that is added when a deployment group is created.

Parameter autoScalingGroups : A list of associated Amazon EC2 Auto Scaling groups.

Parameter blueGreenDeploymentConfiguration : Information about blue/green deployment options for a deployment group.

Parameter deploymentConfigName : If specified, the deployment configuration name can be either one of the predefined configurations provided with CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.

CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or deployment group.

For more information about the predefined deployment configurations in CodeDeploy, see Working with Deployment Configurations in CodeDeploy in the CodeDeploy User Guide.

Parameter deploymentStyle : Information about the type of deployment, in-place or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.

Parameter ec2TagFilters : The Amazon EC2 tags on which to filter. The deployment group includes Amazon EC2 instances with any of the specified tags. Cannot be used in the same call as ec2TagSet.

Parameter ec2TagSet : Information about groups of tags applied to Amazon EC2 instances. The deployment group includes only Amazon EC2 instances identified by all the tag groups. Cannot be used in the same call as ec2TagFilters.

Parameter ecsServices : The target Amazon ECS services in the deployment group. This applies only to deployment groups that use the Amazon ECS compute platform. A target Amazon ECS service is specified as an Amazon ECS cluster and service name pair using the format .

Parameter loadBalancerInfo : Information about the load balancer used in a deployment.

Parameter onPremisesInstanceTagFilters : The on-premises instance tags on which to filter. The deployment group includes on-premises instances with any of the specified tags. Cannot be used in the same call as OnPremisesTagSet.

Parameter onPremisesTagSet : Information about groups of tags applied to on-premises instances. The deployment group includes only on-premises instances identified by all of the tag groups. Cannot be used in the same call as onPremisesInstanceTagFilters.

Parameter outdatedInstancesStrategy : Indicates what happens when new Amazon EC2 instances are launched mid-deployment and do not receive the deployed application revision.

If this option is set to UPDATE or is unspecified, CodeDeploy initiates one or more 'auto-update outdated instances' deployments to apply the deployed application revision to the new Amazon EC2 instances.

If this option is set to IGNORE, CodeDeploy does not initiate a deployment to update the new Amazon EC2 instances. This may result in instances having different revisions.

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

Parameter terminationHookEnabled : This parameter only applies if you are using CodeDeploy with Amazon EC2 Auto Scaling. For more information, see Integrating CodeDeploy with Amazon EC2 Auto Scaling in the CodeDeploy User Guide.

Set terminationHookEnabled to true to have CodeDeploy install a termination hook into your Auto Scaling group when you create a deployment group. When this hook is installed, CodeDeploy will perform termination deployments.

For information about termination deployments, see Enabling termination deployments during Auto Scaling scale-in events in the CodeDeploy User Guide.

For more information about Auto Scaling scale-in events, see the Scale in topic in the Amazon EC2 Auto Scaling User Guide.

Parameter triggerConfigurations : Information about triggers to create when the deployment group is created. For examples, see Create a Trigger for an CodeDeploy Event in the CodeDeploy User Guide.

Implementation

Future<CreateDeploymentGroupOutput> createDeploymentGroup({
  required String applicationName,
  required String deploymentGroupName,
  required String serviceRoleArn,
  AlarmConfiguration? alarmConfiguration,
  AutoRollbackConfiguration? autoRollbackConfiguration,
  List<String>? autoScalingGroups,
  BlueGreenDeploymentConfiguration? blueGreenDeploymentConfiguration,
  String? deploymentConfigName,
  DeploymentStyle? deploymentStyle,
  List<EC2TagFilter>? ec2TagFilters,
  EC2TagSet? ec2TagSet,
  List<ECSService>? ecsServices,
  LoadBalancerInfo? loadBalancerInfo,
  List<TagFilter>? onPremisesInstanceTagFilters,
  OnPremisesTagSet? onPremisesTagSet,
  OutdatedInstancesStrategy? outdatedInstancesStrategy,
  List<Tag>? tags,
  bool? terminationHookEnabled,
  List<TriggerConfig>? triggerConfigurations,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeDeploy_20141006.CreateDeploymentGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'applicationName': applicationName,
      'deploymentGroupName': deploymentGroupName,
      'serviceRoleArn': serviceRoleArn,
      if (alarmConfiguration != null)
        'alarmConfiguration': alarmConfiguration,
      if (autoRollbackConfiguration != null)
        'autoRollbackConfiguration': autoRollbackConfiguration,
      if (autoScalingGroups != null) 'autoScalingGroups': autoScalingGroups,
      if (blueGreenDeploymentConfiguration != null)
        'blueGreenDeploymentConfiguration': blueGreenDeploymentConfiguration,
      if (deploymentConfigName != null)
        'deploymentConfigName': deploymentConfigName,
      if (deploymentStyle != null) 'deploymentStyle': deploymentStyle,
      if (ec2TagFilters != null) 'ec2TagFilters': ec2TagFilters,
      if (ec2TagSet != null) 'ec2TagSet': ec2TagSet,
      if (ecsServices != null) 'ecsServices': ecsServices,
      if (loadBalancerInfo != null) 'loadBalancerInfo': loadBalancerInfo,
      if (onPremisesInstanceTagFilters != null)
        'onPremisesInstanceTagFilters': onPremisesInstanceTagFilters,
      if (onPremisesTagSet != null) 'onPremisesTagSet': onPremisesTagSet,
      if (outdatedInstancesStrategy != null)
        'outdatedInstancesStrategy': outdatedInstancesStrategy.value,
      if (tags != null) 'tags': tags,
      if (terminationHookEnabled != null)
        'terminationHookEnabled': terminationHookEnabled,
      if (triggerConfigurations != null)
        'triggerConfigurations': triggerConfigurations,
    },
  );

  return CreateDeploymentGroupOutput.fromJson(jsonResponse.body);
}