cortexapps-cli 1.6.0__tar.gz → 1.9.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.
Files changed (59) hide show
  1. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/PKG-INFO +2 -2
  2. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/cli.py +1 -1
  3. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/backup.py +12 -0
  4. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/cortex_client.py +24 -3
  5. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/pyproject.toml +2 -2
  6. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/LICENSE +0 -0
  7. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/README.rst +0 -0
  8. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/command_options.py +0 -0
  9. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/api_keys.py +0 -0
  10. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/audit_logs.py +0 -0
  11. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/backup_commands/cortex_export.py +0 -0
  12. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/catalog.py +0 -0
  13. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/custom_data.py +0 -0
  14. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/custom_events.py +0 -0
  15. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/custom_metrics.py +0 -0
  16. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/dependencies.py +0 -0
  17. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/deploys.py +0 -0
  18. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/discovery_audit.py +0 -0
  19. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/docs.py +0 -0
  20. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/entity_relationship_types.py +0 -0
  21. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/entity_relationships.py +0 -0
  22. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/entity_types.py +0 -0
  23. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/gitops_logs.py +0 -0
  24. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/groups.py +0 -0
  25. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/initiatives.py +0 -0
  26. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations.py +0 -0
  27. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/aws.py +0 -0
  28. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/azure_devops.py +0 -0
  29. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/azure_resources.py +0 -0
  30. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/circleci.py +0 -0
  31. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/coralogix.py +0 -0
  32. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/datadog.py +0 -0
  33. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/github.py +0 -0
  34. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/gitlab.py +0 -0
  35. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/incidentio.py +0 -0
  36. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/launchdarkly.py +0 -0
  37. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/newrelic.py +0 -0
  38. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/pagerduty.py +0 -0
  39. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/prometheus.py +0 -0
  40. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/integrations_commands/sonarqube.py +0 -0
  41. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/ip_allowlist.py +0 -0
  42. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/on_call.py +0 -0
  43. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages.py +0 -0
  44. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages_commands/go.py +0 -0
  45. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages_commands/java.py +0 -0
  46. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages_commands/node.py +0 -0
  47. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages_commands/nuget.py +0 -0
  48. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/packages_commands/python.py +0 -0
  49. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/plugins.py +0 -0
  50. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/queries.py +0 -0
  51. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/rest.py +0 -0
  52. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/scim.py +0 -0
  53. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/scorecards.py +0 -0
  54. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/scorecards_commands/exemptions.py +0 -0
  55. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/secrets.py +0 -0
  56. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/teams.py +0 -0
  57. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/commands/workflows.py +0 -0
  58. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/models/team.py +0 -0
  59. {cortexapps_cli-1.6.0 → cortexapps_cli-1.9.0}/cortexapps_cli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortexapps-cli
3
- Version: 1.6.0
3
+ Version: 1.9.0
4
4
  Summary: Command Line Interface for cortexapps
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ Requires-Dist: click (<8.2)
18
18
  Requires-Dist: pyyaml (>=6.0.1,<7)
19
19
  Requires-Dist: requests (>=2.32.4,<3.0.0)
20
20
  Requires-Dist: typer (>=0.12.5,<0.13.0)
21
- Requires-Dist: urllib3 (>=2.2.2)
21
+ Requires-Dist: urllib3 (>=2.6.0)
22
22
  Project-URL: Bug Tracker, https://github.com/cortexapps/cli/issues
23
23
  Project-URL: Changes, https://github.com/cortexapps/cli/blob/main/HISTORY.md
24
24
  Project-URL: Documentation, https://github.com/cortexapps/cli/blob/main/README.rst
@@ -87,7 +87,7 @@ def global_callback(
87
87
  url: str = typer.Option(None, "--url", "-u", help="Base URL for the API", envvar="CORTEX_BASE_URL"),
88
88
  config_file: str = typer.Option(os.path.join(os.path.expanduser('~'), '.cortex', 'config'), "--config", "-c", help="Config file path", envvar="CORTEX_CONFIG"),
89
89
  tenant: str = typer.Option("default", "--tenant", "-t", help="Tenant alias", envvar="CORTEX_TENANT_ALIAS"),
90
- log_level: Annotated[str, typer.Option("--log-level", "-l", help="Set the logging level")] = "INFO",
90
+ log_level: Annotated[str, typer.Option("--log-level", "-l", help="Set the logging level")] = "WARNING",
91
91
  rate_limit: int = typer.Option(None, "--rate-limit", "-r", help="API rate limit in requests per minute (default: 1000)", envvar="CORTEX_RATE_LIMIT")
92
92
  ):
93
93
  if not ctx.obj:
@@ -472,6 +472,8 @@ def _import_entity_relationships(ctx, directory):
472
472
  return ("entity-relationships", len(results) - failed_count, [(fp, et, em) for rt, fp, et, em in results if et])
473
473
 
474
474
  def _import_catalog(ctx, directory):
