Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

* Adds `AgentPool` field to the OAuthClientUpdateOptions struct, which is used to associate a VCS Provider with an AgentPool for PrivateVCS support by @jpogran [#1075](https://github.com/hashicorp/go-tfe/pull/1075)

## BREAKING CHANGES

* Updates team token `Description` to be a pointer, allowing for both nil descriptions and empty string descriptions. Team token descriptions and the ability to create multiple team tokens is in BETA, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users, by @mkam [#1088](https://github.com/hashicorp/go-tfe/pull/1088)
Expand All @@ -21,6 +23,7 @@

In the last release, Runs interface method `ListForOrganization` included pagination fields `TotalCount` and `TotalPages`, but these are being removed as this feature approaches general availablity by @brandonc [#1074](https://github.com/hashicorp/go-tfe/pull/1074)


# v1.76.0

## Enhancements
Expand Down
3 changes: 3 additions & 0 deletions oauth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ type OAuthClientUpdateOptions struct {
// Optional: The token string you were given by your VCS provider.
OAuthToken *string `jsonapi:"attr,oauth-token-string,omitempty"`

// Optional: AgentPool to associate the VCS Provider with, for PrivateVCS support
AgentPool *AgentPool `jsonapi:"relation,agent-pool,omitempty"`

// Optional: Whether the OAuthClient is available to all workspaces in the organization.
// True if the oauth client is organization scoped, false otherwise.
OrganizationScoped *bool `jsonapi:"attr,organization-scoped,omitempty"`
Expand Down
30 changes: 30 additions & 0 deletions oauth_client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,36 @@ func TestOAuthClientsUpdate(t *testing.T) {
assert.NotEmpty(t, oc.ID)
assert.NotEqual(t, origOC.OrganizationScoped, oc.OrganizationScoped)
})

t.Run("updates agent pool", func(t *testing.T) {
testAgentPool1, agentPoolCleanup := createAgentPool(t, client, orgTest)
defer agentPoolCleanup()
testAgentPool2, agentPoolCleanup2 := createAgentPool(t, client, orgTest)
defer agentPoolCleanup2()

organizationScopedTrue := true
options := OAuthClientCreateOptions{
APIURL: String("https://bbdc.com"),
HTTPURL: String("https://bbdc.com"),
ServiceProvider: ServiceProvider(ServiceProviderBitbucketDataCenter),
OrganizationScoped: &organizationScopedTrue,
AgentPool: testAgentPool1,
}

origOC, err := client.OAuthClients.Create(ctx, orgTest.Name, options)

require.NoError(t, err)
assert.NotEmpty(t, origOC.ID)

updateOpts := OAuthClientUpdateOptions{
AgentPool: testAgentPool2,
}
oc, err := client.OAuthClients.Update(ctx, origOC.ID, updateOpts)
require.NoError(t, err)
assert.NotEmpty(t, oc.ID)
assert.Equal(t, oc.AgentPool.ID, testAgentPool2.ID)
assert.NotEqual(t, origOC.AgentPool.ID, oc.AgentPool.ID)
})
}

const publicKey = `
Expand Down
Loading