Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UpdateAllowedWorkspaces method to Agent Pool #701

Merged

Conversation

hs26gill
Copy link
Contributor

@hs26gill hs26gill commented May 11, 2023

Description

This pull request is a bug fix to the Agent Pool resource that would enable users to remove all allowed workspaces from an agent pool. AgentPool Update was previously not able to accomplish this, so UpdateAllowedWorkspaces method is exclusively added to allow user to make this request. To facilitate this change, the Allowed-Workspaces attribute has been relocated from the AgentPoolUpdateOptions struct to a new struct named AgentPoolAllowedWorkspacesUpdateOptions.

This modification is necessary to provide users with the ability to clear all allowed workspaces and set it to an empty value. Alternatively, users can use the existing Update method to modify other attributes of the agent pool while retaining the current allowed workspaces.

Testing plan

Integration tests have been added to cover this section

External links

Output from tests

=== RUN   TestAgentPoolsUpdateAllowedWorkspaces
--- PASS: TestAgentPoolsUpdateAllowedWorkspaces (5.60s)
=== RUN   TestAgentPoolsUpdateAllowedWorkspaces/when_updating_allowed-workspaces
    --- PASS: TestAgentPoolsUpdateAllowedWorkspaces/when_updating_allowed-workspaces (2.03s)
=== RUN   TestAgentPoolsUpdateAllowedWorkspaces/when_removing_all_the_allowed-workspaces
    --- PASS: TestAgentPoolsUpdateAllowedWorkspaces/when_removing_all_the_allowed-workspaces (1.43s)
PASS

...

@hs26gill hs26gill requested a review from a team as a code owner May 11, 2023 15:13
@hs26gill hs26gill force-pushed the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch 2 times, most recently from a0999ec to 648dd3b Compare May 11, 2023 15:33
jbonhag
jbonhag previously approved these changes May 11, 2023
Copy link
Contributor

@jbonhag jbonhag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think we could combine the changelog entries into a single bugfix entry but this implementation feels good.

jbonhag
jbonhag previously approved these changes May 11, 2023
Copy link
Contributor

@jbonhag jbonhag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@hs26gill hs26gill force-pushed the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch from bc218da to 5956999 Compare May 12, 2023 13:45
agent_pool.go Outdated Show resolved Hide resolved
@hs26gill hs26gill force-pushed the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch 3 times, most recently from 1a6c3c9 to af73eac Compare May 12, 2023 19:43
Copy link
Contributor

@uturunku1 uturunku1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for when UpdateAllowedWorkspaces is called with AgentPoolAllowedWorkspacesUpdateOptions{}? 🙏

@joekarl joekarl force-pushed the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch from af73eac to 25a07e6 Compare June 6, 2023 15:33
@joekarl joekarl dismissed uturunku1’s stale review June 6, 2023 16:30

Cleared with uturunku1 offline, will get re-reviewed

CHANGELOG.md Outdated Show resolved Hide resolved
hs26gill and others added 3 commits June 6, 2023 15:07
@joekarl joekarl force-pushed the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch from 92f7f87 to 79e6824 Compare June 6, 2023 20:08
Copy link
Contributor

@Uk1288 Uk1288 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joekarl joekarl merged commit 6ac159a into main Jun 6, 2023
@joekarl joekarl deleted the hs26gill/TF-3175-fix-for-scoping-Agent-Pools-to-Workspaces branch June 6, 2023 20:29
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants