From bd4b955cb1aff1c56b5e464285542f6c66af1296 Mon Sep 17 00:00:00 2001 From: hashimoon <98980386+hashimoon@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:48:42 -0700 Subject: [PATCH] [TF-7737] Use a VCS Repo object when updating the branch and tags for RegistryModules --- registry_module.go | 18 +++++++++++------- registry_module_integration_test.go | 12 +++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/registry_module.go b/registry_module.go index 2749f7a6f..0d542130d 100644 --- a/registry_module.go +++ b/registry_module.go @@ -270,13 +270,7 @@ type RegistryModuleUpdateOptions struct { // **Note: This field is still in BETA and subject to change.** TestConfig *RegistryModuleTestConfigOptions `jsonapi:"attr,test-config,omitempty"` - // The Branch and Tag fields are used to determine - // the PublishingMechanism for a RegistryModule that has a VCS a connection. - // When a value for Branch is provided, the Tags field is removed on the server - // When a value for Tags is provided, the Branch field is removed on the server - // **Note: This field is still in BETA and subject to change.** - Branch string `jsonapi:"attr,branch,omitempty"` - Tags string `jsonapi:"attr,tags,omitempty"` + VCSRepo *RegistryModuleVCSRepoUpdateOptions `jsonapi:"attr-vcs-repo,omitempty"` } type RegistryModuleTestConfigOptions struct { @@ -297,6 +291,16 @@ type RegistryModuleVCSRepoOptions struct { Branch *string `json:"branch,omitempty"` } +type RegistryModuleVCSRepoUpdateOptions struct { + // The Branch and Tag fields are used to determine + // the PublishingMechanism for a RegistryModule that has a VCS a connection. + // When a value for Branch is provided, the Tags field is removed on the server + // When a value for Tags is provided, the Branch field is removed on the server + // **Note: This field is still in BETA and subject to change.** + Branch *string `json:"branch,omitempty"` + Tags *string `json:"tags,omitempty"` +} + // List all the registory modules within an organization. func (r *registryModules) List(ctx context.Context, organization string, options *RegistryModuleListOptions) (*RegistryModuleList, error) { if !validStringID(&organization) { diff --git a/registry_module_integration_test.go b/registry_module_integration_test.go index 9880eab42..3eb44900d 100644 --- a/registry_module_integration_test.go +++ b/registry_module_integration_test.go @@ -367,7 +367,9 @@ func TestRegistryModuleUpdateWithVCSConnection(t *testing.T) { assert.Equal(t, "git_tag", rm.PublishingMechanism) options := RegistryModuleUpdateOptions{ - Branch: githubBranch, + VCSRepo: &RegistryModuleVCSRepoUpdateOptions{ + Branch: String(githubBranch), + }, } rm, err := client.RegistryModules.Update(ctx, RegistryModuleID{ Organization: orgTest.Name, @@ -380,7 +382,9 @@ func TestRegistryModuleUpdateWithVCSConnection(t *testing.T) { assert.Equal(t, "branch", rm.PublishingMechanism) options = RegistryModuleUpdateOptions{ - Tags: "1.0.0", + VCSRepo: &RegistryModuleVCSRepoUpdateOptions{ + Tags: String("1.0.0"), + }, } rm, err = client.RegistryModules.Update(ctx, RegistryModuleID{ Organization: orgTest.Name, @@ -394,7 +398,9 @@ func TestRegistryModuleUpdateWithVCSConnection(t *testing.T) { assert.Equal(t, "git_tag", rm.PublishingMechanism) options = RegistryModuleUpdateOptions{ - Branch: githubBranch, + VCSRepo: &RegistryModuleVCSRepoUpdateOptions{ + Branch: String(githubBranch), + }, } rm, err = client.RegistryModules.Update(ctx, RegistryModuleID{ Organization: orgTest.Name,