@codiac.io/codiac-cli 1.2.164 → 1.2.165

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 @codiac.io/codiac-cli
22
22
  $ codiac COMMAND
23
23
  running command...
24
24
  $ codiac (--version|-v)
25
- @codiac.io/codiac-cli/1.2.164 linux-x64 node-v16.20.0
25
+ @codiac.io/codiac-cli/1.2.165 linux-x64 node-v16.20.0
26
26
  $ codiac --help [COMMAND]
27
27
  USAGE
28
28
  $ codiac COMMAND
@@ -77,6 +77,7 @@ USAGE
77
77
  * [`codiac cluster create [NAME]`](#codiac-cluster-create-name)
78
78
  * [`codiac cluster deinit [NAME]`](#codiac-cluster-deinit-name)
79
79
  * [`codiac cluster destroy [NAME]`](#codiac-cluster-destroy-name)
80
+ * [`codiac cluster forget`](#codiac-cluster-forget)
80
81
  * [`codiac cluster grant [NAME]`](#codiac-cluster-grant-name)
81
82
  * [`codiac cluster init [NAME]`](#codiac-cluster-init-name)
82
83
  * [`codiac cluster list`](#codiac-cluster-list)
@@ -149,6 +150,7 @@ USAGE
149
150
  * [`codiac noc cluster create [NAME]`](#codiac-noc-cluster-create-name)
150
151
  * [`codiac noc cluster deinit [NAME]`](#codiac-noc-cluster-deinit-name)
151
152
  * [`codiac noc cluster destroy [NAME]`](#codiac-noc-cluster-destroy-name)
153
+ * [`codiac noc cluster forget`](#codiac-noc-cluster-forget)
152
154
  * [`codiac noc cluster grant [NAME]`](#codiac-noc-cluster-grant-name)
153
155
  * [`codiac noc cluster init [NAME]`](#codiac-noc-cluster-init-name)
154
156
  * [`codiac noc cluster list`](#codiac-noc-cluster-list)
@@ -1008,7 +1010,7 @@ DESCRIPTION
1008
1010
  Creates a new branch for the parent project and any sourced dependencies.
1009
1011
  ```
1010
1012
 
1011
- _See code: [src/commands/branch.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/branch.ts)_
1013
+ _See code: [src/commands/branch.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/branch.ts)_
1012
1014
 
1013
1015
  ## `codiac branch current`
1014
1016
 
@@ -1133,7 +1135,7 @@ DESCRIPTION
1133
1135
  Builds the project and the docker container
1134
1136
  ```
1135
1137
 
1136
- _See code: [src/commands/build.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/build.ts)_
1138
+ _See code: [src/commands/build.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/build.ts)_
1137
1139
 
1138
1140
  ## `codiac cab create [CABINET]`
1139
1141
 
@@ -1427,7 +1429,7 @@ DESCRIPTION
1427
1429
  Applies settings to the Codiac CLI itself (scoped to the local machine).
1428
1430
  ```
1429
1431
 
1430
- _See code: [src/commands/cli.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/cli.ts)_
1432
+ _See code: [src/commands/cli.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/cli.ts)_
1431
1433
 
1432
1434
  ## `codiac cluster create [NAME]`
1433
1435
 
@@ -1521,6 +1523,30 @@ ALIASES
1521
1523
  $ codiac cluster destroy
1522
1524
  ```
1523
1525
 
1526
+ ## `codiac cluster forget`
1527
+
1528
+ Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster. You must remove all cabinets and environments in a cluster before forgetting it.
1529
+
1530
+ ```
1531
+ USAGE
1532
+ $ codiac cluster forget [-y -n <value> -p azure|aws|dockerHub|other]
1533
+
1534
+ FLAGS
1535
+ -n, --name=<value> Name of the cluster.
1536
+ -p, --provider=<option> Code for the cloud service provider.
1537
+ <options: azure|aws|dockerHub|other>
1538
+ -y, --silent (Optional: defaults to false) Prevents confirmations of user-values. Required: ["name",
1539
+ "provider"]
1540
+
1541
+ DESCRIPTION
1542
+ Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the
1543
+ cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster.
1544
+ You must remove all cabinets and environments in a cluster before forgetting it.
1545
+
1546
+ ALIASES
1547
+ $ codiac cluster forget
1548
+ ```
1549
+
1524
1550
  ## `codiac cluster grant [NAME]`
1525
1551
 
1526
1552
  (AWS Only) Provides cluster access to the given user.
@@ -1644,7 +1670,7 @@ DESCRIPTION
1644
1670
  Commits the currently staged changes on the current branch of the main project and on any sourced dependencies.
1645
1671
  ```
1646
1672
 
1647
- _See code: [src/commands/commit.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/commit.ts)_
1673
+ _See code: [src/commands/commit.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/commit.ts)_
1648
1674
 
1649
1675
  ## `codiac config add [SETTING]`
1650
1676
 
@@ -1904,7 +1930,7 @@ DESCRIPTION
1904
1930
  Installs a package into current project.
1905
1931
  ```
1906
1932
 
1907
- _See code: [src/commands/dep.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/dep.ts)_
1933
+ _See code: [src/commands/dep.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/dep.ts)_
1908
1934
 
1909
1935
  ## `codiac dep create [URL]`
1910
1936
 
@@ -2139,7 +2165,7 @@ DESCRIPTION
2139
2165
  Deploys a given asset to a given cabinet. Defaults to current version.
2140
2166
  ```
2141
2167
 
2142
- _See code: [src/commands/deploy.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/deploy.ts)_
2168
+ _See code: [src/commands/deploy.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/deploy.ts)_
2143
2169
 
2144
2170
  ## `codiac domain map [DOMAIN]`
2145
2171
 
@@ -2552,7 +2578,7 @@ ALIASES
2552
2578
  $ codiac token
2553
2579
  ```
2554
2580
 
2555
- _See code: [src/commands/identity.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/identity.ts)_
2581
+ _See code: [src/commands/identity.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/identity.ts)_
2556
2582
 
2557
2583
  ## `codiac identity delete [NAME]`
2558
2584
 
@@ -3349,7 +3375,7 @@ DESCRIPTION
3349
3375
  Declares the given folder as a project root
3350
3376
  ```
3351
3377
 
3352
- _See code: [src/commands/init.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/init.ts)_
3378
+ _See code: [src/commands/init.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/init.ts)_
3353
3379
 
3354
3380
  ## `codiac kit create [SETTING]`
3355
3381
 
@@ -3409,7 +3435,7 @@ ALIASES
3409
3435
  $ codiac user login
3410
3436
  ```
3411
3437
 
3412
- _See code: [src/commands/login.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/login.ts)_
3438
+ _See code: [src/commands/login.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/login.ts)_
3413
3439
 
3414
3440
  ## `codiac logout`
3415
3441
 
@@ -3426,7 +3452,7 @@ EXAMPLES
3426
3452
  $ codiac logout
3427
3453
  ```
3428
3454
 
3429
- _See code: [src/commands/logout.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/logout.ts)_
3455
+ _See code: [src/commands/logout.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/logout.ts)_
3430
3456
 
3431
3457
  ## `codiac merge [BRANCH]`
3432
3458
 
@@ -3447,7 +3473,7 @@ DESCRIPTION
3447
3473
  Merges the given branch into the current branch of the main project and on any sourced dependencies.
3448
3474
  ```
3449
3475
 
3450
- _See code: [src/commands/merge.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/merge.ts)_
3476
+ _See code: [src/commands/merge.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/merge.ts)_
3451
3477
 
3452
3478
  ## `codiac noc cluster create [NAME]`
3453
3479
 
@@ -3541,6 +3567,30 @@ ALIASES
3541
3567
  $ codiac cluster destroy
3542
3568
  ```
3543
3569
 
3570
+ ## `codiac noc cluster forget`
3571
+
3572
+ Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster. You must remove all cabinets and environments in a cluster before forgetting it.
3573
+
3574
+ ```
3575
+ USAGE
3576
+ $ codiac noc cluster forget [-y -n <value> -p azure|aws|dockerHub|other]
3577
+
3578
+ FLAGS
3579
+ -n, --name=<value> Name of the cluster.
3580
+ -p, --provider=<option> Code for the cloud service provider.
3581
+ <options: azure|aws|dockerHub|other>
3582
+ -y, --silent (Optional: defaults to false) Prevents confirmations of user-values. Required: ["name",
3583
+ "provider"]
3584
+
3585
+ DESCRIPTION
3586
+ Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the
3587
+ cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster.
3588
+ You must remove all cabinets and environments in a cluster before forgetting it.
3589
+
3590
+ ALIASES
3591
+ $ codiac cluster forget
3592
+ ```
3593
+
3544
3594
  ## `codiac noc cluster grant [NAME]`
3545
3595
 
3546
3596
  (AWS Only) Provides cluster access to the given user.
@@ -3771,7 +3821,7 @@ DESCRIPTION
3771
3821
  Starts the codiac relay services, maintains container instance, and opens the web app.
3772
3822
  ```
3773
3823
 
3774
- _See code: [src/commands/portal.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/portal.ts)_
3824
+ _See code: [src/commands/portal.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/portal.ts)_
3775
3825
 
3776
3826
  ## `codiac publish [NAME]`
3777
3827
 
@@ -3804,7 +3854,7 @@ DESCRIPTION
3804
3854
  Publishes the exports (packages and images) declared in the ProjectConfig.
3805
3855
  ```
3806
3856
 
3807
- _See code: [src/commands/publish.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/publish.ts)_
3857
+ _See code: [src/commands/publish.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/publish.ts)_
3808
3858
 
3809
3859
  ## `codiac pull [NAME]`
3810
3860
 
@@ -3828,7 +3878,7 @@ DESCRIPTION
3828
3878
  Pulls all commits from upstream to local.
3829
3879
  ```
3830
3880
 
3831
- _See code: [src/commands/pull.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/pull.ts)_
3881
+ _See code: [src/commands/pull.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/pull.ts)_
3832
3882
 
3833
3883
  ## `codiac pullsecret`
3834
3884
 
@@ -3911,7 +3961,7 @@ DESCRIPTION
3911
3961
  Pushes all local commits upstream.
3912
3962
  ```
3913
3963
 
3914
- _See code: [src/commands/push.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/push.ts)_
3964
+ _See code: [src/commands/push.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/push.ts)_
3915
3965
 
3916
3966
  ## `codiac run`
3917
3967
 
@@ -3953,7 +4003,7 @@ DESCRIPTION
3953
4003
  Runs the latest build of the api container locally.
3954
4004
  ```
3955
4005
 
3956
- _See code: [src/commands/run.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/run.ts)_
4006
+ _See code: [src/commands/run.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/run.ts)_
3957
4007
 
3958
4008
  ## `codiac secretStore`
3959
4009
 
@@ -4054,7 +4104,7 @@ DESCRIPTION
4054
4104
  Flags files to be included in the next commit.
4055
4105
  ```
4056
4106
 
4057
- _See code: [src/commands/stage.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/stage.ts)_
4107
+ _See code: [src/commands/stage.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/stage.ts)_
4058
4108
 
4059
4109
  ## `codiac stash [FILE]`
4060
4110
 
@@ -4076,7 +4126,7 @@ DESCRIPTION
4076
4126
  describe the command here
4077
4127
  ```
4078
4128
 
4079
- _See code: [src/commands/stash.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/stash.ts)_
4129
+ _See code: [src/commands/stash.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/stash.ts)_
4080
4130
 
4081
4131
  ## `codiac status`
4082
4132
 
@@ -4095,7 +4145,7 @@ DESCRIPTION
4095
4145
  Shows the current uncommitted changes in the current branch.
4096
4146
  ```
4097
4147
 
4098
- _See code: [src/commands/status.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/status.ts)_
4148
+ _See code: [src/commands/status.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/status.ts)_
4099
4149
 
4100
4150
  ## `codiac stop`
4101
4151
 
@@ -4113,7 +4163,7 @@ DESCRIPTION
4113
4163
  Stops the running container for this project
4114
4164
  ```
4115
4165
 
4116
- _See code: [src/commands/stop.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/stop.ts)_
4166
+ _See code: [src/commands/stop.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/stop.ts)_
4117
4167
 
4118
4168
  ## `codiac switch [NAME]`
4119
4169
 
@@ -4133,7 +4183,7 @@ DESCRIPTION
4133
4183
  Changes branch on the main project and any sourced dependencies.
4134
4184
  ```
4135
4185
 
4136
- _See code: [src/commands/switch.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/switch.ts)_
4186
+ _See code: [src/commands/switch.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/switch.ts)_
4137
4187
 
4138
4188
  ## `codiac sync [NAME]`
4139
4189
 
@@ -4158,7 +4208,7 @@ DESCRIPTION
4158
4208
  Merges the given branch into the current branch.
4159
4209
  ```
4160
4210
 
4161
- _See code: [src/commands/sync.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/sync.ts)_
4211
+ _See code: [src/commands/sync.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/sync.ts)_
4162
4212
 
4163
4213
  ## `codiac tenant create [NAME]`
4164
4214
 
@@ -4340,7 +4390,7 @@ DESCRIPTION
4340
4390
  Flags files to be included in the next commit.
4341
4391
  ```
4342
4392
 
4343
- _See code: [src/commands/unstage.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/unstage.ts)_
4393
+ _See code: [src/commands/unstage.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/unstage.ts)_
4344
4394
 
4345
4395
  ## `codiac update [CHANNEL]`
4346
4396
 
@@ -4377,7 +4427,7 @@ EXAMPLES
4377
4427
  $ codiac update --available
4378
4428
  ```
4379
4429
 
4380
- _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.1.17/src/commands/update.ts)_
4430
+ _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.1.18/src/commands/update.ts)_
4381
4431
 
4382
4432
  ## `codiac user login`
4383
4433
 
@@ -4461,7 +4511,7 @@ DESCRIPTION
4461
4511
  Renders the current cabinet context the image project is pointed to. ie: Tenant, Enterprise, Environment, Cabinet.
4462
4512
  ```
4463
4513
 
4464
- _See code: [src/commands/whereami.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/whereami.ts)_
4514
+ _See code: [src/commands/whereami.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/whereami.ts)_
4465
4515
 
4466
4516
  ## `codiac whoami`
4467
4517
 
@@ -4478,5 +4528,5 @@ ALIASES
4478
4528
  $ codiac user show
4479
4529
  ```
4480
4530
 
4481
- _See code: [src/commands/whoami.ts](https://github.com/codiac/codiac-cli/blob/v1.2.164/src/commands/whoami.ts)_
4531
+ _See code: [src/commands/whoami.ts](https://github.com/codiac/codiac-cli/blob/v1.2.165/src/commands/whoami.ts)_
4482
4532
  <!-- commandsstop -->
@@ -0,0 +1,16 @@
1
+ import { CommandBaseEnterprise } from '../../../command-base-enterprise';
2
+ export default class NocClusterForget extends CommandBaseEnterprise {
3
+ static description: string;
4
+ static aliases: string[];
5
+ static flags: {
6
+ name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ provider: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static args: {};
11
+ protected bootstrap(): void;
12
+ run(): Promise<void>;
13
+ private promptForCluster;
14
+ /** Renders a user-friendly cluster description. */
15
+ private describe;
16
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const codiac_domain_1 = require("@codiac.io/codiac-domain");
5
+ const codiac_ops_common_1 = require("@codiac.io/codiac-ops-common");
6
+ const core_1 = require("@oclif/core");
7
+ const _ = require("lodash");
8
+ const command_base_enterprise_1 = require("../../../command-base-enterprise");
9
+ class NocClusterForget extends command_base_enterprise_1.CommandBaseEnterprise {
10
+ bootstrap() {
11
+ super.bootstrap();
12
+ }
13
+ run() {
14
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+ return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ var _a;
17
+ try {
18
+ this.bootstrap();
19
+ const { args, flags } = yield this.parse(NocClusterForget);
20
+ (_a = this._relayContainer) === null || _a === void 0 ? void 0 : _a.ready$.subscribe(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ if (flags.silent)
22
+ this.__ui = new codiac_ops_common_1.ThrowingUserInputProvider(this.logger); // <--- Isnt this built into the command base somewhere?
23
+ this._userCntx = yield this.establishTenantContext(this._userCntx);
24
+ let provider = flags.provider ? codiac_domain_1.CloudProviderEnum[flags.provider] : undefined;
25
+ let cluster = yield this.promptForCluster(flags.name, provider, flags.silent);
26
+ // Perform the delete...
27
+ if (cluster) {
28
+ this._ui.startSpinner(`Forgetting ${cluster.provider} cluster: ${this._styler.hilite(cluster.name)}...`);
29
+ let result = yield this._codiacApi.ClusterDef.tryDelete({ id: cluster.id }, {});
30
+ this._ui.stopSpinner(result.success ? "SUCCESS" : "FAILED");
31
+ let msg = `Cluster forget ${result.success ? this._styler.colorGood("SUCCESS") : this._styler.colorCritical("FAILED")}: ${result.message || ""}`;
32
+ this.logger.debug(msg, result);
33
+ this._ui.userMessage(msg);
34
+ }
35
+ resolve();
36
+ }));
37
+ }
38
+ catch (err) {
39
+ reject(err);
40
+ }
41
+ }));
42
+ });
43
+ }
44
+ promptForCluster(name, provider, silent) {
45
+ var _a;
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ try {
48
+ // // Use the rootMap to determine if the slected cluster has any child envs or cabs
49
+ // let rootMapResult = await this._codiacApi.Call.getRootMap({ all: true }, {});
50
+ // if (rootMapResult.error) throw new Error(`Error loading entities: ${rootMapResult.message ?? rootMapResult.error.message}`);
51
+ // if (rootMapResult.output == undefined) throw new Error(`Error enterprise entities: empty root map.`);
52
+ // let rootMap = rootMapResult.output;
53
+ // this.logger.trace("rootmap", rootMap);
54
+ // Get the list of clusters
55
+ let cluster;
56
+ let readResult = yield this._codiacApi.ClusterDef.tryReadMany({ all: true }, { projection: { pathsIncluded: ["id", "name", "provider", "locationName", "instance", "modified", "modifiedBy"], pathsExcluded: [] } });
57
+ let clusterDefs = (_a = readResult.output) !== null && _a !== void 0 ? _a : [];
58
+ clusterDefs = _.orderBy(clusterDefs, c => c.name);
59
+ if (provider) {
60
+ clusterDefs = clusterDefs.filter(c => c.provider == provider);
61
+ }
62
+ if (readResult.error == undefined && (clusterDefs == undefined || clusterDefs.length === 0)) {
63
+ this._ui.userMessage("No clusters found");
64
+ }
65
+ else {
66
+ clusterDefs = clusterDefs.filter(c => c.instance == undefined); // we can only forget clusters that DO NOT have an instance
67
+ if (readResult.error == undefined && clusterDefs.length === 0) {
68
+ this._ui.userMessage("No clusters exist without instances");
69
+ }
70
+ else if (silent === true) {
71
+ cluster = clusterDefs.find(c => c.name === name && c.provider === provider);
72
+ if (cluster == undefined) {
73
+ // this._ui.userMessage("No clusters found with the given name and provider"); // no need to throw here
74
+ throw new Error("No clusters found with the given name and provider"); // fail loudly when silent?
75
+ }
76
+ }
77
+ else {
78
+ let candidate = {};
79
+ if (name)
80
+ candidate.name = name;
81
+ let confirm = false;
82
+ do {
83
+ if (readResult.error) {
84
+ // if there is a problem with the cluster record, it may prevent a good read,
85
+ // so we're going to allow the user to invoke the operation nonetheless.
86
+ let allPvds = this.cspUiFactory.getAllProviders(this.ioc);
87
+ const csp = yield this.cspContextualizer.promptForCloudProvider(allPvds, undefined);
88
+ const name = (yield this._ui.prompt("clusterName", "Enter name of the cluster to forget:", true));
89
+ cluster = { name: name, provider: csp, modified: new Date(Date.now()), modifiedBy: "unknown" };
90
+ }
91
+ else { // if (readResult.success && readResult.output && readResult.output.length > 0) {
92
+ let found = (candidate.name) ? clusterDefs.find(c => c.name === candidate.name) : undefined;
93
+ if (found) {
94
+ cluster = found;
95
+ }
96
+ else {
97
+ let choices = clusterDefs
98
+ .map(c => { return { name: this.describe(c), value: c.name }; });
99
+ const name = (yield this._ui.promptSelect("clusterName", "Select the cluster to forget:", choices));
100
+ cluster = (clusterDefs.find(c => c.name === name));
101
+ }
102
+ }
103
+ confirm = yield this._ui.promptConfirm("confirmForget", `Forget the cluster: ${this._styler.hilite(this.describe(cluster))} ? `, false);
104
+ if (!confirm)
105
+ candidate = {}; // if cluster was set as a cmd flag, but they denied the confirm, this allows selecting a different one.
106
+ } while (confirm !== true);
107
+ }
108
+ }
109
+ return cluster;
110
+ }
111
+ catch (err) {
112
+ throw err;
113
+ }
114
+ });
115
+ }
116
+ /** Renders a user-friendly cluster description. */
117
+ describe(cluster) {
118
+ var _a;
119
+ const UTF8_HEART = "\u2665";
120
+ let dim1 = ` (${cluster.provider}, ${cluster.locationName}${_.isEmpty(cluster.instance) ? "" : ", " + UTF8_HEART})`;
121
+ let dim2 = ` (${new Date((_a = cluster.modified) !== null && _a !== void 0 ? _a : "").toLocaleDateString()}, by ${cluster.modifiedBy})`;
122
+ return `${cluster.name} ${this._styler.dim(dim1)} ${this._styler.dim(dim2)}`;
123
+ }
124
+ }
125
+ exports.default = NocClusterForget;
126
+ NocClusterForget.description = "Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster. You must remove all cabinets and environments in a cluster before forgetting it.";
127
+ // static examples = [
128
+ // '<%= config.bin %> <%= command.id %>',
129
+ // ]
130
+ NocClusterForget.aliases = ["cluster:forget"];
131
+ NocClusterForget.flags = {
132
+ name: core_1.Flags.string({ char: 'n', required: false, description: 'Name of the cluster.' }),
133
+ provider: core_1.Flags.string({ char: 'p', options: Object.keys(codiac_domain_1.CloudProviderEnum), required: false, description: 'Code for the cloud service provider.' }),
134
+ silent: core_1.Flags.boolean({ char: 'y', dependsOn: ["name", "provider"], required: false, description: `(Optional: defaults to false) Prevents confirmations of user-values. Required: ["name", "provider"]` })
135
+ };
136
+ NocClusterForget.args = {};
137
+ //# sourceMappingURL=forget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forget.js","sourceRoot":"","sources":["../../../../src/commands/noc/cluster/forget.ts"],"names":[],"mappings":";;;AACA,4DAA6D;AAC7D,oEAAyE;AACzE,sCAAkD;AAClD,4BAA6B;AAE7B,8EAAwE;AAExE,MAAqB,gBAAiB,SAAQ,+CAAqB;IAmBvD,SAAS;QACjB,KAAK,CAAC,SAAS,EAAE,CAAC;IACpB,CAAC;IAGY,GAAG;;YACd,OAAO,IAAI,OAAO,CAAO,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;;gBACjD,IAAI;oBACF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACjB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;oBAC1D,MAAA,IAAI,CAAC,eAAe,0CAAE,MAAM,CACzB,SAAS,CAAC,GAAS,EAAE;wBACpB,IAAI,KAAK,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AAE,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,qGAAqG,EAAE,CAAC;CAC3M,CAAA;AAEM,qBAAI,GAAG,EACb,CAAA"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.164",
2
+ "version": "1.2.165",
3
3
  "commands": {
4
4
  "branch": {
5
5
  "id": "branch",
@@ -5129,6 +5129,54 @@
5129
5129
  "name"
5130
5130
  ]
5131
5131
  },
5132
+ "noc:cluster:forget": {
5133
+ "id": "noc:cluster:forget",
5134
+ "description": "Permanently removes the record of a cluster. This command does NOT affect any infrastructure; it simply removes the cluster from the Codiac consciousness. Use `cod cluster capture` to re-acquire an existing but forgotten cluster. You must remove all cabinets and environments in a cluster before forgetting it.",
5135
+ "strict": true,
5136
+ "pluginName": "@codiac.io/codiac-cli",
5137
+ "pluginAlias": "@codiac.io/codiac-cli",
5138
+ "pluginType": "core",
5139
+ "aliases": [
5140
+ "cluster:forget"
5141
+ ],
5142
+ "flags": {
5143
+ "name": {
5144
+ "name": "name",
5145
+ "type": "option",
5146
+ "char": "n",
5147
+ "description": "Name of the cluster.",
5148
+ "required": false,
5149
+ "multiple": false
5150
+ },
5151
+ "provider": {
5152
+ "name": "provider",
5153
+ "type": "option",
5154
+ "char": "p",
5155
+ "description": "Code for the cloud service provider.",
5156
+ "required": false,
5157
+ "multiple": false,
5158
+ "options": [
5159
+ "azure",
5160
+ "aws",
5161
+ "dockerHub",
5162
+ "other"
5163
+ ]
5164
+ },
5165
+ "silent": {
5166
+ "name": "silent",
5167
+ "type": "boolean",
5168
+ "char": "y",
5169
+ "description": "(Optional: defaults to false) Prevents confirmations of user-values. Required: [\"name\", \"provider\"]",
5170
+ "required": false,
5171
+ "allowNo": false,
5172
+ "dependsOn": [
5173
+ "name",
5174
+ "provider"
5175
+ ]
5176
+ }
5177
+ },
5178
+ "args": {}
5179
+ },
5132
5180
  "noc:cluster:grant": {
5133
5181
  "id": "noc:cluster:grant",
5134
5182
  "description": "(AWS Only) Provides cluster access to the given user.",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codiac.io/codiac-cli",
3
3
  "description": "Local command line interface for registering and maintaining enterprise assets and pipelines",
4
- "version": "1.2.164",
4
+ "version": "1.2.165",
5
5
  "author": "Codiac",
6
6
  "bin": {
7
7
  "codiac": "./bin/run",