opal-security 3.1.1-beta.e92fdf8 → 3.1.1-beta.f1a5f49

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 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.1.1-beta.e92fdf8 linux-x64 node-v20.19.2
25
+ opal-security/3.1.1-beta.f1a5f49 linux-x64 node-v20.19.2
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -53,6 +53,7 @@ USAGE
53
53
  * [`opal ssh copyTo`](#opal-ssh-copyto)
54
54
  * [`opal ssh start`](#opal-ssh-start)
55
55
  * [`opal version`](#opal-version)
56
+ * [`opal whoami`](#opal-whoami)
56
57
 
57
58
  ## `opal autocomplete [SHELL]`
58
59
 
@@ -101,7 +102,7 @@ EXAMPLES
101
102
  $ opal aws:identity
102
103
  ```
103
104
 
104
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/aws/identity.ts)_
105
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/aws/identity.ts)_
105
106
 
106
107
  ## `opal clear-auth-provider`
107
108
 
@@ -121,7 +122,7 @@ EXAMPLES
121
122
  $ opal clear-auth-provider
122
123
  ```
123
124
 
124
- _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/clear-auth-provider.ts)_
125
+ _See code: [src/commands/clear-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/clear-auth-provider.ts)_
125
126
 
126
127
  ## `opal curl-example`
127
128
 
@@ -138,7 +139,7 @@ DESCRIPTION
138
139
  Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.
139
140
  ```
140
141
 
141
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/curl-example.ts)_
142
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/curl-example.ts)_
142
143
 
143
144
  ## `opal groups get`
144
145
 
@@ -150,7 +151,7 @@ USAGE
150
151
 
151
152
  FLAGS
152
153
  -h, --help Show CLI help.
153
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
154
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
154
155
 
155
156
  DESCRIPTION
156
157
  Get group info for a particular group.
@@ -159,7 +160,7 @@ EXAMPLES
159
160
  $ opal groups:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
160
161
  ```
161
162
 
162
- _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/groups/get.ts)_
163
+ _See code: [src/commands/groups/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/groups/get.ts)_
163
164
 
164
165
  ## `opal help [COMMANDS]`
165
166
 
@@ -191,7 +192,7 @@ USAGE
191
192
 
192
193
  FLAGS
193
194
  -h, --help Show CLI help.
194
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
195
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
195
196
  https://opal.dev/resources/[ID]
196
197
  -r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
197
198
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
@@ -209,7 +210,7 @@ EXAMPLES
209
210
  $ opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
210
211
  ```
211
212
 
212
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/iam-roles/start.ts)_
213
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/iam-roles/start.ts)_
213
214
 
214
215
  ## `opal kube-roles start`
215
216
 
@@ -222,7 +223,7 @@ USAGE
222
223
  FLAGS
223
224
  -a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
224
225
  -h, --help Show CLI help.
225
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
226
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
226
227
  https://opal.dev/resources/[ID]
227
228
  -r, --refresh Starts a new session even if one already exists. Useful if a session is about to
228
229
  expire.
@@ -240,7 +241,7 @@ EXAMPLES
240
241
  $ opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
241
242
  ```
242
243
 
243
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/kube-roles/start.ts)_
244
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/kube-roles/start.ts)_
244
245
 
245
246
  ## `opal login`
246
247
 
@@ -261,7 +262,7 @@ EXAMPLES
261
262
  $ opal login
262
263
  ```
263
264
 
264
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/login.ts)_
265
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/login.ts)_
265
266
 
266
267
  ## `opal logout`
267
268
 
@@ -281,7 +282,7 @@ EXAMPLES
281
282
  $ opal logout
282
283
  ```
283
284
 
284
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/logout.ts)_
285
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/logout.ts)_
285
286
 
286
287
  ## `opal postgres-instances start`
287
288
 
@@ -294,7 +295,7 @@ USAGE
294
295
  FLAGS
295
296
  -a, --accessLevelRemoteId=<value> The remote ID of the access level with which to access the resource.
296
297
  -h, --help Show CLI help.
297
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
298
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
298
299
  https://opal.dev/resources/[ID]
299
300
  -r, --refresh Starts a new session even if one already exists. Useful if a session is about to
300
301
  expire.
@@ -318,7 +319,7 @@ EXAMPLES
318
319
  $ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
319
320
  ```
320
321
 
321
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/postgres-instances/start.ts)_
322
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/postgres-instances/start.ts)_
322
323
 
323
324
  ## `opal resources get`
324
325
 
@@ -330,7 +331,7 @@ USAGE
330
331
 
331
332
  FLAGS
332
333
  -h, --help Show CLI help.
333
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
334
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
334
335
 
335
336
  DESCRIPTION
336
337
  Get resource info for a particular resource.
@@ -339,7 +340,7 @@ EXAMPLES
339
340
  $ opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
340
341
  ```
