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 docs/stackit_argus.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ stackit argus [flags]
* [stackit](./stackit.md) - Manage STACKIT resources using the command line
* [stackit argus instance](./stackit_argus_instance.md) - Provides functionality for Argus instances
* [stackit argus plans](./stackit_argus_plans.md) - Lists all Argus service plans
* [stackit argus scrape-configs](./stackit_argus_scrape-configs.md) - Provides functionality for scrape configs in Argus.
* [stackit argus scrape-config](./stackit_argus_scrape-config.md) - Provides functionality for scrape configurations in Argus

35 changes: 35 additions & 0 deletions docs/stackit_argus_scrape-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## stackit argus scrape-config

Provides functionality for scrape configurations in Argus

### Synopsis

Provides functionality for scrape configurations in Argus.

```
stackit argus scrape-config [flags]
```

### Options

```
-h, --help Help for "stackit argus scrape-config"
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit argus](./stackit_argus.md) - Provides functionality for Argus
* [stackit argus scrape-config create](./stackit_argus_scrape-config_create.md) - Creates a scrape configuration for an Argus instance
* [stackit argus scrape-config delete](./stackit_argus_scrape-config_delete.md) - Deletes a scrape configuration from an Argus instance
* [stackit argus scrape-config generate-payload](./stackit_argus_scrape-config_generate-payload.md) - Generates a payload to create/update scrape configurations for an Argus instance

Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
## stackit argus scrape-configs create
## stackit argus scrape-config create

Creates a Scrape Config job for an Argus instance
Creates a scrape configuration for an Argus instance

### Synopsis

Creates a Scrape Config job for an Argus instance.
Creates a scrape configuration job for an Argus instance.
The payload can be provided as a JSON string or a file path prefixed with "@".
If no payload is provided, a default payload will be used.
See https://docs.api.stackit.cloud/documentation/argus/version/v1#tag/scrape-config/operation/v1_projects_instances_scrapeconfigs_create for information regarding the payload structure.

```
stackit argus scrape-configs create [flags]
stackit argus scrape-config create [flags]
```

### Examples

```
Create a Scrape Config job on Argus instance "xxx" using default configuration
$ stackit argus scrape-configs create
Create a scrape configuration on Argus instance "xxx" using default configuration
$ stackit argus scrape-config create

Create a Scrape Config job on Argus instance "xxx" using an API payload sourced from the file "./payload.json"
$ stackit argus scrape-configs create --payload @./payload.json --instance-id xxx
Create a scrape configuration on Argus instance "xxx" using an API payload sourced from the file "./payload.json"
$ stackit argus scrape-config create --payload @./payload.json --instance-id xxx

Create a Scrape Config job on Argus instance "xxx" using an API payload provided as a JSON string
$ stackit argus scrape-configs create --payload "{...}" --instance-id xxx
Create a scrape configuration on Argus instance "xxx" using an API payload provided as a JSON string
$ stackit argus scrape-config create --payload "{...}" --instance-id xxx

Generate a payload with default values, and adapt it with custom values for the different configuration options
$ stackit argus scrape-configs generate-payload > ./payload.json
$ stackit argus scrape-config generate-payload > ./payload.json
<Modify payload in file, if needed>
$ stackit argus scrape-configs create --payload @./payload.json --instance-id xxx
$ stackit argus scrape-config create --payload @./payload.json --instance-id xxx
```

### Options

```
-h, --help Help for "stackit argus scrape-configs create"
-h, --help Help for "stackit argus scrape-config create"
--instance-id string Instance ID
--payload string Request payload (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json). If unset, will use a default payload (you can check it by running "stackit argus scrape-configs generate-payload")
--payload string Request payload (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json). If unset, will use a default payload (you can check it by running "stackit argus scrape-config generate-payload")
```

### Options inherited from parent commands
Expand All @@ -51,5 +51,5 @@ stackit argus scrape-configs create [flags]

### SEE ALSO

* [stackit argus scrape-configs](./stackit_argus_scrape-configs.md) - Provides functionality for scrape configs in Argus.
* [stackit argus scrape-config](./stackit_argus_scrape-config.md) - Provides functionality for scrape configurations in Argus

40 changes: 40 additions & 0 deletions docs/stackit_argus_scrape-config_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit argus scrape-config delete

Deletes a scrape configuration from an Argus instance

### Synopsis

Deletes a scrape configuration from an Argus instance.

```
stackit argus scrape-config delete JOB_NAME [flags]
```

### Examples

```
Delete a scrape configuration job with name "my-config" from Argus instance "xxx"
$ stackit argus scrape-config delete my-config --instance-id xxx
```

### Options

```
-h, --help Help for "stackit argus scrape-config delete"
--instance-id string Instance ID
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty"]
-p, --project-id string Project ID
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit argus scrape-config](./stackit_argus_scrape-config.md) - Provides functionality for scrape configurations in Argus

Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
## stackit argus scrape-configs generate-payload
## stackit argus scrape-config generate-payload

