cortexapps-cli 0.24.2__tar.gz → 0.24.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cortexapps-cli
3
- Version: 0.24.2
3
+ Version: 0.24.3
4
4
  Summary: Command Line Interface for cortexapps
5
5
  License: MIT
6
6
  Author: Cortex Apps
@@ -251,6 +251,125 @@ Your cortex config file will require api keys for both tenants. It would look l
251
251
  are automatically imported by Cortex. Cortex does not have access to any keys, so it cannot export any
252
252
  integration configurations.
253
253
 
254
+
255
+ ---------------------------------------------------------
256
+ Export all services from one tenant; import into another
257
+ ---------------------------------------------------------
258
+
259
+ This example shows how to export services from a tenant named :code:`myTenant-dev` and import those services into a tenant
260
+ named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
261
+ exports/imports services.
262
+
263
+ Your cortex config file will require api keys for both tenants. It would look like this:
264
+
265
+ .. code-block::
266
+
267
+ [myTenant]
268
+ api_key = <your API Key for myTenant>
269
+
270
+ [myTenant-dev]
271
+ api_key = <your API Key for myTenant-dev>
272
+
273
+
274
+ **Option 1: export service YAMLs to a directory and then import them**
275
+
276
+ This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
277
+ because you will have all YAMLs saved on disk.
278
+
279
+ **Export**
280
+
281
+ .. code:: bash
282
+
283
+ mkdir -p /tmp/cortex-export
284
+ cd /tmp/cortex-export
285
+ for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
286
+ do
287
+ cortex -t myTenant catalog descriptor -y -t ${service} > ${service}.yaml
288
+ done
289
+
290
+ **Import**
291
+
292
+ .. code:: bash
293
+
294
+ cd /tmp/cortex-export
295
+ for file in `ls -1 *.yaml`
296
+ do
297
+ cortex -t myTenant-dev catalog create -f ${file}
298
+ done
299
+
300
+ **Option 2: combine the export and import in a single command**
301
+
302
+ This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
303
+ entire export/import in its entirety.
304
+
305
+ .. code:: bash
306
+
307
+ for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
308
+ do
309
+ echo "Processing service: ${service}"
310
+ cortex -t myTenant catalog descriptor -y -t ${service} | cortex -t myTenant-dev catalog create -f-
311
+ done
312
+
313
+ ---------------------------------------------------------
314
+ Export all domains from one tenant; import into another
315
+ ---------------------------------------------------------
316
+
317
+ This example shows how to export domains from a tenant named :code:`myTenant-dev` and import those domains into a tenant
318
+ named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
319
+ exports/imports domains.
320
+
321
+ Your cortex config file will require api keys for both tenants. It would look like this:
322
+
323
+ .. code-block::
324
+
325
+ [myTenant]
326
+ api_key = <your API Key for myTenant>
327
+
328
+ [myTenant-dev]
329
+ api_key = <your API Key for myTenant-dev>
330
+
331
+
332
+ **Option 1: export domain YAMLs to a directory and then import them**
333
+
334
+ This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
335
+ because you will have all YAMLs saved on disk.
336
+
337
+ **Export**
338
+
339
+ .. code:: bash
340
+
341
+ mkdir -p /tmp/cortex-export
342
+ cd /tmp/cortex-export
343
+ for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
344
+ do
345
+ echo "creating ${domain}.yaml"
346
+ cortex -t myTenant catalog descriptor -y -t ${domain} > ${domain}.yaml
347
+ done
348
+
349
+ **Import**
350
+
351
+ .. code:: bash
352
+
353
+ cd /tmp/cortex-export
354
+ for file in `ls -1 *.yaml`
355
+ do
356
+ cortex -t myTenant-dev catalog create -f ${file}
357
+ done
358
+
359
+ **Option 2: combine the export and import in a single command**
360
+
361
+ This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
362
+ entire export/import in its entirety.
363
+
364
+ .. code:: bash
365
+
366
+ for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
367
+ do
368
+ echo "Processing domain: ${domain}"
369
+ cortex -t myTenant catalog descriptor -y -t ${domain} | cortex -t myTenant-dev catalog create -f-
370
+ done
371
+
372
+
254
373
  ------------------------
255
374
  Iterate over all domains
256
375
  ------------------------
@@ -480,6 +599,24 @@ Run this command for two different scorecards and diff the csv files to compare
480
599
 
481
600
  sdiff -s /tmp/scorecard1.csv /tmp/scorecard2.csv
482
601
 
