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. List<Tag>? tags,
  17. List<TriggerConfig>? triggerConfigurations,
})

Creates a deployment group to which application revisions are deployed.

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

Parameter applicationName : The name of an AWS CodeDeploy application associated with the IAM user or AWS 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 AWS CodeDeploy to act on the user's behalf when interacting with AWS 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 AWS 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 AWS CodeDeploy, see Working with Deployment Configurations in CodeDeploy in the AWS 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 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 EC2 instances. The deployment group includes only 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 <clustername>:<servicename>.

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 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 triggerConfigurations : Information about triggers to create when the deployment group is created. For examples, see Create a Trigger for an AWS CodeDeploy Event in the AWS 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,
  List<Tag>? tags,
  List<TriggerConfig>? triggerConfigurations,
}) async {
  ArgumentError.checkNotNull(applicationName, 'applicationName');
  _s.validateStringLength(
    'applicationName',
    applicationName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(deploymentGroupName, 'deploymentGroupName');
  _s.validateStringLength(
    'deploymentGroupName',
    deploymentGroupName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serviceRoleArn, 'serviceRoleArn');
  _s.validateStringLength(
    'deploymentConfigName',
    deploymentConfigName,
    1,
    100,
  );
  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 (tags != null) 'tags': tags,
      if (triggerConfigurations != null)
        'triggerConfigurations': triggerConfigurations,
    },
  );

  return CreateDeploymentGroupOutput.fromJson(jsonResponse.body);
}