Generates a payload to create/update Scrape Configurations for an Argus instance
Generates a payload to create/update scrape configurations for an Argus instance

### Synopsis

Generates a JSON payload with values to be used as --payload input for Scrape Configurations creation or update.
This command can be used to generate a payload to update an existing Scrape Config job or to create a new Scrape Config job.
To update an existing Scrape Config job, provide the job name and the instance ID of the Argus instance.
To obtain a default payload to create a new Scrape Config job, run the command with no flags.
Generates a JSON payload with values to be used as --payload input for scrape configurations creation or update.
This command can be used to generate a payload to update an existing scrape config or to create a new scrape config job.
To update an existing scrape config job, provide the job name and the instance ID of the Argus instance.
To obtain a default payload to create a new scrape config job, run the command with no flags.
Note that some of the default values provided, such as the job name, the metrics path and URL of the targets, should be adapted to your use case.
See https://docs.api.stackit.cloud/documentation/argus/version/v1#tag/scrape-config/operation/v1_projects_instances_scrapeconfigs_create for information regarding the payload structure.


```
stackit argus scrape-configs generate-payload [flags]
stackit argus scrape-config generate-payload [flags]
```

### Examples

```
Generate a Create payload with default values, and adapt it with custom values for the different configuration options
$ stackit argus scrape-configs generate-payload > ./payload.json
$ stackit argus scrape-config generate-payload > ./payload.json
<Modify payload in file, if needed>
$ stackit argus scrape-configs create my-config --payload @./payload.json
$ stackit argus scrape-config create my-config --payload @./payload.json

Generate an Update payload with the values of an existing configuration named "my-config" for Argus instance xxx, and adapt it with custom values for the different configuration options
$ stackit argus scrape-configs generate-payload --job-name my-config --instance-id xxx > ./payload.json
$ stackit argus scrape-config generate-payload --job-name my-config --instance-id xxx > ./payload.json
<Modify payload in file>
$ stackit argus scrape-configs update my-config --payload @./payload.json
$ stackit argus scrape-config update my-config --payload @./payload.json
```

### Options

```
-h, --help Help for "stackit argus scrape-configs generate-payload"
-h, --help Help for "stackit argus scrape-config generate-payload"
--instance-id string Instance ID
-n, --job-name string If set, generates an update payload with the current state of the given scrape config. If unset, generates a create payload with default values
```
Expand All @@ -50,5 +50,5 @@ stackit argus scrape-configs generate-payload [flags]

### SEE ALSO

* [stackit argus scrape-configs](./stackit_argus_scrape-configs.md) - Provides functionality for scrape configs in Argus.
* [stackit argus scrape-config](./stackit_argus_scrape-config.md) - Provides functionality for scrape configurations in Argus

34 changes: 0 additions & 34 deletions docs/stackit_argus_scrape-configs.md

This file was deleted.