341
342
 
342
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/resources/get.ts)_
343
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/resources/get.ts)_
343
344
 
344
345
  ## `opal set-auth-provider`
345
346
 
@@ -365,7 +366,7 @@ EXAMPLES
365
366
  $ opal set-auth-provider --clientID 1234asdf --issuerUrl https://auth.example.com
366
367
  ```
367
368
 
368
- _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/set-auth-provider.ts)_
369
+ _See code: [src/commands/set-auth-provider.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/set-auth-provider.ts)_
369
370
 
370
371
  ## `opal set-custom-header`
371
372
 
@@ -386,7 +387,7 @@ EXAMPLES
386
387
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
387
388
  ```
388
389
 
389
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/set-custom-header.ts)_
390
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/set-custom-header.ts)_
390
391
 
391
392
  ## `opal set-token`
392
393
 
@@ -406,7 +407,7 @@ EXAMPLES
406
407
  $ opal set-token
407
408
  ```
408
409
 
409
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/set-token.ts)_
410
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/set-token.ts)_
410
411
 
411
412
  ## `opal set-url [URL]`
412
413
 
@@ -430,7 +431,7 @@ EXAMPLES
430
431
  $ opal set-url
431
432
  ```
432
433
 
433
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/set-url.ts)_
434
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/set-url.ts)_
434
435
 
435
436
  ## `opal ssh copyFrom`
436
437
 
@@ -442,7 +443,7 @@ USAGE
442
443
 
443
444
  FLAGS
444
445
  -h, --help Show CLI help.
445
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
446
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
446
447
  https://opal.dev/resources/[ID]
447
448
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
448
449
  web flow.
@@ -461,7 +462,7 @@ EXAMPLES
461
462
  $ opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
462
463
  ```
463
464
 
464
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/ssh/copyFrom.ts)_
465
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/ssh/copyFrom.ts)_
465
466
 
466
467
  ## `opal ssh copyTo`
467
468
 
@@ -473,7 +474,7 @@ USAGE
473
474
 
474
475
  FLAGS
475
476
  -h, --help Show CLI help.
476
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
477
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
477
478
  https://opal.dev/resources/[ID]
478
479
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
479
480
  web flow.
@@ -492,7 +493,7 @@ EXAMPLES
492
493
  $ opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
493
494
  ```
494
495
 
495
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/ssh/copyTo.ts)_
496
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/ssh/copyTo.ts)_
496
497
 
497
498
  ## `opal ssh start`
498
499
 
@@ -504,7 +505,7 @@ USAGE
504
505
 
505
506
  FLAGS
506
507
  -h, --help Show CLI help.
507
- -i, --id=<value> The Opal ID of the resource. You can find this from the URL, e.g.
508
+ -i, --id=<value> The Opal ID of the asset. You can find this from the URL, e.g.
508
509
  https://opal.dev/resources/[ID]
509
510
  -r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
510
511
  -s, --sessionId=<value> The Opal ID of the session to connect to. Uses an existing session that was created via the
@@ -519,7 +520,7 @@ EXAMPLES
519
520
  $ opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
520
521
  ```
521
522
 
522
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.e92fdf8/src/commands/ssh/start.ts)_
523
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/ssh/start.ts)_
523
524
 
524
525
  ## `opal version`
525
526
 
@@ -540,4 +541,21 @@ FLAG DESCRIPTIONS
540
541
  ```
541
542
 
542
543
  _See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.27/src/commands/version.ts)_
