From b3dc95db92c41a3d1521087d8b971ea5fa186290 Mon Sep 17 00:00:00 2001 From: natalie-todd Date: Tue, 31 Dec 2024 10:59:24 -0800 Subject: [PATCH] Add CHANGELOG entry, omitempty, and remove Archs from structs not used by terraform releases --- CHANGELOG.md | 4 ++++ admin_terraform_version.go | 44 ++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d112c9d6..9d7b142c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +## Enhancements + +* Add `Archs` field to `AdminTerraformVersionCreateOptions` by @natalie-todd [#1022](https://github.com/hashicorp/go-tfe/pull/1022) + # v1.71.0 ## Enhancements diff --git a/admin_terraform_version.go b/admin_terraform_version.go index 057fa75a0..3ea396848 100644 --- a/admin_terraform_version.go +++ b/admin_terraform_version.go @@ -43,18 +43,17 @@ type adminTerraformVersions struct { // AdminTerraformVersion represents a Terraform Version type AdminTerraformVersion struct { - ID string `jsonapi:"primary,terraform-versions"` - Version string `jsonapi:"attr,version"` - URL string `jsonapi:"attr,url"` - Sha string `jsonapi:"attr,sha"` - Deprecated bool `jsonapi:"attr,deprecated"` - DeprecatedReason *string `jsonapi:"attr,deprecated-reason,omitempty"` - Official bool `jsonapi:"attr,official"` - Enabled bool `jsonapi:"attr,enabled"` - Beta bool `jsonapi:"attr,beta"` - Usage int `jsonapi:"attr,usage"` - CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` - Archs []*ToolVersionArchitecture `jsonapi:"attr,archs"` + ID string `jsonapi:"primary,terraform-versions"` + Version string `jsonapi:"attr,version"` + URL string `jsonapi:"attr,url"` + Sha string `jsonapi:"attr,sha"` + Deprecated bool `jsonapi:"attr,deprecated"` + DeprecatedReason *string `jsonapi:"attr,deprecated-reason,omitempty"` + Official bool `jsonapi:"attr,official"` + Enabled bool `jsonapi:"attr,enabled"` + Beta bool `jsonapi:"attr,beta"` + Usage int `jsonapi:"attr,usage"` + CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` } type ToolVersionArchitecture struct { @@ -88,22 +87,21 @@ type AdminTerraformVersionCreateOptions struct { DeprecatedReason *string `jsonapi:"attr,deprecated-reason,omitempty"` Enabled *bool `jsonapi:"attr,enabled,omitempty"` Beta *bool `jsonapi:"attr,beta,omitempty"` - Archs []*ToolVersionArchitecture `jsonapi:"attr,archs"` + Archs []*ToolVersionArchitecture `jsonapi:"attr,archs,omitempty"` } // AdminTerraformVersionUpdateOptions for updating terraform version. // https://developer.hashicorp.com/terraform/enterprise/api-docs/admin/terraform-versions#request-body type AdminTerraformVersionUpdateOptions struct { - Type string `jsonapi:"primary,terraform-versions"` - Version *string `jsonapi:"attr,version,omitempty"` - URL *string `jsonapi:"attr,url,omitempty"` - Sha *string `jsonapi:"attr,sha,omitempty"` - Official *bool `jsonapi:"attr,official,omitempty"` - Deprecated *bool `jsonapi:"attr,deprecated,omitempty"` - DeprecatedReason *string `jsonapi:"attr,deprecated-reason,omitempty"` - Enabled *bool `jsonapi:"attr,enabled,omitempty"` - Beta *bool `jsonapi:"attr,beta,omitempty"` - Archs []*ToolVersionArchitecture `jsonapi:"attr,archs"` + Type string `jsonapi:"primary,terraform-versions"` + Version *string `jsonapi:"attr,version,omitempty"` + URL *string `jsonapi:"attr,url,omitempty"` + Sha *string `jsonapi:"attr,sha,omitempty"` + Official *bool `jsonapi:"attr,official,omitempty"` + Deprecated *bool `jsonapi:"attr,deprecated,omitempty"` + DeprecatedReason *string `jsonapi:"attr,deprecated-reason,omitempty"` + Enabled *bool `jsonapi:"attr,enabled,omitempty"` + Beta *bool `jsonapi:"attr,beta,omitempty"` } // AdminTerraformVersionsList represents a list of terraform versions.