opal-security 2.3.4 → 3.0.1-beta.4262451

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 (69) hide show
  1. package/README.md +67 -38
  2. package/lib/commands/aws/identity.d.ts +1 -1
  3. package/lib/commands/aws/identity.js +2 -2
  4. package/lib/commands/{migrate-creds.d.ts → clear-auth-provider.d.ts} +3 -2
  5. package/lib/commands/clear-auth-provider.js +28 -0
  6. package/lib/commands/curl-example.d.ts +1 -1
  7. package/lib/commands/curl-example.js +10 -3
  8. package/lib/commands/iam-roles/start.d.ts +1 -1
  9. package/lib/commands/iam-roles/start.js +14 -14
  10. package/lib/commands/kube-roles/start.d.ts +1 -1
  11. package/lib/commands/kube-roles/start.js +10 -10
  12. package/lib/commands/login.d.ts +2 -1
  13. package/lib/commands/login.js +134 -74
  14. package/lib/commands/logout.d.ts +1 -1
  15. package/lib/commands/logout.js +3 -3
  16. package/lib/commands/postgres-instances/start.d.ts +1 -1
  17. package/lib/commands/postgres-instances/start.js +35 -34
  18. package/lib/commands/resources/get.d.ts +1 -1
  19. package/lib/commands/resources/get.js +6 -4
  20. package/lib/commands/set-auth-provider.d.ts +11 -0
  21. package/lib/commands/set-auth-provider.js +44 -0
  22. package/lib/commands/set-custom-header.d.ts +1 -1
  23. package/lib/commands/set-custom-header.js +5 -3
  24. package/lib/commands/set-token.d.ts +1 -1
  25. package/lib/commands/set-token.js +26 -19
  26. package/lib/commands/set-url.d.ts +1 -1
  27. package/lib/commands/set-url.js +13 -12
  28. package/lib/commands/ssh/copyFrom.d.ts +1 -1
  29. package/lib/commands/ssh/copyFrom.js +13 -13
  30. package/lib/commands/ssh/copyTo.d.ts +1 -1
  31. package/lib/commands/ssh/copyTo.js +13 -13
  32. package/lib/commands/ssh/start.d.ts +1 -1
  33. package/lib/commands/ssh/start.js +14 -15
  34. package/lib/graphql/fragment-masking.d.ts +19 -0
  35. package/lib/graphql/fragment-masking.js +21 -0
  36. package/lib/graphql/gql.d.ts +36 -0
  37. package/lib/graphql/gql.js +12 -0
  38. package/lib/graphql/graphql.d.ts +11413 -0
  39. package/lib/graphql/graphql.js +1491 -0
  40. package/lib/graphql/index.d.ts +2 -0
  41. package/lib/graphql/index.js +5 -0
  42. package/lib/handler.d.ts +5 -5
  43. package/lib/handler.js +7 -7
  44. package/lib/index.d.ts +1 -1
  45. package/lib/lib/apollo.d.ts +4 -2
  46. package/lib/lib/apollo.js +107 -55
  47. package/lib/lib/aws.js +15 -12
  48. package/lib/lib/cmd.d.ts +4 -6
  49. package/lib/lib/cmd.js +11 -11
  50. package/lib/lib/config.js +14 -15
  51. package/lib/lib/credentials/index.d.ts +9 -4
  52. package/lib/lib/credentials/index.js +26 -15
  53. package/lib/lib/credentials/keychain.d.ts +3 -3
  54. package/lib/lib/credentials/keychain.js +12 -12
  55. package/lib/lib/credentials/localEncryption.d.ts +3 -3
  56. package/lib/lib/credentials/localEncryption.js +40 -31
  57. package/lib/lib/flags.js +9 -9
  58. package/lib/lib/resources.d.ts +2 -2
  59. package/lib/lib/resources.js +29 -23
  60. package/lib/lib/sessions.d.ts +2 -2
  61. package/lib/lib/sessions.js +18 -17
  62. package/lib/lib/ssh.d.ts +1 -1
  63. package/lib/lib/ssh.js +8 -8
  64. package/lib/lib/util.d.ts +0 -1
  65. package/lib/lib/util.js +13 -13
  66. package/lib/types.d.ts +1787 -1787
  67. package/oclif.manifest.json +56 -7
  68. package/package.json +23 -29
  69. package/lib/commands/migrate-creds.js +0 -48
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/2.3.4 darwin-arm64 node-v18.19.0
25
+ opal-security/3.0.1-beta.4262451 linux-x64 node-v20.19.0
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -35,15 +35,16 @@ USAGE
35
35
  <!-- commands -->