475
+ results = []
476
+ failed_count = 0
475
477
  if os.path.isdir(directory):
476
478
  print("Processing: " + directory)
477
479
  files = [(filename, os.path.join(directory, filename))
@@ -507,6 +509,8 @@ def _import_catalog(ctx, directory):
507
509
  return ("catalog", len(results) - failed_count, [(fp, et, em) for fn, fp, et, em in results if et])
508
510
 
509
511
  def _import_plugins(ctx, directory):
512
+ results = []
513
+ failed_count = 0
510
514
  if os.path.isdir(directory):
511
515
  print("Processing: " + directory)
512
516
  files = [(filename, os.path.join(directory, filename))
@@ -543,6 +547,8 @@ def _import_plugins(ctx, directory):
543
547
  return ("plugins", len(results) - failed_count, [(fp, et, em) for fn, fp, et, em in results if et])
544
548
 
545
549
  def _import_scorecards(ctx, directory):
550
+ results = []
551
+ failed_count = 0
546
552
  if os.path.isdir(directory):
547
553
  print("Processing: " + directory)
548
554
  files = [(filename, os.path.join(directory, filename))
@@ -579,6 +585,8 @@ def _import_scorecards(ctx, directory):
579
585
  return ("scorecards", len(results) - failed_count, [(fp, et, em) for fn, fp, et, em in results if et])
580
586
 
581
587
  def _import_workflows(ctx, directory):
588
+ results = []
589
+ failed_count = 0
582
590
  if os.path.isdir(directory):
583
591
  print("Processing: " + directory)
584
592
  files = [(filename, os.path.join(directory, filename))
@@ -690,3 +698,7 @@ def import_tenant(
690
698
  print(f"cortex scorecards create -f \"{file_path}\"")
691
699
  elif import_type == "workflows":
692
700
  print(f"cortex workflows create -f \"{file_path}\"")
701
+
702
+ # Exit with non-zero code if any imports failed
703
+ if total_failed > 0:
704
+ raise typer.Exit(1)
@@ -98,7 +98,7 @@ class CortexClient:
98
98
  max_retries=Retry(
99
99
  total=3,
100
100
  backoff_factor=0.3,
101
- status_forcelist=[500, 502, 503, 504], # Removed 429 - we avoid it with rate limiting
101
+ status_forcelist=[429], # Only retry on rate limit errors
102
102
  allowed_methods=["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
103
103
  respect_retry_after_header=True
104
104
  )
@@ -149,6 +149,23 @@ class CortexClient:
149
149
  # try to parse the error message
150
150
  error = response.json()
151
151
  status = response.status_code
152
+
153
+ # Check for validation error format with violations array
154
+ if 'violations' in error and isinstance(error['violations'], list):
155
+ print(f'[red][bold]HTTP Error {status}[/bold][/red]: Validation failed')
156
+ for violation in error['violations']:
157
+ title = violation.get('title', 'Validation Error')
158
+ description = violation.get('description', 'No description')
159
+ violation_type = violation.get('violationType', '')
160
+ pointer = violation.get('pointer', '')
161
+ print(f' [yellow]{title}[/yellow]: {description}')
162
+ if pointer:
163
+ print(f' [dim]Location: {pointer}[/dim]')
164
+ if violation_type:
165
+ print(f' [dim]Type: {violation_type}[/dim]')
166
+ raise typer.Exit(code=1)
167
+
168
+ # Standard error format with message/details
152
169
  message = error.get('message', 'Unknown error')
153
170
  details = error.get('details', 'No details')
154
171
  request_id = error.get('requestId', 'No request ID')
@@ -156,8 +173,12 @@ class CortexClient:
156
173
  print(error_str)
157
174
  raise typer.Exit(code=1)
158
175
  except json.JSONDecodeError:
159
- # if we can't parse the error message, just raise the HTTP error
160
- response.raise_for_status()
176
+ # if we can't parse the error message, print a clean error and exit
177
+ status = response.status_code
178
+ reason = response.reason or 'Unknown error'
179
+ error_str = f'[red][bold]HTTP Error {status}[/bold][/red]: {reason}'
180
+ print(error_str)
181
+ raise typer.Exit(code=1)
161
182
 
162
183
  if raw_response:
163
184
  return response
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "cortexapps-cli"
3
3
  # version will be incremented via command line as part of github actions build
4
- version = "1.6.0"
4
+ version = "1.9.0"
5
5
  description = "Command Line Interface for cortexapps"
6
6
  license = "MIT"
7
7
  authors = [
@@ -19,7 +19,7 @@ classifiers = [
19
19
  python = "^3.11"
20
20
  requests = "^2.32.4"
21
21
  pyyaml = ">= 6.0.1, < 7"
22
- urllib3 = ">= 2.2.2"
22
+ urllib3 = ">= 2.6.0"
23
23
  typer = "^0.12.5"
24
24
  click = "<8.2"
25
25
 
File without changes