Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pup - Datadog API CLI

Go-based CLI wrapper for Datadog APIs. Provides OAuth2 + API key authentication for 33 command groups with 200+ subcommands.
Go-based CLI wrapper for Datadog APIs. Provides OAuth2 + API key authentication for 28 command groups with 200+ subcommands across 33 API domains.

## Documentation Index

Expand Down
6 changes: 3 additions & 3 deletions cmd/api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func runAPIKeysList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list API keys: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -135,7 +135,7 @@ func runAPIKeysGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get API key: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func runAPIKeysCreate(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to create API key: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/audit_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func runAuditLogsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list audit logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func runAuditLogsSearch(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to search audit logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func runAuthStatus(cmd *cobra.Command, args []string) error {
fmt.Printf(" Token expires in: %s\n", timeLeft.Round(time.Second))
}

output, err := formatter.ToJSON(status)
output, err := formatter.FormatOutput(status, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/cicd.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func runCICDPipelinesList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list pipelines: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -200,7 +200,7 @@ func runCICDPipelinesGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get pipeline: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -248,7 +248,7 @@ func runCICDEventsSearch(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to search events: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func runCICDEventsAggregate(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to aggregate events: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func runCloudAWSList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list AWS integrations: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -119,7 +119,7 @@ func runCloudGCPList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list GCP integrations: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -142,7 +142,7 @@ func runCloudAzureList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list Azure integrations: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func runDashboardsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list dashboards: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -238,7 +238,7 @@ func runDashboardsGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get dashboard: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -282,7 +282,7 @@ func runDashboardsDelete(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to delete dashboard: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/data_governance.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func runDataGovernanceScannerRulesList(cmd *cobra.Command, args []string) error
return fmt.Errorf("failed to list scanning rules: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func runDowntimeList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list downtimes: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -105,7 +105,7 @@ func runDowntimeGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get downtime: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/error_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func runErrorTrackingIssuesList(cmd *cobra.Command, args []string) error {
},
}

output, err := formatter.ToJSON(result)
output, err := formatter.FormatOutput(result, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -88,7 +88,7 @@ func runErrorTrackingIssuesGet(cmd *cobra.Command, args []string) error {
},
}

output, err := formatter.ToJSON(result)
output, err := formatter.FormatOutput(result, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func runEventsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list events: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func runEventsSearch(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to search events: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -194,7 +194,7 @@ func runEventsGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get event: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/incidents.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func runIncidentsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list incidents: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -262,7 +262,7 @@ func runIncidentsGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get incident: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func runInfrastructureHostsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list hosts: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -122,7 +122,7 @@ func runInfrastructureHostsGet(cmd *cobra.Command, args []string) error {
}

_ = hostname // Use hostname for filtering in actual implementation
output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func runIntegrationsSlackList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list Slack channels: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -125,7 +125,7 @@ func runIntegrationsWebhooksList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list webhooks: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/logs_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func runLogsSearch(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to search logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -736,7 +736,7 @@ func runLogsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -793,7 +793,7 @@ func runLogsQuery(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to query logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -863,7 +863,7 @@ func runLogsAggregate(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to aggregate logs: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -888,7 +888,7 @@ func runLogsArchivesList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list log archives: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -914,7 +914,7 @@ func runLogsArchivesGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get log archive: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down Expand Up @@ -978,7 +978,7 @@ func runLogsCustomDestinationsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list custom destinations: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -1004,7 +1004,7 @@ func runLogsCustomDestinationsGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get custom destination: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -1029,7 +1029,7 @@ func runLogsMetricsList(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to list log-based metrics: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand All @@ -1055,7 +1055,7 @@ func runLogsMetricsGet(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to get log-based metric: %w", err)
}

output, err := formatter.ToJSON(resp)
output, err := formatter.FormatOutput(resp, formatter.OutputFormat(outputFormat))
if err != nil {
return err
}
Expand Down
Loading
Loading