602
+ -----------------------------------------------------------------------------
603
+ Backup all Workday teams
604
+ -----------------------------------------------------------------------------
605
+
606
+ This recipe is helpful if you change your Workday report and want to save your existing teams in case you want to restore them.
607
+
608
+ For each team it will create two files:
609
+ - a JSON file that contains the Workday data
610
+ - a Cortex team YAML file that refers to the Workday team
611
+
612
+ .. code:: bash
613
+
614
+ for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
615
+ do
616
+ cortex teams get -t ${team} > ${team}.json
617
+ cortex catalog descriptor -y -t ${team} > ${team}.yaml
618
+ done
619
+
483
620
  -----------------------------------------------------------------------------
484
621
  Delete all Workday teams
485
622
  -----------------------------------------------------------------------------
@@ -490,7 +627,7 @@ This recipe is helpful if you want to remove all Workday teams and import from s
490
627
 
491
628
  for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
492
629
  do
493
- cortex team delete -t ${team}
630
+ cortex teams delete -t ${team}
494
631
  done
495
632
 
496
633
  ====================================
@@ -230,6 +230,125 @@ Your cortex config file will require api keys for both tenants. It would look l
230
230
  are automatically imported by Cortex. Cortex does not have access to any keys, so it cannot export any
231
231
  integration configurations.
232
232
 
233
+
234
+ ---------------------------------------------------------
235
+ Export all services from one tenant; import into another
236
+ ---------------------------------------------------------
237
+
238
+ This example shows how to export services from a tenant named :code:`myTenant-dev` and import those services into a tenant
239
+ named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
240
+ exports/imports services.
241
+
242
+ Your cortex config file will require api keys for both tenants. It would look like this:
243
+
244
+ .. code-block::
245
+
246
+ [myTenant]
247
+ api_key = <your API Key for myTenant>
248
+
249
+ [myTenant-dev]
250
+ api_key = <your API Key for myTenant-dev>
251
+
252
+
253
+ **Option 1: export service YAMLs to a directory and then import them**
254
+
255
+ This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
256
+ because you will have all YAMLs saved on disk.
257
+
258
+ **Export**
259
+
260
+ .. code:: bash
261
+
262
+ mkdir -p /tmp/cortex-export
263
+ cd /tmp/cortex-export
264
+ for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
265
+ do
266
+ cortex -t myTenant catalog descriptor -y -t ${service} > ${service}.yaml
267
+ done
268
+
269
+ **Import**
270
+
271
+ .. code:: bash
272
+
273
+ cd /tmp/cortex-export
274
+ for file in `ls -1 *.yaml`
275
+ do
276
+ cortex -t myTenant-dev catalog create -f ${file}
277
+ done
278
+
279
+ **Option 2: combine the export and import in a single command**
280
+
281
+ This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
282
+ entire export/import in its entirety.
283
+
284
+ .. code:: bash
285
+
286
+ for service in `cortex -t myTenant catalog list -t service | jq -r ".entities[].tag" | sort`
287
+ do
288
+ echo "Processing service: ${service}"
289
+ cortex -t myTenant catalog descriptor -y -t ${service} | cortex -t myTenant-dev catalog create -f-
290
+ done
291
+
292
+ ---------------------------------------------------------
293
+ Export all domains from one tenant; import into another
294
+ ---------------------------------------------------------
295
+
296
+ This example shows how to export domains from a tenant named :code:`myTenant-dev` and import those domains into a tenant
297
+ named :code:`myTenant`. It is similar to the full export example "`Export from one tenant; import into another`_", but only
298
+ exports/imports domains.
299
+
300
+ Your cortex config file will require api keys for both tenants. It would look like this:
301
+
302
+ .. code-block::
303
+
304
+ [myTenant]
305
+ api_key = <your API Key for myTenant>
306
+
307
+ [myTenant-dev]
308
+ api_key = <your API Key for myTenant-dev>
309
+
310
+
311
+ **Option 1: export domain YAMLs to a directory and then import them**
312
+
313
+ This option is helpful in case you want to save the entity YAML files. It makes it easy to restart or retry an import
314
+ because you will have all YAMLs saved on disk.
315
+
316
+ **Export**
317
+
318
+ .. code:: bash
319
+
320
+ mkdir -p /tmp/cortex-export
321
+ cd /tmp/cortex-export
322
+ for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
323
+ do
324
+ echo "creating ${domain}.yaml"
325
+ cortex -t myTenant catalog descriptor -y -t ${domain} > ${domain}.yaml
326
+ done
327
+
328
+ **Import**
329
+
330
+ .. code:: bash
331
+
332
+ cd /tmp/cortex-export
333
+ for file in `ls -1 *.yaml`
334
+ do
335
+ cortex -t myTenant-dev catalog create -f ${file}
336
+ done
337
+
338
+ **Option 2: combine the export and import in a single command**
339
+
340
+ This option is simpler and doesn't require any disk operations. However, if it fails for any reason you have to run the
341
+ entire export/import in its entirety.
342
+
343
+ .. code:: bash
344
+
345
+ for domain in `cortex -t myTenant catalog list -t domain | jq -r ".entities[].tag" | sort`
346
+ do
347
+ echo "Processing domain: ${domain}"
348
+ cortex -t myTenant catalog descriptor -y -t ${domain} | cortex -t myTenant-dev catalog create -f-
349
+ done
350
+
351
+
233
352
  ------------------------
