opensearchcli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: opensearchcli
3
+ Version: 0.1.0
4
+ Summary: A CLI tool for OpenSearch
5
+ Requires-Python: >=3.14
6
+ Requires-Dist: opensearch-py>=3.1.0
7
+ Requires-Dist: typer>=0.20.0
@@ -0,0 +1,74 @@
1
+
2
+ # OpenSearch CLI
3
+
4
+ OpenSearch CLI is a command-line tool to manage and interact with OpenSearch clusters. It provides commands for cluster management, snapshots, raw API calls, and more, all from your terminal.
5
+
6
+ ## Features
7
+
8
+ - Manage OpenSearch clusters (health, settings, allocation, etc.)
9
+ - Run raw OpenSearch API calls
10
+ - Manage snapshots
11
+ - Profile-based configuration
12
+
13
+ ## Requirements
14
+
15
+ - Python 3.14+
16
+
17
+ ## Installation
18
+
19
+ Clone the repository and install dependencies using [uv](https://github.com/astral-sh/uv):
20
+
21
+ ```sh
22
+ git clone <repo-url>
23
+ cd OpenSearch
24
+ uv sync
25
+ ```
26
+
27
+ Or, to run commands directly with uv (no manual activation needed):
28
+
29
+ ```sh
30
+ uv run opensearchcli --help
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Run the CLI:
36
+
37
+ ```sh
38
+ opensearchcli --help
39
+ ```
40
+
41
+ Example: Check cluster health
42
+
43
+ ```sh
44
+ opensearchcli cluster health
45
+ ```
46
+
47
+ ## Configuration
48
+
49
+ The CLI uses a config file (default: `~/.config/opensearch-cli/config.toml`) to store connection profiles. You can specify a profile with `--profile` or the `OPENSEARCH_PROFILE` environment variable.
50
+
51
+ Example config file:
52
+
53
+ ```toml
54
+ [default]
55
+ domain = "localhost"
56
+ username = "admin"
57
+ password = "admin"
58
+ ```
59
+
60
+ ## Project Structure
61
+
62
+ - `src/opensearchcli/cli.py` — Main CLI entry point
63
+ - `src/opensearchcli/commands/` — Command modules (cluster, snapshot, etc.)
64
+
65
+ ## Dependencies
66
+
67
+ - [opensearch-py](https://pypi.org/project/opensearch-py/)
68
+ - [typer](https://pypi.org/project/typer/)
69
+ - [rich](https://pypi.org/project/rich/)
70
+
71
+ ## License
72
+
73
+ MIT (add your license here)
74
+
@@ -0,0 +1,20 @@
1
+ [project]
2
+ name = "opensearchcli"
3
+ description = "A CLI tool for OpenSearch"
4
+ version = "0.1.0"
5
+ requires-python = ">=3.14"
6
+ dependencies = [
7
+ "opensearch-py>=3.1.0",
8
+ "typer>=0.20.0",
9
+ ]
10
+
11
+ [project.scripts]
12
+ opensearchcli = "opensearchcli.cli:app"
13
+
14
+ [tool.uv]
15
+ package = true
16
+
17
+ [dependency-groups]
18
+ dev = [
19
+ "ruff>=0.14.7",
20
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,87 @@
1
+ import os
2
+ from typing import Annotated
3
+
4
+ import typer
5
+ from pathlib import Path
6
+ from opensearchpy import OpenSearch
7
+ from rich.console import Console
8
+ from opensearchcli.commands import cluster, config, snapshot, commands, raw, index
9
+ import urllib3
10
+
11
+ urllib3.disable_warnings()
12
+
13
+ console = Console()
14
+ app = typer.Typer(rich_markup_mode="rich", no_args_is_help=True)
15
+ app.add_typer(typer_instance=commands.app, name="commands")
16
+ app.add_typer(
17
+ typer_instance=cluster.app, name="cluster", help="OpenSearch cluster api commands"
18
+ )
19
+ app.add_typer(
20
+ typer_instance=index.app, name="index", help="OpenSearch index api commands"
21
+ )
22
+ app.add_typer(
23
+ typer_instance=snapshot.app,
24
+ name="snapshot",
25
+ help="OpenSearch snapshot api commands",
26
+ )
27
+ app.add_typer(typer_instance=raw.app, name="raw", help="Make raw OpenSearch API calls")
28
+
29
+
30
+ class OpenSearchCli:
31
+ def __init__(
32
+ self,
33
+ config: config.Config,
34
+ profile: config.ConfigProfile,
35
+ config_file_path: str,
36
+ ) -> None:
37
+ self._opensearch: OpenSearch | None = None
38
+ self.config = config
39
+ self.profile = profile
40
+ self.config_file_path = config_file_path
41
+
42
+ @property
43
+ def opensearch(self) -> OpenSearch:
44
+ if self._opensearch is None:
45
+ self._opensearch = OpenSearch(
46
+ hosts=[
47
+ {
48
+ "host": self.profile.domain,
49
+ "port": 9200,
50
+ }
51
+ ],
52
+ http_auth=(self.profile.username, self.profile.password),
53
+ use_ssl=True,
54
+ verify_certs=False,
55
+ ssl_show_warn=False,
56
+ )
57
+ return self._opensearch
58
+
59
+
60
+ @app.callback()
61
+ def common(
62
+ ctx: typer.Context,
63
+ config_file: Annotated[str, typer.Option()] = os.path.expanduser(
64
+ path=f"{Path.home()}/.config/opensearch-cli/config.toml"
65
+ ),
66
+ profile: Annotated[
67
+ str,
68
+ typer.Option(help="OpenSearch profile name", envvar="OPENSEARCH_PROFILE"),
69
+ ] = "default",
70
+ raw: bool = Annotated[
71
+ bool, typer.Option(help="Display raw JSON output", default=False)
72
+ ],
73
+ ) -> None:
74
+ """OpenSearch CLI - Manage your OpenSearch clusters."""
75
+
76
+ _config = config.read_config(config_file=config_file)
77
+ _profile = _config.find_profile_by_name(profile_name=profile)
78
+
79
+ ctx.obj = OpenSearchCli(
80
+ config=_config,
81
+ profile=_profile,
82
+ config_file_path=config_file,
83
+ )
84
+
85
+
86
+ if __name__ == "__main__":
87
+ app()
@@ -0,0 +1,67 @@
1
+ from typing import Annotated
2
+
3
+ import typer
4
+ from opensearchpy import RequestError
5
+ from rich.console import Console
6
+
7
+ from opensearchcli.commands import cluster_settings
8
+ from opensearchcli.commands.exceptions import catch_exception
9
+
10
+ app = typer.Typer(
11
+ rich_markup_mode="rich",
12
+ no_args_is_help=True,
13
+ help="Manage OpenSearch cluster operations",
14
+ )
15
+ app.add_typer(cluster_settings.app, name="settings", help="Manage cluster settings")
16
+ console = Console()
17
+
18
+
19
+ @app.command()
20
+ def info(
21
+ ctx: typer.Context,
22
+ ):
23
+ """Retrieve cluster information."""
24
+ info = ctx.obj.opensearch.info()
25
+ console.print(info)
26
+
27
+
28
+ @app.command()
29
+ def health(
30
+ ctx: typer.Context,
31
+ ):
32
+ """Check the health of the OpenSearch cluster."""
33
+ health = ctx.obj.opensearch.cluster.health()
34
+ console.print(health)
35
+
36
+
37
+ @app.command()
38
+ @catch_exception(RequestError, exit_code=1)
39
+ def allocation_explain(
40
+ ctx: typer.Context,
41
+ index: Annotated[
42
+ str, typer.Argument(help="The name of the index to explain allocation for")
43
+ ] = None,
44
+ ):
45
+ """Explain shard allocation for a specific index."""
46
+ if index:
47
+ explanation = ctx.obj.opensearch.cluster.allocation_explain(index=index)
48
+ else:
49
+ explanation = ctx.obj.opensearch.cluster.allocation_explain()
50
+
51
+ console.print(explanation)
52
+
53
+
54
+ @app.command()
55
+ def pending_tasks(
56
+ ctx: typer.Context,
57
+ ):
58
+ """List pending tasks in the OpenSearch cluster."""
59
+ tasks = ctx.obj.opensearch.cluster.pending_tasks()
60
+ console.print(tasks)
61
+
62
+
63
+ @app.command()
64
+ def stats(ctx: typer.Context):
65
+ """Retrieve cluster statistics."""
66
+ stats = ctx.obj.opensearch.cluster.stats()
67
+ console.print(stats)
@@ -0,0 +1,51 @@
1
+ from typing import Annotated, List
2
+
3
+ import typer
4
+ from opensearchpy import RequestError
5
+ from rich.console import Console
6
+
7
+ app = typer.Typer(
8
+ rich_markup_mode="rich",
9
+ no_args_is_help=True,
10
+ help="Manage OpenSearch cluster settings",
11
+ )
12
+ console = Console()
13
+
14
+
15
+ @app.command()
16
+ def get(
17
+ ctx: typer.Context,
18
+ params: Annotated[
19
+ list[str], typer.Option(help="Cluster settings to retrieve")
20
+ ] = [],
21
+ ):
22
+ """Retrieve cluster settings."""
23
+ _params = {}
24
+ for p in params:
25
+ if "=" in p:
26
+ key, value = p.split("=", 1)
27
+ _params[key] = value
28
+ else:
29
+ _params[p] = "true"
30
+ _settings = ctx.obj.opensearch.cluster.get_settings(params=_params)
31
+ console.print(_settings)
32
+
33
+
34
+ @app.command()
35
+ def set(ctx: typer.Context, settings: List[str]):
36
+ """Update cluster settings."""
37
+
38
+ body = {
39
+ "persistent": {},
40
+ }
41
+ for s in settings:
42
+ name, value = s.split("=", 1)
43
+ body["persistent"][name] = value
44
+
45
+ try:
46
+ ctx.obj.opensearch.cluster.put_settings(body=body)
47
+ console.print(
48
+ f"[green]Successfully updated settings:[/green] {body['persistent']}"
49
+ )
50
+ except RequestError as e:
51
+ console.print(f"[red]Error updating settings:[/red] {e.info}")
@@ -0,0 +1,189 @@
1
+ """
2
+ Commands introspection module.
3
+
4
+ Provides commands to list and explore all available CLI commands.
5
+ """
6
+
7
+ from typing_extensions import Annotated
8
+ import typer
9
+ from rich.console import Console
10
+ from rich.tree import Tree
11
+ from rich.table import Table
12
+ from rich import box
13
+
14
+
15
+ app = typer.Typer(
16
+ rich_markup_mode="rich",
17
+ no_args_is_help=True,
18
+ help="Introspect available CLI commands",
19
+ )
20
+ console = Console()
21
+
22
+
23
+ def _get_command_info(command) -> dict:
24
+ """Extract information from a Typer command."""
25
+ # Get help text from various sources
26
+ help_text = ""
27
+ if hasattr(command, "help") and command.help:
28
+ help_text = command.help
29
+ elif hasattr(command, "callback") and command.callback:
30
+ doc = command.callback.__doc__
31
+ if doc:
32
+ # Get first line of docstring
33
+ help_text = doc.strip().split("\n")[0]
34
+
35
+ # Get command name
36
+ name = ""
37
+ if hasattr(command, "name") and command.name:
38
+ name = command.name
39
+ elif hasattr(command, "callback"):
40
+ name = command.callback.__name__.replace("_", "-")
41
+
42
+ return {
43
+ "name": name,
44
+ "help": help_text,
45
+ "callback": getattr(command, "callback", None),
46
+ }
47
+
48
+
49
+ def _get_typer_commands(typer_instance: typer.Typer) -> list[dict]:
50
+ """Recursively get all commands from a Typer instance."""
51
+ commands = []
52
+
53
+ # Get registered commands
54
+ if hasattr(typer_instance, "registered_commands"):
55
+ for command in typer_instance.registered_commands:
56
+ commands.append({**_get_command_info(command), "type": "command"})
57
+
58
+ # Get registered groups (sub-typers)
59
+ if hasattr(typer_instance, "registered_groups"):
60
+ for group in typer_instance.registered_groups:
61
+ # Skip if typer_instance is None
62
+ if not group.typer_instance:
63
+ continue
64
+
65
+ # Get group name
66
+ group_name = group.name
67
+ if (
68
+ not group_name
69
+ and hasattr(group.typer_instance, "info")
70
+ and group.typer_instance.info
71
+ ):
72
+ group_name = group.typer_instance.info.name
73
+
74
+ # Get group help
75
+ group_help = group.help
76
+ if (
77
+ not group_help
78
+ and hasattr(group.typer_instance, "info")
79
+ and group.typer_instance.info
80
+ ):
81
+ info_help = getattr(group.typer_instance.info, "help", None)
82
+ # Only use if it's not a DefaultPlaceholder
83
+ if info_help and not str(info_help).startswith("<"):
84
+ group_help = info_help
85
+
86
+ group_info = {
87
+ "name": group_name or "unknown",
88
+ "help": group_help or "",
89
+ "type": "group",
90
+ "commands": _get_typer_commands(group.typer_instance),
91
+ }
92
+ commands.append(group_info)
93
+
94
+ return commands
95
+
96
+
97
+ def _build_tree(commands: list[dict], tree: Tree, prefix: str = "") -> None:
98
+ """Recursively build a Rich Tree from command structure."""
99
+ for cmd in sorted(commands, key=lambda x: x["name"]):
100
+ if cmd["type"] == "group":
101
+ # Add a branch for command groups
102
+ help_text = f" - [dim]{cmd['help']}[/dim]" if cmd.get("help") else ""
103
+ branch = tree.add(f"[bold cyan]{cmd['name']}[/bold cyan]{help_text}")
104
+ # Recursively add subcommands
105
+ if cmd.get("commands"):
106
+ _build_tree(cmd["commands"], branch, prefix=f"{prefix}{cmd['name']} ")
107
+ else:
108
+ # Add a leaf for individual commands
109
+ help_text = f" - [dim]{cmd['help']}[/dim]" if cmd.get("help") else ""
110
+ tree.add(f"[green]{cmd['name']}[/green]{help_text}")
111
+
112
+
113
+ def _build_flat_list(commands: list[dict], prefix: str = "") -> list[dict]:
114
+ """Build a flat list of all commands with their full paths."""
115
+ flat_list = []
116
+
117
+ for cmd in sorted(commands, key=lambda x: x["name"]):
118
+ if cmd["type"] == "group":
119
+ group_path = f"{prefix}{cmd['name']}"
120
+ flat_list.append(
121
+ {"command": group_path, "type": "group", "help": cmd["help"]}
122
+ )
123
+ # Recursively add subcommands
124
+ if cmd.get("commands"):
125
+ flat_list.extend(
126
+ _build_flat_list(cmd["commands"], prefix=f"{group_path} ")
127
+ )
128
+ else:
129
+ command_path = f"{prefix}{cmd['name']}"
130
+ flat_list.append(
131
+ {"command": command_path, "type": "command", "help": cmd["help"]}
132
+ )
133
+
134
+ return flat_list
135
+
136
+
137
+ @app.command(name="list")
138
+ def list_commands(
139
+ flat: Annotated[
140
+ bool, typer.Option("--flat", help="Show as flat list instead of tree")
141
+ ] = False,
142
+ ):
143
+ """
144
+ List all available CLI commands.
145
+
146
+ Shows a tree view of all commands and subcommands by default.
147
+ Use --flat to show as a flat list with full command paths.
148
+ """
149
+ # Get the root typer app
150
+ # We need to access the parent context to get the root app
151
+ from opensearchcli import cli
152
+
153
+ # Get all commands from the root app
154
+ commands = _get_typer_commands(cli.app)
155
+
156
+ if flat:
157
+ # Build flat list
158
+ flat_list = _build_flat_list(commands)
159
+
160
+ # Create table for flat view
161
+ table = Table(
162
+ title="Available Commands",
163
+ box=box.ROUNDED,
164
+ show_header=True,
165
+ header_style="bold magenta",
166
+ )
167
+ table.add_column("Command", style="cyan", no_wrap=True)
168
+ table.add_column("Type", style="yellow", width=10)
169
+ table.add_column("Description", style="white")
170
+
171
+ for item in flat_list:
172
+ type_display = "group" if item["type"] == "group" else "command"
173
+ table.add_row(item["command"], type_display, item["help"])
174
+
175
+ console.print(table)
176
+ else:
177
+ # Build tree view
178
+ tree = Tree(
179
+ "[bold blue]opensearchcli[/bold blue] - OpenSearch CLI", guide_style="dim"
180
+ )
181
+ _build_tree(commands, tree)
182
+
183
+ console.print("\n")
184
+ console.print(tree)
185
+ console.print("\n[dim]Use --flat for a flat list view[/dim]\n")
186
+
187
+
188
+ if __name__ == "__main__":
189
+ app()
@@ -0,0 +1,59 @@
1
+ import os
2
+ import tomllib
3
+
4
+
5
+ class ConfigProfile:
6
+ def __init__(self, profile_name: str, data: dict) -> None:
7
+ self.profile_name = profile_name
8
+ self._data = data
9
+
10
+ @property
11
+ def domain(self) -> str:
12
+ return self._data.get("domain", "")
13
+
14
+ @property
15
+ def username(self) -> str:
16
+ return self._data.get("username", "")
17
+
18
+ @property
19
+ def password(self) -> str:
20
+ return self._data.get("password", "")
21
+
22
+ def __str__(self) -> str:
23
+ return (
24
+ f"Profile Name: {self.profile_name}\n"
25
+ f"\tDomain: {self.domain}\n"
26
+ f"\tUsername: {self.username}\n"
27
+ f"\tPassword: {'*' * len(self.password) if self.password else ''}"
28
+ )
29
+
30
+
31
+ class Config:
32
+ def __init__(self, file_loc: str, profiles: list[ConfigProfile]) -> None:
33
+ self.file = file_loc
34
+ self.profiles = profiles
35
+
36
+ def find_profile_by_name(self, profile_name: str) -> ConfigProfile:
37
+ for profile in self.profiles:
38
+ if profile.profile_name == profile_name:
39
+ return profile
40
+ return ConfigProfile(profile_name="", data={})
41
+
42
+
43
+ def read_config(config_file: str) -> Config:
44
+ if not os.path.isfile(path=config_file):
45
+ return Config(file_loc="", profiles=[ConfigProfile(profile_name="", data={})])
46
+
47
+ try:
48
+ with open(file=config_file, mode="rb") as _file:
49
+ data = tomllib.load(_file)
50
+ except ValueError as error:
51
+ data = {}
52
+ print(f"invalid toml: {error}")
53
+ return Config(
54
+ file_loc=config_file,
55
+ profiles=[
56
+ ConfigProfile(profile_name=profile_name, data=data[profile_name])
57
+ for profile_name in data.keys()
58
+ ],
59
+ )
@@ -0,0 +1,21 @@
1
+ from functools import wraps
2
+
3
+ import typer
4
+ from rich.console import Console
5
+
6
+ console = Console()
7
+
8
+
9
+ def catch_exception(which_exception, exit_code=1):
10
+ def decorator(func):
11
+ @wraps(func)
12
+ def wrapper(*args, **kwargs):
13
+ try:
14
+ return func(*args, **kwargs)
15
+ except which_exception as e:
16
+ console.print(f"[red]Error:[/red] {str(e)}")
17
+ raise typer.Exit(code=exit_code)
18
+
19
+ return wrapper
20
+
21
+ return decorator
@@ -0,0 +1,25 @@
1
+ from collections import defaultdict
2
+ from functools import reduce
3
+ from typing import List
4
+
5
+
6
+ def body_dict_from_flags(body: List[str]) -> dict:
7
+ nested_dict = lambda: defaultdict(nested_dict)
8
+ body_dict = nested_dict()
9
+
10
+ for part in body:
11
+ key, value = part.split("=", 1)
12
+ keys = key.split(".")
13
+ reduce(dict.__getitem__, keys[:-1], body_dict)[keys[-1]] = value
14
+
15
+ return dict(body_dict)
16
+
17
+ def parse_params(params: List[str]) -> dict:
18
+ params_dict = {}
19
+ for part in params:
20
+ if "=" not in part:
21
+ params_dict[part] = "true"
22
+ continue
23
+ key, value = part.split("=", 1)
24
+ params_dict[key] = value
25
+ return params_dict
@@ -0,0 +1,36 @@
1
+ import typer
2
+ from rich.console import Console
3
+
4
+ from opensearchcli.commands import index_settings
5
+
6
+ app = typer.Typer(
7
+ rich_markup_mode="rich",
8
+ no_args_is_help=True,
9
+ help="Manage OpenSearch index operations",
10
+ )
11
+ app.add_typer(index_settings.app, name="settings", help="Manage index settings")
12
+ console = Console()
13
+
14
+
15
+ @app.command()
16
+ def list(
17
+ ctx: typer.Context,
18
+ index_pattern: str = typer.Argument(
19
+ ..., help="Index name or pattern to list indices"
20
+ ),
21
+ ):
22
+ indices = ctx.obj.opensearch.indices.get(index=index_pattern)
23
+ for index_name in indices.keys():
24
+ console.print(index_name)
25
+
26
+
27
+ @app.command()
28
+ def get(
29
+ ctx: typer.Context,
30
+ index: str = typer.Argument(
31
+ help="The name of the index to retrieve information for"
32
+ ),
33
+ ):
34
+ """Retrieve information for a specific index."""
35
+ index_info = ctx.obj.opensearch.indices.get(index=index)
36
+ console.print(index_info)
@@ -0,0 +1,43 @@
1
+ from typing import List
2
+
3
+ import typer
4
+ from rich.console import Console
5
+
6
+ from opensearchcli.commands.helpers import body_dict_from_flags, parse_params
7
+
8
+ app = typer.Typer(
9
+ rich_markup_mode="rich",
10
+ no_args_is_help=True,
11
+ help="Manage OpenSearch index settings",
12
+ )
13
+ console = Console()
14
+
15
+
16
+ @app.command()
17
+ def get(
18
+ ctx: typer.Context,
19
+ index: str = typer.Argument(help="The name of the index to retrieve settings for"),
20
+ params: List[str] = typer.Option(
21
+ default=[], help="Settings parameters to retrieve"
22
+ ),
23
+ ):
24
+ """Retrieve settings for a specific index."""
25
+
26
+ _params = parse_params(params)
27
+
28
+ settings = ctx.obj.opensearch.indices.get_settings(index=index, params=_params)
29
+ console.print(settings)
30
+
31
+
32
+ @app.command()
33
+ def set(
34
+ ctx: typer.Context,
35
+ index: str = typer.Argument(help="The name of the index to update settings for"),
36
+ settings: List[str] = typer.Argument(
37
+ help="Settings to update in the format key=value"
38
+ ),
39
+ ):
40
+ """Update settings for a specific index."""
41
+ payload = body_dict_from_flags(settings)
42
+ response = ctx.obj.opensearch.indices.put_settings(index=index, body=payload)
43
+ console.print(response)
@@ -0,0 +1,36 @@
1
+ from typing import List
2
+
3
+ import typer
4
+ from rich.console import Console
5
+
6
+ from opensearchcli.commands.helpers import body_dict_from_flags, parse_params
7
+
8
+ app = typer.Typer(
9
+ rich_markup_mode="rich",
10
+ no_args_is_help=True,
11
+ help="Make raw API calls to OpenSearch cluster",
12
+ )
13
+ console = Console()
14
+
15
+
16
+ @app.command()
17
+ def do(
18
+ ctx: typer.Context,
19
+ method: str = typer.Argument("GET", help="HTTP method to use"),
20
+ endpoint: str = typer.Argument(help="API endpoint to call"),
21
+ body: List[str] = typer.Option({}, help="Request body for POST/PUT requests"),
22
+ params: List[str] = typer.Option({}, help="Query parameters for the request"),
23
+ ):
24
+ """Make a raw API call to the OpenSearch cluster."""
25
+ opensearch = ctx.obj.opensearch
26
+
27
+ payload = body_dict_from_flags(body)
28
+ query_params = parse_params(params)
29
+
30
+ response = opensearch.transport.perform_request(
31
+ method,
32
+ endpoint,
33
+ body=payload if body else None,
34
+ params=query_params if params else None,
35
+ )
36
+ console.print(response)
@@ -0,0 +1,14 @@
1
+ import typer
2
+ from rich.console import Console
3
+
4
+ app = typer.Typer(
5
+ rich_markup_mode="rich", no_args_is_help=True, help="Manage snapshots"
6
+ )
7
+ console = Console()
8
+
9
+
10
+ @app.command()
11
+ def repository(ctx: typer.Context):
12
+ """Get snapshot information."""
13
+ snapshot_info = ctx.obj.opensearch.snapshot.get_repository()
14
+ console.print(snapshot_info)
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: opensearchcli
3
+ Version: 0.1.0
4
+ Summary: A CLI tool for OpenSearch
5
+ Requires-Python: >=3.14
6
+ Requires-Dist: opensearch-py>=3.1.0
7
+ Requires-Dist: typer>=0.20.0
@@ -0,0 +1,21 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/opensearchcli/__init__.py
4
+ src/opensearchcli/cli.py
5
+ src/opensearchcli.egg-info/PKG-INFO
6
+ src/opensearchcli.egg-info/SOURCES.txt
7
+ src/opensearchcli.egg-info/dependency_links.txt
8
+ src/opensearchcli.egg-info/entry_points.txt
9
+ src/opensearchcli.egg-info/requires.txt
10
+ src/opensearchcli.egg-info/top_level.txt
11
+ src/opensearchcli/commands/__init__.py
12
+ src/opensearchcli/commands/cluster.py
13
+ src/opensearchcli/commands/cluster_settings.py
14
+ src/opensearchcli/commands/commands.py
15
+ src/opensearchcli/commands/config.py
16
+ src/opensearchcli/commands/exceptions.py
17
+ src/opensearchcli/commands/helpers.py
18
+ src/opensearchcli/commands/index.py
19
+ src/opensearchcli/commands/index_settings.py
20
+ src/opensearchcli/commands/raw.py
21
+ src/opensearchcli/commands/snapshot.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ opensearchcli = opensearchcli.cli:app
@@ -0,0 +1,2 @@
1
+ opensearch-py>=3.1.0
2
+ typer>=0.20.0
@@ -0,0 +1 @@
1
+ opensearchcli