Skip to content

feat(pingone): add User-Agent suffix to PingOne SDK client requests#25

Open
samir-gandhi wants to merge 5 commits into
mainfrom
polaris/issue-18-include-agent-header-to-client
Open

feat(pingone): add User-Agent suffix to PingOne SDK client requests#25
samir-gandhi wants to merge 5 commits into
mainfrom
polaris/issue-18-include-agent-header-to-client

Conversation

@samir-gandhi

Copy link
Copy Markdown
Contributor

Summary

  • Configures the PingOne SDK client with a User-Agent suffix of pingcli-plugin-terraformer/<version> on every outbound API request, so requests from Ping CLI are identifiable in PingOne server logs
  • Threads the version string from package main through TfCommand.SetVersionExportCommand.versionrunExportNewFromCredentials without import cycles
  • Adds goreleaser ldflags to inject the real release tag ({{.Version}}) at build time; development builds continue to report dev

Test plan

  • User-Agent suffix pingcli-plugin-terraformer/<version> is appended via cfg.AppendUserAgent (SDK base string preserved) — Verified by Polaris QA
  • Version flows correctly from main.goTfCommand.SetVersionExportCommandNewFromCredentials — Verified by Polaris QA
  • .goreleaser.yaml injects -X main.version={{.Version}} -X main.commit={{.Commit}} at build time — Verified by Polaris QA
  • All existing tests pass with the updated NewFromCredentials signature — Verified by Polaris QA

Notes

  • The raw HTTP calls in resource_flow.go (fetchFlowVariableDeps/exportFlowVersion) bypass the SDK client and do not carry this header — explicitly out of scope; tracked separately if needed
  • runExport now has 18 parameters; a follow-up to introduce a config struct is recommended but out of scope here

Closes #18

🤖 Generated with Claude Code

samir-gandhi and others added 5 commits May 26, 2026 16:32
…gent suffix

Add a `version string` parameter to `NewFromCredentials` and call
`cfg.AppendUserAgent(fmt.Sprintf("pingcli-plugin-terraformer/%s", version))`
between `NewConfiguration` and `NewAPIClient`, so every outbound SDK
request carries a `pingcli-plugin-terraformer/<version>` suffix in its
User-Agent header.

Update the test call site in client_test.go to pass "dev" as the new
final argument so the package continues to compile and vet cleanly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wire the `version` string from `package main` into `NewFromCredentials`
via a new `version` field on `ExportCommand` and `TfCommand`, an exported
`SetVersion` method on `TfCommand`, and updated call sites in `runExport`,
`runAsStandalone`, and `runAsPlugin`. Acceptance test helper updated to
pass `"dev"` to satisfy the new signature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TestTfCommand_SetVersion validates that SetVersion stores the value in
the struct field. TestTfCommand_Routing_VersionPropagation exercises the
export routing path after SetVersion and confirms the version is wired
through TfCommand.Run into ExportCommand construction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion injection

Add ldflags to .goreleaser.yaml builds[0] to inject -X main.version={{.Version}}
and -X main.commit={{.Commit}} at release build time, so release binaries report
the real version tag in the pingcli-plugin-terraformer/<version> User-Agent suffix
rather than the "dev" default.

Create .changelog/pr-25.txt with a release-note:enhancement entry describing the
User-Agent suffix feature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verify that NewFromCredentials appends the pingcli-plugin-terraformer/<version>
suffix via AppendUserAgent without overwriting the SDK base string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable
default-hcl ✅ PASS 0 0
default-tfjson ✅ PASS 0 0
hcl-include-all ✅ PASS 0 0
hcl-skip-deps ✅ PASS 0 0
tfjson-skip-deps ✅ PASS 0 0

✅ No regressions detected

All export configurations produced compatible output.


Generated by regression workflow • View run

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.

include agent header to client

1 participant