opal-security 3.0.0 → 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 (67) hide show
  1. package/README.md +19 -20
  2. package/lib/commands/aws/identity.d.ts +1 -1
  3. package/lib/commands/aws/identity.js +2 -2
  4. package/lib/commands/clear-auth-provider.d.ts +1 -1
  5. package/lib/commands/clear-auth-provider.js +3 -3
  6. package/lib/commands/curl-example.d.ts +1 -1
  7. package/lib/commands/curl-example.js +2 -2
  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 +1 -1
  13. package/lib/commands/login.js +71 -63
  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 +1 -1
  21. package/lib/commands/set-auth-provider.js +6 -4
  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 +3 -2
  46. package/lib/lib/apollo.js +59 -46
  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 -14
  51. package/lib/lib/credentials/index.d.ts +1 -1
  52. package/lib/lib/credentials/index.js +6 -6
  53. package/lib/lib/credentials/keychain.js +5 -5
  54. package/lib/lib/credentials/localEncryption.d.ts +2 -2
  55. package/lib/lib/credentials/localEncryption.js +33 -24
  56. package/lib/lib/flags.js +9 -9
  57. package/lib/lib/resources.d.ts +2 -2
  58. package/lib/lib/resources.js +29 -23
  59. package/lib/lib/sessions.d.ts +2 -2
  60. package/lib/lib/sessions.js +18 -17
  61. package/lib/lib/ssh.d.ts +1 -1
  62. package/lib/lib/ssh.js +8 -8
  63. package/lib/lib/util.d.ts +0 -1
  64. package/lib/lib/util.js +13 -13
  65. package/lib/types.d.ts +1787 -1787
  66. package/oclif.manifest.json +2 -3
  67. package/package.json +23 -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.0 darwin-arm64 node-v22.14.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
@@ -100,7 +100,7 @@ EXAMPLES
100
100
  $ opal aws:identity
101
101
  ```
102
102
 
103
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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
104
 
105
105
  ## `opal clear-auth-provider`
106
106
 
@@ -120,7 +120,7 @@ EXAMPLES
120
120
  $ opal clear-auth-provider
121
121
  ```
122
122
 
123
- _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/src/commands/clear-auth-provider.ts)_
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)_
124
124
 
125
125
  ## `opal curl-example`
126
126
 
@@ -137,7 +137,7 @@ DESCRIPTION
137
137
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
138
138
  ```
139
139
 
140
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
141
141
 
142
142
  ## `opal help [COMMANDS]`
143
143
 
@@ -187,7 +187,7 @@ EXAMPLES
187
187
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
188
188
  ```
189
189
 
190
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
191
191
 
192
192
  ## `opal kube-roles:start`
193
193
 
@@ -218,7 +218,7 @@ EXAMPLES
218
218
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
219
219
  ```
220
220
 
221
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
222
222
 
223
223
  ## `opal login`
224
224
 
@@ -239,7 +239,7 @@ EXAMPLES
239
239
  $ opal login
240
240
  ```
241
241
 
242
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
243
243
 
244
244
  ## `opal logout`
245
245
 
@@ -259,7 +259,7 @@ EXAMPLES
259
259
  $ opal logout
260
260
  ```
261
261
 
262
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/src/commands/logout.ts)_
262
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.1-beta.4262451/src/commands/logout.ts)_
263
263
 
264
264
  ## `opal postgres-instances:start`
265
265
 
@@ -267,7 +267,7 @@ Starts a session to connect to a Postgres database.
267
267
 
268
268
  ```
269
269
  USAGE
270
- $ 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]
271
271
 
272
272
  FLAGS
273
273
  -a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
@@ -279,10 +279,9 @@ FLAGS
279
279
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created
280
280
  via the web flow.
281
281
  --action=<option> Method of connecting to the database.
282
- - open: Open external database app
283
282
  - psql: Start psql session in shell
284
283
  - view: View connection configuration details
285
- <options: open|psql|view>
284
+ <options: psql|view>
286
285
 
287
286
  DESCRIPTION
288
287
  Starts a session to connect to a Postgres database.
@@ -297,7 +296,7 @@ EXAMPLES
297
296
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
298
297
  ```
299
298
 
300
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
301
300
 
302
301
  ## `opal resources:get`
303
302
 
@@ -318,7 +317,7 @@ EXAMPLES
318
317
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
319
318
  ```
320
319
 
321
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
322
321
 
323
322
  ## `opal set-auth-provider`
324
323
 
@@ -344,7 +343,7 @@ EXAMPLES
344
343
  $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
345
344
  ```
346
345
 
347
- _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/src/commands/set-auth-provider.ts)_
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)_
348
347
 
349
348
  ## `opal set-custom-header`
350
349
 
@@ -365,7 +364,7 @@ EXAMPLES
365
364
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
366
365
  ```
367
366
 
368
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
369
368
 
370
369
  ## `opal set-token`
371
370
 
@@ -385,7 +384,7 @@ EXAMPLES
385
384
  $ opal set-token
386
385
  ```
387
386
 
388
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
389
388
 
390
389
  ## `opal set-url [URL]`
391
390
 
@@ -409,7 +408,7 @@ EXAMPLES
409
408
  $ opal set-url
410
409
  ```
411
410
 
412
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
413
412
 
414
413
  ## `opal ssh:copyFrom`
415
414
 
@@ -440,7 +439,7 @@ EXAMPLES
440
439
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
441
440
  ```
442
441
 
443
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
444
443
 
445
444
  ## `opal ssh:copyTo`
446
445
 
@@ -471,7 +470,7 @@ EXAMPLES
471
470
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
472
471
  ```
473
472
 
474
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
475
474
 
476
475
  ## `opal ssh:start`
477
476
 
@@ -498,7 +497,7 @@ EXAMPLES
498
497
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
499
498
  ```
500
499
 
501
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.0.0/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)_
502
501
 
503
502
  ## `opal version`
504
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,4 +1,4 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class ClearAuthProvider extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
@@ -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('Client ID and Issuer URL reset to defaults');
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 = `Clears the custom Issuer URL and Client ID set by set-airgap-auth, returning to the default.`;
24
- ClearAuthProvider.examples = ['$ opal clear-auth-provider'];
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
  };
@@ -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: {
@@ -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 = '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.";
31
31
  CurlExample.flags = {
32
32
  help: flags_1.SHARED_FLAGS.help,
33
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,4 +1,4 @@
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";