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

fix: Implement filtering a worker pool by name (#537) #786

Merged
merged 1 commit into from
Sep 18, 2024
Merged
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
6 changes: 6 additions & 0 deletions octopusdeploy/data_source_worker_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func dataSourceWorkerPoolsRead(ctx context.Context, d *schema.ResourceData, m in
Skip: d.Get("skip").(int),
Take: d.Get("take").(int),
}
name := d.Get("name").(string)

client := m.(*client.Client)
workerPools, err := workerpools.Get(client, d.Get("space_id").(string), query)
Expand All @@ -39,6 +40,11 @@ func dataSourceWorkerPoolsRead(ctx context.Context, d *schema.ResourceData, m in
return diag.FromErr(err)
}

// There is no name filter on the WorkerPools endpoint in the Octopus API,
// so filter in-memory if the name field is specified
if name != "" && workerPoolResource.Name != name {
continue
}
flattenedWorkerPools = append(flattenedWorkerPools, flattenWorkerPool(workerPoolResource))
}

Expand Down
Loading