From 5b677a4125df01729b9625f07a554e746869c269 Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 28 Feb 2024 15:53:46 -0500 Subject: [PATCH 1/4] adding description to projects --- project.go | 11 +++++++++-- projects_integration_test.go | 8 ++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/project.go b/project.go index e2df7a119..c32e37482 100644 --- a/project.go +++ b/project.go @@ -46,8 +46,9 @@ type ProjectList struct { // Project represents a Terraform Enterprise project type Project struct { - ID string `jsonapi:"primary,projects"` - Name string `jsonapi:"attr,name"` + ID string `jsonapi:"primary,projects"` + Name string `jsonapi:"attr,name"` + Description string `jsonapi:"attr,description"` // Relations Organization *Organization `jsonapi:"relation,organization"` @@ -76,6 +77,9 @@ type ProjectCreateOptions struct { // Required: A name to identify the project. Name string `jsonapi:"attr,name"` + + // Optional: A description for the project. + Description *string `jsonapi:"attr,description,omitempty"` } // ProjectUpdateOptions represents the options for updating a project @@ -88,6 +92,9 @@ type ProjectUpdateOptions struct { // Optional: A name to identify the project Name *string `jsonapi:"attr,name,omitempty"` + + // Optional: A description for the project. + Description *string `jsonapi:"attr,description,omitempty"` } // List all projects. diff --git a/projects_integration_test.go b/projects_integration_test.go index 9a0f0eb58..f4076dab9 100644 --- a/projects_integration_test.go +++ b/projects_integration_test.go @@ -103,7 +103,8 @@ func TestProjectsCreate(t *testing.T) { t.Run("with valid options", func(t *testing.T) { options := ProjectCreateOptions{ - Name: "foo", + Name: "foo", + Description: String("qux"), } w, err := client.Projects.Create(ctx, orgTest.Name, options) @@ -118,6 +119,7 @@ func TestProjectsCreate(t *testing.T) { } { assert.NotEmpty(t, item.ID) assert.Equal(t, options.Name, item.Name) + assert.Equal(t, *options.Description, item.Description) } }) @@ -156,12 +158,14 @@ func TestProjectsUpdate(t *testing.T) { defer kTestCleanup() kAfter, err := client.Projects.Update(ctx, kBefore.ID, ProjectUpdateOptions{ - Name: String("new project name"), + Name: String("new project name"), + Description: String("updated description"), }) require.NoError(t, err) assert.Equal(t, kBefore.ID, kAfter.ID) assert.NotEqual(t, kBefore.Name, kAfter.Name) + assert.NotEqual(t, kBefore.Description, kAfter.Description) }) t.Run("when updating with invalid name", func(t *testing.T) { From ea582b817467dc8e2ad35bbc7c1722dab41d74d5 Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 28 Feb 2024 16:54:53 -0500 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 791f0162a..29bf1d061 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Unreleased +## Enhancements +* Adds `description` attribute to `Projects` by @netramali [861](https://github.com/hashicorp/go-tfe/pull/861) + # v1.46.0 ## Enhancements From c875162545063584edf36a94139aa87aa5a7c8a5 Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Wed, 28 Feb 2024 16:55:08 -0500 Subject: [PATCH 3/4] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29bf1d061..af36674f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased ## Enhancements -* Adds `description` attribute to `Projects` by @netramali [861](https://github.com/hashicorp/go-tfe/pull/861) +* Adds `description` attribute to `Project` by @netramali [861](https://github.com/hashicorp/go-tfe/pull/861) # v1.46.0 From 97dd08843d259788a96746630dcb05e448fe46f3 Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Thu, 29 Feb 2024 10:22:46 -0500 Subject: [PATCH 4/4] beta --- project.go | 8 ++++++-- projects_integration_test.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/project.go b/project.go index c32e37482..68632493f 100644 --- a/project.go +++ b/project.go @@ -46,8 +46,10 @@ type ProjectList struct { // Project represents a Terraform Enterprise project type Project struct { - ID string `jsonapi:"primary,projects"` - Name string `jsonapi:"attr,name"` + ID string `jsonapi:"primary,projects"` + Name string `jsonapi:"attr,name"` + + // **Note: This field is still in BETA and subject to change.** Description string `jsonapi:"attr,description"` // Relations @@ -79,6 +81,7 @@ type ProjectCreateOptions struct { Name string `jsonapi:"attr,name"` // Optional: A description for the project. + // **Note: This field is still in BETA and subject to change.** Description *string `jsonapi:"attr,description,omitempty"` } @@ -94,6 +97,7 @@ type ProjectUpdateOptions struct { Name *string `jsonapi:"attr,name,omitempty"` // Optional: A description for the project. + // **Note: This field is still in BETA and subject to change.** Description *string `jsonapi:"attr,description,omitempty"` } diff --git a/projects_integration_test.go b/projects_integration_test.go index f4076dab9..46b8dfdbb 100644 --- a/projects_integration_test.go +++ b/projects_integration_test.go @@ -102,6 +102,7 @@ func TestProjectsCreate(t *testing.T) { defer orgTestCleanup() t.Run("with valid options", func(t *testing.T) { + skipUnlessBeta(t) options := ProjectCreateOptions{ Name: "foo", Description: String("qux"), @@ -154,6 +155,7 @@ func TestProjectsUpdate(t *testing.T) { defer orgTestCleanup() t.Run("with valid options", func(t *testing.T) { + skipUnlessBeta(t) kBefore, kTestCleanup := createProject(t, client, orgTest) defer kTestCleanup()