• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

astronomer / astro-cli / 88489d08-9b6c-4c4b-8deb-9cee83b841fc

11 Feb 2026 02:53PM UTC coverage: 34.999% (+1.8%) from 33.15%
88489d08-9b6c-4c4b-8deb-9cee83b841fc

Pull #2006

circleci

jeremybeard
Feedback updates
Pull Request #2006: Add `astro api` command

2002 of 2395 new or added lines in 13 files covered. (83.59%)

22867 of 65336 relevant lines covered (35.0%)

8.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api/api.go
1
// Package api provides the 'astro api' command for making authenticated API requests.
2
package api
3

4
import (
5
        "io"
6
        "os"
7

8
        "github.com/fatih/color"
9
        "github.com/spf13/cobra"
10
)
11

12
// NewAPICmd creates the parent 'astro api' command.
NEW
13
func NewAPICmd() *cobra.Command {
×
NEW
14
        return NewAPICmdWithOutput(os.Stdout)
×
NEW
15
}
×
16

17
// NewAPICmdWithOutput creates the parent 'astro api' command with a custom output writer.
NEW
18
func NewAPICmdWithOutput(out io.Writer) *cobra.Command {
×
NEW
19
        var noColor bool
×
NEW
20

×
NEW
21
        cmd := &cobra.Command{
×
NEW
22
                Use:           "api",
×
NEW
23
                Short:         "Make authenticated API requests to Astronomer services",
×
NEW
24
                SilenceErrors: true, // API commands print error bodies themselves; don't let cobra double-print
×
NEW
25
                SilenceUsage:  true,
×
NEW
26
                Long: `Make authenticated HTTP requests to Astronomer APIs and print responses.
×
NEW
27

×
NEW
28
The 'astro api' command provides direct access to Astronomer's REST APIs.
×
NEW
29

×
NEW
30
Available subcommands:
×
NEW
31
  airflow  Make requests to the Airflow REST API
×
NEW
32
  cloud    Make requests to the Astro Cloud API (api.astronomer.io)
×
NEW
33

×
NEW
34
Use "astro api [command] --help" for more information about a command.`,
×
NEW
35
                PersistentPreRun: func(cmd *cobra.Command, args []string) {
×
NEW
36
                        if noColor {
×
NEW
37
                                color.NoColor = true
×
NEW
38
                        }
×
39
                },
NEW
40
                Run: func(cmd *cobra.Command, args []string) {
×
NEW
41
                        _ = cmd.Help()
×
NEW
42
                },
×
43
        }
44

NEW
45
        cmd.PersistentFlags().BoolVar(&noColor, "no-color", false, "Disable colorized output")
×
NEW
46

×
NEW
47
        cmd.AddCommand(NewAirflowCmd(out))
×
NEW
48
        cmd.AddCommand(NewCloudCmd(out))
×
NEW
49

×
NEW
50
        return cmd
×
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc