diff --git a/builtin/providers/aws/config.go b/builtin/providers/aws/config.go index f3c721c97..d15b0f4bc 100644 --- a/builtin/providers/aws/config.go +++ b/builtin/providers/aws/config.go @@ -24,6 +24,7 @@ import ( "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" + "github.com/aws/aws-sdk-go/service/codebuild" "github.com/aws/aws-sdk-go/service/codecommit" "github.com/aws/aws-sdk-go/service/codedeploy" "github.com/aws/aws-sdk-go/service/databasemigrationservice" @@ -146,6 +147,7 @@ type AWSClient struct { lightsailconn *lightsail.Lightsail opsworksconn *opsworks.OpsWorks glacierconn *glacier.Glacier + codebuildconn *codebuild.CodeBuild codedeployconn *codedeploy.CodeDeploy codecommitconn *codecommit.CodeCommit sfnconn *sfn.SFN @@ -277,6 +279,7 @@ func (c *Config) Client() (interface{}, error) { client.cloudwatcheventsconn = cloudwatchevents.New(sess) client.cloudwatchlogsconn = cloudwatchlogs.New(sess) client.codecommitconn = codecommit.New(sess) + client.codebuildconn = codebuild.New(sess) client.codedeployconn = codedeploy.New(sess) client.dmsconn = databasemigrationservice.New(sess) client.dsconn = directoryservice.New(sess) diff --git a/builtin/providers/aws/provider.go b/builtin/providers/aws/provider.go index 429fc3a90..fcdcf5ca5 100644 --- a/builtin/providers/aws/provider.go +++ b/builtin/providers/aws/provider.go @@ -238,6 +238,7 @@ func Provider() terraform.ResourceProvider { "aws_codedeploy_deployment_group": resourceAwsCodeDeployDeploymentGroup(), "aws_codecommit_repository": resourceAwsCodeCommitRepository(), "aws_codecommit_trigger": resourceAwsCodeCommitTrigger(), + "aws_codebuild_project": resourceAwsCodeBuildProject(), "aws_customer_gateway": resourceAwsCustomerGateway(), "aws_db_event_subscription": resourceAwsDbEventSubscription(), "aws_db_instance": resourceAwsDbInstance(), diff --git a/builtin/providers/aws/resource_aws_codebuild_project.go b/builtin/providers/aws/resource_aws_codebuild_project.go new file mode 100644 index 000000000..379002664 --- /dev/null +++ b/builtin/providers/aws/resource_aws_codebuild_project.go @@ -0,0 +1,713 @@ +package aws + +import ( + "bytes" + "fmt" + "log" + "regexp" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/codebuild" + "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/helper/schema" +) + +func resourceAwsCodeBuildProject() *schema.Resource { + return &schema.Resource{ + Create: resourceAwsCodeBuildProjectCreate, + Read: resourceAwsCodeBuildProjectRead, + Update: resourceAwsCodeBuildProjectUpdate, + Delete: resourceAwsCodeBuildProjectDelete, + + Schema: map[string]*schema.Schema{ + "artifacts": &schema.Schema{ + Type: schema.TypeSet, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Optional: true, + }, + "namespace_type": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateAwsCodeBuildArifactsNamespaceType, + }, + "packaging": { + Type: schema.TypeString, + Optional: true, + }, + "path": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAwsCodeBuildArifactsType, + }, + }, + }, + Set: resourceAwsCodeBuildProjectArtifactsHash, + }, + "description": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validateAwsCodeBuildProjectDescription, + }, + "encryption_key": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "environment": &schema.Schema{ + Type: schema.TypeSet, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "compute_type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAwsCodeBuildEnvironmentComputeType, + }, + "environment_variable": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "value": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "image": { + Type: schema.TypeString, + Required: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAwsCodeBuildEnvironmentType, + }, + }, + }, + Set: resourceAwsCodeBuildProjectEnvironmentHash, + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateAwsCodeBuildProjectName, + }, + "service_role": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "source": &schema.Schema{ + Type: schema.TypeSet, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auth": &schema.Schema{ + Type: schema.TypeSet, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "resource": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAwsCodeBuildSourceAuthType, + }, + }, + }, + Optional: true, + }, + "buildspec": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Optional: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateAwsCodeBuildSourceType, + }, + }, + }, + Required: true, + MaxItems: 1, + }, + "timeout": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validateAwsCodeBuildTimeout, + }, + "tags": tagsSchema(), + }, + } +} + +func resourceAwsCodeBuildProjectCreate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).codebuildconn + + projectEnv := expandProjectEnvironment(d) + projectSource := expandProjectSource(d) + projectArtifacts := expandProjectArtifacts(d) + + params := &codebuild.CreateProjectInput{ + Environment: projectEnv, + Name: aws.String(d.Get("name").(string)), + Source: &projectSource, + Artifacts: &projectArtifacts, + } + + if v, ok := d.GetOk("description"); ok { + params.Description = aws.String(v.(string)) + } + + if v, ok := d.GetOk("encryption_key"); ok { + params.EncryptionKey = aws.String(v.(string)) + } + + if v, ok := d.GetOk("service_role"); ok { + params.ServiceRole = aws.String(v.(string)) + } + + if v, ok := d.GetOk("timeout"); ok { + params.TimeoutInMinutes = aws.Int64(int64(v.(int))) + } + + var resp *codebuild.CreateProjectOutput + err := resource.Retry(30*time.Second, func() *resource.RetryError { + var err error + + resp, err = conn.CreateProject(params) + + if err != nil { + return resource.RetryableError(err) + } + + return resource.NonRetryableError(err) + }) + + if err != nil { + return fmt.Errorf("[ERROR] Error creating CodeBuild project: %s", err) + } + + d.SetId(*resp.Project.Arn) + + return resourceAwsCodeBuildProjectUpdate(d, meta) +} + +func expandProjectArtifacts(d *schema.ResourceData) codebuild.ProjectArtifacts { + configs := d.Get("artifacts").(*schema.Set).List() + data := configs[0].(map[string]interface{}) + + projectArtifacts := codebuild.ProjectArtifacts{ + Type: aws.String(data["type"].(string)), + } + + if data["location"].(string) != "" { + projectArtifacts.Location = aws.String(data["location"].(string)) + } + + if data["name"].(string) != "" { + projectArtifacts.Name = aws.String(data["name"].(string)) + } + + if data["namespace_type"].(string) != "" { + projectArtifacts.NamespaceType = aws.String(data["namespace_type"].(string)) + } + + if data["packaging"].(string) != "" { + projectArtifacts.Packaging = aws.String(data["packaging"].(string)) + } + + if data["path"].(string) != "" { + projectArtifacts.Path = aws.String(data["path"].(string)) + } + + return projectArtifacts +} + +func expandProjectEnvironment(d *schema.ResourceData) *codebuild.ProjectEnvironment { + configs := d.Get("environment").(*schema.Set).List() + projectEnv := &codebuild.ProjectEnvironment{} + + envConfig := configs[0].(map[string]interface{}) + + if v := envConfig["compute_type"]; v != nil { + projectEnv.ComputeType = aws.String(v.(string)) + } + + if v := envConfig["image"]; v != nil { + projectEnv.Image = aws.String(v.(string)) + } + + if v := envConfig["type"]; v != nil { + projectEnv.Type = aws.String(v.(string)) + } + + if v := envConfig["environment_variable"]; v != nil { + envVariables := v.([]interface{}) + if len(envVariables) > 0 { + projectEnvironmentVariables := make([]*codebuild.EnvironmentVariable, 0, len(envVariables)) + + for _, envVariablesConfig := range envVariables { + config := envVariablesConfig.(map[string]interface{}) + + projectEnvironmentVar := &codebuild.EnvironmentVariable{} + + if v := config["name"].(string); v != "" { + projectEnvironmentVar.Name = &v + } + + if v := config["value"].(string); v != "" { + projectEnvironmentVar.Value = &v + } + + projectEnvironmentVariables = append(projectEnvironmentVariables, projectEnvironmentVar) + } + + projectEnv.EnvironmentVariables = projectEnvironmentVariables + } + } + + return projectEnv +} + +func expandProjectSource(d *schema.ResourceData) codebuild.ProjectSource { + configs := d.Get("source").(*schema.Set).List() + projectSource := codebuild.ProjectSource{} + + for _, configRaw := range configs { + data := configRaw.(map[string]interface{}) + + sourceType := data["type"].(string) + location := data["location"].(string) + buildspec := data["buildspec"].(string) + + projectSource = codebuild.ProjectSource{ + Type: &sourceType, + Location: &location, + Buildspec: &buildspec, + } + + if v, ok := data["auth"]; ok { + if len(v.(*schema.Set).List()) > 0 { + auth := v.(*schema.Set).List()[0].(map[string]interface{}) + + projectSource.Auth = &codebuild.SourceAuth{ + Type: aws.String(auth["type"].(string)), + Resource: aws.String(auth["resource"].(string)), + } + } + } + } + + return projectSource +} + +func resourceAwsCodeBuildProjectRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).codebuildconn + + resp, err := conn.BatchGetProjects(&codebuild.BatchGetProjectsInput{ + Names: []*string{ + aws.String(d.Id()), + }, + }) + + if err != nil { + return fmt.Errorf("[ERROR] Error retreiving Projects: %q", err) + } + + // if nothing was found, then return no state + if len(resp.Projects) == 0 { + log.Printf("[INFO]: No projects were found, removing from state") + d.SetId("") + return nil + } + + project := resp.Projects[0] + + if err := d.Set("artifacts", flattenAwsCodebuildProjectArtifacts(project.Artifacts)); err != nil { + return err + } + + if err := d.Set("environment", schema.NewSet(resourceAwsCodeBuildProjectEnvironmentHash, flattenAwsCodebuildProjectEnvironment(project.Environment))); err != nil { + return err + } + + if err := d.Set("source", flattenAwsCodebuildProjectSource(project.Source)); err != nil { + return err + } + + d.Set("description", project.Description) + d.Set("encryption_key", project.EncryptionKey) + d.Set("name", project.Name) + d.Set("service_role", project.ServiceRole) + d.Set("timeout", project.TimeoutInMinutes) + + if err := d.Set("tags", tagsToMapCodeBuild(project.Tags)); err != nil { + return err + } + + return nil +} + +func resourceAwsCodeBuildProjectUpdate(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).codebuildconn + + params := &codebuild.UpdateProjectInput{ + Name: aws.String(d.Get("name").(string)), + } + + if d.HasChange("environment") { + projectEnv := expandProjectEnvironment(d) + params.Environment = projectEnv + } + + if d.HasChange("source") { + projectSource := expandProjectSource(d) + params.Source = &projectSource + } + + if d.HasChange("artifacts") { + projectArtifacts := expandProjectArtifacts(d) + params.Artifacts = &projectArtifacts + } + + if d.HasChange("description") { + params.Description = aws.String(d.Get("description").(string)) + } + + if d.HasChange("encryption_key") { + params.EncryptionKey = aws.String(d.Get("encryption_key").(string)) + } + + if d.HasChange("service_role") { + params.ServiceRole = aws.String(d.Get("service_role").(string)) + } + + if d.HasChange("timeout") { + params.TimeoutInMinutes = aws.Int64(int64(d.Get("timeout").(int))) + } + + if d.HasChange("tags") { + params.Tags = tagsFromMapCodeBuild(d.Get("tags").(map[string]interface{})) + } + + _, err := conn.UpdateProject(params) + + if err != nil { + return fmt.Errorf( + "[ERROR] Error updating CodeBuild project (%s): %s", + d.Id(), err) + } + + return resourceAwsCodeBuildProjectRead(d, meta) +} + +func resourceAwsCodeBuildProjectDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).codebuildconn + + _, err := conn.DeleteProject(&codebuild.DeleteProjectInput{ + Name: aws.String(d.Id()), + }) + + if err != nil { + return err + } + + d.SetId("") + + return nil +} + +func flattenAwsCodebuildProjectArtifacts(artifacts *codebuild.ProjectArtifacts) *schema.Set { + + artifactSet := schema.Set{ + F: resourceAwsCodeBuildProjectArtifactsHash, + } + + values := map[string]interface{}{} + + values["type"] = *artifacts.Type + + if artifacts.Location != nil { + values["location"] = *artifacts.Location + } + + if artifacts.Name != nil { + values["name"] = *artifacts.Name + } + + if artifacts.NamespaceType != nil { + values["namespace_type"] = *artifacts.NamespaceType + } + + if artifacts.Packaging != nil { + values["packaging"] = *artifacts.Packaging + } + + if artifacts.Path != nil { + values["path"] = *artifacts.Path + } + + artifactSet.Add(values) + + return &artifactSet +} + +func flattenAwsCodebuildProjectEnvironment(environment *codebuild.ProjectEnvironment) []interface{} { + envConfig := map[string]interface{}{} + + envConfig["type"] = *environment.Type + envConfig["compute_type"] = *environment.ComputeType + envConfig["image"] = *environment.Image + + if environment.EnvironmentVariables != nil { + envConfig["environment_variable"] = environmentVariablesToMap(environment.EnvironmentVariables) + } + + return []interface{}{envConfig} + +} + +func flattenAwsCodebuildProjectSource(source *codebuild.ProjectSource) *schema.Set { + + sourceSet := schema.Set{ + F: resourceAwsCodeBuildProjectSourceHash, + } + + sourceConfig := map[string]interface{}{} + + sourceConfig["type"] = *source.Type + + if source.Auth != nil { + sourceConfig["auth"] = sourceAuthToMap(source.Auth) + } + + if source.Buildspec != nil { + sourceConfig["buildspec"] = *source.Buildspec + } + + if source.Location != nil { + sourceConfig["location"] = *source.Location + } + + sourceSet.Add(sourceConfig) + + return &sourceSet + +} + +func resourceAwsCodeBuildProjectArtifactsHash(v interface{}) int { + var buf bytes.Buffer + m := v.(map[string]interface{}) + + artifactType := m["type"].(string) + + buf.WriteString(fmt.Sprintf("%s-", artifactType)) + + return hashcode.String(buf.String()) +} + +func resourceAwsCodeBuildProjectEnvironmentHash(v interface{}) int { + var buf bytes.Buffer + m := v.(map[string]interface{}) + + environmentType := m["type"].(string) + computeType := m["compute_type"].(string) + image := m["image"].(string) + + buf.WriteString(fmt.Sprintf("%s-", environmentType)) + buf.WriteString(fmt.Sprintf("%s-", computeType)) + buf.WriteString(fmt.Sprintf("%s-", image)) + + return hashcode.String(buf.String()) +} + +func resourceAwsCodeBuildProjectSourceHash(v interface{}) int { + var buf bytes.Buffer + m := v.(map[string]interface{}) + + sourceType := m["type"].(string) + buildspec := m["buildspec"].(string) + location := m["location"].(string) + + buf.WriteString(fmt.Sprintf("%s-", sourceType)) + buf.WriteString(fmt.Sprintf("%s-", buildspec)) + buf.WriteString(fmt.Sprintf("%s-", location)) + + return hashcode.String(buf.String()) +} + +func environmentVariablesToMap(environmentVariables []*codebuild.EnvironmentVariable) []map[string]interface{} { + + envVariables := make([]map[string]interface{}, len(environmentVariables)) + + if len(environmentVariables) > 0 { + for i := 0; i < len(environmentVariables); i++ { + env := environmentVariables[i] + item := make(map[string]interface{}) + item["name"] = *env.Name + item["value"] = *env.Value + envVariables = append(envVariables, item) + } + } + + return envVariables +} + +func sourceAuthToMap(sourceAuth *codebuild.SourceAuth) map[string]interface{} { + + auth := map[string]interface{}{} + auth["type"] = *sourceAuth.Type + + if sourceAuth.Type != nil { + auth["resource"] = *sourceAuth.Resource + } + + return auth +} + +func validateAwsCodeBuildArifactsType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "CODEPIPELINE": true, + "NO_ARTIFACTS": true, + "S3": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Arifacts Type can only be CODEPIPELINE / NO_ARTIFACTS / S3")) + } + return +} + +func validateAwsCodeBuildArifactsNamespaceType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "NONE": true, + "BUILD_ID": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Arifacts Namespace Type can only be NONE / BUILD_ID")) + } + return +} + +func validateAwsCodeBuildProjectName(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if !regexp.MustCompile(`^[A-Za-z0-9]`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "first character of %q must be a letter or number", value)) + } + + if !regexp.MustCompile(`^[A-Za-z0-9\-_]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf( + "only alphanumeric characters, hyphens and underscores allowed in %q", value)) + } + + if len(value) > 255 { + errors = append(errors, fmt.Errorf( + "%q cannot be greater than 255 characters", value)) + } + + return +} + +func validateAwsCodeBuildProjectDescription(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + if len(value) > 255 { + errors = append(errors, fmt.Errorf("%q cannot be greater than 255 characters", value)) + } + return +} + +func validateAwsCodeBuildEnvironmentComputeType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "BUILD_GENERAL1_SMALL": true, + "BUILD_GENERAL1_MEDIUM": true, + "BUILD_GENERAL1_LARGE": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Environment Compute Type can only be BUILD_GENERAL1_SMALL / BUILD_GENERAL1_MEDIUM / BUILD_GENERAL1_LARGE")) + } + return +} + +func validateAwsCodeBuildEnvironmentType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "LINUX_CONTAINER": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Environment Type can only be LINUX_CONTAINER")) + } + return +} + +func validateAwsCodeBuildSourceType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "CODECOMMIT": true, + "CODEPIPELINE": true, + "GITHUB": true, + "S3": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Source Type can only be CODECOMMIT / CODEPIPELINE / GITHUB / S3")) + } + return +} + +func validateAwsCodeBuildSourceAuthType(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + types := map[string]bool{ + "OAUTH": true, + } + + if !types[value] { + errors = append(errors, fmt.Errorf("CodeBuild: Source Auth Type can only be OAUTH")) + } + return +} + +func validateAwsCodeBuildTimeout(v interface{}, k string) (ws []string, errors []error) { + value := v.(int) + + if value < 5 || value > 480 { + errors = append(errors, fmt.Errorf("%q must be greater than 5 minutes and less than 480 minutes (8 hours)", value)) + } + return +} diff --git a/builtin/providers/aws/resource_aws_codebuild_project_test.go b/builtin/providers/aws/resource_aws_codebuild_project_test.go new file mode 100644 index 000000000..a21fe0f2a --- /dev/null +++ b/builtin/providers/aws/resource_aws_codebuild_project_test.go @@ -0,0 +1,367 @@ +package aws + +import ( + "fmt" + "strings" + "testing" + "unicode" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/codebuild" + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccAWSCodeBuildProject_basic(t *testing.T) { + name := acctest.RandString(10) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSCodeBuildProjectConfig_basic(name), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSCodeBuildProjectExists("aws_codebuild_project.foo"), + ), + }, + }, + }) +} + +func TestAccAWSCodeBuildProject_artifactsTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "CODEPIPELINE", ErrCount: 0}, + {Value: "NO_ARTIFACTS", ErrCount: 0}, + {Value: "S3", ErrCount: 0}, + {Value: "XYZ", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildArifactsType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project artifacts type to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_artifactsNamespaceTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "NONE", ErrCount: 0}, + {Value: "BUILD_ID", ErrCount: 0}, + {Value: "XYZ", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildArifactsNamespaceType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project artifacts namepsace_type to trigger a validation error") + } + } +} + +func longTestData() string { + data := ` + test-test-test-test-test-test-test-test-test-test- + test-test-test-test-test-test-test-test-test-test- + test-test-test-test-test-test-test-test-test-test- + test-test-test-test-test-test-test-test-test-test- + test-test-test-test-test-test-test-test-test-test- + test-test-test-test-test-test-test-test-test-test- + ` + + return strings.Map(func(r rune) rune { + if unicode.IsSpace(r) { + return -1 + } + return r + }, data) +} + +func TestAccAWSCodeBuildProject_nameValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "_test", ErrCount: 1}, + {Value: "test", ErrCount: 0}, + {Value: "1_test", ErrCount: 0}, + {Value: "test**1", ErrCount: 1}, + {Value: longTestData(), ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildProjectName(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project name to trigger a validation error - %s", errors) + } + } +} + +func TestAccAWSCodeBuildProject_descriptionValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "test", ErrCount: 0}, + {Value: longTestData(), ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildProjectDescription(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project description to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_environmentComputeTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "BUILD_GENERAL1_SMALL", ErrCount: 0}, + {Value: "BUILD_GENERAL1_MEDIUM", ErrCount: 0}, + {Value: "BUILD_GENERAL1_LARGE", ErrCount: 0}, + {Value: "BUILD_GENERAL1_VERYLARGE", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildEnvironmentComputeType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project environment compute_type to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_environmentTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "LINUX_CONTAINER", ErrCount: 0}, + {Value: "WINDOWS_CONTAINER", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildEnvironmentType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project environment type to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_sourceTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "CODECOMMIT", ErrCount: 0}, + {Value: "CODEPIPELINE", ErrCount: 0}, + {Value: "GITHUB", ErrCount: 0}, + {Value: "S3", ErrCount: 0}, + {Value: "GITLAB", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildSourceType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project source type to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_sourceAuthTypeValidation(t *testing.T) { + cases := []struct { + Value string + ErrCount int + }{ + {Value: "OAUTH", ErrCount: 0}, + {Value: "PASSWORD", ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildSourceAuthType(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project source auth to trigger a validation error") + } + } +} + +func TestAccAWSCodeBuildProject_timeoutValidation(t *testing.T) { + cases := []struct { + Value int + ErrCount int + }{ + {Value: 10, ErrCount: 0}, + {Value: 200, ErrCount: 0}, + {Value: 1, ErrCount: 1}, + {Value: 500, ErrCount: 1}, + } + + for _, tc := range cases { + _, errors := validateAwsCodeBuildTimeout(tc.Value, "aws_codebuild_project") + + if len(errors) != tc.ErrCount { + t.Fatalf("Expected the AWS CodeBuild project timeout to trigger a validation error") + } + } +} + +func testAccCheckAWSCodeBuildProjectExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.ID == "" { + return fmt.Errorf("No CodeBuild Project ID is set") + } + + conn := testAccProvider.Meta().(*AWSClient).codebuildconn + + out, err := conn.BatchGetProjects(&codebuild.BatchGetProjectsInput{ + Names: []*string{ + aws.String(rs.Primary.ID), + }, + }) + + if err != nil { + return err + } + + if len(out.Projects) < 1 { + return fmt.Errorf("No project found") + } + + return nil + } +} + +func testAccCheckAWSCodeBuildProjectDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).codebuildconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_codebuild_project" { + continue + } + + out, err := conn.BatchGetProjects(&codebuild.BatchGetProjectsInput{ + Names: []*string{ + aws.String(rs.Primary.ID), + }, + }) + + if err != nil { + return err + } + + if out != nil && len(out.Projects) > 0 { + return fmt.Errorf("Expected AWS CodeBuild Project to be gone, but was still found") + } + + return nil + } + + return fmt.Errorf("Default error in CodeBuild Test") +} + +func testAccAWSCodeBuildProjectConfig_basic(rName string) string { + return fmt.Sprintf(` +resource "aws_iam_role" "codebuild_role" { + name = "codebuild-role-%s" + assume_role_policy = < 0 { + return invalidParams + } + return nil +} + +// SetIds sets the Ids field's value. +func (s *BatchGetBuildsInput) SetIds(v []*string) *BatchGetBuildsInput { + s.Ids = v + return s +} + +type BatchGetBuildsOutput struct { + _ struct{} `type:"structure"` + + // Information about the requested builds. + Builds []*Build `locationName:"builds" type:"list"` + + // The IDs of builds for which information could not be found. + BuildsNotFound []*string `locationName:"buildsNotFound" min:"1" type:"list"` +} + +// String returns the string representation +func (s BatchGetBuildsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetBuildsOutput) GoString() string { + return s.String() +} + +// SetBuilds sets the Builds field's value. +func (s *BatchGetBuildsOutput) SetBuilds(v []*Build) *BatchGetBuildsOutput { + s.Builds = v + return s +} + +// SetBuildsNotFound sets the BuildsNotFound field's value. +func (s *BatchGetBuildsOutput) SetBuildsNotFound(v []*string) *BatchGetBuildsOutput { + s.BuildsNotFound = v + return s +} + +type BatchGetProjectsInput struct { + _ struct{} `type:"structure"` + + // The names of the build projects to get information about. + // + // Names is a required field + Names []*string `locationName:"names" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s BatchGetProjectsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetProjectsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchGetProjectsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchGetProjectsInput"} + if s.Names == nil { + invalidParams.Add(request.NewErrParamRequired("Names")) + } + if s.Names != nil && len(s.Names) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Names", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNames sets the Names field's value. +func (s *BatchGetProjectsInput) SetNames(v []*string) *BatchGetProjectsInput { + s.Names = v + return s +} + +type BatchGetProjectsOutput struct { + _ struct{} `type:"structure"` + + // Information about the requested build projects. + Projects []*Project `locationName:"projects" type:"list"` + + // The names of build projects for which information could not be found. + ProjectsNotFound []*string `locationName:"projectsNotFound" min:"1" type:"list"` +} + +// String returns the string representation +func (s BatchGetProjectsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetProjectsOutput) GoString() string { + return s.String() +} + +// SetProjects sets the Projects field's value. +func (s *BatchGetProjectsOutput) SetProjects(v []*Project) *BatchGetProjectsOutput { + s.Projects = v + return s +} + +// SetProjectsNotFound sets the ProjectsNotFound field's value. +func (s *BatchGetProjectsOutput) SetProjectsNotFound(v []*string) *BatchGetProjectsOutput { + s.ProjectsNotFound = v + return s +} + +// Information about a build. +type Build struct { + _ struct{} `type:"structure"` + + // The build's Amazon Resource Name (ARN). + Arn *string `locationName:"arn" min:"1" type:"string"` + + // Information about the build's output artifacts. + Artifacts *BuildArtifacts `locationName:"artifacts" type:"structure"` + + // Whether the build has finished. Valid values include true if completed; otherwise, + // false. + BuildComplete *bool `locationName:"buildComplete" type:"boolean"` + + // The build's current status. Valid values include: + // + // * FAILED: The build failed. + // + // * FAULT: The build faulted. + // + // * IN_PROGRESS: The build is still in progress. + // + // * STOPPED: The build stopped. + // + // * SUCCEEDED: The build succeeded. + // + // * TIMED_OUT: The build timed out. + BuildStatus *string `locationName:"buildStatus" type:"string" enum:"StatusType"` + + // The build's current build phase. + CurrentPhase *string `locationName:"currentPhase" type:"string"` + + // When the build process ended, expressed in Unix time format. + EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"unix"` + + // Information about the build environment for this build. + Environment *ProjectEnvironment `locationName:"environment" type:"structure"` + + // The build's unique ID. + Id *string `locationName:"id" min:"1" type:"string"` + + // The entity that started the build. Valid values include: + // + // * If AWS CodePipeline started the build, the pipeline's name, for example + // codepipeline/my-demo-pipeline. + // + // * If an AWS Identity and Access Management (IAM) user started the build, + // the user's name, for example MyUserName. + // + // * If the Jenkins plugin for AWS CodeBuild started the build, the string + // CodeBuild-Jenkins-Plugin. + Initiator *string `locationName:"initiator" type:"string"` + + // Information about the build's logs in Amazon CloudWatch Logs. + Logs *LogsLocation `locationName:"logs" type:"structure"` + + // Information about all previous build phases that have completed, and information + // about any current build phase that has not yet completed. + Phases []*BuildPhase `locationName:"phases" type:"list"` + + // The build project's name. + ProjectName *string `locationName:"projectName" min:"1" type:"string"` + + // Information about the source code to be built. + Source *ProjectSource `locationName:"source" type:"structure"` + + // Any version identifier for the version of the source code to be built. + SourceVersion *string `locationName:"sourceVersion" min:"1" type:"string"` + + // When the build process started, expressed in Unix time format. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"unix"` + + // How long in minutes for AWS CodeBuild to wait to timeout this build if it + // does not get marked as completed. + TimeoutInMinutes *int64 `locationName:"timeoutInMinutes" type:"integer"` +} + +// String returns the string representation +func (s Build) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Build) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *Build) SetArn(v string) *Build { + s.Arn = &v + return s +} + +// SetArtifacts sets the Artifacts field's value. +func (s *Build) SetArtifacts(v *BuildArtifacts) *Build { + s.Artifacts = v + return s +} + +// SetBuildComplete sets the BuildComplete field's value. +func (s *Build) SetBuildComplete(v bool) *Build { + s.BuildComplete = &v + return s +} + +// SetBuildStatus sets the BuildStatus field's value. +func (s *Build) SetBuildStatus(v string) *Build { + s.BuildStatus = &v + return s +} + +// SetCurrentPhase sets the CurrentPhase field's value. +func (s *Build) SetCurrentPhase(v string) *Build { + s.CurrentPhase = &v + return s +} + +// SetEndTime sets the EndTime field's value. +func (s *Build) SetEndTime(v time.Time) *Build { + s.EndTime = &v + return s +} + +// SetEnvironment sets the Environment field's value. +func (s *Build) SetEnvironment(v *ProjectEnvironment) *Build { + s.Environment = v + return s +} + +// SetId sets the Id field's value. +func (s *Build) SetId(v string) *Build { + s.Id = &v + return s +} + +// SetInitiator sets the Initiator field's value. +func (s *Build) SetInitiator(v string) *Build { + s.Initiator = &v + return s +} + +// SetLogs sets the Logs field's value. +func (s *Build) SetLogs(v *LogsLocation) *Build { + s.Logs = v + return s +} + +// SetPhases sets the Phases field's value. +func (s *Build) SetPhases(v []*BuildPhase) *Build { + s.Phases = v + return s +} + +// SetProjectName sets the ProjectName field's value. +func (s *Build) SetProjectName(v string) *Build { + s.ProjectName = &v + return s +} + +// SetSource sets the Source field's value. +func (s *Build) SetSource(v *ProjectSource) *Build { + s.Source = v + return s +} + +// SetSourceVersion sets the SourceVersion field's value. +func (s *Build) SetSourceVersion(v string) *Build { + s.SourceVersion = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *Build) SetStartTime(v time.Time) *Build { + s.StartTime = &v + return s +} + +// SetTimeoutInMinutes sets the TimeoutInMinutes field's value. +func (s *Build) SetTimeoutInMinutes(v int64) *Build { + s.TimeoutInMinutes = &v + return s +} + +// Information about build output artifacts. +type BuildArtifacts struct { + _ struct{} `type:"structure"` + + // Information about the build artifacts' location. + Location *string `locationName:"location" type:"string"` + + // The MD5 hash of the build artifact. + // + // You can use this hash along with a checksum tool to confirm both file integrity + // and authenticity. + // + // This value is available only if the related build project's packaging value + // is set to ZIP. + Md5sum *string `locationName:"md5sum" type:"string"` + + // The SHA-256 hash of the build artifact. + // + // You can use this hash along with a checksum tool to confirm both file integrity + // and authenticity. + // + // This value is available only if the related build project's packaging value + // is set to ZIP. + Sha256sum *string `locationName:"sha256sum" type:"string"` +} + +// String returns the string representation +func (s BuildArtifacts) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BuildArtifacts) GoString() string { + return s.String() +} + +// SetLocation sets the Location field's value. +func (s *BuildArtifacts) SetLocation(v string) *BuildArtifacts { + s.Location = &v + return s +} + +// SetMd5sum sets the Md5sum field's value. +func (s *BuildArtifacts) SetMd5sum(v string) *BuildArtifacts { + s.Md5sum = &v + return s +} + +// SetSha256sum sets the Sha256sum field's value. +func (s *BuildArtifacts) SetSha256sum(v string) *BuildArtifacts { + s.Sha256sum = &v + return s +} + +// Information about a stage for a build. +type BuildPhase struct { + _ struct{} `type:"structure"` + + // Additional information about a build phase, especially to help troubleshoot + // a failed build. + Contexts []*PhaseContext `locationName:"contexts" type:"list"` + + // How long, in seconds, between the build's phase starting and ending times. + DurationInSeconds *int64 `locationName:"durationInSeconds" type:"long"` + + // When the build phase ended, expressed in Unix time format. + EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"unix"` + + // The build phase's current status. Valid values include: + // + // * FAILED: The build phase failed. + // + // * FAULT: The build phase faulted. + // + // * IN_PROGRESS: The build phase is still in progress. + // + // * STOPPED: The build phase stopped. + // + // * SUCCEEDED: The build phase succeeded. + // + // * TIMED_OUT: The build phase timed out. + PhaseStatus *string `locationName:"phaseStatus" type:"string" enum:"StatusType"` + + // The build phase's name. Valid values include: + // + // * BUILD: Core build activities typically occur in this build phase. + // + // * COMPLETED: The build has completed. + // + // * DOWNLOAD_SOURCE: Source code is being downloaded in this build phase. + // + // * FINALIZING: The build process is completing in this build phase. + // + // * INSTALL: Installation activities typically occur in this build phase. + // + // * POST_BUILD: Post-build activities typically occur in this build phase. + // + // * PRE_BUILD: Pre-build activities typically occur in this build phase. + // + // * PROVISIONING: The build environment is being set up. + // + // * SUBMITTED: The build has been submitted. + // + // * UPLOAD_ARTIFACTS: Build output artifacts are being uploaded to output + // location. + PhaseType *string `locationName:"phaseType" type:"string" enum:"BuildPhaseType"` + + // When the build phase started, expressed in Unix time format. + StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"unix"` +} + +// String returns the string representation +func (s BuildPhase) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BuildPhase) GoString() string { + return s.String() +} + +// SetContexts sets the Contexts field's value. +func (s *BuildPhase) SetContexts(v []*PhaseContext) *BuildPhase { + s.Contexts = v + return s +} + +// SetDurationInSeconds sets the DurationInSeconds field's value. +func (s *BuildPhase) SetDurationInSeconds(v int64) *BuildPhase { + s.DurationInSeconds = &v + return s +} + +// SetEndTime sets the EndTime field's value. +func (s *BuildPhase) SetEndTime(v time.Time) *BuildPhase { + s.EndTime = &v + return s +} + +// SetPhaseStatus sets the PhaseStatus field's value. +func (s *BuildPhase) SetPhaseStatus(v string) *BuildPhase { + s.PhaseStatus = &v + return s +} + +// SetPhaseType sets the PhaseType field's value. +func (s *BuildPhase) SetPhaseType(v string) *BuildPhase { + s.PhaseType = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *BuildPhase) SetStartTime(v time.Time) *BuildPhase { + s.StartTime = &v + return s +} + +type CreateProjectInput struct { + _ struct{} `type:"structure"` + + // Information about the build project's build output artifacts. + // + // Artifacts is a required field + Artifacts *ProjectArtifacts `locationName:"artifacts" type:"structure" required:"true"` + + // A meaningful description of the build project. + Description *string `locationName:"description" type:"string"` + + // The AWS Key Management Service (AWS KMS) customer master key (CMK) to be + // used for encrypting the build project's build output artifacts. + // + // You can specify either the CMK's Amazon Resource Name (ARN) or, if available, + // the CMK's alias (using the format alias/alias-name). + EncryptionKey *string `locationName:"encryptionKey" min:"1" type:"string"` + + // Information about the build project's build environment. + // + // Environment is a required field + Environment *ProjectEnvironment `locationName:"environment" type:"structure" required:"true"` + + // The build project's name. + // + // Name is a required field + Name *string `locationName:"name" min:"2" type:"string" required:"true"` + + // The Amazon Resource Name (ARN) of the AWS Identity and Access Management + // (IAM) role that enables AWS CodeBuild to interact with dependent AWS services + // on behalf of the AWS account. + ServiceRole *string `locationName:"serviceRole" min:"1" type:"string"` + + // Information about the build project's build input source code. + // + // Source is a required field + Source *ProjectSource `locationName:"source" type:"structure" required:"true"` + + // A set of tags for this build project. + // + // These tags are available for use by AWS services that support AWS CodeBuild + // build project tags. + Tags []*Tag `locationName:"tags" type:"list"` + + // How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until + // timing out any related build that does not get marked as completed. The default + // is 60 minutes. + TimeoutInMinutes *int64 `locationName:"timeoutInMinutes" min:"1" type:"integer"` +} + +// String returns the string representation +func (s CreateProjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateProjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateProjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateProjectInput"} + if s.Artifacts == nil { + invalidParams.Add(request.NewErrParamRequired("Artifacts")) + } + if s.EncryptionKey != nil && len(*s.EncryptionKey) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EncryptionKey", 1)) + } + if s.Environment == nil { + invalidParams.Add(request.NewErrParamRequired("Environment")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 2 { + invalidParams.Add(request.NewErrParamMinLen("Name", 2)) + } + if s.ServiceRole != nil && len(*s.ServiceRole) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ServiceRole", 1)) + } + if s.Source == nil { + invalidParams.Add(request.NewErrParamRequired("Source")) + } + if s.TimeoutInMinutes != nil && *s.TimeoutInMinutes < 1 { + invalidParams.Add(request.NewErrParamMinValue("TimeoutInMinutes", 1)) + } + if s.Artifacts != nil { + if err := s.Artifacts.Validate(); err != nil { + invalidParams.AddNested("Artifacts", err.(request.ErrInvalidParams)) + } + } + if s.Environment != nil { + if err := s.Environment.Validate(); err != nil { + invalidParams.AddNested("Environment", err.(request.ErrInvalidParams)) + } + } + if s.Source != nil { + if err := s.Source.Validate(); err != nil { + invalidParams.AddNested("Source", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArtifacts sets the Artifacts field's value. +func (s *CreateProjectInput) SetArtifacts(v *ProjectArtifacts) *CreateProjectInput { + s.Artifacts = v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateProjectInput) SetDescription(v string) *CreateProjectInput { + s.Description = &v + return s +} + +// SetEncryptionKey sets the EncryptionKey field's value. +func (s *CreateProjectInput) SetEncryptionKey(v string) *CreateProjectInput { + s.EncryptionKey = &v + return s +} + +// SetEnvironment sets the Environment field's value. +func (s *CreateProjectInput) SetEnvironment(v *ProjectEnvironment) *CreateProjectInput { + s.Environment = v + return s +} + +// SetName sets the Name field's value. +func (s *CreateProjectInput) SetName(v string) *CreateProjectInput { + s.Name = &v + return s +} + +// SetServiceRole sets the ServiceRole field's value. +func (s *CreateProjectInput) SetServiceRole(v string) *CreateProjectInput { + s.ServiceRole = &v + return s +} + +// SetSource sets the Source field's value. +func (s *CreateProjectInput) SetSource(v *ProjectSource) *CreateProjectInput { + s.Source = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateProjectInput) SetTags(v []*Tag) *CreateProjectInput { + s.Tags = v + return s +} + +// SetTimeoutInMinutes sets the TimeoutInMinutes field's value. +func (s *CreateProjectInput) SetTimeoutInMinutes(v int64) *CreateProjectInput { + s.TimeoutInMinutes = &v + return s +} + +type CreateProjectOutput struct { + _ struct{} `type:"structure"` + + // Information about the build project that was created. + Project *Project `locationName:"project" type:"structure"` +} + +// String returns the string representation +func (s CreateProjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateProjectOutput) GoString() string { + return s.String() +} + +// SetProject sets the Project field's value. +func (s *CreateProjectOutput) SetProject(v *Project) *CreateProjectOutput { + s.Project = v + return s +} + +type DeleteProjectInput struct { + _ struct{} `type:"structure"` + + // The name of the build project to delete. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteProjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteProjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteProjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteProjectInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeleteProjectInput) SetName(v string) *DeleteProjectInput { + s.Name = &v + return s +} + +type DeleteProjectOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteProjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteProjectOutput) GoString() string { + return s.String() +} + +// Information about a Docker image that is managed by AWS CodeBuild. +type EnvironmentImage struct { + _ struct{} `type:"structure"` + + // The Docker image's description. + Description *string `locationName:"description" type:"string"` + + // The Docker image's name. + Name *string `locationName:"name" type:"string"` +} + +// String returns the string representation +func (s EnvironmentImage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentImage) GoString() string { + return s.String() +} + +// SetDescription sets the Description field's value. +func (s *EnvironmentImage) SetDescription(v string) *EnvironmentImage { + s.Description = &v + return s +} + +// SetName sets the Name field's value. +func (s *EnvironmentImage) SetName(v string) *EnvironmentImage { + s.Name = &v + return s +} + +// A set of Docker images that are related by programming language and are managed +// by AWS CodeBuild. +type EnvironmentLanguage struct { + _ struct{} `type:"structure"` + + // The list of Docker images that are related by the specified programming language. + Images []*EnvironmentImage `locationName:"images" type:"list"` + + // The programming language for the related set of Docker images. + Language *string `locationName:"language" type:"string" enum:"LanguageType"` +} + +// String returns the string representation +func (s EnvironmentLanguage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentLanguage) GoString() string { + return s.String() +} + +// SetImages sets the Images field's value. +func (s *EnvironmentLanguage) SetImages(v []*EnvironmentImage) *EnvironmentLanguage { + s.Images = v + return s +} + +// SetLanguage sets the Language field's value. +func (s *EnvironmentLanguage) SetLanguage(v string) *EnvironmentLanguage { + s.Language = &v + return s +} + +// A set of Docker images that are related by platform and are managed by AWS +// CodeBuild. +type EnvironmentPlatform struct { + _ struct{} `type:"structure"` + + // The list of programming languages that are available for the specified platform. + Languages []*EnvironmentLanguage `locationName:"languages" type:"list"` + + // The platform's name. + Platform *string `locationName:"platform" type:"string" enum:"PlatformType"` +} + +// String returns the string representation +func (s EnvironmentPlatform) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentPlatform) GoString() string { + return s.String() +} + +// SetLanguages sets the Languages field's value. +func (s *EnvironmentPlatform) SetLanguages(v []*EnvironmentLanguage) *EnvironmentPlatform { + s.Languages = v + return s +} + +// SetPlatform sets the Platform field's value. +func (s *EnvironmentPlatform) SetPlatform(v string) *EnvironmentPlatform { + s.Platform = &v + return s +} + +// Information about an environment variable for a build project or a build. +type EnvironmentVariable struct { + _ struct{} `type:"structure"` + + // The environment variable's name or key. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` + + // The environment variable's value. + // + // Value is a required field + Value *string `locationName:"value" type:"string" required:"true"` +} + +// String returns the string representation +func (s EnvironmentVariable) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentVariable) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnvironmentVariable) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnvironmentVariable"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *EnvironmentVariable) SetName(v string) *EnvironmentVariable { + s.Name = &v + return s +} + +// SetValue sets the Value field's value. +func (s *EnvironmentVariable) SetValue(v string) *EnvironmentVariable { + s.Value = &v + return s +} + +type ListBuildsForProjectInput struct { + _ struct{} `type:"structure"` + + // During a previous call, if there are more than 100 items in the list, only + // the first 100 items are returned, along with a unique string called a next + // token. To get the next batch of items in the list, call this operation again, + // adding the next token to the call. To get all of the items in the list, keep + // calling this operation with each subsequent next token that is returned, + // until no more next tokens are returned. + NextToken *string `locationName:"nextToken" type:"string"` + + // The name of the build project to get a list of build IDs for. + // + // ProjectName is a required field + ProjectName *string `locationName:"projectName" min:"1" type:"string" required:"true"` + + // The order to list build IDs. Valid values include: + // + // * ASCENDING: List the build IDs in ascending order by build ID. + // + // * DESCENDING: List the build IDs in descending order by build ID. + SortOrder *string `locationName:"sortOrder" type:"string" enum:"SortOrderType"` +} + +// String returns the string representation +func (s ListBuildsForProjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBuildsForProjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListBuildsForProjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListBuildsForProjectInput"} + if s.ProjectName == nil { + invalidParams.Add(request.NewErrParamRequired("ProjectName")) + } + if s.ProjectName != nil && len(*s.ProjectName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ProjectName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNextToken sets the NextToken field's value. +func (s *ListBuildsForProjectInput) SetNextToken(v string) *ListBuildsForProjectInput { + s.NextToken = &v + return s +} + +// SetProjectName sets the ProjectName field's value. +func (s *ListBuildsForProjectInput) SetProjectName(v string) *ListBuildsForProjectInput { + s.ProjectName = &v + return s +} + +// SetSortOrder sets the SortOrder field's value. +func (s *ListBuildsForProjectInput) SetSortOrder(v string) *ListBuildsForProjectInput { + s.SortOrder = &v + return s +} + +type ListBuildsForProjectOutput struct { + _ struct{} `type:"structure"` + + // A list of build IDs for the specified build project, with each build ID representing + // a single build. + Ids []*string `locationName:"ids" min:"1" type:"list"` + + // If there are more than 100 items in the list, only the first 100 items are + // returned, along with a unique string called a next token. To get the next + // batch of items in the list, call this operation again, adding the next token + // to the call. + NextToken *string `locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListBuildsForProjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBuildsForProjectOutput) GoString() string { + return s.String() +} + +// SetIds sets the Ids field's value. +func (s *ListBuildsForProjectOutput) SetIds(v []*string) *ListBuildsForProjectOutput { + s.Ids = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListBuildsForProjectOutput) SetNextToken(v string) *ListBuildsForProjectOutput { + s.NextToken = &v + return s +} + +type ListBuildsInput struct { + _ struct{} `type:"structure"` + + // During a previous call, if there are more than 100 items in the list, only + // the first 100 items are returned, along with a unique string called a next + // token. To get the next batch of items in the list, call this operation again, + // adding the next token to the call. To get all of the items in the list, keep + // calling this operation with each subsequent next token that is returned, + // until no more next tokens are returned. + NextToken *string `locationName:"nextToken" type:"string"` + + // The order to list build IDs. Valid values include: + // + // * ASCENDING: List the build IDs in ascending order by build ID. + // + // * DESCENDING: List the build IDs in descending order by build ID. + SortOrder *string `locationName:"sortOrder" type:"string" enum:"SortOrderType"` +} + +// String returns the string representation +func (s ListBuildsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBuildsInput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListBuildsInput) SetNextToken(v string) *ListBuildsInput { + s.NextToken = &v + return s +} + +// SetSortOrder sets the SortOrder field's value. +func (s *ListBuildsInput) SetSortOrder(v string) *ListBuildsInput { + s.SortOrder = &v + return s +} + +type ListBuildsOutput struct { + _ struct{} `type:"structure"` + + // A list of build IDs, with each build ID representing a single build. + Ids []*string `locationName:"ids" min:"1" type:"list"` + + // If there are more than 100 items in the list, only the first 100 items are + // returned, along with a unique string called a next token. To get the next + // batch of items in the list, call this operation again, adding the next token + // to the call. + NextToken *string `locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListBuildsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBuildsOutput) GoString() string { + return s.String() +} + +// SetIds sets the Ids field's value. +func (s *ListBuildsOutput) SetIds(v []*string) *ListBuildsOutput { + s.Ids = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListBuildsOutput) SetNextToken(v string) *ListBuildsOutput { + s.NextToken = &v + return s +} + +type ListCuratedEnvironmentImagesInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ListCuratedEnvironmentImagesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCuratedEnvironmentImagesInput) GoString() string { + return s.String() +} + +type ListCuratedEnvironmentImagesOutput struct { + _ struct{} `type:"structure"` + + // Information about supported platforms for Docker images that are managed + // by AWS CodeBuild. + Platforms []*EnvironmentPlatform `locationName:"platforms" type:"list"` +} + +// String returns the string representation +func (s ListCuratedEnvironmentImagesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListCuratedEnvironmentImagesOutput) GoString() string { + return s.String() +} + +// SetPlatforms sets the Platforms field's value. +func (s *ListCuratedEnvironmentImagesOutput) SetPlatforms(v []*EnvironmentPlatform) *ListCuratedEnvironmentImagesOutput { + s.Platforms = v + return s +} + +type ListProjectsInput struct { + _ struct{} `type:"structure"` + + // During a previous call, if there are more than 100 items in the list, only + // the first 100 items are returned, along with a unique string called a next + // token. To get the next batch of items in the list, call this operation again, + // adding the next token to the call. To get all of the items in the list, keep + // calling this operation with each subsequent next token that is returned, + // until no more next tokens are returned. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The criterion to be used to list build project names. Valid values include: + // + // * CREATED_TIME: List the build project names based on when each build + // project was created. + // + // * LAST_MODIFIED_TIME: List the build project names based on when information + // about each build project was last changed. + // + // * NAME: List the build project names based on each build project's name. + // + // Use sortOrder to specify in what order to list the build project names based + // on the preceding criteria. + SortBy *string `locationName:"sortBy" type:"string" enum:"ProjectSortByType"` + + // The order in which to list build projects. Valid values include: + // + // * ASCENDING: List the build project names in ascending order. + // + // * DESCENDING: List the build project names in descending order. + // + // Use sortBy to specify the criterion to be used to list build project names. + SortOrder *string `locationName:"sortOrder" type:"string" enum:"SortOrderType"` +} + +// String returns the string representation +func (s ListProjectsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListProjectsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListProjectsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListProjectsInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNextToken sets the NextToken field's value. +func (s *ListProjectsInput) SetNextToken(v string) *ListProjectsInput { + s.NextToken = &v + return s +} + +// SetSortBy sets the SortBy field's value. +func (s *ListProjectsInput) SetSortBy(v string) *ListProjectsInput { + s.SortBy = &v + return s +} + +// SetSortOrder sets the SortOrder field's value. +func (s *ListProjectsInput) SetSortOrder(v string) *ListProjectsInput { + s.SortOrder = &v + return s +} + +type ListProjectsOutput struct { + _ struct{} `type:"structure"` + + // If there are more than 100 items in the list, only the first 100 items are + // returned, along with a unique string called a next token. To get the next + // batch of items in the list, call this operation again, adding the next token + // to the call. + NextToken *string `locationName:"nextToken" type:"string"` + + // The list of build project names, with each build project name representing + // a single build project. + Projects []*string `locationName:"projects" min:"1" type:"list"` +} + +// String returns the string representation +func (s ListProjectsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListProjectsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListProjectsOutput) SetNextToken(v string) *ListProjectsOutput { + s.NextToken = &v + return s +} + +// SetProjects sets the Projects field's value. +func (s *ListProjectsOutput) SetProjects(v []*string) *ListProjectsOutput { + s.Projects = v + return s +} + +// Information about build logs in Amazon CloudWatch Logs. +type LogsLocation struct { + _ struct{} `type:"structure"` + + // The URL to an individual build log in Amazon CloudWatch Logs. + DeepLink *string `locationName:"deepLink" type:"string"` + + // The name of the Amazon CloudWatch Logs group for the associated build logs. + GroupName *string `locationName:"groupName" type:"string"` + + // The name of the Amazon CloudWatch Logs stream for the associated build logs. + StreamName *string `locationName:"streamName" type:"string"` +} + +// String returns the string representation +func (s LogsLocation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LogsLocation) GoString() string { + return s.String() +} + +// SetDeepLink sets the DeepLink field's value. +func (s *LogsLocation) SetDeepLink(v string) *LogsLocation { + s.DeepLink = &v + return s +} + +// SetGroupName sets the GroupName field's value. +func (s *LogsLocation) SetGroupName(v string) *LogsLocation { + s.GroupName = &v + return s +} + +// SetStreamName sets the StreamName field's value. +func (s *LogsLocation) SetStreamName(v string) *LogsLocation { + s.StreamName = &v + return s +} + +// Additional information about a build phase that has an error, which you can +// use to help troubleshoot a failed build. +type PhaseContext struct { + _ struct{} `type:"structure"` + + // An explanation of the build phase's context. This explanation may include + // a command ID and an exit code. + Message *string `locationName:"message" type:"string"` + + // The status code for the context of the build phase. + StatusCode *string `locationName:"statusCode" type:"string"` +} + +// String returns the string representation +func (s PhaseContext) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PhaseContext) GoString() string { + return s.String() +} + +// SetMessage sets the Message field's value. +func (s *PhaseContext) SetMessage(v string) *PhaseContext { + s.Message = &v + return s +} + +// SetStatusCode sets the StatusCode field's value. +func (s *PhaseContext) SetStatusCode(v string) *PhaseContext { + s.StatusCode = &v + return s +} + +// Information about a build project. +type Project struct { + _ struct{} `type:"structure"` + + // The build project's Amazon Resource Name (ARN). + Arn *string `locationName:"arn" type:"string"` + + // Information about the build project's build output artifacts. + Artifacts *ProjectArtifacts `locationName:"artifacts" type:"structure"` + + // When the build project was created, expressed in Unix time format. + Created *time.Time `locationName:"created" type:"timestamp" timestampFormat:"unix"` + + // A meaningful description of the build project. + Description *string `locationName:"description" type:"string"` + + // The AWS Key Management Service (AWS KMS) customer master key (CMK) to be + // used for encrypting the build project's build output artifacts. + // + // This is expressed either as the CMK's Amazon Resource Name (ARN) or, if specified, + // the CMK's alias (using the format alias/alias-name). + EncryptionKey *string `locationName:"encryptionKey" min:"1" type:"string"` + + // Information about the build environment for this build project. + Environment *ProjectEnvironment `locationName:"environment" type:"structure"` + + // When the build project's settings were last modified, expressed in Unix time + // format. + LastModified *time.Time `locationName:"lastModified" type:"timestamp" timestampFormat:"unix"` + + // The build project's name. + Name *string `locationName:"name" min:"2" type:"string"` + + // The Amazon Resource Name (ARN) of the AWS Identity and Access Management + // (IAM) role that enables AWS CodeBuild to interact with dependent AWS services + // on behalf of the AWS account. + ServiceRole *string `locationName:"serviceRole" min:"1" type:"string"` + + // Information about the build project's build input source code. + Source *ProjectSource `locationName:"source" type:"structure"` + + // The tags for this build project. + // + // These tags are available for use by AWS services that support AWS CodeBuild + // build project tags. + Tags []*Tag `locationName:"tags" type:"list"` + + // How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait to + // timeout any related build that did not get marked as completed. The default + // is 60 minutes. + TimeoutInMinutes *int64 `locationName:"timeoutInMinutes" min:"1" type:"integer"` +} + +// String returns the string representation +func (s Project) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Project) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *Project) SetArn(v string) *Project { + s.Arn = &v + return s +} + +// SetArtifacts sets the Artifacts field's value. +func (s *Project) SetArtifacts(v *ProjectArtifacts) *Project { + s.Artifacts = v + return s +} + +// SetCreated sets the Created field's value. +func (s *Project) SetCreated(v time.Time) *Project { + s.Created = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *Project) SetDescription(v string) *Project { + s.Description = &v + return s +} + +// SetEncryptionKey sets the EncryptionKey field's value. +func (s *Project) SetEncryptionKey(v string) *Project { + s.EncryptionKey = &v + return s +} + +// SetEnvironment sets the Environment field's value. +func (s *Project) SetEnvironment(v *ProjectEnvironment) *Project { + s.Environment = v + return s +} + +// SetLastModified sets the LastModified field's value. +func (s *Project) SetLastModified(v time.Time) *Project { + s.LastModified = &v + return s +} + +// SetName sets the Name field's value. +func (s *Project) SetName(v string) *Project { + s.Name = &v + return s +} + +// SetServiceRole sets the ServiceRole field's value. +func (s *Project) SetServiceRole(v string) *Project { + s.ServiceRole = &v + return s +} + +// SetSource sets the Source field's value. +func (s *Project) SetSource(v *ProjectSource) *Project { + s.Source = v + return s +} + +// SetTags sets the Tags field's value. +func (s *Project) SetTags(v []*Tag) *Project { + s.Tags = v + return s +} + +// SetTimeoutInMinutes sets the TimeoutInMinutes field's value. +func (s *Project) SetTimeoutInMinutes(v int64) *Project { + s.TimeoutInMinutes = &v + return s +} + +// Information about the build project's build output artifacts. +type ProjectArtifacts struct { + _ struct{} `type:"structure"` + + // Information about the build output artifact location, as follows: + // + // * If type is set to CODEPIPELINE, then AWS CodePipeline will ignore this + // value if specified. This is because AWS CodePipeline manages its build + // output locations instead of AWS CodeBuild. + // + // * If type is set to NO_ARTIFACTS, then this value will be ignored if specified, + // because no build output will be produced. + // + // * If type is set to S3, this is the name of the output bucket. If path + // is not also specified, then location can also specify the path of the + // output artifact in the output bucket. + Location *string `locationName:"location" type:"string"` + + // Along with path and namespaceType, the pattern that AWS CodeBuild will use + // to name and store the output artifact, as follows: + // + // * If type is set to CODEPIPELINE, then AWS CodePipeline will ignore this + // value if specified. This is because AWS CodePipeline manages its build + // output names instead of AWS CodeBuild. + // + // * If type is set to NO_ARTIFACTS, then this value will be ignored if specified, + // because no build output will be produced. + // + // * If type is set to S3, this is the name of the output artifact object. + // + // For example, if path is set to MyArtifacts, namespaceType is set to BUILD_ID, + // and name is set to MyArtifact.zip, then the output artifact would be stored + // in MyArtifacts/build-ID/MyArtifact.zip. + Name *string `locationName:"name" type:"string"` + + // Along with path and name, the pattern that AWS CodeBuild will use to determine + // the name and location to store the output artifact, as follows: + // + // * If type is set to CODEPIPELINE, then AWS CodePipeline will ignore this + // value if specified. This is because AWS CodePipeline manages its build + // output names instead of AWS CodeBuild. + // + // * If type is set to NO_ARTIFACTS, then this value will be ignored if specified, + // because no build output will be produced. + // + // * If type is set to S3, then valid values include: + // + // BUILD_ID: Include the build ID in the location of the build output artifact. + // + // NONE: Do not include the build ID. This is the default if namespaceType is + // not specified. + // + // For example, if path is set to MyArtifacts, namespaceType is set to BUILD_ID, + // and name is set to MyArtifact.zip, then the output artifact would be stored + // in MyArtifacts/build-ID/MyArtifact.zip. + NamespaceType *string `locationName:"namespaceType" type:"string" enum:"ArtifactNamespace"` + + // The type of build output artifact to create, as follows: + // + // * If type is set to CODEPIPELINE, then AWS CodePipeline will ignore this + // value if specified. This is because AWS CodePipeline manages its build + // output artifacts instead of AWS CodeBuild. + // + // * If type is set to NO_ARTIFACTS, then this value will be ignored if specified, + // because no build output will be produced. + // + // * If type is set to S3, valid values include: + // + // NONE: AWS CodeBuild will create in the output bucket a folder containing + // the build output. This is the default if packaging is not specified. + // + // ZIP: AWS CodeBuild will create in the output bucket a ZIP file containing + // the build output. + Packaging *string `locationName:"packaging" type:"string" enum:"ArtifactPackaging"` + + // Along with namespaceType and name, the pattern that AWS CodeBuild will use + // to name and store the output artifact, as follows: + // + // * If type is set to CODEPIPELINE, then AWS CodePipeline will ignore this + // value if specified. This is because AWS CodePipeline manages its build + // output names instead of AWS CodeBuild. + // + // * If type is set to NO_ARTIFACTS, then this value will be ignored if specified, + // because no build output will be produced. + // + // * If type is set to S3, this is the path to the output artifact. If path + // is not specified, then path will not be used. + // + // For example, if path is set to MyArtifacts, namespaceType is set to NONE, + // and name is set to MyArtifact.zip, then the output artifact would be stored + // in the output bucket at MyArtifacts/MyArtifact.zip. + Path *string `locationName:"path" type:"string"` + + // The build output artifact's type. Valid values include: + // + // * CODEPIPELINE: The build project with have build output generated through + // AWS CodePipeline. + // + // * NO_ARTIFACTS: The build project will not produce any build output. + // + // * S3: The build project will store build output in Amazon Simple Storage + // Service (Amazon S3). + // + // Type is a required field + Type *string `locationName:"type" type:"string" required:"true" enum:"ArtifactsType"` +} + +// String returns the string representation +func (s ProjectArtifacts) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ProjectArtifacts) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ProjectArtifacts) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ProjectArtifacts"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLocation sets the Location field's value. +func (s *ProjectArtifacts) SetLocation(v string) *ProjectArtifacts { + s.Location = &v + return s +} + +// SetName sets the Name field's value. +func (s *ProjectArtifacts) SetName(v string) *ProjectArtifacts { + s.Name = &v + return s +} + +// SetNamespaceType sets the NamespaceType field's value. +func (s *ProjectArtifacts) SetNamespaceType(v string) *ProjectArtifacts { + s.NamespaceType = &v + return s +} + +// SetPackaging sets the Packaging field's value. +func (s *ProjectArtifacts) SetPackaging(v string) *ProjectArtifacts { + s.Packaging = &v + return s +} + +// SetPath sets the Path field's value. +func (s *ProjectArtifacts) SetPath(v string) *ProjectArtifacts { + s.Path = &v + return s +} + +// SetType sets the Type field's value. +func (s *ProjectArtifacts) SetType(v string) *ProjectArtifacts { + s.Type = &v + return s +} + +// Information about the build project's build environment. +type ProjectEnvironment struct { + _ struct{} `type:"structure"` + + // Information about the compute resources the build project will use. Available + // values include: + // + // * BUILD_GENERAL1_SMALL: Use up to 3 GB memory and 2 vCPUs for builds. + // + // * BUILD_GENERAL1_MEDIUM: Use up to 7 GB memory and 4 vCPUs for builds. + // + // * BUILD_GENERAL1_LARGE: Use up to 15 GB memory and 8 vCPUs for builds. + // + // ComputeType is a required field + ComputeType *string `locationName:"computeType" type:"string" required:"true" enum:"ComputeType"` + + // A set of environment variables to make available to builds for this build + // project. + EnvironmentVariables []*EnvironmentVariable `locationName:"environmentVariables" type:"list"` + + // The ID of the Docker image to use for this build project. + // + // Image is a required field + Image *string `locationName:"image" min:"1" type:"string" required:"true"` + + // The type of build environment to use for related builds. + // + // The only valid value is LINUX_CONTAINER, which represents a Linux-based build + // environment. + // + // Type is a required field + Type *string `locationName:"type" type:"string" required:"true" enum:"EnvironmentType"` +} + +// String returns the string representation +func (s ProjectEnvironment) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ProjectEnvironment) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ProjectEnvironment) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ProjectEnvironment"} + if s.ComputeType == nil { + invalidParams.Add(request.NewErrParamRequired("ComputeType")) + } + if s.Image == nil { + invalidParams.Add(request.NewErrParamRequired("Image")) + } + if s.Image != nil && len(*s.Image) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Image", 1)) + } + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + if s.EnvironmentVariables != nil { + for i, v := range s.EnvironmentVariables { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "EnvironmentVariables", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetComputeType sets the ComputeType field's value. +func (s *ProjectEnvironment) SetComputeType(v string) *ProjectEnvironment { + s.ComputeType = &v + return s +} + +// SetEnvironmentVariables sets the EnvironmentVariables field's value. +func (s *ProjectEnvironment) SetEnvironmentVariables(v []*EnvironmentVariable) *ProjectEnvironment { + s.EnvironmentVariables = v + return s +} + +// SetImage sets the Image field's value. +func (s *ProjectEnvironment) SetImage(v string) *ProjectEnvironment { + s.Image = &v + return s +} + +// SetType sets the Type field's value. +func (s *ProjectEnvironment) SetType(v string) *ProjectEnvironment { + s.Type = &v + return s +} + +// Information about the build project's build input source code. +type ProjectSource struct { + _ struct{} `type:"structure"` + + // Information about the authorization settings for AWS CodeBuild to access + // the source code to be built. + // + // This information is only for the AWS CodeBuild console's use. Your code should + // not get or set this information directly. + Auth *SourceAuth `locationName:"auth" type:"structure"` + + // The build spec declaration to use for this build project's related builds. + // + // If this value is not specified, a build spec must be included along with + // the source code to be built. + Buildspec *string `locationName:"buildspec" type:"string"` + + // Information about the location of the source code to be built. Valid values + // include: + // + // * For source code settings that are specified in the source action of + // a pipeline in AWS CodePipeline, location should not be specified. If it + // is specified, AWS CodePipeline will ignore it. This is because AWS CodePipeline + // uses the settings in a pipeline's source action instead of this value. + // + // * For source code in an AWS CodeCommit repository, the HTTPS clone URL + // to the repository that contains the source code and the build spec (for + // example, https://git-codecommit.region-ID.amazonaws.com/v1/repos/repo-name). + // + // * For source code in an Amazon Simple Storage Service (Amazon S3) input + // bucket, the path to the ZIP file that contains the source code (for example, + // bucket-name/path/to/object-name.zip) + // + // * For source code in a GitHub repository, the HTTPS clone URL, including + // the user name and personal access token, to the repository that contains + // the source code and the build spec (for example, https://login-user-name:personal-access-token@github.com/repo-owner-name/repo-name.git). + // For more information, see Creating an Access Token for Command-Line Use + // (https://help.github.com/articles/creating-an-access-token-for-command-line-use/) + // on the GitHub Help website. + Location *string `locationName:"location" type:"string"` + + // The type of repository that contains the source code to be built. Valid values + // include: + // + // * CODECOMMIT: The source code is in an AWS CodeCommit repository. + // + // * CODEPIPELINE: The source code settings are specified in the source action + // of a pipeline in AWS CodePipeline. + // + // * GITHUB: The source code is in a GitHub repository. + // + // * S3: The source code is in an Amazon Simple Storage Service (Amazon S3) + // input bucket. + // + // Type is a required field + Type *string `locationName:"type" type:"string" required:"true" enum:"SourceType"` +} + +// String returns the string representation +func (s ProjectSource) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ProjectSource) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ProjectSource) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ProjectSource"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + if s.Auth != nil { + if err := s.Auth.Validate(); err != nil { + invalidParams.AddNested("Auth", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAuth sets the Auth field's value. +func (s *ProjectSource) SetAuth(v *SourceAuth) *ProjectSource { + s.Auth = v + return s +} + +// SetBuildspec sets the Buildspec field's value. +func (s *ProjectSource) SetBuildspec(v string) *ProjectSource { + s.Buildspec = &v + return s +} + +// SetLocation sets the Location field's value. +func (s *ProjectSource) SetLocation(v string) *ProjectSource { + s.Location = &v + return s +} + +// SetType sets the Type field's value. +func (s *ProjectSource) SetType(v string) *ProjectSource { + s.Type = &v + return s +} + +// Information about the authorization settings for AWS CodeBuild to access +// the source code to be built. +// +// This information is only for the AWS CodeBuild console's use. Your code should +// not get or set this information directly. +type SourceAuth struct { + _ struct{} `type:"structure"` + + // The resource value that applies to the specified authorization type. + Resource *string `locationName:"resource" type:"string"` + + // The authorization type to use. The only valid value is OAUTH, which represents + // the OAuth authorization type. + // + // Type is a required field + Type *string `locationName:"type" type:"string" required:"true" enum:"SourceAuthType"` +} + +// String returns the string representation +func (s SourceAuth) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SourceAuth) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SourceAuth) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SourceAuth"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResource sets the Resource field's value. +func (s *SourceAuth) SetResource(v string) *SourceAuth { + s.Resource = &v + return s +} + +// SetType sets the Type field's value. +func (s *SourceAuth) SetType(v string) *SourceAuth { + s.Type = &v + return s +} + +type StartBuildInput struct { + _ struct{} `type:"structure"` + + // Build output artifact settings that override, for this build only, the latest + // ones already defined in the corresponding build project. + ArtifactsOverride *ProjectArtifacts `locationName:"artifactsOverride" type:"structure"` + + // A build spec declaration that overrides, for this build only, the latest + // one already defined in the corresponding build project. + BuildspecOverride *string `locationName:"buildspecOverride" type:"string"` + + // A set of environment variables that overrides, for this build only, the latest + // ones already defined in the corresponding build project. + EnvironmentVariablesOverride []*EnvironmentVariable `locationName:"environmentVariablesOverride" type:"list"` + + // The name of the build project to start running a build. + // + // ProjectName is a required field + ProjectName *string `locationName:"projectName" min:"1" type:"string" required:"true"` + + // A version of the build input to be built, for this build only. If not specified, + // the latest version will be used. If specified, must be one of: + // + // * For AWS CodeCommit or GitHub: the commit ID to use. + // + // * For Amazon Simple Storage Service (Amazon S3): the version ID of the + // object representing the build input ZIP file to use. + SourceVersion *string `locationName:"sourceVersion" type:"string"` + + // The number of build timeout minutes, from 5 to 480 (8 hours) that overrides, + // for this build only, the latest setting already defined in the corresponding + // build project. + TimeoutInMinutesOverride *int64 `locationName:"timeoutInMinutesOverride" min:"1" type:"integer"` +} + +// String returns the string representation +func (s StartBuildInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartBuildInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartBuildInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartBuildInput"} + if s.ProjectName == nil { + invalidParams.Add(request.NewErrParamRequired("ProjectName")) + } + if s.ProjectName != nil && len(*s.ProjectName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ProjectName", 1)) + } + if s.TimeoutInMinutesOverride != nil && *s.TimeoutInMinutesOverride < 1 { + invalidParams.Add(request.NewErrParamMinValue("TimeoutInMinutesOverride", 1)) + } + if s.ArtifactsOverride != nil { + if err := s.ArtifactsOverride.Validate(); err != nil { + invalidParams.AddNested("ArtifactsOverride", err.(request.ErrInvalidParams)) + } + } + if s.EnvironmentVariablesOverride != nil { + for i, v := range s.EnvironmentVariablesOverride { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "EnvironmentVariablesOverride", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArtifactsOverride sets the ArtifactsOverride field's value. +func (s *StartBuildInput) SetArtifactsOverride(v *ProjectArtifacts) *StartBuildInput { + s.ArtifactsOverride = v + return s +} + +// SetBuildspecOverride sets the BuildspecOverride field's value. +func (s *StartBuildInput) SetBuildspecOverride(v string) *StartBuildInput { + s.BuildspecOverride = &v + return s +} + +// SetEnvironmentVariablesOverride sets the EnvironmentVariablesOverride field's value. +func (s *StartBuildInput) SetEnvironmentVariablesOverride(v []*EnvironmentVariable) *StartBuildInput { + s.EnvironmentVariablesOverride = v + return s +} + +// SetProjectName sets the ProjectName field's value. +func (s *StartBuildInput) SetProjectName(v string) *StartBuildInput { + s.ProjectName = &v + return s +} + +// SetSourceVersion sets the SourceVersion field's value. +func (s *StartBuildInput) SetSourceVersion(v string) *StartBuildInput { + s.SourceVersion = &v + return s +} + +// SetTimeoutInMinutesOverride sets the TimeoutInMinutesOverride field's value. +func (s *StartBuildInput) SetTimeoutInMinutesOverride(v int64) *StartBuildInput { + s.TimeoutInMinutesOverride = &v + return s +} + +type StartBuildOutput struct { + _ struct{} `type:"structure"` + + // Information about the build to be run. + Build *Build `locationName:"build" type:"structure"` +} + +// String returns the string representation +func (s StartBuildOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartBuildOutput) GoString() string { + return s.String() +} + +// SetBuild sets the Build field's value. +func (s *StartBuildOutput) SetBuild(v *Build) *StartBuildOutput { + s.Build = v + return s +} + +type StopBuildInput struct { + _ struct{} `type:"structure"` + + // The ID of the build to attempt to stop running. + // + // Id is a required field + Id *string `locationName:"id" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s StopBuildInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopBuildInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopBuildInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopBuildInput"} + if s.Id == nil { + invalidParams.Add(request.NewErrParamRequired("Id")) + } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetId sets the Id field's value. +func (s *StopBuildInput) SetId(v string) *StopBuildInput { + s.Id = &v + return s +} + +type StopBuildOutput struct { + _ struct{} `type:"structure"` + + // Information about the build that was attempted to be stopped. + Build *Build `locationName:"build" type:"structure"` +} + +// String returns the string representation +func (s StopBuildOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopBuildOutput) GoString() string { + return s.String() +} + +// SetBuild sets the Build field's value. +func (s *StopBuildOutput) SetBuild(v *Build) *StopBuildOutput { + s.Build = v + return s +} + +// A tag, consisting of a key and a value. +// +// This tag is available for use by AWS services that support tags in AWS CodeBuild. +type Tag struct { + _ struct{} `type:"structure"` + + // The tag's key. + Key *string `locationName:"key" min:"1" type:"string"` + + // The tag's value. + Value *string `locationName:"value" min:"1" type:"string"` +} + +// String returns the string representation +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tag"} + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *Tag) SetKey(v string) *Tag { + s.Key = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Tag) SetValue(v string) *Tag { + s.Value = &v + return s +} + +type UpdateProjectInput struct { + _ struct{} `type:"structure"` + + // Information to be changed about the build project's build output artifacts. + Artifacts *ProjectArtifacts `locationName:"artifacts" type:"structure"` + + // A new or replacement description of the build project. + Description *string `locationName:"description" type:"string"` + + // The replacement AWS Key Management Service (AWS KMS) customer master key + // (CMK) to be used for encrypting the build project's build output artifacts. + // + // You can specify either the CMK's Amazon Resource Name (ARN) or, if available, + // the CMK's alias (using the format alias/alias-name). + EncryptionKey *string `locationName:"encryptionKey" min:"1" type:"string"` + + // Information to be changed about the build project's build environment. + Environment *ProjectEnvironment `locationName:"environment" type:"structure"` + + // The name of the existing build project to change settings. + // + // You cannot change an existing build project's name. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` + + // The replacement Amazon Resource Name (ARN) of the AWS Identity and Access + // Management (IAM) role that enables AWS CodeBuild to interact with dependent + // AWS services on behalf of the AWS account. + ServiceRole *string `locationName:"serviceRole" min:"1" type:"string"` + + // Information to be changed about the build project's build input source code. + Source *ProjectSource `locationName:"source" type:"structure"` + + // The replacement set of tags for this build project. + // + // These tags are available for use by AWS services that support AWS CodeBuild + // build project tags. + Tags []*Tag `locationName:"tags" type:"list"` + + // The replacement value in minutes, from 5 to 480 (8 hours), for AWS CodeBuild + // to wait to timeout any related build that did not get marked as completed. + TimeoutInMinutes *int64 `locationName:"timeoutInMinutes" min:"1" type:"integer"` +} + +// String returns the string representation +func (s UpdateProjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateProjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateProjectInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateProjectInput"} + if s.EncryptionKey != nil && len(*s.EncryptionKey) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EncryptionKey", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.ServiceRole != nil && len(*s.ServiceRole) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ServiceRole", 1)) + } + if s.TimeoutInMinutes != nil && *s.TimeoutInMinutes < 1 { + invalidParams.Add(request.NewErrParamMinValue("TimeoutInMinutes", 1)) + } + if s.Artifacts != nil { + if err := s.Artifacts.Validate(); err != nil { + invalidParams.AddNested("Artifacts", err.(request.ErrInvalidParams)) + } + } + if s.Environment != nil { + if err := s.Environment.Validate(); err != nil { + invalidParams.AddNested("Environment", err.(request.ErrInvalidParams)) + } + } + if s.Source != nil { + if err := s.Source.Validate(); err != nil { + invalidParams.AddNested("Source", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArtifacts sets the Artifacts field's value. +func (s *UpdateProjectInput) SetArtifacts(v *ProjectArtifacts) *UpdateProjectInput { + s.Artifacts = v + return s +} + +// SetDescription sets the Description field's value. +func (s *UpdateProjectInput) SetDescription(v string) *UpdateProjectInput { + s.Description = &v + return s +} + +// SetEncryptionKey sets the EncryptionKey field's value. +func (s *UpdateProjectInput) SetEncryptionKey(v string) *UpdateProjectInput { + s.EncryptionKey = &v + return s +} + +// SetEnvironment sets the Environment field's value. +func (s *UpdateProjectInput) SetEnvironment(v *ProjectEnvironment) *UpdateProjectInput { + s.Environment = v + return s +} + +// SetName sets the Name field's value. +func (s *UpdateProjectInput) SetName(v string) *UpdateProjectInput { + s.Name = &v + return s +} + +// SetServiceRole sets the ServiceRole field's value. +func (s *UpdateProjectInput) SetServiceRole(v string) *UpdateProjectInput { + s.ServiceRole = &v + return s +} + +// SetSource sets the Source field's value. +func (s *UpdateProjectInput) SetSource(v *ProjectSource) *UpdateProjectInput { + s.Source = v + return s +} + +// SetTags sets the Tags field's value. +func (s *UpdateProjectInput) SetTags(v []*Tag) *UpdateProjectInput { + s.Tags = v + return s +} + +// SetTimeoutInMinutes sets the TimeoutInMinutes field's value. +func (s *UpdateProjectInput) SetTimeoutInMinutes(v int64) *UpdateProjectInput { + s.TimeoutInMinutes = &v + return s +} + +type UpdateProjectOutput struct { + _ struct{} `type:"structure"` + + // Information about the build project that was changed. + Project *Project `locationName:"project" type:"structure"` +} + +// String returns the string representation +func (s UpdateProjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateProjectOutput) GoString() string { + return s.String() +} + +// SetProject sets the Project field's value. +func (s *UpdateProjectOutput) SetProject(v *Project) *UpdateProjectOutput { + s.Project = v + return s +} + +const ( + // ArtifactNamespaceNone is a ArtifactNamespace enum value + ArtifactNamespaceNone = "NONE" + + // ArtifactNamespaceBuildId is a ArtifactNamespace enum value + ArtifactNamespaceBuildId = "BUILD_ID" +) + +const ( + // ArtifactPackagingNone is a ArtifactPackaging enum value + ArtifactPackagingNone = "NONE" + + // ArtifactPackagingZip is a ArtifactPackaging enum value + ArtifactPackagingZip = "ZIP" +) + +const ( + // ArtifactsTypeCodepipeline is a ArtifactsType enum value + ArtifactsTypeCodepipeline = "CODEPIPELINE" + + // ArtifactsTypeS3 is a ArtifactsType enum value + ArtifactsTypeS3 = "S3" + + // ArtifactsTypeNoArtifacts is a ArtifactsType enum value + ArtifactsTypeNoArtifacts = "NO_ARTIFACTS" +) + +const ( + // BuildPhaseTypeSubmitted is a BuildPhaseType enum value + BuildPhaseTypeSubmitted = "SUBMITTED" + + // BuildPhaseTypeProvisioning is a BuildPhaseType enum value + BuildPhaseTypeProvisioning = "PROVISIONING" + + // BuildPhaseTypeDownloadSource is a BuildPhaseType enum value + BuildPhaseTypeDownloadSource = "DOWNLOAD_SOURCE" + + // BuildPhaseTypeInstall is a BuildPhaseType enum value + BuildPhaseTypeInstall = "INSTALL" + + // BuildPhaseTypePreBuild is a BuildPhaseType enum value + BuildPhaseTypePreBuild = "PRE_BUILD" + + // BuildPhaseTypeBuild is a BuildPhaseType enum value + BuildPhaseTypeBuild = "BUILD" + + // BuildPhaseTypePostBuild is a BuildPhaseType enum value + BuildPhaseTypePostBuild = "POST_BUILD" + + // BuildPhaseTypeUploadArtifacts is a BuildPhaseType enum value + BuildPhaseTypeUploadArtifacts = "UPLOAD_ARTIFACTS" + + // BuildPhaseTypeFinalizing is a BuildPhaseType enum value + BuildPhaseTypeFinalizing = "FINALIZING" + + // BuildPhaseTypeCompleted is a BuildPhaseType enum value + BuildPhaseTypeCompleted = "COMPLETED" +) + +const ( + // ComputeTypeBuildGeneral1Small is a ComputeType enum value + ComputeTypeBuildGeneral1Small = "BUILD_GENERAL1_SMALL" + + // ComputeTypeBuildGeneral1Medium is a ComputeType enum value + ComputeTypeBuildGeneral1Medium = "BUILD_GENERAL1_MEDIUM" + + // ComputeTypeBuildGeneral1Large is a ComputeType enum value + ComputeTypeBuildGeneral1Large = "BUILD_GENERAL1_LARGE" +) + +const ( + // EnvironmentTypeLinuxContainer is a EnvironmentType enum value + EnvironmentTypeLinuxContainer = "LINUX_CONTAINER" +) + +const ( + // LanguageTypeJava is a LanguageType enum value + LanguageTypeJava = "JAVA" + + // LanguageTypePython is a LanguageType enum value + LanguageTypePython = "PYTHON" + + // LanguageTypeNodeJs is a LanguageType enum value + LanguageTypeNodeJs = "NODE_JS" + + // LanguageTypeRuby is a LanguageType enum value + LanguageTypeRuby = "RUBY" + + // LanguageTypeGolang is a LanguageType enum value + LanguageTypeGolang = "GOLANG" + + // LanguageTypeDocker is a LanguageType enum value + LanguageTypeDocker = "DOCKER" + + // LanguageTypeAndroid is a LanguageType enum value + LanguageTypeAndroid = "ANDROID" + + // LanguageTypeBase is a LanguageType enum value + LanguageTypeBase = "BASE" +) + +const ( + // PlatformTypeDebian is a PlatformType enum value + PlatformTypeDebian = "DEBIAN" + + // PlatformTypeAmazonLinux is a PlatformType enum value + PlatformTypeAmazonLinux = "AMAZON_LINUX" + + // PlatformTypeUbuntu is a PlatformType enum value + PlatformTypeUbuntu = "UBUNTU" +) + +const ( + // ProjectSortByTypeName is a ProjectSortByType enum value + ProjectSortByTypeName = "NAME" + + // ProjectSortByTypeCreatedTime is a ProjectSortByType enum value + ProjectSortByTypeCreatedTime = "CREATED_TIME" + + // ProjectSortByTypeLastModifiedTime is a ProjectSortByType enum value + ProjectSortByTypeLastModifiedTime = "LAST_MODIFIED_TIME" +) + +const ( + // SortOrderTypeAscending is a SortOrderType enum value + SortOrderTypeAscending = "ASCENDING" + + // SortOrderTypeDescending is a SortOrderType enum value + SortOrderTypeDescending = "DESCENDING" +) + +const ( + // SourceAuthTypeOauth is a SourceAuthType enum value + SourceAuthTypeOauth = "OAUTH" +) + +const ( + // SourceTypeCodecommit is a SourceType enum value + SourceTypeCodecommit = "CODECOMMIT" + + // SourceTypeCodepipeline is a SourceType enum value + SourceTypeCodepipeline = "CODEPIPELINE" + + // SourceTypeGithub is a SourceType enum value + SourceTypeGithub = "GITHUB" + + // SourceTypeS3 is a SourceType enum value + SourceTypeS3 = "S3" +) + +const ( + // StatusTypeSucceeded is a StatusType enum value + StatusTypeSucceeded = "SUCCEEDED" + + // StatusTypeFailed is a StatusType enum value + StatusTypeFailed = "FAILED" + + // StatusTypeFault is a StatusType enum value + StatusTypeFault = "FAULT" + + // StatusTypeTimedOut is a StatusType enum value + StatusTypeTimedOut = "TIMED_OUT" + + // StatusTypeInProgress is a StatusType enum value + StatusTypeInProgress = "IN_PROGRESS" + + // StatusTypeStopped is a StatusType enum value + StatusTypeStopped = "STOPPED" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go b/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go new file mode 100644 index 000000000..8cc2061d1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/codebuild/service.go @@ -0,0 +1,131 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +package codebuild + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// AWS CodeBuild is a fully-managed build service in the cloud. AWS CodeBuild +// compiles your source code, runs unit tests, and produces artifacts that are +// ready to deploy. AWS CodeBuild eliminates the need to provision, manage, +// and scale your own build servers. It provides prepackaged build environments +// for the most popular programming languages and build tools such as Apach +// Maven, Gradle, and more. You can also fully customize build environments +// in AWS CodeBuild to use your own build tools. AWS CodeBuild scales automatically +// to meet peak build requests, and you pay only for the build time you consume. +// For more information about AWS CodeBuild, see the AWS CodeBuild User Guide. +// +// AWS CodeBuild supports these operations: +// +// * BatchGetProjects: Gets information about one or more build projects. +// A build project defines how AWS CodeBuild will run a build. This includes +// information such as where to get the source code to build, the build environment +// to use, the build commands to run, and where to store the build output. +// A build environment represents a combination of operating system, programming +// language runtime, and tools that AWS CodeBuild will use to run a build. +// Also, you can add tags to build projects to help manage your resources +// and costs. +// +// * CreateProject: Creates a build project. +// +// * DeleteProject: Deletes a build project. +// +// * ListProjects: Gets a list of build project names, with each build project +// name representing a single build project. +// +// * UpdateProject: Changes the settings of an existing build project. +// +// * BatchGetBuilds: Gets information about one or more builds. +// +// * ListBuilds: Gets a list of build IDs, with each build ID representing +// a single build. +// +// * ListBuildsForProject: Gets a list of build IDs for the specified build +// project, with each build ID representing a single build. +// +// * StartBuild: Starts running a build. +// +// * StopBuild: Attempts to stop running a build. +// +// * ListCuratedEnvironmentImages: Gets information about Docker images that +// are managed by AWS CodeBuild. +//The service client's operations are safe to be used concurrently. +// It is not safe to mutate any of the client's properties though. +type CodeBuild struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// A ServiceName is the name of the service the client will make API calls to. +const ServiceName = "codebuild" + +// New creates a new instance of the CodeBuild client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a CodeBuild client from just a session. +// svc := codebuild.New(mySession) +// +// // Create a CodeBuild client with additional configuration +// svc := codebuild.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *CodeBuild { + c := p.ClientConfig(ServiceName, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CodeBuild { + svc := &CodeBuild{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2016-10-06", + JSONVersion: "1.1", + TargetPrefix: "CodeBuild_20161006", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a CodeBuild operation and runs any +// custom request initialization. +func (c *CodeBuild) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/vendor.json b/vendor/vendor.json index cf48a6168..ff7dc9bdf 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -764,6 +764,14 @@ "version": "v1.6.18", "versionExact": "v1.6.18" }, + { + "checksumSHA1": "MTlPViWUHDJ1wVPusVAeFSZWU2k=", + "path": "github.com/aws/aws-sdk-go/service/codebuild", + "revision": "918c42e2bcdb277aa821401c906e88254501bdf4", + "revisionTime": "2016-12-01T20:26:07Z", + "version": "v1.5.13", + "versionExact": "v1.5.13" + }, { "checksumSHA1": "lHCqaKjIV/AO1B8nxDUyM0AW/+0=", "path": "github.com/aws/aws-sdk-go/service/codecommit", diff --git a/website/source/docs/providers/aws/d/kms_secret.html.markdown b/website/source/docs/providers/aws/d/kms_secret.html.markdown index 0ec791f57..1aeead7a7 100644 --- a/website/source/docs/providers/aws/d/kms_secret.html.markdown +++ b/website/source/docs/providers/aws/d/kms_secret.html.markdown @@ -11,9 +11,7 @@ description: |- The KMS secret data source allows you to use data encrypted with the AWS KMS service within your resource definitions. -## Note about encrypted data - -Using this data provider will allow you to conceal secret data within your +~> **NOTE**: Using this data provider will allow you to conceal secret data within your resource definitions but does not take care of protecting that data in the logging output, plan output or state output. diff --git a/website/source/layouts/aws.erb b/website/source/layouts/aws.erb index 0c01dcc97..35e1f8b6c 100644 --- a/website/source/layouts/aws.erb +++ b/website/source/layouts/aws.erb @@ -245,6 +245,17 @@ + > + CodeBuild Resources + + + > CodeCommit Resources