cortexapps-cli 0.27.0__tar.gz → 1.0.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 (57) hide show
  1. {cortexapps_cli-0.27.0 → cortexapps_cli-1.0.0}/PKG-INFO +29 -236
  2. {cortexapps_cli-0.27.0 → cortexapps_cli-1.0.0}/README.rst +24 -233
  3. cortexapps_cli-1.0.0/cortexapps_cli/cli.py +144 -0
  4. cortexapps_cli-1.0.0/cortexapps_cli/command_options.py +43 -0
  5. cortexapps_cli-1.0.0/cortexapps_cli/commands/api_keys.py +152 -0
  6. cortexapps_cli-1.0.0/cortexapps_cli/commands/audit_logs.py +97 -0
  7. cortexapps_cli-1.0.0/cortexapps_cli/commands/backup.py +310 -0
  8. cortexapps_cli-1.0.0/cortexapps_cli/commands/backup_commands/cortex_export.py +174 -0
  9. cortexapps_cli-1.0.0/cortexapps_cli/commands/catalog.py +365 -0
  10. cortexapps_cli-1.0.0/cortexapps_cli/commands/custom_data.py +200 -0
  11. cortexapps_cli-1.0.0/cortexapps_cli/commands/custom_events.py +248 -0
  12. cortexapps_cli-1.0.0/cortexapps_cli/commands/custom_metrics.py +133 -0
  13. cortexapps_cli-1.0.0/cortexapps_cli/commands/dependencies.py +232 -0
  14. cortexapps_cli-1.0.0/cortexapps_cli/commands/deploys.py +242 -0
  15. cortexapps_cli-1.0.0/cortexapps_cli/commands/discovery_audit.py +80 -0
  16. cortexapps_cli-1.0.0/cortexapps_cli/commands/docs.py +63 -0
  17. cortexapps_cli-1.0.0/cortexapps_cli/commands/entity_types.py +129 -0
  18. cortexapps_cli-1.0.0/cortexapps_cli/commands/gitops_logs.py +75 -0
  19. cortexapps_cli-1.0.0/cortexapps_cli/commands/groups.py +87 -0
  20. cortexapps_cli-1.0.0/cortexapps_cli/commands/initiatives.py +121 -0
  21. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations.py +35 -0
  22. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/aws.py +221 -0
  23. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/azure_devops.py +174 -0
  24. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/azure_resources.py +258 -0
  25. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/circleci.py +170 -0
  26. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/coralogix.py +179 -0
  27. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/datadog.py +178 -0
  28. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/github.py +170 -0
  29. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/gitlab.py +170 -0
  30. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/incidentio.py +170 -0
  31. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/launchdarkly.py +170 -0
  32. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/newrelic.py +170 -0
  33. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/pagerduty.py +170 -0
  34. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/prometheus.py +170 -0
  35. cortexapps_cli-1.0.0/cortexapps_cli/commands/integrations_commands/sonarqube.py +170 -0
  36. cortexapps_cli-1.0.0/cortexapps_cli/commands/ip_allowlist.py +115 -0
  37. cortexapps_cli-1.0.0/cortexapps_cli/commands/on_call.py +33 -0
  38. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages.py +72 -0
  39. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages_commands/go.py +37 -0
  40. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages_commands/java.py +51 -0
  41. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages_commands/node.py +65 -0
  42. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages_commands/nuget.py +50 -0
  43. cortexapps_cli-1.0.0/cortexapps_cli/commands/packages_commands/python.py +51 -0
  44. cortexapps_cli-1.0.0/cortexapps_cli/commands/plugins.py +153 -0
  45. cortexapps_cli-1.0.0/cortexapps_cli/commands/queries.py +64 -0
  46. cortexapps_cli-1.0.0/cortexapps_cli/commands/rest.py +137 -0
  47. cortexapps_cli-1.0.0/cortexapps_cli/commands/scim.py +77 -0
  48. cortexapps_cli-1.0.0/cortexapps_cli/commands/scorecards.py +192 -0
  49. cortexapps_cli-1.0.0/cortexapps_cli/commands/scorecards_commands/exemptions.py +94 -0
  50. cortexapps_cli-1.0.0/cortexapps_cli/commands/teams.py +210 -0
  51. cortexapps_cli-1.0.0/cortexapps_cli/commands/workflows.py +144 -0
  52. cortexapps_cli-1.0.0/cortexapps_cli/cortex_client.py +178 -0
  53. cortexapps_cli-1.0.0/cortexapps_cli/models/team.py +201 -0
  54. cortexapps_cli-1.0.0/cortexapps_cli/utils.py +202 -0
  55. {cortexapps_cli-0.27.0 → cortexapps_cli-1.0.0}/pyproject.toml +6 -3
  56. {cortexapps_cli-0.27.0 → cortexapps_cli-1.0.0}/LICENSE +0 -0
  57. {cortexapps_cli-0.27.0 → cortexapps_cli-1.0.0}/cortexapps_cli/cortex.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: cortexapps-cli