544
+
545
+ ## `opal whoami`
546
+
547
+ Describes current url set, organization name, and logged in user if applicabled.
548
+
549
+ ```
550
+ USAGE
551
+ $ opal whoami [-h]
552
+
553
+ FLAGS
554
+ -h, --help Show CLI help.
555
+
556
+ DESCRIPTION
557
+ Describes current url set, organization name, and logged in user if applicabled.
558
+ ```
559
+
560
+ _See code: [src/commands/whoami.ts](https://github.com/opalsecurity/opal-cli/blob/v3.1.1-beta.f1a5f49/src/commands/whoami.ts)_
543
561
  <!-- commandsstop -->
@@ -88,12 +88,14 @@ class Login extends core_1.Command {
88
88
  const configData = (0, config_1.getOrCreateConfigData)(configDir);
89
89
  let email = flags.email;
90
90
  let organizationId;
91
+ let organizationName;
91
92
  let clientIDCandidate;
92
93
  const existingCreds = await (0, credentials_1.getOpalCredentials)(this, false);
93
94
  // Only use the previous email + organizationID if email isn't explicitly specified.
94
95
  if (!email) {
95
96
  email = existingCreds.email;
96
97
  organizationId = existingCreds.organizationID;
98
+ organizationName = existingCreds.organizationName;
97
99
  clientIDCandidate = existingCreds.clientIDCandidate;
98
100
  }
99
101
  await (0, credentials_1.removeOpalCredentials)(this);
@@ -149,6 +151,7 @@ class Login extends core_1.Command {
149
151
  if (signInOrganizations && signInOrganizations.length > 0) {
150
152
  if (signInOrganizations.length === 1) {
151
153
  organizationId = signInOrganizations[0].organizationId;
154
+ organizationName = signInOrganizations[0].organizationName;
152
155
  clientIDCandidate = signInOrganizations[0].cliClientId;
153
156
  }
154
157
  else {
@@ -164,6 +167,7 @@ class Login extends core_1.Command {
164
167
  },
165
168
  ]);
166
169
  organizationId = responses.signInOrganization.organizationId;
170
+ organizationName = responses.signInOrganization.organizationName;
167
171
  clientIDCandidate = responses.signInOrganization.cliClientId;
168
172
  }
169
173
  }
@@ -238,10 +242,10 @@ class Login extends core_1.Command {
238
242
  if (tokenExchangeError) {
239
243
  this.log("WARN: Failed to exchange access token for session in Opal. Falling back to using access token for authenticating requests\n");
240
244
  // TODO: consider adding a warn line recommending upgrading Opal to version XYZ, once accompanying PR is pushed to prod
241
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken);
245
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, (tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.access_token) || "", credentials_1.SecretType.ApiToken, organizationName);
242
246
  }
243
247
  else {
244
- await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie);
248
+ await (0, credentials_1.setOpalCredentials)(this, email, organizationId !== null && organizationId !== void 0 ? organizationId : "", clientIDCandidate, apollo_1.cookieStr, credentials_1.SecretType.Cookie, organizationName);
245
249
  }
246
250
  // "Representative" authenticated call to check the log-in worked as expected.
