opal-security 3.0.0 → 3.0.1-beta.cbf0332
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.
- package/README.md +59 -44
- package/bin/run +1 -1
- package/lib/commands/aws/identity.d.ts +1 -1
- package/lib/commands/aws/identity.js +2 -2
- package/lib/commands/clear-auth-provider.d.ts +1 -1
- package/lib/commands/clear-auth-provider.js +3 -3
- package/lib/commands/curl-example.d.ts +1 -1
- package/lib/commands/curl-example.js +2 -2
- package/lib/commands/iam-roles/start.d.ts +1 -1
- package/lib/commands/iam-roles/start.js +14 -14
- package/lib/commands/kube-roles/start.d.ts +1 -1
- package/lib/commands/kube-roles/start.js +10 -10
- package/lib/commands/login.d.ts +1 -1
- package/lib/commands/login.js +71 -63
- package/lib/commands/logout.d.ts +1 -1
- package/lib/commands/logout.js +3 -3
- package/lib/commands/postgres-instances/start.d.ts +1 -1
- package/lib/commands/postgres-instances/start.js +35 -34
- package/lib/commands/request/create.d.ts +6 -0
- package/lib/commands/request/create.js +34 -0
- package/lib/commands/request/get.d.ts +6 -0
- package/lib/commands/request/get.js +13 -0
- package/lib/commands/request/list.d.ts +7 -0
- package/lib/commands/request/list.js +14 -0
- package/lib/commands/resources/get.d.ts +1 -1
- package/lib/commands/resources/get.js +6 -4
- package/lib/commands/set-auth-provider.d.ts +1 -1
- package/lib/commands/set-auth-provider.js +6 -4
- package/lib/commands/set-custom-header.d.ts +1 -1
- package/lib/commands/set-custom-header.js +5 -3
- package/lib/commands/set-token.d.ts +1 -1
- package/lib/commands/set-token.js +26 -19
- package/lib/commands/set-url.d.ts +1 -1
- package/lib/commands/set-url.js +13 -12
- package/lib/commands/ssh/copyFrom.d.ts +1 -1
- package/lib/commands/ssh/copyFrom.js +13 -13
- package/lib/commands/ssh/copyTo.d.ts +1 -1
- package/lib/commands/ssh/copyTo.js +13 -13
- package/lib/commands/ssh/start.d.ts +1 -1
- package/lib/commands/ssh/start.js +14 -15
- package/lib/graphql/fragment-masking.d.ts +19 -0
- package/lib/graphql/fragment-masking.js +21 -0
- package/lib/graphql/gql.d.ts +36 -0
- package/lib/graphql/gql.js +12 -0
- package/lib/graphql/graphql.d.ts +11413 -0
- package/lib/graphql/graphql.js +1491 -0
- package/lib/graphql/index.d.ts +2 -0
- package/lib/graphql/index.js +5 -0
- package/lib/handler.d.ts +5 -5
- package/lib/handler.js +7 -7
- package/lib/index.d.ts +1 -1
- package/lib/lib/apollo.d.ts +3 -2
- package/lib/lib/apollo.js +59 -46
- package/lib/lib/aws.js +15 -12
- package/lib/lib/cmd.d.ts +4 -6
- package/lib/lib/cmd.js +11 -11
- package/lib/lib/config.js +14 -14
- package/lib/lib/credentials/index.d.ts +1 -1
- package/lib/lib/credentials/index.js +6 -6
- package/lib/lib/credentials/keychain.js +5 -5
- package/lib/lib/credentials/localEncryption.d.ts +2 -2
- package/lib/lib/credentials/localEncryption.js +33 -24
- package/lib/lib/flags.js +9 -9
- package/lib/lib/requests.d.ts +19 -0
- package/lib/lib/requests.js +118 -0
- package/lib/lib/resources.d.ts +2 -2
- package/lib/lib/resources.js +29 -23
- package/lib/lib/sessions.d.ts +2 -2
- package/lib/lib/sessions.js +18 -17
- package/lib/lib/ssh.d.ts +1 -1
- package/lib/lib/ssh.js +8 -8
- package/lib/lib/util.d.ts +0 -1
- package/lib/lib/util.js +13 -13
- package/lib/types.d.ts +1787 -1787
- package/lib/utils/displays.d.ts +4 -0
- package/lib/utils/displays.js +60 -0
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +18 -0
- package/oclif.manifest.json +70 -3
- package/package.json +25 -29
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ npm install -g opal-security
|
|
|
22
22
|
$ opal COMMAND
|
|
23
23
|
running command...
|
|
24
24
|
$ opal (--version)
|
|
25
|
-
opal-security/3.0.
|
|
25
|
+
opal-security/3.0.1-beta.cbf0332 linux-x64 node-v20.19.0
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -34,23 +34,24 @@ USAGE
|
|
|
34
34
|
|
|
35
35
|
<!-- commands -->
|
|
36
36
|
* [`opal autocomplete [SHELL]`](#opal-autocomplete-shell)
|
|
37
|
-
* [`opal aws
|
|
37
|
+
* [`opal aws identity`](#opal-aws-identity)
|
|
38
38
|
* [`opal clear-auth-provider`](#opal-clear-auth-provider)
|
|
39
39
|
* [`opal curl-example`](#opal-curl-example)
|
|
40
40
|
* [`opal help [COMMANDS]`](#opal-help-commands)
|
|
41
|
-
* [`opal iam-roles
|
|
42
|
-
* [`opal kube-roles
|
|
41
|
+
* [`opal iam-roles start`](#opal-iam-roles-start)
|
|
42
|
+
* [`opal kube-roles start`](#opal-kube-roles-start)
|
|
43
43
|
* [`opal login`](#opal-login)
|
|
44
44
|
* [`opal logout`](#opal-logout)
|
|
45
|
-
* [`opal postgres-instances
|
|
46
|
-
* [`opal
|
|
45
|
+
* [`opal postgres-instances start`](#opal-postgres-instances-start)
|
|
46
|
+
* [`opal request ls`](#opal-request-ls)
|
|
47
|
+
* [`opal resources get`](#opal-resources-get)
|
|
47
48
|
* [`opal set-auth-provider`](#opal-set-auth-provider)
|
|
48
49
|
* [`opal set-custom-header`](#opal-set-custom-header)
|
|
49
50
|
* [`opal set-token`](#opal-set-token)
|
|
50
51
|
* [`opal set-url [URL]`](#opal-set-url-url)
|
|
51
|
-
* [`opal ssh
|
|
52
|
-
* [`opal ssh
|
|
53
|
-
* [`opal ssh
|
|
52
|
+
* [`opal ssh copyFrom`](#opal-ssh-copyfrom)
|
|
53
|
+
* [`opal ssh copyTo`](#opal-ssh-copyto)
|
|
54
|
+
* [`opal ssh start`](#opal-ssh-start)
|
|
54
55
|
* [`opal version`](#opal-version)
|
|
55
56
|
|
|
56
57
|
## `opal autocomplete [SHELL]`
|
|
@@ -82,13 +83,13 @@ EXAMPLES
|
|
|
82
83
|
|
|
83
84
|
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.4.6/src/commands/autocomplete/index.ts)_
|
|
84
85
|
|
|
85
|
-
## `opal aws
|
|
86
|
+
## `opal aws identity`
|
|
86
87
|
|
|
87
88
|
Gets the current caller identity for the "opal" AWS profile.
|
|
88
89
|
|
|
89
90
|
```
|
|
90
91
|
USAGE
|
|
91
|
-
$ opal aws
|
|
92
|
+
$ opal aws identity [-h]
|
|
92
93
|
|
|
93
94
|
FLAGS
|
|
94
95
|
-h, --help Show CLI help.
|
|
@@ -100,7 +101,7 @@ EXAMPLES
|
|
|
100
101
|
$ opal aws:identity
|
|
101
102
|
```
|
|
102
103
|
|
|
103
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
104
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/aws/identity.ts)_
|
|
104
105
|
|
|
105
106
|
## `opal clear-auth-provider`
|
|
106
107
|
|
|
@@ -120,7 +121,7 @@ EXAMPLES
|
|
|
120
121
|
$ opal clear-auth-provider
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
124
|
+
_See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/clear-auth-provider.ts)_
|
|
124
125
|
|
|
125
126
|
## `opal curl-example`
|
|
126
127
|
|
|
@@ -137,7 +138,7 @@ DESCRIPTION
|
|
|
137
138
|
Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
|
|
138
139
|
```
|
|
139
140
|
|
|
140
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
141
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/curl-example.ts)_
|
|
141
142
|
|
|
142
143
|
## `opal help [COMMANDS]`
|
|
143
144
|
|
|
@@ -159,13 +160,13 @@ DESCRIPTION
|
|
|
159
160
|
|
|
160
161
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.20/src/commands/help.ts)_
|
|
161
162
|
|
|
162
|
-
## `opal iam-roles
|
|
163
|
+
## `opal iam-roles start`
|
|
163
164
|
|
|
164
165
|
Starts a session to assume an IAM role.
|
|
165
166
|
|
|
166
167
|
```
|
|
167
168
|
USAGE
|
|
168
|
-
$ opal iam-roles
|
|
169
|
+
$ opal iam-roles start [-h] [-i <value>] [-s <value>] [-r] [--profileName <value>]
|
|
169
170
|
|
|
170
171
|
FLAGS
|
|
171
172
|
-h, --help Show CLI help.
|
|
@@ -187,15 +188,15 @@ EXAMPLES
|
|
|
187
188
|
$ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
188
189
|
```
|
|
189
190
|
|
|
190
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
191
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/iam-roles/start.ts)_
|
|
191
192
|
|
|
192
|
-
## `opal kube-roles
|
|
193
|
+
## `opal kube-roles start`
|
|
193
194
|
|
|
194
195
|
Starts a session to assume a Kubernetes cluster IAM role.
|
|
195
196
|
|
|
196
197
|
```
|
|
197
198
|
USAGE
|
|
198
|
-
$ opal kube-roles
|
|
199
|
+
$ opal kube-roles start [-h] [-i <value>] [-a <value>] [-s <value>] [-r]
|
|
199
200
|
|
|
200
201
|
FLAGS
|
|
201
202
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
@@ -218,7 +219,7 @@ EXAMPLES
|
|
|
218
219
|
$ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
219
220
|
```
|
|
220
221
|
|
|
221
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
222
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/kube-roles/start.ts)_
|
|
222
223
|
|
|
223
224
|
## `opal login`
|
|
224
225
|
|
|
@@ -239,7 +240,7 @@ EXAMPLES
|
|
|
239
240
|
$ opal login
|
|
240
241
|
```
|
|
241
242
|
|
|
242
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
243
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/login.ts)_
|
|
243
244
|
|
|
244
245
|
## `opal logout`
|
|
245
246
|
|
|
@@ -259,15 +260,15 @@ EXAMPLES
|
|
|
259
260
|
$ opal logout
|
|
260
261
|
```
|
|
261
262
|
|
|
262
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
263
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/logout.ts)_
|
|
263
264
|
|
|
264
|
-
## `opal postgres-instances
|
|
265
|
+
## `opal postgres-instances start`
|
|
265
266
|
|
|
266
267
|
Starts a session to connect to a Postgres database.
|
|
267
268
|
|
|
268
269
|
```
|
|
269
270
|
USAGE
|
|
270
|
-
$ opal postgres-instances
|
|
271
|
+
$ opal postgres-instances start [-h] [-i <value>] [-a <value>] [-s <value>] [-r] [--action psql|view]
|
|
271
272
|
|
|
272
273
|
FLAGS
|
|
273
274
|
-a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
|
|
@@ -279,10 +280,9 @@ FLAGS
|
|
|
279
280
|
-s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created
|
|
280
281
|
via the web flow.
|
|
281
282
|
--action=<option> Method of connecting to the database.
|
|
282
|
-
- open: Open external database app
|
|
283
283
|
- psql: Start psql session in shell
|
|
284
284
|
- view: View connection configuration details
|
|
285
|
-
<options:
|
|
285
|
+
<options: psql|view>
|
|
286
286
|
|
|
287
287
|
DESCRIPTION
|
|
288
288
|
Starts a session to connect to a Postgres database.
|
|
@@ -297,15 +297,30 @@ EXAMPLES
|
|
|
297
297
|
$ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
300
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/postgres-instances/start.ts)_
|
|
301
301
|
|
|
302
|
-
## `opal
|
|
302
|
+
## `opal request ls`
|
|
303
|
+
|
|
304
|
+
Lists access requests
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
USAGE
|
|
308
|
+
$ opal request ls
|
|
309
|
+
|
|
310
|
+
DESCRIPTION
|
|
311
|
+
Lists access requests
|
|
312
|
+
|
|
313
|
+
ALIASES
|
|
314
|
+
$ opal request ls
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## `opal resources get`
|
|
303
318
|
|
|
304
319
|
Get resource info for a particular resource.
|
|
305
320
|
|
|
306
321
|
```
|
|
307
322
|
USAGE
|
|
308
|
-
$ opal resources
|
|
323
|
+
$ opal resources get [-h] [-i <value>]
|
|
309
324
|
|
|
310
325
|
FLAGS
|
|
311
326
|
-h, --help Show CLI help.
|
|
@@ -318,7 +333,7 @@ EXAMPLES
|
|
|
318
333
|
$ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
319
334
|
```
|
|
320
335
|
|
|
321
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
336
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/resources/get.ts)_
|
|
322
337
|
|
|
323
338
|
## `opal set-auth-provider`
|
|
324
339
|
|
|
@@ -344,7 +359,7 @@ EXAMPLES
|
|
|
344
359
|
$ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
|
|
345
360
|
```
|
|
346
361
|
|
|
347
|
-
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
362
|
+
_See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/set-auth-provider.ts)_
|
|
348
363
|
|
|
349
364
|
## `opal set-custom-header`
|
|
350
365
|
|
|
@@ -365,7 +380,7 @@ EXAMPLES
|
|
|
365
380
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
366
381
|
```
|
|
367
382
|
|
|
368
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
383
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/set-custom-header.ts)_
|
|
369
384
|
|
|
370
385
|
## `opal set-token`
|
|
371
386
|
|
|
@@ -385,7 +400,7 @@ EXAMPLES
|
|
|
385
400
|
$ opal set-token
|
|
386
401
|
```
|
|
387
402
|
|
|
388
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
403
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/set-token.ts)_
|
|
389
404
|
|
|
390
405
|
## `opal set-url [URL]`
|
|
391
406
|
|
|
@@ -409,15 +424,15 @@ EXAMPLES
|
|
|
409
424
|
$ opal set-url
|
|
410
425
|
```
|
|
411
426
|
|
|
412
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
427
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/set-url.ts)_
|
|
413
428
|
|
|
414
|
-
## `opal ssh
|
|
429
|
+
## `opal ssh copyFrom`
|
|
415
430
|
|
|
416
431
|
Use SCP to copy files from a compute instance.
|
|
417
432
|
|
|
418
433
|
```
|
|
419
434
|
USAGE
|
|
420
|
-
$ opal ssh
|
|
435
|
+
$ opal ssh copyFrom --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>] [-s <value>]
|
|
421
436
|
|
|
422
437
|
FLAGS
|
|
423
438
|
-h, --help Show CLI help.
|
|
@@ -440,15 +455,15 @@ EXAMPLES
|
|
|
440
455
|
$ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
441
456
|
```
|
|
442
457
|
|
|
443
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
458
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/ssh/copyFrom.ts)_
|
|
444
459
|
|
|
445
|
-
## `opal ssh
|
|
460
|
+
## `opal ssh copyTo`
|
|
446
461
|
|
|
447
462
|
Use SCP to copy files to a compute instance.
|
|
448
463
|
|
|
449
464
|
```
|
|
450
465
|
USAGE
|
|
451
|
-
$ opal ssh
|
|
466
|
+
$ opal ssh copyTo --src <value> [-h] [--dest <value>] [--user <value>] [-i <value>] [-s <value>]
|
|
452
467
|
|
|
453
468
|
FLAGS
|
|
454
469
|
-h, --help Show CLI help.
|
|
@@ -471,15 +486,15 @@ EXAMPLES
|
|
|
471
486
|
$ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
472
487
|
```
|
|
473
488
|
|
|
474
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
489
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/ssh/copyTo.ts)_
|
|
475
490
|
|
|
476
|
-
## `opal ssh
|
|
491
|
+
## `opal ssh start`
|
|
477
492
|
|
|
478
493
|
Starts an SSH session to access a compute instance.
|
|
479
494
|
|
|
480
495
|
```
|
|
481
496
|
USAGE
|
|
482
|
-
$ opal ssh
|
|
497
|
+
$ opal ssh start [-h] [-i <value>] [-s <value>] [-r]
|
|
483
498
|
|
|
484
499
|
FLAGS
|
|
485
500
|
-h, --help Show CLI help.
|
|
@@ -498,7 +513,7 @@ EXAMPLES
|
|
|
498
513
|
$ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
499
514
|
```
|
|
500
515
|
|
|
501
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.
|
|
516
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.cbf0332/src/commands/ssh/start.ts)_
|
|
502
517
|
|
|
503
518
|
## `opal version`
|
|
504
519
|
|
|
@@ -518,5 +533,5 @@ FLAG DESCRIPTIONS
|
|
|
518
533
|
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
519
534
|
```
|
|
520
535
|
|
|
521
|
-
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.
|
|
536
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
|
|
522
537
|
<!-- commandsstop -->
|
package/bin/run
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const engineMajorVersion = parseInt(process.version.slice(1).split('.'));
|
|
3
|
+
const engineMajorVersion = Number.parseInt(process.version.slice(1).split('.'));
|
|
4
4
|
if (engineMajorVersion < 18) {
|
|
5
5
|
console.log("Opal CLI requires Node v18.0.0 or later to run.")
|
|
6
6
|
process.exit(1)
|
|
@@ -6,12 +6,12 @@ const flags_1 = require("../../lib/flags");
|
|
|
6
6
|
class Identity extends core_1.Command {
|
|
7
7
|
async run() {
|
|
8
8
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
9
|
-
const currentCallerIdentityCmd =
|
|
9
|
+
const currentCallerIdentityCmd = "aws sts get-caller-identity --profile opal";
|
|
10
10
|
(0, cmd_1.runCommandExec)(currentCallerIdentityCmd, 'This is the current caller identity for the "opal" AWS profile.', 'Failed to get the current caller identity for the "opal" AWS profile.');
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
Identity.description = 'Gets the current caller identity for the "opal" AWS profile.';
|
|
14
|
-
Identity.examples = [
|
|
14
|
+
Identity.examples = ["opal aws:identity"];
|
|
15
15
|
Identity.flags = {
|
|
16
16
|
help: flags_1.SHARED_FLAGS.help,
|
|
17
17
|
};
|
|
@@ -13,15 +13,15 @@ class ClearAuthProvider extends core_1.Command {
|
|
|
13
13
|
configData.clientID = null;
|
|
14
14
|
(0, config_1.writeConfigData)(this.config.configDir, configData);
|
|
15
15
|
await (0, credentials_1.removeOpalCredentials)(this);
|
|
16
|
-
this.log(
|
|
16
|
+
this.log("Client ID and Issuer URL reset to defaults");
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
19
|
this.error(error);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
ClearAuthProvider.description =
|
|
24
|
-
ClearAuthProvider.examples = [
|
|
23
|
+
ClearAuthProvider.description = "Clears the custom Issuer URL and Client ID set by set-airgap-auth, returning to the default.";
|
|
24
|
+
ClearAuthProvider.examples = ["$ opal clear-auth-provider"];
|
|
25
25
|
ClearAuthProvider.flags = {
|
|
26
26
|
help: flags_1.SHARED_FLAGS.help,
|
|
27
27
|
};
|
|
@@ -11,7 +11,7 @@ class CurlExample extends core_1.Command {
|
|
|
11
11
|
const organizationID = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationID;
|
|
12
12
|
const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
|
|
13
13
|
const url = configData[config_1.urlKey];
|
|
14
|
-
let authStr =
|
|
14
|
+
let authStr = "";
|
|
15
15
|
if (opalCreds.secretType === credentials_1.SecretType.ApiToken) {
|
|
16
16
|
authStr = `Authorization: Bearer ${secret}`;
|
|
17
17
|
}
|
|
@@ -27,7 +27,7 @@ curl -v ${url}/query \\
|
|
|
27
27
|
`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
CurlExample.description =
|
|
30
|
+
CurlExample.description = "Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.";
|
|
31
31
|
CurlExample.flags = {
|
|
32
32
|
help: flags_1.SHARED_FLAGS.help,
|
|
33
33
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const get_1 = require("../../commands/resources/get");
|
|
4
5
|
const handler_1 = require("../../handler");
|
|
5
|
-
const cmd_1 = require("../../lib/cmd");
|
|
6
6
|
const apollo_1 = require("../../lib/apollo");
|
|
7
7
|
const aws_1 = require("../../lib/aws");
|
|
8
|
+
const cmd_1 = require("../../lib/cmd");
|
|
9
|
+
const flags_1 = require("../../lib/flags");
|
|
8
10
|
const resources_1 = require("../../lib/resources");
|
|
9
|
-
const get_1 = require("../../commands/resources/get");
|
|
10
11
|
const sessions_1 = require("../../lib/sessions");
|
|
11
|
-
const flags_1 = require("../../lib/flags");
|
|
12
12
|
const IamSessionMetadataFragment = `
|
|
13
13
|
... on AwsIamFederatedRoleSession {
|
|
14
14
|
awsAccessKeyId
|
|
@@ -22,13 +22,13 @@ class StartIAMRoleSession extends core_1.Command {
|
|
|
22
22
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
23
23
|
const { flags } = await this.parse(StartIAMRoleSession);
|
|
24
24
|
if (flags.sessionId && flags.refresh) {
|
|
25
|
-
return (0, apollo_1.handleError)(this,
|
|
25
|
+
return (0, apollo_1.handleError)(this, "Cannot use both --sessionId and --refresh");
|
|
26
26
|
}
|
|
27
27
|
let roleId = flags.id;
|
|
28
28
|
let roleName = null;
|
|
29
29
|
const sessionId = flags.sessionId;
|
|
30
30
|
if (!roleId) {
|
|
31
|
-
const selectedRole = await (0, resources_1.promptUserForResource)(this,
|
|
31
|
+
const selectedRole = await (0, resources_1.promptUserForResource)(this, "AWS_IAM_ROLE", "Select an IAM role to assume");
|
|
32
32
|
if (!selectedRole) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ class StartIAMRoleSession extends core_1.Command {
|
|
|
36
36
|
roleName = selectedRole.name;
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
const { resp, error } = await (0, handler_1.
|
|
39
|
+
const { resp, error } = await (0, handler_1.runQueryDeprecated)({
|
|
40
40
|
command: this,
|
|
41
41
|
query: get_1.GetResourceDocument,
|
|
42
42
|
variables: {
|
|
@@ -49,9 +49,9 @@ class StartIAMRoleSession extends core_1.Command {
|
|
|
49
49
|
if (!(resp === null || resp === void 0 ? void 0 : resp.data.resource.resource)) {
|
|
50
50
|
return (0, apollo_1.handleError)(this, `Resource not found for ID: ${roleId}`);
|
|
51
51
|
}
|
|
52
|
-
roleName = (resp === null || resp === void 0 ? void 0 : resp.data.resource.resource.name) ||
|
|
52
|
+
roleName = (resp === null || resp === void 0 ? void 0 : resp.data.resource.resource.name) || "iam-role";
|
|
53
53
|
}
|
|
54
|
-
if (flags.profileName && flags.profileName !==
|
|
54
|
+
if (flags.profileName && flags.profileName !== "") {
|
|
55
55
|
roleName = flags.profileName;
|
|
56
56
|
}
|
|
57
57
|
const session = await (0, sessions_1.getOrCreateSession)(this, roleId, resources_1.DEFAULT_ACCESS_LEVEL, sessionId, IamSessionMetadataFragment, flags.refresh);
|
|
@@ -60,10 +60,10 @@ class StartIAMRoleSession extends core_1.Command {
|
|
|
60
60
|
}
|
|
61
61
|
const metadata = session.metadata;
|
|
62
62
|
switch (metadata === null || metadata === void 0 ? void 0 : metadata.__typename) {
|
|
63
|
-
case
|
|
63
|
+
case "AwsIamFederatedRoleSession": {
|
|
64
64
|
const updateAwsConfigCommand = (0, aws_1.getAwsConfigUpdateCmd)(roleName, metadata.awsAccessKeyId, metadata.awsSecretAccessKey, metadata.awsSessionToken);
|
|
65
65
|
const startSessionCmd = `${updateAwsConfigCommand}`;
|
|
66
|
-
const roleText = roleName ? `"${roleName}" role` :
|
|
66
|
+
const roleText = roleName ? `"${roleName}" role` : "role";
|
|
67
67
|
const expirationMessage = (0, sessions_1.getSessionExpirationMessage)(session);
|
|
68
68
|
(0, cmd_1.runCommandExec)(startSessionCmd, `Now set to use ${roleText}. (session expires in ${expirationMessage})${(0, aws_1.getAwsEnvVarMessage)()}`, `Failed to use ${roleText}.`);
|
|
69
69
|
break;
|
|
@@ -73,10 +73,10 @@ class StartIAMRoleSession extends core_1.Command {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
StartIAMRoleSession.description =
|
|
76
|
+
StartIAMRoleSession.description = "Starts a session to assume an IAM role.";
|
|
77
77
|
StartIAMRoleSession.examples = [
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
"opal iam-roles:start",
|
|
79
|
+
"opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
|
|
80
80
|
'opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"',
|
|
81
81
|
];
|
|
82
82
|
StartIAMRoleSession.flags = {
|
|
@@ -86,7 +86,7 @@ StartIAMRoleSession.flags = {
|
|
|
86
86
|
refresh: flags_1.SHARED_FLAGS.refresh,
|
|
87
87
|
profileName: core_1.Flags.string({
|
|
88
88
|
multiple: false,
|
|
89
|
-
description:
|
|
89
|
+
description: "Uses a custom AWS profile name for the IAM role. Default value is the role's name.",
|
|
90
90
|
}),
|
|
91
91
|
};
|
|
92
92
|
exports.default = StartIAMRoleSession;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const cmd_1 = require("../../lib/cmd");
|
|
5
4
|
const apollo_1 = require("../../lib/apollo");
|
|
6
5
|
const aws_1 = require("../../lib/aws");
|
|
6
|
+
const cmd_1 = require("../../lib/cmd");
|
|
7
|
+
const flags_1 = require("../../lib/flags");
|
|
7
8
|
const resources_1 = require("../../lib/resources");
|
|
8
9
|
const sessions_1 = require("../../lib/sessions");
|
|
9
|
-
const flags_1 = require("../../lib/flags");
|
|
10
10
|
const EksSessionMetadataFragment = `
|
|
11
11
|
... on AwsIamFederatedEksSession {
|
|
12
12
|
awsAccessKeyId
|
|
@@ -20,19 +20,19 @@ class StartKubeIAMRoleSession extends core_1.Command {
|
|
|
20
20
|
(0, cmd_1.setMostRecentCommand)(this);
|
|
21
21
|
const { flags } = await this.parse(StartKubeIAMRoleSession);
|
|
22
22
|
if (flags.sessionId && flags.refresh) {
|
|
23
|
-
return (0, apollo_1.handleError)(this,
|
|
23
|
+
return (0, apollo_1.handleError)(this, "Cannot use both --sessionId and --refresh");
|
|
24
24
|
}
|
|
25
25
|
let clusterId = flags.id;
|
|
26
26
|
const sessionId = flags.sessionId;
|
|
27
27
|
if (!clusterId) {
|
|
28
|
-
const selectedCluster = await (0, resources_1.promptUserForResource)(this,
|
|
28
|
+
const selectedCluster = await (0, resources_1.promptUserForResource)(this, "AWS_EKS_CLUSTER", "Select an EKS Kubernetes cluster to connect to");
|
|
29
29
|
if (!selectedCluster) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
clusterId = selectedCluster.id;
|
|
33
33
|
}
|
|
34
34
|
// Fetch all access levels for resource
|
|
35
|
-
const accessLevel = await (0, resources_1.promptUserForAccessLevels)(this, clusterId,
|
|
35
|
+
const accessLevel = await (0, resources_1.promptUserForAccessLevels)(this, clusterId, "Kubernetes cluster", flags.accessLevelRemoteId);
|
|
36
36
|
if (!accessLevel) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -42,12 +42,12 @@ class StartKubeIAMRoleSession extends core_1.Command {
|
|
|
42
42
|
}
|
|
43
43
|
const metadata = session.metadata;
|
|
44
44
|
switch (metadata === null || metadata === void 0 ? void 0 : metadata.__typename) {
|
|
45
|
-
case
|
|
45
|
+
case "AwsIamFederatedEksSession": {
|
|
46
46
|
const roleName = accessLevel.accessLevelName;
|
|
47
47
|
const updateAwsConfigCommand = (0, aws_1.getAwsConfigUpdateCmd)(roleName, metadata.awsAccessKeyId, metadata.awsSecretAccessKey, metadata.awsSessionToken);
|
|
48
48
|
const updateKubeConfigCmd = `aws eks update-kubeconfig --name ${metadata.clusterName} --region ${metadata.clusterRegion} --alias ${metadata.clusterName} --profile opal`;
|
|
49
49
|
const startSessionCmd = `${updateAwsConfigCommand} && ${updateKubeConfigCmd}`;
|
|
50
|
-
const roleText = roleName ? `"${roleName}" role` :
|
|
50
|
+
const roleText = roleName ? `"${roleName}" role` : "role";
|
|
51
51
|
const expirationMessage = (0, sessions_1.getSessionExpirationMessage)(session);
|
|
52
52
|
(0, cmd_1.runCommandExec)(startSessionCmd, `Now set to use ${roleText} with updated Kube config pointing to "${metadata.clusterName}" cluster. (session expires in ${expirationMessage})${(0, aws_1.getAwsEnvVarMessage)()}`, `Failed to assume ${roleText} and update Kube config.`);
|
|
53
53
|
break;
|
|
@@ -57,10 +57,10 @@ class StartKubeIAMRoleSession extends core_1.Command {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
StartKubeIAMRoleSession.description =
|
|
60
|
+
StartKubeIAMRoleSession.description = "Starts a session to assume a Kubernetes cluster IAM role.";
|
|
61
61
|
StartKubeIAMRoleSession.examples = [
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
"opal kube-roles:start",
|
|
63
|
+
"opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398",
|
|
64
64
|
'opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"',
|
|
65
65
|
];
|
|
66
66
|
StartKubeIAMRoleSession.flags = {
|
package/lib/commands/login.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export declare const CLISignInMethodName = "CLISignInMethod";
|
|
3
3
|
export declare const CLIAuthSessionCheckName = "CLIAuthSessionCheck";
|
|
4
4
|
export declare const CLIAuthSessionCheckDocument = "\nquery CLIAuthSessionCheck {\n organizationSettings {\n ... on OrganizationSettingsResult {\n settings {\n id\n }\n }\n }\n}\n";
|