3
- Version: 0.27.0
3
+ Version: 1.0.0
4
4
  Summary: Command Line Interface for cortexapps
5
5
  License: MIT
6
6
  Author: Cortex Apps
@@ -12,8 +12,10 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Dist: click (<8.2)
15
16
  Requires-Dist: pyyaml (>=6.0.1,<7)
16
- Requires-Dist: requests (>=2.32.3,<3)
17
+ Requires-Dist: requests (>=2.32.4,<3.0.0)
18
+ Requires-Dist: typer (>=0.12.5,<0.13.0)
17
19
  Requires-Dist: urllib3 (>=2.2.2)
18
20
  Project-URL: Bug Tracker, https://github.com/cortexapps/cli/issues
19
21
  Project-URL: Changes, https://github.com/cortexapps/cli/blob/main/HISTORY.md
@@ -81,7 +83,7 @@ Config file
81
83
  ----------------------
82
84
 
83
85
  The CLI requires an API key for all operations. This key is stored in a config file whose default location is `~/.cortex/config`.
84
- This path can be overridden with the `-c` flag.
86
+ This path can be overridden with the `-c` flag. You will be prompted to create the file if it does not exist.
85
87
 
86
88
  Minimal contents of the file:
87
89
 
@@ -134,74 +136,10 @@ Example:
134
136
  Commands
135
137
  ----------------------
136
138
 
137
- Run :code:`cortex -h` to see a list of all commands:
138
-
139
- .. code-block:
140
-
141
- usage: cortex CLI [-h] [-a] [-c CONFIG] [-d] [-n] [-t] [-v]
142
- {audit-logs,backup,catalog,custom-data,custom-events,dependencies,deploys,discovery-audit,docs,groups,integrations,ip-allowlist,on-call,packages,plugins,queries,resource-definitions,scorecards,teams-hierarchies,teams}
143
- ...
144
-
145
- Cortex command line interface
146
-
147
- positional arguments:
148
- {audit-logs,backup,catalog,custom-data,custom-events,dependencies,deploys,discovery-audit,docs,groups,integrations,ip-allowlist,on-call,packages,plugins,queries,resource-definitions,scorecards,teams-hierarchies,teams}
149
- sub-command help
150
- audit-logs audit log commands
151
- backup import/export commands
152
- catalog catalog commands
153
- custom-data custom_data actions
154
- custom-events custom events actions
155
- dependencies dependencies commands
156
- deploys deploys commands
157
- discovery-audit Discovery Audit commands
158
- docs OpenAPI doc commands
159
- groups groups commands
160
- integrations integrations sub-commands
161
- ip-allowlist IP Allowlist information
162
- on-call get on-call information
163
- packages commands to create and modify packages
164
- plugins commands to create and access plugins
165
- queries run CQL queries
166
- resource-definitions
167
- resource definitions
168
- scorecards scorecards API requests
169
- teams-hierarchies commands to create and modify team hierarchies
170
- teams commands to create and modify teams
171
-
172
- options:
173
- -h, --help show this help message and exit
174
- -a , --cliAlias get CLI parms from [TENANT.aliases] in config file
175
- -c CONFIG, --config CONFIG
176
- Config location, default = ~/.cortex/config
177
- -d, --debug Writes request debug information as JSON to stderr
178
- -n, --noObfuscate Do not obfuscate bearer token when debugging
179
- -t , --tenant tenant name defined in ~/.cortex/config, defaults to 'default'
180
- -v, --version show program's version number and exit
181
-
182
- Type 'man cortex' for additional details.
183
-
139
+ Run :code:`cortex` to see a list of options and sub-commands.
184
140
 
