<commit_before>package amazon

import (
	"fmt"
	"os"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/cloudformation"
	"github.com/docker/ecs-plugin/pkg/compose"
)

func (c *client) ComposeUp(project *compose.Project, loadBalancerArn *string) error {
	ok, err := c.ClusterExists()
	if err != nil {
		return err
	}
	if !ok {
		c.CreateCluster()
	}
	_, err := c.CF.DescribeStacks(&cloudformation.DescribeStacksInput{
		StackName: aws.String(project.Name),
	})
	if err == nil {
		// FIXME no ErrNotFound err type here
		return fmt.Errorf("we do not (yet) support updating an existing CloudFormation stack")
	}

	template, err := c.Convert(project, loadBalancerArn)
	if err != nil {
		return err
	}

	json, err := template.JSON()
	if err != nil {
		return err
	}

	_, err = c.CF.ValidateTemplate(&cloudformation.ValidateTemplateInput{
		TemplateBody: aws.String(string(json)),
	})
	if err != nil {
		return err
	}

	_, err = c.CF.CreateStack(&cloudformation.CreateStackInput{
		OnFailure:        aws.String("DELETE"),<commit_msg>Fix minor issue after merge conflit resolution<commit_after>package amazon

import (
	"fmt"
	"os"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/cloudformation"
	"github.com/docker/ecs-plugin/pkg/compose"
)

func (c *client) ComposeUp(project *compose.Project, loadBalancerArn *string) error {
	ok, err := c.ClusterExists()
	if err != nil {
		return err
	}
	if !ok {
		c.CreateCluster()
	}
	_, err = c.CF.DescribeStacks(&cloudformation.DescribeStacksInput{
		StackName: aws.String(project.Name),
	})
	if err == nil {
		// FIXME no ErrNotFound err type here
		return fmt.Errorf("we do not (yet) support updating an existing CloudFormation stack")
	}

	template, err := c.Convert(project, loadBalancerArn)
	if err != nil {
		return err
	}

	json, err := template.JSON()
	if err != nil {
		return err
	}

	_, err = c.CF.ValidateTemplate(&cloudformation.ValidateTemplateInput{
		TemplateBody: aws.String(string(json)),
	})
	if err != nil {
		return err
	}

	_, err = c.CF.CreateStack(&cloudformation.CreateStackInput{
		OnFailure:        aws.String("DELETE"),
{'fraction_non_alphanumeric': 0.1379472693032015, 'fraction_numerical': 0.0, 'mean_word_length': 3.953379953379953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5069736', 'n_tokens_mistral': 779, 'n_tokens_neox': 753, 'n_words': 167}