@@ -5,19 +5,15 @@ package main
5
5
import (
6
6
"context"
7
7
"fmt"
8
- "net/http"
9
8
"os"
10
9
"os/signal"
11
10
"path/filepath"
12
- goruntime "runtime"
13
11
"sort"
14
12
"strings"
15
13
"syscall"
16
- "time"
17
14
18
15
"gopkg.in/yaml.v2"
19
16
20
- "github.com/grafana/agent/pkg/client/grafanacloud"
21
17
"github.com/grafana/agent/pkg/config"
22
18
"github.com/grafana/agent/pkg/logs"
23
19
"github.com/olekukonko/tablewriter"
@@ -55,7 +51,7 @@ import (
55
51
)
56
52
57
53
func main () {
58
- var cmd = & cobra.Command {
54
+ cmd : = & cobra.Command {
59
55
Use : "agentctl" ,
60
56
Short : "Tools for interacting with the Grafana Agent" ,
61
57
Version : version .Print ("agentctl" ),
@@ -69,7 +65,6 @@ func main() {
69
65
targetStatsCmd (),
70
66
samplesCmd (),
71
67
operatorDetachCmd (),
72
- cloudConfigCmd (),
73
68
templateDryRunCmd (),
74
69
testLogs (),
75
70
)
@@ -436,59 +431,6 @@ func filterAgentOwners(refs []meta_v1.OwnerReference) (filtered []meta_v1.OwnerR
436
431
return
437
432
}
438
433
439
- func cloudConfigCmd () * cobra.Command {
440
- var (
441
- stackID string
442
- apiURL string
443
- apiKey string
444
- platforms string
445
- )
446
-
447
- cmd := & cobra.Command {
448
- Use : "cloud-config" ,
449
- Short : "Retrieves the cloud config for the Grafana Agent" ,
450
- Long : `cloud-config connects to Grafana Cloud and retrieves the generated
451
- config that may be used with this agent.` ,
452
- Args : cobra .ExactArgs (0 ),
453
-
454
- // Hidden, this is only expected to be used by scripts.
455
- Hidden : true ,
456
-
457
- RunE : func (_ * cobra.Command , args []string ) error {
458
- if stackID == "" {
459
- return fmt .Errorf ("--stack must be provided" )
460
- }
461
- if apiKey == "" {
462
- return fmt .Errorf ("--api-key must be provided" )
463
- }
464
-
465
- // setting timeout 2x as the default HTTP transport timeout (30s)
466
- httpClient := & http.Client {
467
- Timeout : time .Minute ,
468
- }
469
- cli := grafanacloud .NewClient (httpClient , apiKey , apiURL )
470
-
471
- cfg , err := cli .AgentConfig (context .Background (), stackID , platforms )
472
- if err != nil {
473
- fmt .Fprintf (os .Stderr , "could not retrieve agent cloud config: %s\n " , err )
474
- os .Exit (1 )
475
- }
476
-
477
- fmt .Println (cfg )
478
- return nil
479
- },
480
- }
481
-
482
- cmd .Flags ().StringVarP (& stackID , "stack" , "u" , "" , "stack ID to get a config for" )
483
- cmd .Flags ().StringVarP (& apiKey , "api-key" , "p" , "" , "API key to authenticate against Grafana Cloud's API with" )
484
- cmd .Flags ().StringVarP (& apiURL , "api-url" , "e" , "" , "Grafana Cloud's API url" )
485
- cmd .Flags ().StringVar (& platforms , "platforms" , goruntime .GOOS , "comma-separated list of Platforms/OSes" )
486
- must (cmd .MarkFlagRequired ("stack" ))
487
- must (cmd .MarkFlagRequired ("api-key" ))
488
-
489
- return cmd
490
- }
491
-
492
434
func templateDryRunCmd () * cobra.Command {
493
435
cmd := & cobra.Command {
494
436
Use : "template-parse [directory]" ,
0 commit comments