185
141
  Run :code:`cortex <subcommand> -h` to see a list of all commands for each subcommand.
186
142
 
187
- For example:
188
-
189
- .. code:: bash
190
-
191
- cortex audit-logs -h
192
-
193
- .. code-block::
194
-
195
- usage: cortex CLI audit-logs [-h] {get} ...
196
-
197
- positional arguments:
198
- {get} audit logs help
199
- get retrieve audit logs
200
-
201
- options:
202
- -h, --help show this help message and exit
203
-
204
-
205
143
  ===================
206
144
  Examples
207
145
  ===================
@@ -234,21 +172,23 @@ Your cortex config file will require api keys for both tenants. It would look l
234
172
 
235
173
  .. code-block::
236
174
 
237
- Getting resource definitions
238
- --> my-resource-1
239
- Getting catalog entities
175
+ Getting catalog
240
176
  --> my-domain-1
241
177
  --> my-service-1
242
178
  --> my-service-2
243
- Getting IP Allowlist definitions
179
+ Getting entity-types
180
+ --> my-entity-type-1
181
+ Getting ip-allowlist
182
+ --> ip-allowlist
183
+ Getting plugins
184
+ --> my-plugin-1
244
185
  Getting scorecards
245
186
  --> my-scorecard-1
246
- Getting teams
247
- --> my-team-1
248
- --> my-team-2
187
+ Getting workflows
188
+ --> my-workflow-1
249
189
 
250
190
  Export complete!
251
- Contents available in /Users/myUser/.cortex/export/2023-11-19-14-58-14
191
+ Contents available in /Users/myUser/.cortex/export/2025-06-12-14-58-14
252
192
 
253
193
  **Import**
254
194
 
@@ -262,139 +202,23 @@ are automatically imported by Cortex. Cortex does not have access to any keys,
262
202
  integration configurations.
263
203
 
264
204
 
265
- ---------------------------------------------------------
266
- Export all services from one tenant; import into another
267
- ---------------------------------------------------------
268
-
269
- This example shows how to export services from a tenant named :code:`myTenant-dev` and import those services into a tenant
270
- named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
271
- exports/imports services.
272
-
273
- Your cortex config file will require api keys for both tenants. It would look like this:
274
-
275
- .. code-block::
276
-
277
- [myTenant]
278
- api_key = <your API Key for myTenant>
279
-
280
- [myTenant-dev]
281
- api_key = <your API Key for myTenant-dev>
282
-
283
-
284
- **Option 1: export service YAMLs to a directory and then import them**
285
-
286
- This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
287
- because you will have all YAMLs saved on disk.
288
-
289
- **Export**
290
-
291
- .. code:: bash
292
-
293
- mkdir -p /tmp/cortex-export
294
- cd /tmp/cortex-export
295
- for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
296
- do
297
- cortex -t myTenant catalog descriptor -y -t ${service} > ${service}.yaml
298
- done
299
-
300
- **Import**
301
-
302
- .. code:: bash
303
-
304
- cd /tmp/cortex-export
305
- for file in `ls -1 *.yaml`
306
- do
307
- cortex -t myTenant-dev catalog create -f ${file}
308
- done
309
-
310
- **Option 2: combine the export and import in a single command**
311
-
312
- This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
313
- entire export/import in its entirety.
314
-
315
- .. code:: bash
316
-
317
- for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
318
- do
319
- echo "Processing service: ${service}"
320
- cortex -t myTenant catalog descriptor -y -t ${service} | cortex -t myTenant-dev catalog create -f-
321
- done
322
-
323
- ---------------------------------------------------------
324
- Export all domains from one tenant; import into another
325
- ---------------------------------------------------------
326
-
327
- This example shows how to export domains from a tenant named :code:`myTenant-dev` and import those domains into a tenant
328
- named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
329
- exports/imports domains.
330
-
331
- Your cortex config file will require api keys for both tenants. It would look like this:
332
-
333
- .. code-block::
334
-
335
- [myTenant]
336
- api_key = <your API Key for myTenant>
337
-
338
- [myTenant-dev]
339
- api_key = <your API Key for myTenant-dev>
340
-
341
-
342
- **Option 1: export domain YAMLs to a directory and then import them**
343
-
344
- This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
345
- because you will have all YAMLs saved on disk.
346
-
347
- **Export**
348
-
349
- .. code:: bash
350
-
351
- mkdir -p /tmp/cortex-export
352
- cd /tmp/cortex-export
353
- for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
354
- do
355
- echo "creating ${domain}.yaml"
356
- cortex -t myTenant catalog descriptor -y -t ${domain} > ${domain}.yaml
357
- done
358
-
359
- **Import**
360
-
361
- .. code:: bash
362
-
363
- cd /tmp/cortex-export
364
- for file in `ls -1 *.yaml`
365
- do
366
- cortex -t myTenant-dev catalog create -f ${file}
367
- done
368
-
369
- **Option 2: combine the export and import in a single command**
370
-
371
- This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
372
- entire export/import in its entirety.
373
-
374
- .. code:: bash
375
-
376
- for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
377
- do
378
- echo "Processing domain: ${domain}"
379
- cortex -t myTenant catalog descriptor -y -t ${domain} | cortex -t myTenant-dev catalog create -f-
380
- done
381
-
382
-
383
205
  ------------------------