234
353
  Iterate over all domains
235
354
  ------------------------
@@ -459,6 +578,24 @@ Run this command for two different scorecards and diff the csv files to compare
459
578
 
460
579
  sdiff -s /tmp/scorecard1.csv /tmp/scorecard2.csv
461
580
 
581
+ -----------------------------------------------------------------------------
582
+ Backup all Workday teams
583
+ -----------------------------------------------------------------------------
584
+
585
+ This recipe is helpful if you change your Workday report and want to save your existing teams in case you want to restore them.
586
+
587
+ For each team it will create two files:
588
+ - a JSON file that contains the Workday data
589
+ - a Cortex team YAML file that refers to the Workday team
590
+
591
+ .. code:: bash
592
+
593
+ for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
594
+ do
595
+ cortex teams get -t ${team} > ${team}.json
596
+ cortex catalog descriptor -y -t ${team} > ${team}.yaml
597
+ done
598
+
462
599
  -----------------------------------------------------------------------------
463
600
  Delete all Workday teams
464
601
  -----------------------------------------------------------------------------
@@ -469,7 +606,7 @@ This recipe is helpful if you want to remove all Workday teams and import from s
469
606
 
470
607
  for team in `cortex teams list | jq -r '.teams[] | select (.type == "IDP") | select (.idpGroup.provider == "WORKDAY") | .teamTag'`
471
608
  do
472
- cortex team delete -t ${team}
609
+ cortex teams delete -t ${team}
473
610
  done
474
611
 
475
612
  ====================================
@@ -107,7 +107,8 @@ def check_config_file(config_file, replace_string):
107
107
  def get_config(config, args, argv, parser, replace_string):
108
108
  if os.environ.get('CORTEX_API_KEY'):
109
109
  if args.tenant:
110
- print("WARNING: tenant setting overidden by CORTEX_API_KEY", file=sys.stderr)
110
+ if not args.quiet:
111
+ print("WARNING: tenant setting overidden by CORTEX_API_KEY", file=sys.stderr)
111
112
 
112
113
  cortex_base_url = os.environ.get('CORTEX_BASE_URL', default='https://api.getcortexapp.com')
113
114
  config.update({"url": cortex_base_url})
@@ -3167,7 +3168,7 @@ def subparser_ip_allowlist_validate(subparser):
3167
3168
  }
3168
3169
  '''))
3169
3170
  add_argument_file(sp, 'file containing JSON-formatted content of IP allowlist entries')
3170
- sp.set_defaults(func=ip_allowlist_get)
3171
+ sp.set_defaults(func=ip_allowlist_validate)
3171
3172
 
3172
3173
  def ip_allowlist_validate(args):
3173
3174
  headers = default_headers()
@@ -3954,6 +3955,7 @@ def cli(argv=sys.argv[1:]):
3954
3955
  parser.add_argument('-c', '--config', help='Config location, default = ~/.cortex/config', default=os.path.expanduser('~') + '/.cortex/config')
3955
3956
  parser.add_argument('-d', '--debug', help='Writes request debug information as JSON to stderr', action='store_true')
3956
3957
  parser.add_argument('-n', '--noObfuscate', help='Do not obfuscate bearer token when debugging', action='store_true')
3958
+ parser.add_argument('-q', '--quiet', help='Suppress warning messages when overriding tenant settings with environment variables', action='store_true')
3957
3959
  parser.add_argument('-t', '--tenant', default='default', help='tenant name defined in ~/.cortex/config, defaults to \'default\'',metavar='')
3958
3960
  parser.add_argument('-v', '--version', action='version', version=version())
3959
3961
  sp = parser.add_subparsers(help='sub-command help')
@@ -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 = "0.24.2"
4
+ version = "0.24.3"
5
5
  description = "Command Line Interface for cortexapps"
6
6
  license = "MIT"
7
7
  authors = [
File without changes