4 changes: 2 additions & 2 deletions internal/cmd/argus/argus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package argus
import (
"github.com/stackitcloud/stackit-cli/internal/cmd/argus/instance"
"github.com/stackitcloud/stackit-cli/internal/cmd/argus/plans"
scrapeconfigs "github.com/stackitcloud/stackit-cli/internal/cmd/argus/scrape-configs"
scrapeconfig "github.com/stackitcloud/stackit-cli/internal/cmd/argus/scrape-config"
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
Expand All @@ -26,5 +26,5 @@ func NewCmd(p *print.Printer) *cobra.Command {
func addSubcommands(cmd *cobra.Command, p *print.Printer) {
cmd.AddCommand(plans.NewCmd(p))
cmd.AddCommand(instance.NewCmd(p))
cmd.AddCommand(scrapeconfigs.NewCmd(p))
cmd.AddCommand(scrapeconfig.NewCmd(p))
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ type inputModel struct {
func NewCmd(p *print.Printer) *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Creates a Scrape Config job for an Argus instance",
Short: "Creates a scrape configuration for an Argus instance",
Long: fmt.Sprintf("%s\n%s\n%s\n%s",
"Creates a Scrape Config job for an Argus instance.",
"Creates a scrape configuration job for an Argus instance.",
"The payload can be provided as a JSON string or a file path prefixed with \"@\".",
"If no payload is provided, a default payload will be used.",
"See https://docs.api.stackit.cloud/documentation/argus/version/v1#tag/scrape-config/operation/v1_projects_instances_scrapeconfigs_create for information regarding the payload structure.",
),
Args: args.NoArgs,
Example: examples.Build(
examples.NewExample(
`Create a Scrape Config job on Argus instance "xxx" using default configuration`,
"$ stackit argus scrape-configs create"),
`Create a scrape configuration on Argus instance "xxx" using default configuration`,
"$ stackit argus scrape-config create"),
examples.NewExample(
`Create a Scrape Config job on Argus instance "xxx" using an API payload sourced from the file "./payload.json"`,
"$ stackit argus scrape-configs create --payload @./payload.json --instance-id xxx"),
`Create a scrape configuration on Argus instance "xxx" using an API payload sourced from the file "./payload.json"`,
"$ stackit argus scrape-config create --payload @./payload.json --instance-id xxx"),
examples.NewExample(
`Create a Scrape Config job on Argus instance "xxx" using an API payload provided as a JSON string`,
`$ stackit argus scrape-configs create --payload "{...}" --instance-id xxx`),
`Create a scrape configuration on Argus instance "xxx" using an API payload provided as a JSON string`,
`$ stackit argus scrape-config create --payload "{...}" --instance-id xxx`),
examples.NewExample(
`Generate a payload with default values, and adapt it with custom values for the different configuration options`,
`$ stackit argus scrape-configs generate-payload > ./payload.json`,
`$ stackit argus scrape-config generate-payload > ./payload.json`,
`<Modify payload in file, if needed>`,
`$ stackit argus scrape-configs create --payload @./payload.json --instance-id xxx`),
`$ stackit argus scrape-config create --payload @./payload.json --instance-id xxx`),
),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
Expand All @@ -77,7 +77,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
}

if !model.AssumeYes {
prompt := fmt.Sprintf("Are you sure you want to create a Scrape Config job on Argus instance %q?", instanceLabel)
prompt := fmt.Sprintf("Are you sure you want to create a scrape configuration on Argus instance %q?", instanceLabel)
err = p.PromptForConfirmation(prompt)
if err != nil {
return err
Expand All @@ -97,7 +97,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
req := buildRequest(ctx, model, apiClient)
_, err = req.Execute()
if err != nil {
return fmt.Errorf("create Scrape Config job: %w", err)
return fmt.Errorf("create scrape configuration: %w", err)
}

jobName := model.Payload.JobName
Expand All @@ -108,7 +108,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
s.Start("Creating scrape config")
_, err = wait.CreateScrapeConfigWaitHandler(ctx, apiClient, model.InstanceId, *jobName, model.ProjectId).WaitWithContext(ctx)
if err != nil {
return fmt.Errorf("wait for Scrape Config job creation: %w", err)
return fmt.Errorf("wait for scrape configuration creation: %w", err)
}
s.Stop()
}
Expand All @@ -117,7 +117,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
if model.Async {
operationState = "Triggered creation of"
}
p.Outputf("%s Scrape Config job with name %q for Argus instance %q\n", operationState, *jobName, instanceLabel)
p.Outputf("%s scrape configuration with name %q for Argus instance %q\n", operationState, *jobName, instanceLabel)
return nil
},
}
Expand All @@ -126,7 +126,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
}

func configureFlags(cmd *cobra.Command) {
cmd.Flags().Var(flags.ReadFromFileFlag(), payloadFlag, `Request payload (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json). If unset, will use a default payload (you can check it by running "stackit argus scrape-configs generate-payload")`)
cmd.Flags().Var(flags.ReadFromFileFlag(), payloadFlag, `Request payload (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json). If unset, will use a default payload (you can check it by running "stackit argus scrape-config generate-payload")`)
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID")

err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
Expand Down
Loading