384
206
  Iterate over all domains
385
207
  ------------------------
386
208
 
387
209
  .. code:: bash
388
210
 
389
- for domain in `cortex catalog list -t domain | jq -r ".entities[].tag" | sort`; do echo "domain = $domain"; done
211
+ for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do echo "domain = $domain"; done
390
212
 
391
213
  ----------------------
392
214
  Iterate over all teams
393
215
  ----------------------
394
216
 
217
+ **NOTE:** as of June 2025, requires a feature flag enabled to return team entities in the catalog API. Work with your CSM if you need assistance.
218
+
395
219
  .. code:: bash
396
220
 
397
- for team in `cortex catalog list -t team | jq -r ".entities[].tag" | sort`; do echo "team = $team"; done
221
+ for team in `cortex catalog list -t team --csv -C tag --sort tag:asc`; do echo "team = $team"; done
398
222
 
399
223
  -------------------------
400
224
  Iterate over all services
@@ -402,7 +226,7 @@ Iterate over all services
402
226
 
403
227
  .. code:: bash
404
228
 
405
- for service in `cortex catalog list -t service | jq -r ".entities[].tag" | sort`; do echo "service = $service"; done
229
+ for service in `cortex catalog list -t service --csv -C tag --sort tag:asc`; do echo "service = $service"; done
406
230
 
407
231
  -----------------------------
408
232
  Get git details for a service
@@ -427,7 +251,7 @@ Add a suffix to all x-cortex-tag values for services
427
251
 
428
252
  .. code:: bash
429
253
 
430
- for service in `cortex catalog list -t service | jq -r ".entities[].tag" | sort`; do
254
+ for service in `cortex catalog list -t service --csv -C tag --sort tag:asc`; do
431
255
  cortex catalog descriptor -y -t ${service} | yq '.info.x-cortex-tag |= . + "-suffix"' | cortex catalog create -f-
432
256
  done
433
257
 
@@ -458,7 +282,7 @@ Remove a group from domains
458
282
 
459
283
  .. code:: bash
460
284
 
461
- for domain in `cortex catalog list -t domain -g my-old-group | jq -r ".entities[].tag" | sort`; do
285
+ for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do
462
286
  cortex catalog descriptor -y -t ${domain} | yq -e '.info.x-cortex-groups -= [ "my-old-group" ]' | cortex catalog create -f-
463
287
  done
