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

Databases: Add OpenSearch index CRUD support #1571

Merged
merged 4 commits into from
Aug 30, 2024

Conversation

bhardwajRahul
Copy link
Contributor

@bhardwajRahul bhardwajRahul commented Aug 28, 2024

This PR aims at adding support for OpenSearch index CRUD in DOCTL.

Command Details

The subcommands under `doctl databases indexes` enable the management of indexes for opensearch clusters

Usage:
  doctl databases indexes [command]

Available Commands:
  delete      Deletes a opensearch index by index name
  list        Retrieve a list of topics for a given kafka database

Flags:
  -h, --help   help for indexes

Global Flags:
  -t, --access-token string   API V2 access token
  -u, --api-url string        Override default API endpoint
  -c, --config string         Specify a custom config file (default "/home/user/.config/doctl/config.yaml")
      --context string        Specify a custom authentication context name
      --http-retry-max int    Set maximum number of retries for requests that fail with a 429 or 500-level error (default 5)
      --interactive           Enable interactive behavior. Defaults to true if the terminal supports it (default true)
  -o, --output string         Desired output format [text|json] (default "text")
      --trace                 Show a log of network activity while performing a command
  -v, --verbose               Enable verbose output

  

Command to List OpenSearch Indexes

This command lists the following details for each index in an opensearch cluster:

	- The Name of the index.
	- The Status of the index.
	- The Health of the index.
	- The Number of Shards in the index.
	- The Number of Replicas in the index.
	- The Number of Documents in the index.
	- The Size of the index.

Usage:
  doctl databases indexes list <database-uuid> [flags]

Aliases:
  list, ls

Flags:
      --format Index Name   Columns for output in a comma-separated list. Possible values: Index Name, `Status`, `Health`, `Size`, `Docs`, `Create At`, `Number of Shards`, `Number of Replica`.
  -h, --help                help for list
      --no-header           Return raw data with no headers

Global Flags:
  -t, --access-token string   API V2 access token
  -u, --api-url string        Override default API endpoint
  -c, --config string         Specify a custom config file (default "/home/user/.config/doctl/config.yaml")
      --context string        Specify a custom authentication context name
      --http-retry-max int    Set maximum number of retries for requests that fail with a 429 or 500-level error (default 5)
      --interactive           Enable interactive behavior. Defaults to true if the terminal supports it (default true)
  -o, --output string         Desired output format [text|json] (default "text")
      --trace                 Show a log of network activity while performing a command
  -v, --verbose               Enable verbose output

Command Usage

doctl -t $token databases indexes list 70c35b01-6f6d-40e6-92ec-2b1f3cdfd61a

Ouput

Index Name                      Status    Health    Size      Docs    Create At               Number of Shards    Number of Replica
index-test-tiger-2024-08-21     open      green     10694     1       2024-08-21T14:11:07Z    1                   0
index-test-tiger-2024-08-22     open      green     10694     1       2024-08-22T14:11:04Z    1                   0
index-test-tiger-2024-08-24     open      green     10710     1       2024-08-24T14:11:11Z    1                   0
index-test-tiger-2024-08-25     open      green     10710     1       2024-08-25T14:11:10Z    1                   0
index-test-tiger-2024-08-26     open      green     10710     1       2024-08-26T14:11:05Z    1                   0

Command to Delete OpenSearch Index

Deletes an opensearch index by index name

Usage:
  doctl databases indexes delete <database-uuid> <index-name> [flags]

Aliases:
  delete, rm

Flags:
  -f, --force   Deletes the opensearch index without a confirmation prompt
  -h, --help    help for delete

Global Flags:
  -t, --access-token string   API V2 access token
  -u, --api-url string        Override default API endpoint
  -c, --config string         Specify a custom config file (default "/home/user/.config/doctl/config.yaml")
      --context string        Specify a custom authentication context name
      --http-retry-max int    Set maximum number of retries for requests that fail with a 429 or 500-level error (default 5)
      --interactive           Enable interactive behavior. Defaults to true if the terminal supports it (default true)
  -o, --output string         Desired output format [text|json] (default "text")
      --trace                 Show a log of network activity while performing a command
  -v, --verbose               Enable verbose output

Command Usage

doctl -t $token databases indexes delete 70c35b01-6f6d-40e6-92ec-2b1f3sdsa61a test_index

@bhardwajRahul bhardwajRahul marked this pull request as draft August 28, 2024 11:54
@bhardwajRahul bhardwajRahul marked this pull request as ready for review August 28, 2024 12:09
@danaelhe
Copy link
Member

Looks great! Could you please create some integration tests as well?
https://github.com/digitalocean/doctl/tree/main/integration

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍 LGTM! Thanks for the integration tests!

@andrewsomething andrewsomething merged commit 18c4a81 into digitalocean:main Aug 30, 2024
8 checks passed
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