Skip to content
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

add repos block-ingest command #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kebroad
Copy link

@kebroad kebroad commented Nov 5, 2024

Implements the blockIngest() mutation and adds a subcommand to block ingest for one or all repos (in parallel).

Crowdstrike has recommended we block all ingest prior to disruptive changes to our Logscale instance, so this command will make it easy for us to do so.

⇒ bin/humioctl repos block-ingest --help
Block ingest for one or all repositories for a specified number of seconds.

Examples:
  # Block ingest for a specific repository
  humioctl repos block-ingest myrepo 3600

  # Block ingest for all repositories
  humioctl repos block-ingest --all 3600

Usage:
  humioctl repos block-ingest [flags] [repository] <seconds>

@kebroad kebroad requested a review from a team as a code owner November 5, 2024 18:07
Short: "Block ingest for a repository",
Long: `Block ingest for one or all repositories for a specified number of seconds.

Examples:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an Example field in the cobra.Command struct where you could move these example invocations.

var allRepos bool

cmd := &cobra.Command{
Use: "block-ingest [flags] [repository] <seconds>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nicer to have seconds be a flag rather than a positional argument. One reason is that you can define the flag as a time.Duration so one could say --duration=4h. Another is that it will simplify some of the logic around the positional args.

@SaaldjorMike
Copy link
Member

The most recent changes refactors how we interact with GraphQL for the humioctl tool. Going forward, you have to

  1. update https://github.com/humio/cli/tree/master/internal/api/humiographql with any new interaction with the LogScale GraphQL API
  2. generate Go-code based on the updated GraphQL queries/mutations: go generate ./...
  3. update humioctl within https://github.com/humio/cli/tree/master/cmd/humioctl so it uses the newly generated code

Right now the code path is as follows: https://github.com/humio/cli/tree/master/cmd/humioctl calls https://github.com/humio/cli/tree/master/internal/api which in turn calls the autogenerated code in https://github.com/humio/cli/blob/master/internal/api/humiographql/humiographql.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants