Skip to content

feat: add runbooks.Get for space-wide runbook queries (cherry-pick of #433) - #453

Open
NickJosevski wants to merge 1 commit into
mainfrom
feat/runbooks-get-by-query
Open

feat: add runbooks.Get for space-wide runbook queries (cherry-pick of #433)#453
NickJosevski wants to merge 1 commit into
mainfrom
feat/runbooks-get-by-query

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Cherry-pick of #433 by @Scott-Emberson, re-hosted on a branch in this repo solely so CI can run. Authorship is preserved on the commit — this is a mechanical move, not a rewrite.

Fork PRs cannot satisfy the required test check: integration-tests.yml needs secrets.DB_IMAGE_SA_PASSWORD, OD_IMAGE_ADMIN_API_KEY and OCTOPUS_SERVER_BASE64_LICENSE, and GitHub withholds secrets from pull_request runs originating on a fork, so the job dies at Initialize containers before any Go executes. #433 is red for that reason and no other.

What it does

Six lines of production code plus a test file. The space-wide runbooks URI template and the RunbooksQuery filter struct both already exist in the package — nothing connected them, so RunbooksQuery is currently unreferenced. This adds Get, using the same newclient.GetByQuery one-liner that tenants.Get and the other resources on this template already use:

func Get(client newclient.Client, spaceID string, runbooksQuery RunbooksQuery) (*resources.Resources[*Runbook], error) {
	return newclient.GetByQuery[Runbook](client, template, spaceID, runbooksQuery)
}

Purely additive — no existing signature changes. Callers could previously only reach runbooks through the project-scoped List.

Unblocks a runbooks data source in the Terraform provider (OctopusDeploy/terraform-provider-octopusdeploy#209).

Once this merges

Close #433 pointing here, so Scott gets the credit and knows it wasn't rejected.

The space-wide runbooks endpoint and its RunbooksQuery filter struct both
already existed, but no function connected them, so callers could only reach
runbooks through the project-scoped List. Add Get, following the same
newclient.GetByQuery pattern used by tenants and the other resources sharing
this template.

This lets callers filter runbooks by project, name, or ID across a space,
which the Terraform provider needs to offer a runbooks data source
(OctopusDeploy/terraform-provider-octopusdeploy#209).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit a63b6c7)
Co-authored-by: Scott Emberson <8268155+Scott-Emberson@users.noreply.github.com>
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.

2 participants