464
288
 
@@ -484,7 +308,7 @@ Modify all github basepath values for domain entitities, changing '-' to '_'
484
308
 
485
309
  .. code:: bash
486
310
 
487
- for domain in `cortex catalog list -t domain | jq -r ".entities[].tag"`; do
311
+ for domain in `cortex catalog list -t domain --csv -C tag --sort tag:asc`; do
488
312
  cortex catalog descriptor -y -t ${domain} | yq ".info.x-cortex-git.github.basepath |= sub(\"-\", \"_\")" | cortex catalog create -f-
489
313
  done
490
314
 
@@ -511,7 +335,7 @@ Create a backup of all scorecards
511
335
 
512
336
  .. code:: bash
513
337
 
514
- for tag in `cortex scorecards list | jq -r ".scorecards[].tag"`
338
+ for tag in `cortex scorecards list --csv -C tag`
515
339
  do
516
340
  echo "backing up: ${tag}"
517
341
  cortex scorecards descriptor -t ${tag} > ${tag}.yaml
@@ -526,7 +350,7 @@ and it appends " Draft" to the end of the existing title.
526
350
 
527
351
  .. code:: bash
528
352
 
529
- for tag in `cortex scorecards list | jq -r ".scorecards[].tag"`
353
+ for tag in `cortex scorecards list --csv -C tag`
530
354
  do
531
355
  cortex scorecards descriptor -t ${tag} | yq '.draft = true | .tag += "-draft" | .name += " Draft"' | cortex scorecards create -f-
532
356
  done
@@ -540,7 +364,7 @@ which the drafts were created and delete the drafts.
540
364
 
541
365
  .. code:: bash
542
366
 
543
- for tag in `cortex scorecards list -s | jq -r ".scorecards[].tag" | grep "\-draft$"`
367
+ for tag in `cortex scorecards list --csv -C tag --filter tag=.*-draft`
544
368
  do
545
369
  cortex scorecards descriptor -t ${tag} | yq '.draft = false | .tag |= sub("-draft","") | .name |= sub(" Draft", "")' | cortex scorecards create -f- && cortex scorecards delete -t ${tag}
546
370
  done
@@ -553,7 +377,7 @@ This recipe is similar to the one above, but it does not create a new scorecard
553
377
 
554
378
  .. code:: bash
555
379
 
556
- for tag in `cortex scorecards list -s | jq -r ".scorecards[].tag" | grep "\-draft$"`
380
+ for tag in `cortex scorecards list --csv -C tag --filter tag=.*-draft`
557
381
  do
558
382
  cortex scorecards descriptor -t ${tag} | yq '.draft = false | .tag |= sub("-draft","") | .name |= sub(" Draft", "")' > ${tag}.yaml
559
383
  done
@@ -609,37 +433,6 @@ Run this command for two different scorecards and diff the csv files to compare
609
433
 
610
434
  sdiff -s /tmp/scorecard1.csv /tmp/scorecard2.csv
611
435
 
612
- -----------------------------------------------------------------------------
613
- Backup all Workday teams
614
- -----------------------------------------------------------------------------
615
-
616
- This recipe is helpful if you change your Workday report and want to save your existing teams in case you want to restore them.
617
-
618
- For each team it will create two files:
619
- - a JSON file that contains the Workday data
620
- - a Cortex team YAML file that refers to the Workday team
621
-
622
- .. code:: bash
623
-
624
- for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
625
- do
626
- cortex teams get -t ${team} > ${team}.json
627
- cortex catalog descriptor -y -t ${team} > ${team}.yaml
628
- done
629
-
630
- -----------------------------------------------------------------------------
631
- Delete all Workday teams
632
- -----------------------------------------------------------------------------
633
-
634
- This recipe is helpful if you want to remove all Workday teams and import from scratch.
635
-
636
- .. code:: bash
637
-
638
- for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
639
- do
640
- cortex teams delete -t ${team}
641
- done
642
-
643
436
  -----------------------------------------------------------------------------
644
437
  Add provider for all group type owners where provider is not listed
645
438
  -----------------------------------------------------------------------------