247
251
  const { resp: authCheckResp, error: authCheckErr } = await (0, handler_1.runQueryDeprecated)({
@@ -2,5 +2,11 @@ import { Command } from "@oclif/core";
2
2
  export default class RequestCreate extends Command {
3
3
  static hidden: boolean;
4
4
  static description: string;
5
+ static flags: {
6
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
7
+ assets: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ reason: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ duration: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ };
5
11
  run(): Promise<void>;
6
12
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const apollo_1 = require("../../lib/apollo");
5
+ const flags_1 = require("../../lib/flags");
5
6
  const requests_1 = require("../../lib/requests");
6
7
  const displays_1 = require("../../utils/displays");
7
8
  const utils_1 = require("../../utils/utils");
@@ -10,30 +11,72 @@ class RequestCreate extends core_1.Command {
10
11
  await (0, apollo_1.initClient)(this, true);
11
12
  const client = await (0, apollo_1.getClient)(this, true);
12
13
  (0, utils_1.restrictToDev)(); //TODO: Remove after development is complete
14
+ const { flags } = await this.parse(RequestCreate);
13
15
  const metadata = (0, requests_1.initEmptyRequestMetadata)();
14
- (0, displays_1.headerMessage)(this);
15
- let shouldProceed = false;
16
- while (!shouldProceed) {
17
- // Step 1: Select first round of assets from an app
18
- await (0, requests_1.selectRequestableItems)(this, client, metadata.requestMap);
19
- // Step 2: Display the selected items in a tree format
16
+ if (flags.assets) {
17
+ // if IDs are provided, bypass the interactive selection process
18
+ await (0, requests_1.bypassRequestSelection)(this, client, flags.assets, metadata);
19
+ }
20
+ else {
20
21
  (0, displays_1.headerMessage)(this);
21
- (0, displays_1.treeifyRequestMap)(this, metadata.requestMap);
22
- // Step 3: Prompt to add more items, repeat 1-3 if needed
23
- shouldProceed = await (0, requests_1.doneSelectingAssets)();
22
+ let shouldProceed = false;
23
+ while (!shouldProceed) {
24
+ // Step 1: Select first round of assets from an app
25
+ await (0, requests_1.selectRequestableItems)(this, client, metadata.requestMap);
26
+ // Step 2: Display the selected items in a tree format
27
+ (0, displays_1.headerMessage)(this);
28
+ (0, displays_1.treeifyRequestMap)(this, metadata.requestMap);
29
+ // Step 3: Prompt to add more items, repeat 1-3 if needed
30
+ shouldProceed = await (0, requests_1.doneSelectingAssets)();
31
+ }
24
32
  }
25
33
  // Step 4: Set Request Defaults
26
34
  await (0, requests_1.setRequestDefaults)(this, client, metadata);
27
35
  // Step 4: Prompt for request reason
28
- await (0, requests_1.promptForReason)(metadata);
36
+ if (flags.reason) {
37
+ metadata.reason = flags.reason;
38
+ }
39
+ else if (!(metadata.requestDefaults.reasonOptional &&
40
+ flags.assets &&
41
+ flags.duration)) {
42
+ await (0, requests_1.promptForReason)(metadata);
43
+ }
29
44
  // Step 5: Prompt for expiration
30
- await (0, requests_1.promptForExpiration)(metadata);
45
+ if (flags.duration) {
46
+ (0, requests_1.bypassDuration)(this, flags.duration, metadata);
47
+ }
48
+ else {
49
+ await (0, requests_1.promptForExpiration)(metadata);
50
+ }
31
51
  // Step 6: Display final summary of request
32
- (0, displays_1.displayFinalRequestSummary)(this, metadata);
33
- // Step 7: Prompt for final submition
34
- await (0, requests_1.submitFinalRequest)(this, client, metadata);
52
+ let canSubmit = true;
53
+ if (!(flags.assets &&
54
+ flags.duration &&
55
+ (metadata.requestDefaults.reasonOptional || flags.reason))) {
56
+ canSubmit = await (0, requests_1.promptRequestSubmission)(this, metadata);
57
+ }
58
+ // Step 7: Prompt for final submission
59
+ if (canSubmit)
60
+ await (0, requests_1.submitFinalRequest)(this, client, metadata);
35
61
  }
36
62
  }
37
63
  RequestCreate.hidden = true;
38
64
  RequestCreate.description = "Creates an Opal access request via an interactive form";
65
+ RequestCreate.flags = {
66
+ help: flags_1.SHARED_FLAGS.help,
67
+ assets: core_1.Flags.string({
68
+ char: "a",
69
+ multiple: true,
70
+ description: "The ids of the assets (resource, group) to request access to. Append a role ID using a colon if needed, e.g. `--assets 123:456`.\
71
+ \n If not provided, an interactive selection flow will be available to select assets to request.",
72
+ }),
73
+ reason: core_1.Flags.string({
74
+ char: "r",
75
+ description: "The reason for the request, contained in quotes. If not provided, you will be prompted.",
76
+ }),
77
+ duration: core_1.Flags.integer({
78
+ char: "d",
79
+ description: "The duration of access for the request in minutes. If not provided, you will be prompted.",
80
+ }),
81
+ };
39
82
  exports.default = RequestCreate;
@@ -0,0 +1,8 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class WhoAmI extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
@@ -0,0 +1,34 @@
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 WhoAmI extends core_1.Command {
8
+ async run() {
9
+ const opalCreds = await (0, credentials_1.getOpalCredentials)(this, false);
10
+ const organizationName = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.organizationName;
11
+ const email = opalCreds === null || opalCreds === void 0 ? void 0 : opalCreds.email;
12
+ const configData = (0, config_1.getOrCreateConfigData)(this.config.configDir);
13
+ const url = configData[config_1.urlKey];
14
+ if (email) {
15
+ this.log(`User: ${email}`);
16
+ }
17
+ if (organizationName) {
18
+ if (organizationName === "unset-org-id") {
19
+ this.log("Authenticated with Opal API Token.");
20
+ }
21
+ else {
22
+ this.log(`Organization: ${organizationName}`);
23
+ }
24
+ }
25
+ if (url) {
26
+ this.log(`Server: ${url}`);
27
+ }
28
+ }
29
+ }
30
+ WhoAmI.description = "Describes current url set, organization name, and logged in user if applicabled.";
31
+ WhoAmI.flags = {
32
+ help: flags_1.SHARED_FLAGS.help,
33
+ };
34
+ exports.default = WhoAmI;
@@ -22,6 +22,8 @@ type Documents = {
22
22
  "\nquery GroupAccessLevels($groupId: GroupId!) {\n groupAccessLevels(\n input: { groupId: $groupId }\n ) {\n ... on GroupAccessLevelsResult {\n groupId\n accessLevels {\n ... on GroupAccessLevel {\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n}\n": typeof types.GroupAccessLevelsDocument;
23
23
  "\n query RequestDefaults(\n $requestedResources: [RequestConfigurationResourceInput!]!\n $requestedGroups: [RequestConfigurationGroupInput!]!\n ) {\n requestDefaults(input: {\n requestedResources: $requestedResources,\n requestedGroups: $requestedGroups,\n }\n ) {\n ... on RequestDefaults {\n durationOptions {\n durationInMinutes\n label\n }\n recommendedDurationInMinutes\n defaultDurationInMinutes\n maxDurationInMinutes\n requireSupportTicket\n reasonOptional\n requesterIsAdmin\n }\n }\n }": typeof types.RequestDefaultsDocument;
24
24
  "\n mutation CreateRequest(\n $requestedResources: [RequestedResourceInput!]!\n $requestedGroups: [RequestedGroupInput!]!\n $reason: String!\n $durationInMinutes: Int\n ) {\n createRequest(\n input: {\n requestedResources: $requestedResources\n requestedGroups: $requestedGroups\n reason: $reason\n durationInMinutes: $durationInMinutes\n }\n ) {\n ... on CreateRequestResult {\n request {\n id\n status\n }\n }\n ... on RequestDurationTooLargeError {\n message\n }\n ... on RequestRequiresUserAuthTokenForConnectionError {\n message\n }\n ... on NoReviewersSetForOwnerError {\n message\n ownerId\n }\n ... on NoReviewersSetForResourceError {\n message\n resourceId\n }\n ... on NoReviewersSetForGroupError {\n message\n groupId\n }\n ... on NoManagerSetForRequestingUserError {\n message\n }\n ... on MfaInvalidError {\n message\n }\n ... on BulkRequestTooLargeError {\n message\n }\n ... on ItemCannotBeRequestedError {\n message\n }\n ... on UserCannotRequestAccessForTargetGroupError {\n message\n groupId\n userId\n }\n ... on GroupNestingNotAllowedError {\n message\n fromGroupId\n toGroupId\n }\n ... on TargetUserHasNestedAccessError {\n message\n groupIds\n }\n ... on RequestReasonMissingError {\n message\n }\n ... on RequestFieldValueMissingError {\n message\n fieldName\n }\n ... on LinkedGroupNotRequestableError {\n message\n sourceGroupId\n groupBindingId\n }\n ... on RequestReasonBelowMinLengthError {\n message\n }\n\n }\n }\n": typeof types.CreateRequestDocument;
25
+ "\n query GetCatalogItem($uuid: UUID!) {\n catalogItem(id: $uuid) {\n __typename\n ... on Connection {\n id\n displayName\n }\n ... on Resource {\n id\n displayName\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ...on Group {\n id\n name\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ... on UserFacingError {\n message\n }\n }\n }\n ": typeof types.GetCatalogItemDocument;
26
+ "\n query GetAssociatedItems($resourceId: ResourceId!, $searchQuery: String) {\n resource(input: {\n id: $resourceId\n }) {\n __typename\n ... on ResourceResult {\n __typename\n resource {\n associatedItems(\n first: 200\n filters: {\n searchQuery: {\n contains: $searchQuery\n }\n access: REQUESTABLE\n endUserVisible: true\n entityType: {\n in: [GROUP, RESOURCE]\n }\n }\n ) {\n edges {\n __typename\n ... on ResourceAssociatedItemEdge {\n alias\n node {\n __typename\n id\n name\n ... on Resource {\n accessLevels(\n filters: {\n skipRemoteAccessLevels: false # azure app roles are remote\n }\n ) {\n __typename\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n }\n }\n }\n }\n ... on ResourceNotFoundError {\n message\n }\n }\n }\n": typeof types.GetAssociatedItemsDocument;
25
27
  };
26
28
  declare const documents: Documents;
27
29
  /**
@@ -77,5 +79,13 @@ export declare function graphql(source: "\n query RequestDefaults(\n $reques
77
79
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
78
80
  */
79
81
  export declare function graphql(source: "\n mutation CreateRequest(\n $requestedResources: [RequestedResourceInput!]!\n $requestedGroups: [RequestedGroupInput!]!\n $reason: String!\n $durationInMinutes: Int\n ) {\n createRequest(\n input: {\n requestedResources: $requestedResources\n requestedGroups: $requestedGroups\n reason: $reason\n durationInMinutes: $durationInMinutes\n }\n ) {\n ... on CreateRequestResult {\n request {\n id\n status\n }\n }\n ... on RequestDurationTooLargeError {\n message\n }\n ... on RequestRequiresUserAuthTokenForConnectionError {\n message\n }\n ... on NoReviewersSetForOwnerError {\n message\n ownerId\n }\n ... on NoReviewersSetForResourceError {\n message\n resourceId\n }\n ... on NoReviewersSetForGroupError {\n message\n groupId\n }\n ... on NoManagerSetForRequestingUserError {\n message\n }\n ... on MfaInvalidError {\n message\n }\n ... on BulkRequestTooLargeError {\n message\n }\n ... on ItemCannotBeRequestedError {\n message\n }\n ... on UserCannotRequestAccessForTargetGroupError {\n message\n groupId\n userId\n }\n ... on GroupNestingNotAllowedError {\n message\n fromGroupId\n toGroupId\n }\n ... on TargetUserHasNestedAccessError {\n message\n groupIds\n }\n ... on RequestReasonMissingError {\n message\n }\n ... on RequestFieldValueMissingError {\n message\n fieldName\n }\n ... on LinkedGroupNotRequestableError {\n message\n sourceGroupId\n groupBindingId\n }\n ... on RequestReasonBelowMinLengthError {\n message\n }\n\n }\n }\n"): (typeof documents)["\n mutation CreateRequest(\n $requestedResources: [RequestedResourceInput!]!\n $requestedGroups: [RequestedGroupInput!]!\n $reason: String!\n $durationInMinutes: Int\n ) {\n createRequest(\n input: {\n requestedResources: $requestedResources\n requestedGroups: $requestedGroups\n reason: $reason\n durationInMinutes: $durationInMinutes\n }\n ) {\n ... on CreateRequestResult {\n request {\n id\n status\n }\n }\n ... on RequestDurationTooLargeError {\n message\n }\n ... on RequestRequiresUserAuthTokenForConnectionError {\n message\n }\n ... on NoReviewersSetForOwnerError {\n message\n ownerId\n }\n ... on NoReviewersSetForResourceError {\n message\n resourceId\n }\n ... on NoReviewersSetForGroupError {\n message\n groupId\n }\n ... on NoManagerSetForRequestingUserError {\n message\n }\n ... on MfaInvalidError {\n message\n }\n ... on BulkRequestTooLargeError {\n message\n }\n ... on ItemCannotBeRequestedError {\n message\n }\n ... on UserCannotRequestAccessForTargetGroupError {\n message\n groupId\n userId\n }\n ... on GroupNestingNotAllowedError {\n message\n fromGroupId\n toGroupId\n }\n ... on TargetUserHasNestedAccessError {\n message\n groupIds\n }\n ... on RequestReasonMissingError {\n message\n }\n ... on RequestFieldValueMissingError {\n message\n fieldName\n }\n ... on LinkedGroupNotRequestableError {\n message\n sourceGroupId\n groupBindingId\n }\n ... on RequestReasonBelowMinLengthError {\n message\n }\n\n }\n }\n"];
82
+ /**
83
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
84
+ */
85
+ export declare function graphql(source: "\n query GetCatalogItem($uuid: UUID!) {\n catalogItem(id: $uuid) {\n __typename\n ... on Connection {\n id\n displayName\n }\n ... on Resource {\n id\n displayName\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ...on Group {\n id\n name\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ... on UserFacingError {\n message\n }\n }\n }\n "): (typeof documents)["\n query GetCatalogItem($uuid: UUID!) {\n catalogItem(id: $uuid) {\n __typename\n ... on Connection {\n id\n displayName\n }\n ... on Resource {\n id\n displayName\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ...on Group {\n id\n name\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ... on UserFacingError {\n message\n }\n }\n }\n "];
86
+ /**
87
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
88
+ */
89
+ export declare function graphql(source: "\n query GetAssociatedItems($resourceId: ResourceId!, $searchQuery: String) {\n resource(input: {\n id: $resourceId\n }) {\n __typename\n ... on ResourceResult {\n __typename\n resource {\n associatedItems(\n first: 200\n filters: {\n searchQuery: {\n contains: $searchQuery\n }\n access: REQUESTABLE\n endUserVisible: true\n entityType: {\n in: [GROUP, RESOURCE]\n }\n }\n ) {\n edges {\n __typename\n ... on ResourceAssociatedItemEdge {\n alias\n node {\n __typename\n id\n name\n ... on Resource {\n accessLevels(\n filters: {\n skipRemoteAccessLevels: false # azure app roles are remote\n }\n ) {\n __typename\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n }\n }\n }\n }\n ... on ResourceNotFoundError {\n message\n }\n }\n }\n"): (typeof documents)["\n query GetAssociatedItems($resourceId: ResourceId!, $searchQuery: String) {\n resource(input: {\n id: $resourceId\n }) {\n __typename\n ... on ResourceResult {\n __typename\n resource {\n associatedItems(\n first: 200\n filters: {\n searchQuery: {\n contains: $searchQuery\n }\n access: REQUESTABLE\n endUserVisible: true\n entityType: {\n in: [GROUP, RESOURCE]\n }\n }\n ) {\n edges {\n __typename\n ... on ResourceAssociatedItemEdge {\n alias\n node {\n __typename\n id\n name\n ... on Resource {\n accessLevels(\n filters: {\n skipRemoteAccessLevels: false # azure app roles are remote\n }\n ) {\n __typename\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n }\n }\n }\n }\n ... on ResourceNotFoundError {\n message\n }\n }\n }\n"];
80
90
  export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
81
91
  export {};
@@ -14,6 +14,8 @@ const documents = {
14
14
  "\nquery GroupAccessLevels($groupId: GroupId!) {\n groupAccessLevels(\n input: { groupId: $groupId }\n ) {\n ... on GroupAccessLevelsResult {\n groupId\n accessLevels {\n ... on GroupAccessLevel {\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n}\n": types.GroupAccessLevelsDocument,
15
15
  "\n query RequestDefaults(\n $requestedResources: [RequestConfigurationResourceInput!]!\n $requestedGroups: [RequestConfigurationGroupInput!]!\n ) {\n requestDefaults(input: {\n requestedResources: $requestedResources,\n requestedGroups: $requestedGroups,\n }\n ) {\n ... on RequestDefaults {\n durationOptions {\n durationInMinutes\n label\n }\n recommendedDurationInMinutes\n defaultDurationInMinutes\n maxDurationInMinutes\n requireSupportTicket\n reasonOptional\n requesterIsAdmin\n }\n }\n }": types.RequestDefaultsDocument,
16
16
  "\n mutation CreateRequest(\n $requestedResources: [RequestedResourceInput!]!\n $requestedGroups: [RequestedGroupInput!]!\n $reason: String!\n $durationInMinutes: Int\n ) {\n createRequest(\n input: {\n requestedResources: $requestedResources\n requestedGroups: $requestedGroups\n reason: $reason\n durationInMinutes: $durationInMinutes\n }\n ) {\n ... on CreateRequestResult {\n request {\n id\n status\n }\n }\n ... on RequestDurationTooLargeError {\n message\n }\n ... on RequestRequiresUserAuthTokenForConnectionError {\n message\n }\n ... on NoReviewersSetForOwnerError {\n message\n ownerId\n }\n ... on NoReviewersSetForResourceError {\n message\n resourceId\n }\n ... on NoReviewersSetForGroupError {\n message\n groupId\n }\n ... on NoManagerSetForRequestingUserError {\n message\n }\n ... on MfaInvalidError {\n message\n }\n ... on BulkRequestTooLargeError {\n message\n }\n ... on ItemCannotBeRequestedError {\n message\n }\n ... on UserCannotRequestAccessForTargetGroupError {\n message\n groupId\n userId\n }\n ... on GroupNestingNotAllowedError {\n message\n fromGroupId\n toGroupId\n }\n ... on TargetUserHasNestedAccessError {\n message\n groupIds\n }\n ... on RequestReasonMissingError {\n message\n }\n ... on RequestFieldValueMissingError {\n message\n fieldName\n }\n ... on LinkedGroupNotRequestableError {\n message\n sourceGroupId\n groupBindingId\n }\n ... on RequestReasonBelowMinLengthError {\n message\n }\n\n }\n }\n": types.CreateRequestDocument,
17
+ "\n query GetCatalogItem($uuid: UUID!) {\n catalogItem(id: $uuid) {\n __typename\n ... on Connection {\n id\n displayName\n }\n ... on Resource {\n id\n displayName\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ...on Group {\n id\n name\n connection {\n id\n displayName\n }\n accessLevels{\n accessLevelName\n accessLevelRemoteId\n }\n }\n ... on UserFacingError {\n message\n }\n }\n }\n ": types.GetCatalogItemDocument,
18
+ "\n query GetAssociatedItems($resourceId: ResourceId!, $searchQuery: String) {\n resource(input: {\n id: $resourceId\n }) {\n __typename\n ... on ResourceResult {\n __typename\n resource {\n associatedItems(\n first: 200\n filters: {\n searchQuery: {\n contains: $searchQuery\n }\n access: REQUESTABLE\n endUserVisible: true\n entityType: {\n in: [GROUP, RESOURCE]\n }\n }\n ) {\n edges {\n __typename\n ... on ResourceAssociatedItemEdge {\n alias\n node {\n __typename\n id\n name\n ... on Resource {\n accessLevels(\n filters: {\n skipRemoteAccessLevels: false # azure app roles are remote\n }\n ) {\n __typename\n accessLevelName\n accessLevelRemoteId\n }\n }\n }\n }\n }\n }\n }\n }\n ... on ResourceNotFoundError {\n message\n }\n }\n }\n": types.GetAssociatedItemsDocument,
17
19
  };
18
20
  function graphql(source) {
19
21
  var _a;
@@ -11752,6 +11752,89 @@ export type CreateRequestMutation = {
11752
11752
  userId: string;
11753
11753
  };
11754
11754
  };
11755
+ export type GetCatalogItemQueryVariables = Exact<{
11756
+ uuid: Scalars["UUID"]["input"];
11757
+ }>;
11758
+ export type GetCatalogItemQuery = {
11759
+ __typename?: "Query";
11760
+ catalogItem: {
11761
+ __typename: "Connection";
11762
+ id: string;
11763
+ displayName: string;
11764
+ } | {
11765
+ __typename: "Group";
11766
+ id: string;
11767
+ name: string;
11768
+ connection?: {
11769
+ __typename?: "Connection";
11770
+ id: string;
11771
+ displayName: string;
11772
+ } | null;
11773
+ accessLevels?: Array<{
11774
+ __typename?: "GroupAccessLevel";
11775
+ accessLevelName: string;
11776
+ accessLevelRemoteId: string;
11777
+ }> | null;
11778
+ } | {
11779
+ __typename: "Resource";
11780
+ id: string;
11781
+ displayName: string;
11782
+ connection?: {
11783
+ __typename?: "Connection";
11784
+ id: string;
11785
+ displayName: string;
11786
+ } | null;
11787
+ accessLevels?: Array<{
11788
+ __typename?: "ResourceAccessLevel";
11789
+ accessLevelName: string;
11790
+ accessLevelRemoteId: string;
11791
+ }> | null;
11792
+ } | {
11793
+ __typename: "UserFacingError";
11794
+ message: string;
11795
+ };
11796
+ };
11797
+ export type GetAssociatedItemsQueryVariables = Exact<{
11798
+ resourceId: Scalars["ResourceId"]["input"];
11799
+ searchQuery?: InputMaybe<Scalars["String"]["input"]>;
11800
+ }>;
11801
+ export type GetAssociatedItemsQuery = {
11802
+ __typename?: "Query";
11803
+ resource: {
11804
+ __typename: "ResourceNotFoundError";
11805
+ message: string;
11806
+ } | {
11807
+ __typename: "ResourceResult";
11808
+ resource: {
11809
+ __typename?: "Resource";
11810
+ associatedItems: {
11811
+ __typename?: "AssociatedItemConnection";
11812
+ edges: Array<{
11813
+ __typename: "ConnectionAssociatedItemEdge";
11814
+ } | {
11815
+ __typename: "GroupAssociatedItemEdge";
11816
+ } | {
11817
+ __typename: "ResourceAssociatedItemEdge";
11818
+ alias?: string | null;
11819
+ node: {
11820
+ __typename: "Group";
11821
+ id: string;
11822
+ name: string;
11823
+ } | {
11824
+ __typename: "Resource";
11825
+ id: string;
11826
+ name: string;
11827
+ accessLevels?: Array<{
11828
+ __typename: "ResourceAccessLevel";
11829
+ accessLevelName: string;
11830
+ accessLevelRemoteId: string;
11831
+ }> | null;
11832
+ };
11833
+ }>;
11834
+ };
11835
+ };
11836
+ };
11837
+ };
11755
11838
  export declare const GetGroupDocument: DocumentNode<GetGroupQuery, GetGroupQueryVariables>;
11756
11839
  export declare const GetRequestDocument: DocumentNode<GetRequestQuery, GetRequestQueryVariables>;
11757
11840
  export declare const GetRequestsDocument: DocumentNode<GetRequestsQuery, GetRequestsQueryVariables>;
@@ -11762,3 +11845,5 @@ export declare const ResourceAccessLevelsDocument: DocumentNode<ResourceAccessLe
11762
11845
  export declare const GroupAccessLevelsDocument: DocumentNode<GroupAccessLevelsQuery, GroupAccessLevelsQueryVariables>;
11763
11846
  export declare const RequestDefaultsDocument: DocumentNode<RequestDefaultsQuery, RequestDefaultsQueryVariables>;
11764
11847
  export declare const CreateRequestDocument: DocumentNode<CreateRequestMutation, CreateRequestMutationVariables>;
11848
+ export declare const GetCatalogItemDocument: DocumentNode<GetCatalogItemQuery, GetCatalogItemQueryVariables>;
11849
+ export declare const GetAssociatedItemsDocument: DocumentNode<GetAssociatedItemsQuery, GetAssociatedItemsQueryVariables>;