-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add ingestion key command and update dependencies #316
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
feat: add ingestion key command and update dependencies #316
Conversation
- Introduced a new command `get-ingestion-key` to retrieve or create an ingestion key using the Groundcover SDK. - Updated Go version in Earthfile and go.mod to 1.24. - Added new dependencies including `github.com/groundcover-com/groundcover-sdk-go` v1.34.0 and various `go-openapi` packages. - Enhanced client functionality with a custom transport to include tenant UUID in requests.
WalkthroughThis update introduces a new CLI command to fetch or create ingestion keys, adds a package for tenant-aware Groundcover SDK client creation, and updates dependencies and build configurations to Go 1.24 and newer SDK versions. No changes to existing public APIs; all additions are new features or upgrades. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI (get-ingestion-key)
participant SDKClientFactory
participant GroundcoverAPI
User->>CLI (get-ingestion-key): Run command
CLI (get-ingestion-key)->>SDKClientFactory: Create SDK client (with tenant UUID, token)
SDKClientFactory->>GroundcoverAPI: Instantiate client (custom transport)
CLI (get-ingestion-key)->>GroundcoverAPI: List ingestion keys
alt Key exists
GroundcoverAPI-->>CLI (get-ingestion-key): Return existing key
else Key missing
CLI (get-ingestion-key)->>GroundcoverAPI: Create new ingestion key
GroundcoverAPI-->>CLI (get-ingestion-key): Return new key
end
CLI (get-ingestion-key)-->>User: Print ingestion key
sequenceDiagram
participant SDKClientFactory
participant GroundcoverAPI
SDKClientFactory->>GroundcoverAPI: NewClient(baseURL, token, backendId, tenantUUID)
GroundcoverAPI->>GroundcoverAPI: Use custom transport (adds X-Tenant-UUID header)
GroundcoverAPI-->>SDKClientFactory: Return configured client
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
cmd/ingestion_key.go (2)
74-78
: Potential inefficiency in key lookupThe loop searches through all keys even when filtering by name in the API request. The API already filters by name, so this loop should only contain matching keys.
Consider simplifying to:
- // Look for existing CLI ingestion key - for _, key := range existingKeys.Payload { - if key.Name == CLI_INGESTION_KEY_NAME { - return key.Key, nil - } - } + // Return the first key if any exist (API already filtered by name) + if len(existingKeys.Payload) > 0 { + return existingKeys.Payload[0].Key, nil + }
25-27
: Consider more descriptive command detailsThe command name and short description are identical. Consider enhancing usability.
- Use: "get-ingestion-key", - Short: "get-ingestion-key", + Use: "get-ingestion-key", + Short: "Retrieve or create a CLI ingestion key",pkg/client/client.go (1)
75-82
: NotImplementedError appears unusedThis error type is defined but not used in the current implementation.
Consider removing if not needed, or document its intended usage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
📒 Files selected for processing (4)
Earthfile
(1 hunks)cmd/ingestion_key.go
(1 hunks)go.mod
(6 hunks)pkg/client/client.go
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
cmd/ingestion_key.go (5)
pkg/api/tenant.go (1)
TenantInfo
(20-24)pkg/auth/auth0.go (2)
Auth0Token
(20-25)LoadAuth0Token
(39-59)pkg/client/client.go (1)
NewDefaultClient
(63-66)pkg/ui/writer.go (1)
QuietWriter
(38-38)cmd/auth.go (1)
AuthCmd
(7-10)
pkg/client/client.go (1)
pkg/api/client.go (1)
NewClient
(33-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: goreleaser
- GitHub Check: Analyze (go)
🔇 Additional comments (5)
Earthfile (2)
1-1
: Good practice adding explicit VERSION specificationAdding the VERSION directive improves build reproducibility.
4-4
: No explicit Go version constraints detectedWe checked:
• Docker base: golang:1.24-alpine
• go.mod: nogo X.Y
directive foundNext steps:
– Confirm your CI/workflows pull Go 1.24
– Audit all third-party modules for 1.24 compatibility
– Run full test/build on the new imagecmd/ingestion_key.go (1)
24-60
: Command implementation looks solidGood error handling patterns and proper integration with existing auth/tenant systems.
go.mod (1)
3-5
: Go version upgrade looks goodThe version update from 1.22.0 to 1.24.0 aligns with the Earthfile changes.
pkg/client/client.go (1)
17-28
: Custom transport implementation is solidGood implementation of http.RoundTripper with proper header injection.
- Updated the `get-ingestion-key` command to require an ingestion key type as an argument. - Modified the `getOrCreateIngestionKey` function to use the provided key type for generating the ingestion key name. - Improved error h 8000 andling to ensure the key type is specified before proceeding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment, otherwise looks good!
get-ingestion-key
to retrieve or create an ingestion key using the Groundcover SDK.github.com/groundcover-com/groundcover-sdk-go
v1.34.0 and variousgo-openapi
packages.Summary by CodeRabbit
New Features
Chores