36
36
  * [`opal autocomplete [SHELL]`](#opal-autocomplete-shell)
37
37
  * [`opal aws:identity`](#opal-awsidentity)
38
+ * [`opal clear-auth-provider`](#opal-clear-auth-provider)
38
39
  * [`opal curl-example`](#opal-curl-example)
39
40
  * [`opal help [COMMANDS]`](#opal-help-commands)
40
41
  * [`opal iam-roles:start`](#opal-iam-rolesstart)
41
42
  * [`opal kube-roles:start`](#opal-kube-rolesstart)
42
43
  * [`opal login`](#opal-login)
43
44
  * [`opal logout`](#opal-logout)
44
- * [`opal migrate-creds`](#opal-migrate-creds)
45
45
  * [`opal postgres-instances:start`](#opal-postgres-instancesstart)
46
46
  * [`opal resources:get`](#opal-resourcesget)
47
+ * [`opal set-auth-provider`](#opal-set-auth-provider)
47
48
  * [`opal set-custom-header`](#opal-set-custom-header)
48
49
  * [`opal set-token`](#opal-set-token)
49
50
  * [`opal set-url [URL]`](#opal-set-url-url)
@@ -99,7 +100,27 @@ EXAMPLES
99
100
  $ opal aws:identity
100
101
  ```
101
102
 
102
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/aws/identity.ts)_
103
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/aws/identity.ts)_
104
+
105
+ ## `opal clear-auth-provider`
106
+
107
+ Clears the custom Issuer URL and Client ID set by set-airgap-auth, returning to the default.
108
+
109
+ ```
110
+ USAGE
111
+ $ opal clear-auth-provider [-h]
112
+
113
+ FLAGS
114
+ -h, --help Show CLI help.
115
+
116
+ DESCRIPTION
117
+ Clears the custom Issuer URL and Client ID set by set-airgap-auth, returning to the default.
118
+
119
+ EXAMPLES
120
+ $ opal clear-auth-provider
121
+ ```
122
+
123
+ _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/clear-auth-provider.ts)_
103
124
 
104
125
  ## `opal curl-example`
105
126
 
@@ -116,7 +137,7 @@ DESCRIPTION
116
137
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
117
138
  ```
118
139
 
119
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/curl-example.ts)_
140
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/curl-example.ts)_
120
141
 
121
142
  ## `opal help [COMMANDS]`
122
143
 
@@ -124,10 +145,10 @@ Display help for opal.
124
145
 
125
146
  ```
126
147
  USAGE
127
- $ opal help [COMMANDS] [-n]
148
+ $ opal help [COMMANDS...] [-n]
128
149
 
129
150
  ARGUMENTS
130
- COMMANDS Command to show help for.
151
+ COMMANDS... Command to show help for.
131
152
 
132
153
  FLAGS
133
154
  -n, --nested-commands Include all nested commands in the output.
@@ -166,7 +187,7 @@ EXAMPLES
166
187
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
167
188
  ```
168
189
 
169
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/iam-roles/start.ts)_
190
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/iam-roles/start.ts)_
170
191
 
171
192
  ## `opal kube-roles:start`
172
193
 
@@ -197,7 +218,7 @@ EXAMPLES
197
218
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
198
219
  ```
199
220
 
200
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/kube-roles/start.ts)_
221
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/kube-roles/start.ts)_
201
222
 
202
223
  ## `opal login`
203
224
 
@@ -218,7 +239,7 @@ EXAMPLES
218
239
  $ opal login
219
240
  ```
220
241
 
221
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/login.ts)_
242
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/login.ts)_
222
243
 
223
244
  ## `opal logout`
224
245
 
@@ -238,24 +259,7 @@ EXAMPLES
238
259
  $ opal logout
239
260
  ```
240
261
 
241
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/logout.ts)_
242
-
243
- ## `opal migrate-creds`
244
-
245
- Migrates credentials from old keystore to new store. Should only need to be run once
246
-
247
- ```
248
- USAGE
249
- $ opal migrate-creds [-h]
250
-
251
- FLAGS
252
- -h, --help Show CLI help.
253
-
254
- DESCRIPTION
255
- Migrates credentials from old keystore to new store. Should only need to be run once
256
- ```
257
-
258
- _See code: [src/commands/migrate-creds.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/migrate-creds.ts)_
262
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/logout.ts)_
259
263
 
260
264
  ## `opal postgres-instances:start`
261
265
 
@@ -263,7 +267,7 @@ Starts a session to connect to a Postgres database.
263
267
 
264
268
  ```
265
269
  USAGE
266
- $ opal postgres-instances:start [-h] [-i <value>] [-a <value>] [-s <value>] [-r] [--action open|psql|view]
270
+ $ opal postgres-instances:start [-h] [-i <value>] [-a <value>] [-s <value>] [-r] [--action psql|view]
267
271
 
268
272
  FLAGS
269
273
  -a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
@@ -275,10 +279,9 @@ FLAGS
275
279
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created
276
280
  via the web flow.
277
281
  --action=<option> Method of connecting to the database.
278
- - open: Open external database app
279
282
  - psql: Start psql session in shell
280
283
  - view: View connection configuration details
281
- <options: open|psql|view>
284
+ <options: psql|view>
282
285
 
283
286
  DESCRIPTION
284
287
  Starts a session to connect to a Postgres database.
@@ -293,7 +296,7 @@ EXAMPLES
293
296
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
294
297
  ```
295
298
 
296
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/postgres-instances/start.ts)_
299
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/postgres-instances/start.ts)_
297
300
 
298
301
  ## `opal resources:get`
299
302
 
@@ -314,7 +317,33 @@ EXAMPLES
314
317
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
315
318
  ```
316
319
 
317
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/resources/get.ts)_
320
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/resources/get.ts)_
321
+
322
+ ## `opal set-auth-provider`
323
+
324
+ Sets the Issuer URL and Client ID of the Auth Provider that the CLI will authenticate with.
325
+
326
+ ```
327
+ USAGE
328
+ $ opal set-auth-provider --clientID <value> --issuerUrl <value> [-h]
329
+
330
+ FLAGS
331
+ -h, --help Show CLI help.
332
+ --clientID=<value> (required) Client ID of your Auth Provider
333
+ --issuerUrl=<value> (required) Issuer URL of your Auth Provider
334
+
335
+ DESCRIPTION
336
+ Sets the Issuer URL and Client ID of the Auth Provider that the CLI will authenticate with.
337
+ Only use this if you are running a self-hosted, air-gapped instance of Opal that uses a custom Auth Provider.
338
+
339
+ Note - you will need an OIDC provider that supports the device_code grant.
340
+
341
+
342
+ EXAMPLES
343
+ $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
344
+ ```
345
+
346
+ _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/set-auth-provider.ts)_
318
347
 
319
348
  ## `opal set-custom-header`
320
349
 
@@ -335,7 +364,7 @@ EXAMPLES
335
364
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
336
365
  ```
337
366
 
338
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/set-custom-header.ts)_
367
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/set-custom-header.ts)_
339
368
 
340
369
  ## `opal set-token`
341
370
 
@@ -355,7 +384,7 @@ EXAMPLES
355
384
  $ opal set-token
356
385
  ```
357
386
 
358
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/set-token.ts)_
387
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/set-token.ts)_
359
388
 
360
389
  ## `opal set-url [URL]`
361
390
 
@@ -379,7 +408,7 @@ EXAMPLES
379
408
  $ opal set-url
380
409
  ```
381
410
 
382
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/set-url.ts)_
411
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/set-url.ts)_
383
412
 
384
413
  ## `opal ssh:copyFrom`
385
414
 
@@ -410,7 +439,7 @@ EXAMPLES
410
439
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
411
440
  ```
412
441
 
413
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/ssh/copyFrom.ts)_
442
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/ssh/copyFrom.ts)_
414
443
 
415
444
  ## `opal ssh:copyTo`
416
445
 
@@ -441,7 +470,7 @@ EXAMPLES
441
470
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
442
471
  ```
443
472
 
444
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/ssh/copyTo.ts)_
473
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/ssh/copyTo.ts)_
445
474
 
446
475
  ## `opal ssh:start`
447
476
 
@@ -468,7 +497,7 @@ EXAMPLES
468
497
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
469
498
  ```
470
499
 
471
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.3.4/src/commands/ssh/start.ts)_
500
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/ssh/start.ts)_
472
501
 
473
502
  ## `opal version`
474
503
 
@@ -1,4 +1,4 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class Identity extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -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 = 'aws sts get-caller-identity --profile opal';
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 = ['opal aws:identity'];
14
+ Identity.examples = ["opal aws:identity"];
15
15
  Identity.flags = {
16
16
  help: flags_1.SHARED_FLAGS.help,
17
17
  };
@@ -1,6 +1,7 @@
1
- import { Command } from '@oclif/core';
2
- export default class MigrateCreds extends Command {
1
+ import { Command } from "@oclif/core";
2
+ export default class ClearAuthProvider extends Command {
3
3
  static description: string;
4
+ static examples: string[];
4
5
  static flags: {
5
6
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
7
  };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const config_1 = require("../lib/config");
5
+ const credentials_1 = require("../lib/credentials");
6
+ const flags_1 = require("../lib/flags");
7
+ class ClearAuthProvider extends core_1.Command {
8
+ async run() {
9
+ try {
10
+ const { flags, args } = await this.parse(ClearAuthProvider);
11
+ const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
12
+ configData.issuerURL = null;
13
+ configData.clientID = null;
14
+ (0, config_1.writeConfigData)(this.config.configDir, configData);
15
+ await (0, credentials_1.removeOpalCredentials)(this);
16
+ this.log("Client ID and Issuer URL reset to defaults");
17
+ }
18
+ catch (error) {
19
+ this.error(error);
20
+ }
21
+ }
22
+ }
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
+ ClearAuthProvider.flags = {
26
+ help: flags_1.SHARED_FLAGS.help,
27
+ };
28
+ exports.default = ClearAuthProvider;
@@ -1,4 +1,4 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class CurlExample extends Command {
3
3
  static description: string;
4
4
  static flags: {
@@ -7,20 +7,27 @@ const flags_1 = require("../lib/flags");
7
7
  class CurlExample extends core_1.Command {
8
8
  async run() {
9
9
  const opalCreds = await (0, credentials_1.getOpalCredentials)(this);
10
- const accessToken = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.accessToken;
10
+ const secret = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.secret;
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 = "";
15
+ if (opalCreds.secretType === credentials_1.SecretType.ApiToken) {
16
+ authStr = `Authorization: Bearer ${secret}`;
17
+ }
18
+ else {
19
+ authStr = `Cookie: ${secret}`;
20
+ }
14
21
  this.log(`
15
22
  curl -v ${url}/query \\
16
23
  --data-binary '{"query":"query ListSSHSessions {resources(input: {serviceType: SSH, onlyMine: true}) {... on ResourcesResult { resources { name } } } }"}' \\
17
24
  --header "Content-Type: application/json" \\
18
- --header "Authorization: Bearer ${accessToken}" \\
25
+ --header "${authStr}" \\
19
26
  --header "X-Opal-Organization-ID: ${organizationID}"
20
27
  `);
21
28
  }
22
29
  }
23
- CurlExample.description = 'Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.';
30
+ CurlExample.description = "Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.";
24
31
  CurlExample.flags = {
25
32
  help: flags_1.SHARED_FLAGS.help,
26
33
  };
@@ -1,4 +1,4 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class StartIAMRoleSession extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -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, 'Cannot use both --sessionId and --refresh');
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, 'AWS_IAM_ROLE', 'Select an IAM role to assume');
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.runQuery)({
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) || 'iam-role';
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 'AwsIamFederatedRoleSession': {
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` : '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 = 'Starts a session to assume an IAM role.';
76
+ StartIAMRoleSession.description = "Starts a session to assume an IAM role.";
77
77
  StartIAMRoleSession.examples = [
78
- 'opal iam-roles:start',
79
- 'opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398',
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: 'Uses a custom AWS profile name for the IAM role. Default value is the role\'s name.',
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,4 +1,4 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class StartKubeIAMRoleSession extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -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, 'Cannot use both --sessionId and --refresh');
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, 'AWS_EKS_CLUSTER', 'Select an EKS Kubernetes cluster to connect to');
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, 'Kubernetes cluster', flags.accessLevelRemoteId);
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 'AwsIamFederatedEksSession': {
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` : '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 = 'Starts a session to assume a Kubernetes cluster IAM role.';
60
+ StartKubeIAMRoleSession.description = "Starts a session to assume a Kubernetes cluster IAM role.";
61
61
  StartKubeIAMRoleSession.examples = [
62
- 'opal kube-roles:start',
63
- 'opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398',
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 = {
@@ -1,7 +1,8 @@
1
- import { Command } from '@oclif/core';
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";
5
+ export declare const CLITokenExchangeName = "CLITokenExchange";
5
6
  export default class Login extends Command {
6
7
  static description: string;
7
8
  static examples: string[];