cortexapps-cli 1.19.2__tar.gz → 1.20.1__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.
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/PKG-INFO +1 -1
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/cli.py +2 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/backup.py +121 -2
- cortexapps_cli-1.20.1/cortexapps_cli/commands/users.py +5 -0
- cortexapps_cli-1.20.1/cortexapps_cli/commands/users_commands/roles.py +49 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/pyproject.toml +1 -1
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/LICENSE +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/README.rst +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/__init__.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/command_options.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/api_keys.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/audit_logs.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/backup_commands/cortex_export.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/catalog.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/custom_data.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/custom_events.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/custom_metrics.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/dependencies.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/deploys.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/discovery_audit.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/docs.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/entity_relationship_types.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/entity_relationships.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/entity_types.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/gitops_logs.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/groups.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/initiatives.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/apiiro.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/argocd.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/aws.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/azure_active_directory.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/azure_devops.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/azure_resources.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/bamboohr.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/bitbucket.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/bugsnag.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/buildkite.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/checkmarx_sast.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/circleci.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/clickup.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/codecov.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/coralogix.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/datadog.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/dynatrace.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/firehydrant.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/github.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/gitlab.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/incidentio.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/instana.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/jenkins.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/jira.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/launchdarkly.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/mend_sast.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/mend_sca.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/newrelic.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/okta.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/opsgenie.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/pagerduty.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/prometheus.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/rollbar.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/rootly.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/semgrep.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/sentry.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/servicenow.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/servicenow_cloud_observability.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/snyk.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/sonarqube.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/splunk_observability_cloud.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/splunk_on_call.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/sumologic.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/veracode.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/wiz.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/workday.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/xmatters.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/ip_allowlist.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/on_call.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/go.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/java.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/node.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/nuget.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/python.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/plugins.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/queries.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/rest.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/scim.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/scorecards.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/scorecards_commands/exemptions.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/secrets.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/teams.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/workflows.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/cortex_client.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/models/team.py +0 -0
- {cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/utils.py +0 -0
|
@@ -40,6 +40,7 @@ import cortexapps_cli.commands.scim as scim
|
|
|
40
40
|
import cortexapps_cli.commands.scorecards as scorecards
|
|
41
41
|
import cortexapps_cli.commands.secrets as secrets
|
|
42
42
|
import cortexapps_cli.commands.teams as teams
|
|
43
|
+
import cortexapps_cli.commands.users as users
|
|
43
44
|
import cortexapps_cli.commands.workflows as workflows
|
|
44
45
|
|
|
45
46
|
app = typer.Typer(
|
|
@@ -77,6 +78,7 @@ app.add_typer(scim.app, name="scim")
|
|
|
77
78
|
app.add_typer(scorecards.app, name="scorecards")
|
|
78
79
|
app.add_typer(secrets.app, name="secrets")
|
|
79
80
|
app.add_typer(teams.app, name="teams")
|
|
81
|
+
app.add_typer(users.app, name="users")
|
|
80
82
|
app.add_typer(workflows.app, name="workflows")
|
|
81
83
|
|
|
82
84
|
# global options
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
+
import time
|
|
2
3
|
from typing import Optional
|
|
3
4
|
from typing import List
|
|
4
5
|
from typing_extensions import Annotated
|
|
@@ -7,7 +8,6 @@ import json
|
|
|
7
8
|
import os
|
|
8
9
|
import tempfile
|
|
9
10
|
import sys
|
|
10
|
-
from io import StringIO
|
|
11
11
|
from contextlib import redirect_stdout, redirect_stderr
|
|
12
12
|
from rich import print, print_json
|
|
13
13
|
from rich.console import Console
|
|
@@ -471,6 +471,18 @@ def _import_entity_relationships(ctx, directory):
|
|
|
471
471
|
|
|
472
472
|
return ("entity-relationships", len(results) - failed_count, [(fp, et, em) for rt, fp, et, em in results if et])
|
|
473
473
|
|
|
474
|
+
def _has_relationships(file_path):
|
|
475
|
+
"""Check if a catalog YAML file contains x-cortex-relationships."""
|
|
476
|
+
try:
|
|
477
|
+
with open(file_path) as f:
|
|
478
|
+
content = yaml.safe_load(f)
|
|
479
|
+
info = content.get('info', {})
|
|
480
|
+
relationships = info.get('x-cortex-relationships')
|
|
481
|
+
return relationships is not None and len(relationships) > 0
|
|
482
|
+
except Exception:
|
|
483
|
+
return False
|
|
484
|
+
|
|
485
|
+
|
|
474
486
|
def _import_catalog(ctx, directory):
|
|
475
487
|
results = []
|
|
476
488
|
failed_count = 0
|
|
@@ -493,7 +505,7 @@ def _import_catalog(ctx, directory):
|
|
|
493
505
|
except Exception as e:
|
|
494
506
|
return (filename, file_path, type(e).__name__, str(e))
|
|
495
507
|
|
|
496
|
-
# Import all files
|
|
508
|
+
# Pass 1: Import all files
|
|
497
509
|
with ThreadPoolExecutor(max_workers=30) as executor:
|
|
498
510
|
futures = {executor.submit(import_catalog_file, file_info): file_info[0] for file_info in files}
|
|
499
511
|
results = []
|
|
@@ -506,6 +518,113 @@ def _import_catalog(ctx, directory):
|
|
|
506
518
|
if failed_count > 0:
|
|
507
519
|
print(f"\n Total catalog import failures: {failed_count}")
|
|
508
520
|
|
|
521
|
+
# Pass 2: Delete and re-create entities with x-cortex-relationships.
|
|
522
|
+
# On first creation (pass 1), the relationship processor runs synchronously but
|
|
523
|
+
# the entity hasn't been committed to the DB yet, so it caches a failed state.
|
|
524
|
+
# Subsequent updates don't clear this cache. Deleting the entity clears the cache,
|
|
525
|
+
# so the fresh re-create triggers proper relationship processing.
|
|
526
|
+
#
|
|
527
|
+
# Two-wave approach handles multi-tier hierarchies: Wave 1 re-creates all
|
|
528
|
+
# relationship entities (e.g., clusters → services, where services are stable from
|
|
529
|
+
# pass 1). Wave 2 re-creates entities whose destinations were also recreated in
|
|
530
|
+
# wave 1 (e.g., accounts → clusters), ensuring destinations exist before the
|
|
531
|
+
# relationship processor runs for those dependent sources.
|
|
532
|
+
relationship_files = [(fn, fp) for fn, fp in files if _has_relationships(fp)]
|
|
533
|
+
if relationship_files:
|
|
534
|
+
print(f"\n Re-importing {len(relationship_files)} entities with relationships...")
|
|
535
|
+
|
|
536
|
+
# Collect all tags being recreated in pass 2
|
|
537
|
+
pass2_tags = set()
|
|
538
|
+
for fn, fp in relationship_files:
|
|
539
|
+
try:
|
|
540
|
+
with open(fp) as f:
|
|
541
|
+
content = yaml.safe_load(f)
|
|
542
|
+
tag = content.get('info', {}).get('x-cortex-tag')
|
|
543
|
+
if tag:
|
|
544
|
+
pass2_tags.add(tag)
|
|
545
|
+
except Exception:
|
|
546
|
+
pass
|
|
547
|
+
|
|
548
|
+
def delete_entity(file_info):
|
|
549
|
+
filename, file_path = file_info
|
|
550
|
+
try:
|
|
551
|
+
with open(file_path) as f:
|
|
552
|
+
content = yaml.safe_load(f)
|
|
553
|
+
tag = content.get('info', {}).get('x-cortex-tag')
|
|
554
|
+
if tag:
|
|
555
|
+
catalog.delete(ctx, tag=tag)
|
|
556
|
+
except Exception:
|
|
557
|
+
pass # Entity may not exist; that's fine
|
|
558
|
+
|
|
559
|
+
def create_entity(file_info):
|
|
560
|
+
filename, file_path = file_info
|
|
561
|
+
print(f" Re-importing: {filename}")
|
|
562
|
+
try:
|
|
563
|
+
with open(file_path) as f:
|
|
564
|
+
catalog.create(ctx, file_input=f, _print=False)
|
|
565
|
+
return (filename, file_path, None, None)
|
|
566
|
+
except typer.Exit as e:
|
|
567
|
+
return (filename, file_path, "HTTP", "Validation or HTTP error")
|
|
568
|
+
except Exception as e:
|
|
569
|
+
return (filename, file_path, type(e).__name__, str(e))
|
|
570
|
+
|
|
571
|
+
def has_pass2_destination(file_path):
|
|
572
|
+
"""Return True if any of this entity's relationship destinations are
|
|
573
|
+
also being recreated in pass 2 (i.e., they need to exist first)."""
|
|
574
|
+
try:
|
|
575
|
+
with open(file_path) as f:
|
|
576
|
+
content = yaml.safe_load(f)
|
|
577
|
+
info = content.get('info', {})
|
|
578
|
+
for rel in info.get('x-cortex-relationships', []):
|
|
579
|
+
for dest in rel.get('destinations', []):
|
|
580
|
+
if dest.get('tag') in pass2_tags:
|
|
581
|
+
return True
|
|
582
|
+
except Exception:
|
|
583
|
+
pass
|
|
584
|
+
return False
|
|
585
|
+
|
|
586
|
+
reprocess_results = []
|
|
587
|
+
|
|
588
|
+
# Wave 1: Delete all, then create all. This establishes every entity
|
|
589
|
+
# in the DB and resolves relationships whose destinations are stable
|
|
590
|
+
# (i.e., not being recreated in this pass).
|
|
591
|
+
with ThreadPoolExecutor(max_workers=30) as executor:
|
|
592
|
+
futures = {executor.submit(delete_entity, fi): fi[0] for fi in relationship_files}
|
|
593
|
+
for future in as_completed(futures):
|
|
594
|
+
future.result()
|
|
595
|
+
|
|
596
|
+
time.sleep(2) # Allow deletes to commit before re-creating
|
|
597
|
+
|
|
598
|
+
with ThreadPoolExecutor(max_workers=30) as executor:
|
|
599
|
+
futures = {executor.submit(create_entity, fi): fi[0] for fi in relationship_files}
|
|
600
|
+
for future in as_completed(futures):
|
|
601
|
+
reprocess_results.append(future.result())
|
|
602
|
+
|
|
603
|
+
# Wave 2: For entities whose destinations were also recreated in wave 1,
|
|
604
|
+
# do another delete+create now that those destinations exist in the DB.
|
|
605
|
+
dependent_files = [(fn, fp) for fn, fp in relationship_files if has_pass2_destination(fp)]
|
|
606
|
+
if dependent_files:
|
|
607
|
+
time.sleep(5) # Let wave 1 entities settle in the DB
|
|
608
|
+
|
|
609
|
+
with ThreadPoolExecutor(max_workers=30) as executor:
|
|
610
|
+
futures = {executor.submit(delete_entity, fi): fi[0] for fi in dependent_files}
|
|
611
|
+
for future in as_completed(futures):
|
|
612
|
+
future.result()
|
|
613
|
+
|
|
614
|
+
time.sleep(2)
|
|
615
|
+
|
|
616
|
+
with ThreadPoolExecutor(max_workers=30) as executor:
|
|
617
|
+
futures = {executor.submit(create_entity, fi): fi[0] for fi in dependent_files}
|
|
618
|
+
for future in as_completed(futures):
|
|
619
|
+
reprocess_results.append(future.result())
|
|
620
|
+
|
|
621
|
+
reprocess_failed = sum(1 for fn, fp, et, em in reprocess_results if et)
|
|
622
|
+
if reprocess_failed > 0:
|
|
623
|
+
print(f"\n Total catalog re-import failures: {reprocess_failed}")
|
|
624
|
+
failed_count += reprocess_failed
|
|
625
|
+
else:
|
|
626
|
+
print(f" Note: relationships are processed asynchronously and will be visible within 30 seconds.")
|
|
627
|
+
|
|
509
628
|
return ("catalog", len(results) - failed_count, [(fp, et, em) for fn, fp, et, em in results if et])
|
|
510
629
|
|
|
511
630
|
def _import_plugins(ctx, directory):
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
import typer
|
|
3
|
+
from cortexapps_cli.command_options import ListCommandOptions
|
|
4
|
+
from cortexapps_cli.utils import print_output_with_context
|
|
5
|
+
|
|
6
|
+
app = typer.Typer(help="Roles commands", no_args_is_help=True)
|
|
7
|
+
|
|
8
|
+
@app.command()
|
|
9
|
+
def list(
|
|
10
|
+
ctx: typer.Context,
|
|
11
|
+
email: Optional[List[str]] = typer.Option(None, "--email", "-e", help="Filter by email address; can be specified multiple times", show_default=False),
|
|
12
|
+
page: ListCommandOptions.page = None,
|
|
13
|
+
page_size: ListCommandOptions.page_size = 250,
|
|
14
|
+
table_output: ListCommandOptions.table_output = False,
|
|
15
|
+
csv_output: ListCommandOptions.csv_output = False,
|
|
16
|
+
columns: ListCommandOptions.columns = [],
|
|
17
|
+
no_headers: ListCommandOptions.no_headers = False,
|
|
18
|
+
filters: ListCommandOptions.filters = [],
|
|
19
|
+
sort: ListCommandOptions.sort = [],
|
|
20
|
+
):
|
|
21
|
+
"""
|
|
22
|
+
List user role assignments. The API key used to make the request must have the View Roles permission.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
client = ctx.obj["client"]
|
|
26
|
+
|
|
27
|
+
params = {
|
|
28
|
+
"page": page,
|
|
29
|
+
"pageSize": page_size,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if email:
|
|
33
|
+
params["email"] = ",".join(email)
|
|
34
|
+
|
|
35
|
+
if (table_output or csv_output) and not ctx.params.get('columns'):
|
|
36
|
+
ctx.params['columns'] = [
|
|
37
|
+
"Email=email",
|
|
38
|
+
"Name=name",
|
|
39
|
+
"Roles=roles",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
# remove any params that are None
|
|
43
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
44
|
+
|
|
45
|
+
if page is None:
|
|
46
|
+
r = client.fetch("api/v1/users/roles", params=params)
|
|
47
|
+
else:
|
|
48
|
+
r = client.get("api/v1/users/roles", params=params)
|
|
49
|
+
print_output_with_context(ctx, r)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/entity_relationship_types.py
RENAMED
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/entity_relationships.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/aws.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/integrations_commands/wiz.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/go.py
RENAMED
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/java.py
RENAMED
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/node.py
RENAMED
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/nuget.py
RENAMED
|
File without changes
|
{cortexapps_cli-1.19.2 → cortexapps_cli-1.20.1}/cortexapps_cli/commands/packages_commands/python.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|