diff --git a/packages/cli/package.json b/packages/cli/package.json index 4c5bcb67aa..9bff0aa5b2 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -11,11 +11,9 @@ "@heroku-cli/command-v9": "npm:@heroku-cli/command@^9.0.2", "@heroku-cli/notifications": "^1.2.4", "@heroku-cli/plugin-certs-v5": "^9.0.0-alpha.0", - "@heroku-cli/plugin-ci-v5": "^9.0.0-alpha.0", "@heroku-cli/plugin-ps": "^8.1.7", "@heroku-cli/plugin-ps-exec": "^2.4.0", "@heroku-cli/plugin-run": "8.1.4", - "@heroku-cli/plugin-spaces": "^9.0.0-alpha.0", "@heroku-cli/schema": "^1.0.25", "@heroku/buildpack-registry": "^1.0.1", "@heroku/eventsource": "^1.0.7", @@ -183,7 +181,6 @@ "@oclif/plugin-legacy", "@heroku-cli/plugin-certs-v5", "@heroku-cli/plugin-ps-exec", - "@heroku-cli/plugin-spaces", "@oclif/plugin-commands", "@oclif/plugin-help", "@oclif/plugin-not-found", diff --git a/packages/cli/src/commands/spaces/vpn/connections.ts b/packages/cli/src/commands/spaces/vpn/connections.ts new file mode 100644 index 0000000000..7652c48227 --- /dev/null +++ b/packages/cli/src/commands/spaces/vpn/connections.ts @@ -0,0 +1,66 @@ +import {Command, flags} from '@heroku-cli/command' +import {ux} from '@oclif/core' +import * as Heroku from '@heroku-cli/schema' +import heredoc from 'tsheredoc' +import {displayVPNStatus} from '../../../lib/spaces/format' + +type VpnConnectionTunnels = Required['tunnels'] + +export default class Connections extends Command { + static topic = 'spaces' + static description = 'list the VPN Connections for a space' + static example = heredoc` + $ heroku spaces:vpn:connections --space my-space + === my-space VPN Connections + Name Status Tunnels + ────── ────── ─────── + office active UP/UP + ` + static flags = { + space: flags.string({char: 's', description: 'space to get VPN connections from', required: true}), + json: flags.boolean({description: 'output in json format'}), + } + + public async run(): Promise { + const {flags} = await this.parse(Connections) + const {space, json} = flags + const {body: connections} = await this.heroku.get[]>(`/spaces/${space}/vpn-connections`) + this.render(space, connections, json) + } + + protected render(space: string, connections: Required[], json: boolean) { + if (json) { + ux.styledJSON(connections) + } else { + this.displayVPNConnections(space, connections) + } + } + + protected displayVPNConnections(space: string, connections: Required[]) { + if (connections.length === 0) { + ux.log('No VPN Connections have been created yet') + return + } + + ux.styledHeader(`${space} VPN Connections`) + + ux.table( + connections, + { + Name: { + get: c => c.name || c.id, + }, + Status: { + get: c => displayVPNStatus(c.status), + }, + Tunnels: { + get: c => this.tunnelFormat(c.tunnels), + }, + }, + ) + } + + protected tunnelFormat(t: VpnConnectionTunnels) { + return t.map(tunnel => displayVPNStatus(tunnel.status)).join('/') + } +} diff --git a/packages/cli/src/lib/spaces/format.ts b/packages/cli/src/lib/spaces/format.ts index c62eb7fd34..6a5720caae 100644 --- a/packages/cli/src/lib/spaces/format.ts +++ b/packages/cli/src/lib/spaces/format.ts @@ -15,6 +15,8 @@ export function hostStatus(s: string) { return `${color.red(s)}` case 'released': return `${color.gray(s)}` + default: + return s } } @@ -29,6 +31,9 @@ export function peeringStatus(s: string) { case 'failed': case 'deleted': case 'rejected': + return `${color.red(s)}` + default: + return s } } diff --git a/packages/cli/test/unit/commands/spaces/vpn/connections.unit.test.ts b/packages/cli/test/unit/commands/spaces/vpn/connections.unit.test.ts new file mode 100644 index 0000000000..beb53628e2 --- /dev/null +++ b/packages/cli/test/unit/commands/spaces/vpn/connections.unit.test.ts @@ -0,0 +1,113 @@ +import {stdout} from 'stdout-stderr' +import Cmd from '../../../../../src/commands/spaces/vpn/connections' +import runCommand from '../../../../helpers/runCommand' +import * as nock from 'nock' +import {expect} from 'chai' +import heredoc from 'tsheredoc' + +describe('spaces:vpn:connections', function () { + afterEach(function () { + nock.cleanAll() + }) + + const space = { + id: '123456789012', + name: 'office', + public_ip: '35.161.69.30', + routable_cidrs: [ + '172.16.0.0/16', + ], + ike_version: 1, + space_cidr_block: '10.0.0.0/16', + status: 'active', + status_message: 'Active', + tunnels: [ + { + last_status_change: '2016-10-25T22:10:05Z', + ip: '52.44.146.197', + customer_ip: '52.44.146.197', + pre_shared_key: 'secret', + status: 'UP', + status_message: 'status message', + }, + { + last_status_change: '2016-10-25T22:09:05Z', + ip: '52.44.146.196', + customer_ip: '52.44.146.196', + pre_shared_key: 'secret', + status: 'UP', + status_message: 'status message', + }, + ], + } + + it('displays no connection message if none exist', async function () { + const api = nock('https://api.heroku.com') + .get('/spaces/my-space/vpn-connections') + .reply(200, []) + + await runCommand(Cmd, [ + '--space', + 'my-space', + ]) + + api.done() + expect(stdout.output).to.eq('No VPN Connections have been created yet\n') + }) + + it('displays VPN Connections', async function () { + const api = nock('https://api.heroku.com') + .get('/spaces/my-space/vpn-connections') + .reply(200, [space]) + + await runCommand(Cmd, [ + '--space', + 'my-space', + ]) + + api.done() + expect(stdout.output).to.eq(heredoc` + === my-space VPN Connections + + Name Status Tunnels + ────── ────── ─────── + office active UP/UP + `) + }) + + it('displays VPN Connection ID when name is unavailable', async function () { + const conn = {...space, name: ''} + const api = nock('https://api.heroku.com') + .get('/spaces/my-space/vpn-connections') + .reply(200, [conn]) + + await runCommand(Cmd, [ + '--space', + 'my-space', + ]) + + api.done() + expect(stdout.output).to.eq(heredoc` + === my-space VPN Connections + + Name Status Tunnels + ──────────── ────── ─────── + 123456789012 active UP/UP + `) + }) + + it('displays VPN Connections in JSON', async function () { + const api = nock('https://api.heroku.com') + .get('/spaces/my-space/vpn-connections') + .reply(200, [space]) + + await runCommand(Cmd, [ + '--space', + 'my-space', + '--json', + ]) + + api.done() + expect(JSON.parse(stdout.output)).to.eql([space]) + }) +}) diff --git a/packages/cli/test/unit/lib/spaces/format.unit.test.ts b/packages/cli/test/unit/lib/spaces/format.unit.test.ts new file mode 100644 index 0000000000..3eeb6dc484 --- /dev/null +++ b/packages/cli/test/unit/lib/spaces/format.unit.test.ts @@ -0,0 +1,56 @@ +import {expect} from 'chai' +import {displayCIDR, hostStatus, peeringStatus, displayVPNStatus} from '../../../../src/lib/spaces/format' + +describe('displayCIDR', function () { + it('formats an array of cidrs', function () { + return expect(displayCIDR(['a', 'b'])).to.eq('a, b') + }) + + it('formats an array with a single cidr', function () { + return expect(displayCIDR(['a'])).to.eq('a') + }) + + it('returns empty string if cidr has no value', function () { + // eslint-disable-next-line unicorn/no-useless-undefined + return expect(displayCIDR(undefined)).to.eq('') + }) +}) + +describe('hostStatus', function () { + it('returns ANSI colorized host status if status meets switch statement condition, uncolorized value if it does not', function () { + expect(hostStatus('available')).to.eq('\u001B[32mavailable\u001B[39m') + expect(hostStatus('under-assessment')).to.eq('\u001B[33munder-assessment\u001B[39m') + expect(hostStatus('permanent-failure')).to.eq('\u001B[31mpermanent-failure\u001B[39m') + expect(hostStatus('released-permanent-failure')).to.eq('\u001B[31mreleased-permanent-failure\u001B[39m') + expect(hostStatus('released')).to.eq('\u001B[2mreleased\u001B[22m') + expect(hostStatus('foo')).to.eq('foo') + }) +}) + +describe('displayVPNStatus', function () { + it('returns ANSI colorized VPN status if status meets switch statement condition, uncolorized value if it does not', function () { + expect(displayVPNStatus('UP')).to.eq('\u001B[32mUP\u001B[39m') + expect(displayVPNStatus('available')).to.eq('\u001B[32mavailable\u001B[39m') + expect(displayVPNStatus('pending')).to.eq('\u001B[33mpending\u001B[39m') + expect(displayVPNStatus('provisioning')).to.eq('\u001B[33mprovisioning\u001B[39m') + expect(displayVPNStatus('deprovisioning')).to.eq('\u001B[33mdeprovisioning\u001B[39m') + expect(displayVPNStatus('DOWN')).to.eq('\u001B[31mDOWN\u001B[39m') + expect(displayVPNStatus('deleting')).to.eq('\u001B[31mdeleting\u001B[39m') + expect(displayVPNStatus('deleted')).to.eq('\u001B[31mdeleted\u001B[39m') + expect(displayVPNStatus('foo')).to.eq('foo') + }) +}) + +describe('peeringStatus', function () { + it('returns ANSI colorized peering status if status meets switch statement condition, uncolorized value if it does not', function () { + expect(peeringStatus('active')).to.eq('\u001B[32mactive\u001B[39m') + expect(peeringStatus('pending-acceptance')).to.eq('\u001B[33mpending-acceptance\u001B[39m') + expect(peeringStatus('provisioning')).to.eq('\u001B[33mprovisioning\u001B[39m') + expect(peeringStatus('expired')).to.eq('\u001B[31mexpired\u001B[39m') + expect(peeringStatus('failed')).to.eq('\u001B[31mfailed\u001B[39m') + expect(peeringStatus('deleted')).to.eq('\u001B[31mdeleted\u001B[39m') + expect(peeringStatus('rejected')).to.eq('\u001B[31mrejected\u001B[39m') + expect(peeringStatus('foo')).to.eq('foo') + }) +}) + diff --git a/packages/spaces/.gitignore b/packages/spaces/.gitignore deleted file mode 100644 index 1fd04daf2e..0000000000 --- a/packages/spaces/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -coverage -.nyc_output diff --git a/packages/spaces/.npmignore b/packages/spaces/.npmignore deleted file mode 100644 index db8d505a2c..0000000000 --- a/packages/spaces/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -.codeclimate.yml -.npmignore -.nyc_output -circle.yml -test -yarn.lock diff --git a/packages/spaces/CHANGELOG.md b/packages/spaces/CHANGELOG.md deleted file mode 100644 index 57769506a2..0000000000 --- a/packages/spaces/CHANGELOG.md +++ /dev/null @@ -1,622 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [9.0.0-alpha.1](https://github.com/heroku/cli/compare/v8.7.1...v9.0.0-alpha.1) (2023-11-09) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [8.7.1](https://github.com/heroku/cli/compare/v8.7.0...v8.7.1) (2023-11-06) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -# [8.6.0](https://github.com/heroku/cli/compare/v8.5.0...v8.6.0) (2023-10-16) - - -### Bug Fixes - -* run lint after every test. ([#2490](https://github.com/heroku/cli/issues/2490)) ([d4db466](https://github.com/heroku/cli/commit/d4db46648baef355f9e362679fca827591f037c1)) - - - - - -# [8.4.0](https://github.com/heroku/cli/compare/v8.3.1...v8.4.0) (2023-08-23) - - -### Reverts - -* Revert "Revert "refactor: add per hour and max price per month to pricing displays"" (#2448) ([dd535a5](https://github.com/heroku/cli/commit/dd535a506e781e24b48208dcb666947a201460ba)), closes [#2448](https://github.com/heroku/cli/issues/2448) [#2439](https://github.com/heroku/cli/issues/2439) [#2447](https://github.com/heroku/cli/issues/2447) - - - - - -# [8.2.0](https://github.com/heroku/cli/compare/v8.1.9...v8.2.0) (2023-08-14) - - -### Bug Fixes - -* monorepo dependency issues - upgrade to yarn 3 ([#2429](https://github.com/heroku/cli/issues/2429)) ([0d7e5ca](https://github.com/heroku/cli/commit/0d7e5ca519799af4352ec973f51b45748699f3a1)) - - - - - -## [8.1.7](https://github.com/heroku/cli/compare/v8.1.4...v8.1.7) (2023-06-01) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [8.1.4](https://github.com/heroku/cli/compare/v8.1.3...v8.1.4) (2023-05-24) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [8.1.3](https://github.com/heroku/cli/compare/v8.1.2...v8.1.3) (2023-05-01) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -# [8.1.0](https://github.com/heroku/cli/compare/v8.0.6...v8.1.0) (2023-04-27) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [8.0.5](https://github.com/heroku/cli/compare/v8.0.4...v8.0.5) (2023-04-18) - - -### Bug Fixes - -* oclif promote step ([#2301](https://github.com/heroku/cli/issues/2301)) ([4e94fb1](https://github.com/heroku/cli/commit/4e94fb1fdc1a591bd1b744e2da69c0e0df03ed6e)) - - - - - -## [8.0.2](https://github.com/heroku/cli/compare/v7.69.1...v8.0.2) (2023-03-16) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.69.2](https://github.com/heroku/cli/compare/v7.69.1...v7.69.2) (2023-03-16) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -# [7.68.0](https://github.com/heroku/cli/compare/v8.0.1...v7.68.0) (2023-02-06) - - -### Bug Fixes - -* revert to v7.67.2 ([#2235](https://github.com/heroku/cli/issues/2235)) ([0955a24](https://github.com/heroku/cli/commit/0955a24d6aeafdec7211ffd6179f772560f35098)), closes [#2231](https://github.com/heroku/cli/issues/2231) [#2230](https://github.com/heroku/cli/issues/2230) [#2229](https://github.com/heroku/cli/issues/2229) [#2228](https://github.com/heroku/cli/issues/2228) [#2227](https://github.com/heroku/cli/issues/2227) [#2225](https://github.com/heroku/cli/issues/2225) [#2144](https://github.com/heroku/cli/issues/2144) [#2216](https://github.com/heroku/cli/issues/2216) [#2207](https://github.com/heroku/cli/issues/2207) [#2212](https://github.com/heroku/cli/issues/2212) [#2212](https://github.com/heroku/cli/issues/2212) - - - - - -## [7.66.3](https://github.com/heroku/cli/compare/v7.66.2...v7.66.3) (2022-11-14) - - -### Bug Fixes - -* debian builds ([#2128](https://github.com/heroku/cli/issues/2128)) ([8f80622](https://github.com/heroku/cli/commit/8f80622617194c8be8ebce1688e1e5b565a8ffb1)) - - - - - -# [7.54.0](https://github.com/heroku/cli/compare/v7.47.10...v7.54.0) (2021-05-18) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -# [7.49.0](https://github.com/heroku/cli/compare/v7.47.13...v7.49.0) (2021-02-24) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.13](https://github.com/heroku/cli/compare/v7.47.12...v7.47.13) (2021-02-18) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.10](https://github.com/heroku/cli/compare/v7.47.7...v7.47.10) (2021-01-21) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.9](https://github.com/heroku/cli/compare/v7.47.7...v7.47.9) (2021-01-21) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.8](https://github.com/heroku/cli/compare/v7.47.2...v7.47.8) (2021-01-19) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.7](https://github.com/heroku/cli/compare/v7.47.6...v7.47.7) (2021-01-05) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.47.6](https://github.com/heroku/cli/compare/v7.47.5...v7.47.6) (2020-12-16) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -# [7.43.0](https://github.com/heroku/cli/compare/v7.42.13...v7.43.0) (2020-09-15) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.42.8](https://github.com/heroku/cli/compare/v7.42.7...v7.42.8) (2020-08-17) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.42.3](https://github.com/heroku/cli/compare/v7.42.2...v7.42.3) (2020-07-09) - - -### Bug Fixes - -* use inclusive terms ([#1553](https://github.com/heroku/cli/issues/1553)) ([3639297](https://github.com/heroku/cli/commit/36392971cba2a4e4e9077c4575626bfb89c5005a)) - - - - - -## [7.42.1](https://github.com/heroku/cli/compare/v7.42.0...v7.42.1) (2020-06-05) - - -### Bug Fixes - -* **spaces:** missing version bump ([a964454](https://github.com/heroku/cli/commit/a96445434ed9f7f6350c676a551dd2d9126e8072)) - - - - - -## [7.39.2](https://github.com/heroku/cli/compare/v7.39.1...v7.39.2) (2020-03-30) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - -## [7.38.1](https://github.com/heroku/cli/compare/v7.38.0...v7.38.1) (2020-02-10) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -# [7.27.0](https://github.com/heroku/cli/compare/v7.26.2...v7.27.0) (2019-07-30) - - -### Features - -* **spaces:** add spaces:transfer command ([#1266](https://github.com/heroku/cli/issues/1266)) ([53d21c7](https://github.com/heroku/cli/commit/53d21c7)) - - - - - -## [7.22.2](https://github.com/heroku/cli/compare/v7.22.1...v7.22.2) (2019-02-28) - - -### Bug Fixes - -* revert "No more wantsOrg" ([#1204](https://github.com/heroku/cli/issues/1204)) ([7641009](https://github.com/heroku/cli/commit/7641009)) - - - - - -## [7.16.3](https://github.com/heroku/cli/compare/v7.16.2...v7.16.3) (2018-10-03) - - -### Bug Fixes - -* updated deps ([#1058](https://github.com/heroku/cli/issues/1058)) ([ce1fd6b](https://github.com/heroku/cli/commit/ce1fd6b)) - - - - - -## [7.16.2](https://github.com/heroku/cli/compare/v7.16.1...v7.16.2) (2018-10-02) - - -### Bug Fixes - -* updated deps ([482dc85](https://github.com/heroku/cli/commit/482dc85)) - - - - - - -# [7.16.0](https://github.com/heroku/cli/compare/v7.15.2...v7.16.0) (2018-09-14) - - -### Bug Fixes - -* updated deps ([6d3be5a](https://github.com/heroku/cli/commit/6d3be5a)) -* updated dev-cli ([022396b](https://github.com/heroku/cli/commit/022396b)) - - - - - - -## [7.15.2](https://github.com/heroku/cli/compare/v7.15.1...v7.15.2) (2018-09-12) - - -### Bug Fixes - -* **spaces:** clarify --data-cidr description ([#1027](https://github.com/heroku/cli/issues/1027)) ([83e394a](https://github.com/heroku/cli/commit/83e394a)) - - - - - - -# [7.15.0](https://github.com/heroku/cli/compare/v7.14.4...v7.15.0) (2018-09-10) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -# [7.14.0](https://github.com/heroku/cli/compare/v7.13.0...v7.14.0) (2018-08-30) - - -### Features - -* **spaces:** send notification for spaces:wait ([b44554c](https://github.com/heroku/cli/commit/b44554c)) - - - - - - -## [7.12.6](https://github.com/heroku/cli/compare/v7.12.5...v7.12.6) (2018-08-30) - - -### Bug Fixes - -* windows test failures ([5b4d171](https://github.com/heroku/cli/commit/5b4d171)) - - - - - - -## [7.12.5](https://github.com/heroku/cli/compare/v7.12.4...v7.12.5) (2018-08-29) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -## [7.12.4](https://github.com/heroku/cli/compare/v7.12.3...v7.12.4) (2018-08-29) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -## [7.9.3](https://github.com/heroku/cli/compare/v7.9.2...v7.9.3) (2018-08-18) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -## [7.9.2](https://github.com/heroku/cli/compare/v7.9.1...v7.9.2) (2018-08-18) - - -### Bug Fixes - -* typescript 3.0 ([268c0af](https://github.com/heroku/cli/commit/268c0af)) - - - - - - -## [7.9.1](https://github.com/heroku/cli/compare/v7.9.0...v7.9.1) (2018-08-17) - - -### Bug Fixes - -* updated some dependencies ([0306f88](https://github.com/heroku/cli/commit/0306f88)) - - - - - -# [7.8.0](https://github.com/heroku/cli/compare/v7.7.10...v7.8.0) (2018-08-17) - - -### Features - -* **spaces:** Add --data-cidr flag for specifying cidr that's used with Heroku Data peerings ([#981](https://github.com/heroku/cli/issues/981)) ([69f4c29](https://github.com/heroku/cli/commit/69f4c29)) - - - - - -## [7.7.10](https://github.com/heroku/cli/compare/v7.7.8...v7.7.10) (2018-08-14) - - - - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - -## [7.7.9](https://github.com/heroku/cli/compare/v7.7.8...v7.7.9) (2018-08-14) - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - - - - - -## [7.7.8](https://github.com/heroku/cli/compare/v7.7.7...v7.7.8) (2018-07-30) - - -### Bug Fixes - -* **spaces:** remove 422 check from vpn:wait ([#952](https://github.com/heroku/cli/issues/952)) ([171b4e5](https://github.com/heroku/cli/commit/171b4e5)) - - - - - -## [7.7.7](https://github.com/heroku/cli/compare/v7.7.6...v7.7.7) (2018-07-26) - - -### Bug Fixes - -* **spaces:** add top-level help for spaces:vpn ([#949](https://github.com/heroku/cli/issues/949)) ([04fc675](https://github.com/heroku/cli/commit/04fc675)) - - - - - -## [7.7.6](https://github.com/heroku/cli/compare/v7.7.5...v7.7.6) (2018-07-25) - - -### Bug Fixes - -* **spaces:** Fix inconsistencies in vpn:connect and vpn:wait ([#953](https://github.com/heroku/cli/issues/953)) ([78f9d3e](https://github.com/heroku/cli/commit/78f9d3e)) -* **spaces:** remove vpn:create reference ([#960](https://github.com/heroku/cli/issues/960)) ([92f18d1](https://github.com/heroku/cli/commit/92f18d1)) -* **spaces:** remove vpn:create which has been replaced by vpn:connect ([#950](https://github.com/heroku/cli/issues/950)) ([69897f8](https://github.com/heroku/cli/commit/69897f8)) -* **spaces:** rename dyno cidrs to space cidrs ([#958](https://github.com/heroku/cli/issues/958)) ([437ad62](https://github.com/heroku/cli/commit/437ad62)) -* **spaces:** update destroy command to require a name ([#954](https://github.com/heroku/cli/issues/954)) ([8dbb189](https://github.com/heroku/cli/commit/8dbb189)) - - - - - -## [7.7.1](https://github.com/heroku/cli/compare/v7.7.0...v7.7.1) (2018-07-17) - - -### Bug Fixes - -* **spaces:** default name to ID in list if missing ([#941](https://github.com/heroku/cli/issues/941)) ([1ba091a](https://github.com/heroku/cli/commit/1ba091a)) -* **spaces:** display the config info after VPN wait ([#929](https://github.com/heroku/cli/issues/929)) ([6bf1d7b](https://github.com/heroku/cli/commit/6bf1d7b)) -* **spaces:** display the name in vpn:info ([#943](https://github.com/heroku/cli/issues/943)) ([e3cbce0](https://github.com/heroku/cli/commit/e3cbce0)) - - - - - -## [7.6.1](https://github.com/heroku/cli/compare/v7.6.0...v7.6.1) (2018-07-16) - - -### Bug Fixes - -* **spaces:** wait should check that the status is active, not available ([#939](https://github.com/heroku/cli/issues/939)) ([649ff1c](https://github.com/heroku/cli/commit/649ff1c)) - - - - - -# [7.6.0](https://github.com/heroku/cli/compare/v7.5.11...v7.6.0) (2018-07-12) - - -### Bug Fixes - -* **space:** update vpn:destroy for multiple vpn connections ([#933](https://github.com/heroku/cli/issues/933)) ([1a2074f](https://github.com/heroku/cli/commit/1a2074f)) -* **spaces:** tweaks to vpn:destroy ([#936](https://github.com/heroku/cli/issues/936)) ([65dcbf8](https://github.com/heroku/cli/commit/65dcbf8)) -* **spaces:** update vpn wait / info / config ([#934](https://github.com/heroku/cli/issues/934)) ([36551d3](https://github.com/heroku/cli/commit/36551d3)) - - -### Features - -* **spaces:** add vpn:connect command ([#931](https://github.com/heroku/cli/issues/931)) ([4accdc5](https://github.com/heroku/cli/commit/4accdc5)) -* **spaces:** add vpn:connections command ([#935](https://github.com/heroku/cli/issues/935)) ([21b6254](https://github.com/heroku/cli/commit/21b6254)) - - - - - -## [7.5.8](https://github.com/heroku/cli/compare/v7.5.7...v7.5.8) (2018-07-02) - - -### Bug Fixes - -* **spaces:** Increase vpn wait timeout from 10 minutes to 20 minutes ([#928](https://github.com/heroku/cli/issues/928)) ([cce5fd0](https://github.com/heroku/cli/commit/cce5fd0)) - - - - - -## [7.5.7](https://github.com/heroku/cli/compare/v7.5.6...v7.5.7) (2018-06-29) - - -### Bug Fixes - -* cleanup spaces dependencies ([542cabf](https://github.com/heroku/cli/commit/542cabf)) - - - - - -## [7.5.6](https://github.com/heroku/cli/compare/v7.5.5...v7.5.6) (2018-06-29) - - -### Bug Fixes - -* bump legacy and color ([a3fa970](https://github.com/heroku/cli/commit/a3fa970)) - - - - - -## [7.5.5](https://github.com/heroku/cli/compare/v7.5.4...v7.5.5) (2018-06-29) - - - - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - -## [7.5.1](https://github.com/heroku/cli/compare/v7.5.0...v7.5.1) (2018-06-26) - - -### Bug Fixes - -* bump dev-cli ([fb3e41a](https://github.com/heroku/cli/commit/fb3e41a)) - - - - - -# [7.5.0](https://github.com/heroku/cli/compare/v7.4.11...v7.5.0) (2018-06-26) - - - - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - -## [7.4.8](https://github.com/heroku/cli/compare/v7.4.7...v7.4.8) (2018-06-21) - - - - -**Note:** Version bump only for package @heroku-cli/plugin-spaces - - -## [7.4.6](https://github.com/heroku/cli/compare/v7.4.5...v7.4.6) (2018-06-20) - - -### Bug Fixes - -* update dev-cli readme generation ([42a77bc](https://github.com/heroku/cli/commit/42a77bc)) - - - - - -## [7.4.5](https://github.com/heroku/cli/compare/v7.4.4...v7.4.5) (2018-06-20) - - -### Bug Fixes - -* updated monorepo documentation urls ([4bb6fe0](https://github.com/heroku/cli/commit/4bb6fe0)) - - - - - -# [7.4.0](https://github.com/heroku/cli/compare/v7.3.0...v7.4.0) (2018-06-19) - - -### Bug Fixes - -* repo name ([c306c78](https://github.com/heroku/cli/commit/c306c78)) - - - - - -# [7.3.0](https://github.com/heroku/heroku-spaces/compare/v7.2.0...v7.3.0) (2018-06-19) - - - - -**Note:** Version bump only for package @heroku-cli/plugin-spaces diff --git a/packages/spaces/LICENSE b/packages/spaces/LICENSE deleted file mode 100644 index 6bd5b0f9d4..0000000000 --- a/packages/spaces/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2016, Heroku - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/packages/spaces/README.md b/packages/spaces/README.md deleted file mode 100644 index 93543011a5..0000000000 --- a/packages/spaces/README.md +++ /dev/null @@ -1,543 +0,0 @@ -heroku-spaces CLI plugin [![Circle CI](https://circleci.com/gh/heroku/heroku-spaces.svg?style=svg&circle-token=99951d0283972db74af1fa0f5dc179ebf6d85963)](https://circleci.com/gh/heroku/heroku-spaces) -=========== - -[![npm version](https://img.shields.io/npm/v/@heroku-cli/plugin-spaces.svg)](https://www.npmjs.com/package/@heroku-cli/plugin-spaces) - - -* [`heroku spaces`](#heroku-spaces) -* [`heroku spaces:create`](#heroku-spacescreate) -* [`heroku spaces:destroy`](#heroku-spacesdestroy) -* [`heroku spaces:info`](#heroku-spacesinfo) -* [`heroku spaces:peering:info`](#heroku-spacespeeringinfo) -* [`heroku spaces:peerings`](#heroku-spacespeerings) -* [`heroku spaces:peerings:accept`](#heroku-spacespeeringsaccept) -* [`heroku spaces:peerings:destroy`](#heroku-spacespeeringsdestroy) -* [`heroku spaces:ps`](#heroku-spacesps) -* [`heroku spaces:rename`](#heroku-spacesrename) -* [`heroku spaces:topology`](#heroku-spacestopology) -* [`heroku spaces:transfer`](#heroku-spacestransfer) -* [`heroku spaces:vpn:config`](#heroku-spacesvpnconfig) -* [`heroku spaces:vpn:connect`](#heroku-spacesvpnconnect) -* [`heroku spaces:vpn:connections`](#heroku-spacesvpnconnections) -* [`heroku spaces:vpn:destroy`](#heroku-spacesvpndestroy) -* [`heroku spaces:vpn:info`](#heroku-spacesvpninfo) -* [`heroku spaces:vpn:update`](#heroku-spacesvpnupdate) -* [`heroku spaces:vpn:wait`](#heroku-spacesvpnwait) -* [`heroku spaces:wait`](#heroku-spaceswait) -* [`heroku trusted-ips`](#heroku-trusted-ips) -* [`heroku trusted-ips:add SOURCE`](#heroku-trusted-ipsadd-source) -* [`heroku trusted-ips:remove SOURCE`](#heroku-trusted-ipsremove-source) - -## `heroku spaces` - -list available spaces - -``` -USAGE - $ heroku spaces [--json] [-t ] - -FLAGS - -t, --team= team to use - --json output in json format - -DESCRIPTION - list available spaces -``` - -## `heroku spaces:create` - -create a new space - -``` -USAGE - $ heroku spaces:create [SPACE] [-s ] [--region ] [--cidr ] [--data-cidr ] [-t ] - -FLAGS - -s, --space= name of space to create - -t, --team= team to use - --cidr= RFC-1918 CIDR the space will use - --data-cidr= RFC-1918 CIDR used by Heroku Data resources for the space - --region= region name - -DESCRIPTION - create a new space - Example: - - $ heroku spaces:create --space my-space --team my-team --region oregon - Creating space my-space in team my-team... done - === my-space - ID: e7b99e37-69b3-4475-ad47-a5cc5d75fd9f - Team: my-team - Region: oregon - CIDR: 10.0.0.0/16 - Data CIDR: 172.23.0.0/20 - State: allocating - Created at: 2016-01-06T03:23:13Z -``` - -## `heroku spaces:destroy` - -destroy a space - -``` -USAGE - $ heroku spaces:destroy [SPACE] [-s ] [--confirm ] - -FLAGS - -s, --space= space to destroy - --confirm= set to space name to bypass confirm prompt - -DESCRIPTION - destroy a space - Example: - - $ heroku spaces:destroy --space my-space - Destroying my-space... done -``` - -## `heroku spaces:info` - -show info about a space - -``` -USAGE - $ heroku spaces:info [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get info of - --json output in json format - -DESCRIPTION - show info about a space -``` - -## `heroku spaces:peering:info` - -display the information necessary to initiate a peering connection - -``` -USAGE - $ heroku spaces:peering:info [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get peering info from - --json output in json format - -DESCRIPTION - display the information necessary to initiate a peering connection - Example: - - $ heroku spaces:peering:info example-space - === example-space Peering Info - AWS Account ID: 012345678910 - AWS Region: us-west-2 - AWS VPC ID: vpc-baadf00d - AWS VPC CIDR: 10.0.0.0/16 - Space CIDRs: 10.0.128.0/20, 10.0.144.0/20 - Unavailable CIDRs: 10.1.0.0/16 - - You will use the information provided by this command to establish a peering connection request from your AWS VPC to - your private space. - - To start the peering process, go into your AWS console for the VPC you would like peered with your Private Space, - navigate to the VPC service, choose the "Peering Connections" option and click the "Create peering connection" button. - - - The AWS Account ID and VPC ID are necessary for the AWS VPC Peering connection wizard. - - You will also need to configure your VPC route table to route the Dyno CIDRs through the peering connection. - - Once you've established the peering connection request, you can use the spaces:peerings:accept command to accept and - configure the peering connection for the space. -``` - -## `heroku spaces:peerings` - -list peering connections for a space - -``` -USAGE - $ heroku spaces:peerings [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get peer list from - --json output in json format - -DESCRIPTION - list peering connections for a space -``` - -## `heroku spaces:peerings:accept` - -accepts a pending peering request for a private space - -``` -USAGE - $ heroku spaces:peerings:accept [PCXID] [-p ] [-s ] - -FLAGS - -p, --pcxid= PCX ID of a pending peering - -s, --space= space to get peering info from - -DESCRIPTION - accepts a pending peering request for a private space - Example: - - $ heroku spaces:peerings:accept pcx-4bd27022 --space example-space - Accepting and configuring peering connection pcx-4bd27022 -``` - -## `heroku spaces:peerings:destroy` - -destroys an active peering connection in a private space - -``` -USAGE - $ heroku spaces:peerings:destroy [PCXID] [-p ] [-s ] [--confirm ] - -FLAGS - -p, --pcxid= PCX ID of a pending peering - -s, --space= space to get peering info from - --confirm= set to PCX ID to bypass confirm prompt - -DESCRIPTION - destroys an active peering connection in a private space - Example: - - $ heroku spaces:peerings:destroy pcx-4bd27022 --confirm pcx-4bd27022 --space example-space - Tearing down peering connection pcx-4bd27022 -``` - -## `heroku spaces:ps` - -list dynos for a space - -``` -USAGE - $ heroku spaces:ps [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get dynos of - --json output in json format - -DESCRIPTION - list dynos for a space -``` - -## `heroku spaces:rename` - -renames a space - -``` -USAGE - $ heroku spaces:rename --from --to - -FLAGS - --from= (required) current name of space - --to= (required) desired name of space - -DESCRIPTION - renames a space - Example: - - $ heroku spaces:rename --from old-space-name --to new-space-name - Renaming space old-space-name to new-space-name... done -``` - -## `heroku spaces:topology` - -show space topology - -``` -USAGE - $ heroku spaces:topology [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get topology of - --json output in json format - -DESCRIPTION - show space topology -``` - -## `heroku spaces:transfer` - -transfer a space to another team - -``` -USAGE - $ heroku spaces:transfer --space --team - -FLAGS - --space= (required) name of space - --team= (required) desired owner of space - -DESCRIPTION - transfer a space to another team - Example: - - $ heroku spaces:transfer --space=space-name --team=team-name - Transferring space-name to team-name... done -``` - -## `heroku spaces:vpn:config` - -display the configuration information for VPN - -``` -USAGE - $ heroku spaces:vpn:config [NAME] [-s ] [-n ] [--json] - -FLAGS - -n, --name= name or id of the VPN connection to retrieve config from - -s, --space= space the VPN connection belongs to - --json output in json format - -DESCRIPTION - display the configuration information for VPN - Example: - - $ heroku spaces:vpn:config --space my-space vpn-connection-name - === vpn-connection-name VPN Tunnels - VPN Tunnel Customer Gateway VPN Gateway Pre-shared Key Routable Subnets IKE Version - ────────── ──────────────── ────────────── ────────────── ──────────────── ─────────── - Tunnel 1 104.196.121.200 35.171.237.136 abcdef12345 10.0.0.0/16 1 - Tunnel 2 104.196.121.200 52.44.7.216 fedcba54321 10.0.0.0/16 1 - - You will use the information provided by this command to establish a Private Space VPN Connection. - - - You must configure your VPN Gateway to use both Tunnels provided by Heroku - - The VPN Gateway values are the IP addresses of the Private Space Tunnels - - The Customer Gateway value is the Public IP of your VPN Gateway - - The VPN Gateway must use the IKE Version shown and the Pre-shared Keys as the authentication method -``` - -## `heroku spaces:vpn:connect` - -create VPN - -``` -USAGE - $ heroku spaces:vpn:connect [NAME] [-n ] [-i ] [-c ] [-s ] - -FLAGS - -c, --cidrs= a list of routable CIDRs separated by commas - -i, --ip= public IP of customer gateway - -n, --name= VPN name - -s, --space= space name - -DESCRIPTION - create VPN - Private Spaces can be connected to another private network via an IPSec VPN connection allowing dynos to connect to - hosts on your private networks and vice versa. - The connection is established over the public Internet but all traffic is encrypted using IPSec. - -EXAMPLES - $ heroku spaces:vpn:connect --name office --ip 35.161.69.30 --cidrs 172.16.0.0/16,10.0.0.0/24 --space my-space - Creating VPN Connection in space my-space... done - ▸ Use spaces:vpn:wait to track allocation. -``` - -## `heroku spaces:vpn:connections` - -list the VPN Connections for a space - -``` -USAGE - $ heroku spaces:vpn:connections [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get VPN connections from - --json output in json format - -DESCRIPTION - list the VPN Connections for a space - Example: - - $ heroku spaces:vpn:connections --space my-space - === my-space VPN Connections - Name Status Tunnels - ────── ────── ─────── - office active UP/UP -``` - -## `heroku spaces:vpn:destroy` - -destroys VPN in a private space - -``` -USAGE - $ heroku spaces:vpn:destroy [NAME] [-s ] [-n ] [--confirm ] - -FLAGS - -n, --name= name or id of the VPN connection to retrieve config from - -s, --space= space to get peering info from - --confirm= set to VPN connection name to bypass confirm prompt - -DESCRIPTION - destroys VPN in a private space - Example: - - $ heroku spaces:vpn:destroy --space example-space vpn-connection-name --confirm vpn-connection-name - Tearing down VPN Connection vpn-connection-name in space example-space -``` - -## `heroku spaces:vpn:info` - -display the information for VPN - -``` -USAGE - $ heroku spaces:vpn:info [NAME] [-s ] [--json] [-n ] - -FLAGS - -n, --name= name or id of the VPN connection to get info from - -s, --space= space the vpn connection belongs to - --json output in json format - -DESCRIPTION - display the information for VPN - Example: - - $ heroku spaces:vpn:info --space my-space vpn-connection-name - === vpn-connection-name VPN Tunnel Info - Name: vpn-connection-name - ID: 123456789012 - Public IP: 35.161.69.30 - Routable CIDRs: 172.16.0.0/16 - Status: failed - Status Message: supplied CIDR block already in use - === my-space Tunnel Info - VPN Tunnel IP Address Status Status Last Changed Details - ────────── ───────────── ────── ──────────────────── ────────────── - Tunnel 1 52.44.146.197 UP 2016-10-25T22:09:05Z status message - Tunnel 2 52.44.146.197 UP 2016-10-25T22:09:05Z status message -``` - -## `heroku spaces:vpn:update` - -update VPN - -``` -USAGE - $ heroku spaces:vpn:update [NAME] [-n ] [-c ] [-s ] - -FLAGS - -c, --cidrs= a list of routable CIDRs separated by commas - -n, --name= VPN name - -s, --space= space name - -DESCRIPTION - update VPN - Private Spaces can be connected to another private network via an IPSec VPN connection allowing dynos to connect to - hosts on your private networks and vice versa. - The connection is established over the public Internet but all traffic is encrypted using IPSec. - -EXAMPLES - $ heroku spaces:vpn:update --name office --cidrs 172.16.0.0/16,10.0.0.0/24 --space my-space - Updating VPN Connection in space my-space... done -``` - -## `heroku spaces:vpn:wait` - -wait for VPN Connection to be created - -``` -USAGE - $ heroku spaces:vpn:wait [NAME] [-s ] [-n ] [--json] [-i ] [-t ] - -FLAGS - -i, --interval= seconds to wait between poll intervals - -n, --name= name or id of the vpn connection to wait for - -s, --space= space the vpn connection belongs to - -t, --timeout= maximum number of seconds to wait - --json output in json format - -DESCRIPTION - wait for VPN Connection to be created -``` - -## `heroku spaces:wait` - -wait for a space to be created - -``` -USAGE - $ heroku spaces:wait [SPACE] [-s ] [--json] [-i ] [-t ] - -FLAGS - -i, --interval= seconds to wait between poll intervals - -s, --space= space to get info of - -t, --timeout= maximum number of seconds to wait - --json output in json format - -DESCRIPTION - wait for a space to be created -``` - -## `heroku trusted-ips` - -list trusted IP ranges for a space - -``` -USAGE - $ heroku trusted-ips [SPACE] [-s ] [--json] - -FLAGS - -s, --space= space to get inbound rules from - --json output in json format - -DESCRIPTION - list trusted IP ranges for a space - - Trusted IP ranges are only available on Private Spaces. - - The space name is a required parameter. Newly created spaces will have 0.0.0.0/0 set by default - allowing all traffic to applications in the space. More than one CIDR block can be provided at - a time to the commands listed below. For example 1.2.3.4/20 and 5.6.7.8/20 can be added with: -``` - -## `heroku trusted-ips:add SOURCE` - -Add one range to the list of trusted IP ranges - -``` -USAGE - $ heroku trusted-ips:add SOURCE [-s ] [--confirm ] - -FLAGS - -s, --space= space to add rule to - --confirm= set to space name to bypass confirm prompt - -DESCRIPTION - Add one range to the list of trusted IP ranges - - Uses CIDR notation. - - Example: - - $ heroku trusted-ips:add --space my-space 192.168.2.0/24 - Added 192.168.0.1/24 to trusted IP ranges on my-space -``` - -## `heroku trusted-ips:remove SOURCE` - -Remove a range from the list of trusted IP ranges - -``` -USAGE - $ heroku trusted-ips:remove SOURCE --space [--confirm ] - -FLAGS - --confirm= set to space name to bypass confirm prompt - --space= (required) space to remove rule from - -DESCRIPTION - Remove a range from the list of trusted IP ranges - - Uses CIDR notation. - - Example: - - $ heroku trusted-ips:remove --space my-space 192.168.2.0/24 - Removed 192.168.2.0/24 from trusted IP ranges on my-space -``` - diff --git a/packages/spaces/commands/vpn/index.js b/packages/spaces/commands/vpn/index.js deleted file mode 100644 index 015d3de227..0000000000 --- a/packages/spaces/commands/vpn/index.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict' - -const cli = require('@heroku/heroku-cli-util') -const format = require('../../lib/format')() - -function displayVPNConnections(space, connections) { - if (connections.length === 0) { - cli.log('No VPN Connections have been created yet') - return - } - - let tunnelFormat = function (t) { - // eslint-disable-next-line new-cap - return t.map(tunnel => format.VPNStatus(tunnel.status)).join('/') - } - - cli.styledHeader(`${space} VPN Connections`) - cli.table(connections, { - columns: [ - {label: 'Name', format: (_, v) => v.name || v.id}, - {label: 'Status', key: 'status', format: format.VPNStatus}, - {label: 'Tunnels', key: 'tunnels', format: t => tunnelFormat(t)}, - ], - }) -} - -function render(space, connections, flags) { - if (flags.json) { - cli.styledJSON(connections) - } else { - displayVPNConnections(space, connections) - } -} - -async function run(context, heroku) { - let space = context.flags.space || context.args.space - if (!space) throw new Error('Space name required.\nUSAGE: heroku spaces:vpn:connections --space my-space') - - let lib = require('../../lib/vpn-connections')(heroku) - let connections = await lib.getVPNConnections(space) - render(space, connections, context.flags) -} - -module.exports = { - topic: 'spaces', - command: 'vpn:connections', - description: 'list the VPN Connections for a space', - help: `Example: - - $ heroku spaces:vpn:connections --space my-space - === my-space VPN Connections - Name Status Tunnels - ────── ────── ─────── - office active UP/UP - `, - needsApp: false, - needsAuth: true, - args: [{name: 'space', optional: true, hidden: true}], - flags: [ - {name: 'space', char: 's', hasValue: true, description: 'space to get VPN connections from'}, - {name: 'json', description: 'output in json format'}, - ], - run: cli.command(run), - render: render, -} diff --git a/packages/spaces/index.js b/packages/spaces/index.js deleted file mode 100644 index f1a9f51d9c..0000000000 --- a/packages/spaces/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -exports.topics = [ - {name: 'spaces', description: 'manage heroku private spaces'}, - {name: 'trusted-ips', hidden: true}, -] - -exports.commands = [ - require('./commands/vpn/index'), -] diff --git a/packages/spaces/lib/format.js b/packages/spaces/lib/format.js deleted file mode 100644 index 6f07daf570..0000000000 --- a/packages/spaces/lib/format.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict' - -const cli = require('@heroku/heroku-cli-util') - -module.exports = function () { - function CIDR(cidr) { - if (!cidr || cidr.length === 0) return '' - return cidr.join(', ') - } - - function CIDRBlocksOrCIDRBlock(cidrBlocks, row) { - if (!cidrBlocks || cidrBlocks.length === 0) return row.cidr_block - // eslint-disable-next-line new-cap - return CIDR(cidrBlocks) - } - - function VPNStatus(s) { - switch (s) { - case 'UP': - case 'available': - return `${cli.color.green(s)}` - case 'pending': - case 'provisioning': - case 'deprovisioning': - return `${cli.color.yellow(s)}` - case 'DOWN': - case 'deleting': - case 'deleted': - return `${cli.color.red(s)}` - default: - return s - } - } - - function PeeringStatus(s) { - switch (s) { - case 'active': - return `${cli.color.green(s)}` - case 'pending-acceptance': - case 'provisioning': - return `${cli.color.yellow(s)}` - case 'expired': - case 'failed': - case 'deleted': - case 'rejected': - return `${cli.color.red(s)}` - default: - return s - } - } - - function HostStatus(s) { - switch (s) { - case 'available': - return `${cli.color.green(s)}` - case 'under-assessment': - return `${cli.color.yellow(s)}` - case 'permanent-failure': - case 'released-permanent-failure': - return `${cli.color.red(s)}` - case 'released': - return `${cli.color.gray(s)}` - default: - return s - } - } - - function Percent(v) { - const fmt = () => `${v}%` - - switch (typeof v) { - case 'number': - case 'bigint': - return fmt() - case 'string': - return v.length > 0 ? fmt() : v - default: - return v - } - } - - return { - CIDR, - CIDRBlocksOrCIDRBlock, - PeeringStatus, - VPNStatus, - HostStatus, - Percent, - } -} diff --git a/packages/spaces/lib/hosts.js b/packages/spaces/lib/hosts.js deleted file mode 100644 index 693ad7a4c0..0000000000 --- a/packages/spaces/lib/hosts.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict' - -const cli = require('@heroku/heroku-cli-util') -const format = require('./format')() - -module.exports = function (heroku) { - function getHosts(space) { - return request('GET', `/spaces/${space}/hosts`) - } - - function displayHosts(space, hosts) { - cli.styledHeader(`${space} Hosts`) - cli.table(hosts, { - columns: [ - {key: 'host_id', label: 'Host ID'}, - {key: 'state', label: 'State', format: format.HostStatus}, - {key: 'available_capacity_percentage', label: 'Available Capacity', format: format.Percent}, - {key: 'allocated_at', label: 'Allocated At'}, - {key: 'released_at', label: 'Released At'}, - ], - }) - } - - function request(method, path, body) { - return heroku.request({ - method: method, - path: path, - body: body, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - return { - getHosts, - displayHosts, - } -} diff --git a/packages/spaces/lib/outbound-rules.js b/packages/spaces/lib/outbound-rules.js deleted file mode 100644 index e847fac968..0000000000 --- a/packages/spaces/lib/outbound-rules.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict' - -let cli = require('@heroku/heroku-cli-util') - -module.exports = function (heroku) { - function getOutboundRules(space) { - return heroku.request({ - path: `/spaces/${space}/outbound-ruleset`, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - function putOutboundRules(space, ruleset) { - return heroku.request({ - method: 'PUT', - path: `/spaces/${space}/outbound-ruleset`, - body: ruleset, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - function displayRules(space, ruleset) { - if (ruleset.rules.length > 0) { - cli.styledHeader('Outbound Rules') - display(ruleset.rules) - } else { - cli.styledHeader(`${space} has no Outbound Rules. Your Dynos cannot communicate with hosts outside of ${space}.`) - } - } - - function lined(rules) { - var lined = [] - for (var i = 0, len = rules.length; i < len; i++) { - lined.push({ - line: i + 1, - target: rules[i].target, - from_port: rules[i].from_port, - to_port: rules[i].to_port, - protocol: rules[i].protocol, - }) - } - - return lined - } - - function display(rules) { - var f = function (p) { - var n = p - return n.toString() - } - - cli.table(lined(rules), { - columns: [ - {key: 'line', label: 'Rule Number'}, - {key: 'target', label: 'Destination'}, - {key: 'from_port', label: 'From Port', format: fromPort => f(fromPort)}, - {key: 'to_port', label: 'To Port', format: toPort => f(toPort)}, - {key: 'protocol', label: 'Protocol'}, - ], - }) - } - - function parsePorts(proto, p) { - if (p === '-1' || p === 'any') { - if (proto === 'icmp') { - return [0, 255] - } - - return [0, 65535] - } - - var actual = [] - // eslint-disable-next-line no-eq-null, eqeqeq - if (p != null) { - var ports = p.split('-') - if (ports.length === 2) { - // eslint-disable-next-line unicorn/prefer-math-trunc - actual = [ports[0] | 0, ports[1] | 0] - } else if (ports.length === 1) { - // eslint-disable-next-line unicorn/prefer-math-trunc - actual = [ports[0] | 0, ports[0] | 0] - } else { - throw new Error('Specified --port range seems incorrect.') - } - } - - if (actual.length !== 2) { - throw new Error('Specified --port range seems incorrect.') - } - - return actual - } - - return { - getOutboundRules, - putOutboundRules, - displayRules, - parsePorts, - } -} diff --git a/packages/spaces/lib/parsers.js b/packages/spaces/lib/parsers.js deleted file mode 100644 index 3c5b572df9..0000000000 --- a/packages/spaces/lib/parsers.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -module.exports = function () { - /* - Splits strings separated by commas into an array - If the string is empty or null, an empty array is returned. - */ - function splitCsv(string) { - return (string || '') - .split(',') - .map(s => s.trim()) - .filter(s => s.length > 0) - } - - return { - splitCsv, - } -} diff --git a/packages/spaces/lib/peering.js b/packages/spaces/lib/peering.js deleted file mode 100644 index 7964781790..0000000000 --- a/packages/spaces/lib/peering.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict' - -const cli = require('@heroku/heroku-cli-util') -const format = require('./format')() - -module.exports = function (heroku) { - function getPeeringInfo(space) { - return request('GET', `/spaces/${space}/peering-info`) - } - - function getPeerings(space) { - return request('GET', `/spaces/${space}/peerings`) - } - - function acceptPeeringRequest(space, pcxID) { - return request('POST', `/spaces/${space}/peerings`, {pcx_id: pcxID}) - } - - function destroyPeeringRequest(space, pcxID) { - return request('DELETE', `/spaces/${space}/peerings/${pcxID}`) - } - - function displayPeeringInfo(space, info) { - cli.styledHeader(`${space} Peering Info`) - cli.styledObject({ - 'AWS Account ID': info.aws_account_id, - 'AWS Region': info.aws_region, - 'AWS VPC ID': info.vpc_id, - 'AWS VPC CIDR': info.vpc_cidr, - // eslint-disable-next-line new-cap - 'Space CIDRs': format.CIDR(info.space_cidr_blocks), - // eslint-disable-next-line new-cap - 'Unavailable CIDRs': format.CIDR(info.unavailable_cidr_blocks), - }, ['AWS Account ID', 'AWS Region', 'AWS VPC ID', 'AWS VPC CIDR', 'Space CIDRs', 'Unavailable CIDRs']) - } - - function displayPeers(space, peers) { - cli.styledHeader(`${space} Peerings`) - cli.table(peers, { - columns: [ - {key: 'pcx_id', label: 'PCX ID'}, - {key: 'type', label: 'Type'}, - {key: 'cidr_blocks', label: 'CIDR Blocks', format: format.CIDRBlocksOrCIDRBlock}, - {key: 'status', label: 'Status', format: format.PeeringStatus}, - {key: 'aws_vpc_id', label: 'VPC ID'}, - {key: 'aws_region', label: 'AWS Region'}, - {key: 'aws_account_id', label: 'AWS Account ID'}, - {key: 'expires', label: 'Expires'}, - ], - }) - } - - function request(method, path, body) { - return heroku.request({ - method: method, - path: path, - body: body, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - return { - getPeeringInfo, - displayPeeringInfo, - displayPeers, - getPeerings, - acceptPeeringRequest, - destroyPeeringRequest, - } -} diff --git a/packages/spaces/lib/spaces.js b/packages/spaces/lib/spaces.js deleted file mode 100644 index aae093a02b..0000000000 --- a/packages/spaces/lib/spaces.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' -const cli = require('@heroku/heroku-cli-util') - -function displayNat(nat) { - if (!nat) return - if (nat.state !== 'enabled') return nat.state - return nat.sources.join(', ') -} - -function displayShieldState(space) { - return space.shield ? 'on' : 'off' -} - -function renderInfo(space, flags) { - if (flags.json) { - cli.log(JSON.stringify(space, null, 2)) - } else { - cli.styledHeader(space.name) - cli.styledObject({ - ID: space.id, - Team: space.team.name, - Region: space.region.description, - CIDR: space.cidr, - 'Data CIDR': space.data_cidr, - State: space.state, - Shield: displayShieldState(space), - 'Outbound IPs': displayNat(space.outbound_ips), - 'Created at': space.created_at, - }, ['ID', 'Team', 'Region', 'CIDR', 'Data CIDR', 'State', 'Shield', 'Outbound IPs', 'Created at']) - } -} - -exports.renderInfo = renderInfo -exports.displayNat = displayNat -exports.displayShieldState = displayShieldState diff --git a/packages/spaces/lib/trusted-ips.js b/packages/spaces/lib/trusted-ips.js deleted file mode 100644 index 61e69b77fc..0000000000 --- a/packages/spaces/lib/trusted-ips.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict' - -let cli = require('@heroku/heroku-cli-util') - -module.exports = function (heroku) { - function getRules(space) { - return heroku.request({ - path: `/spaces/${space}/inbound-ruleset`, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - function putRules(space, ruleset) { - return heroku.request({ - method: 'PUT', - path: `/spaces/${space}/inbound-ruleset`, - body: ruleset, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - function displayRules(space, ruleset) { - if (ruleset.rules.length > 0) { - cli.styledHeader('Trusted IP Ranges') - for (let rule of ruleset.rules) cli.log(rule.source) - } else { - cli.styledHeader(`${space} has no trusted IP ranges. All inbound web requests to dynos are blocked.`) - } - } - - return { - getRules, - putRules, - displayRules, - } -} diff --git a/packages/spaces/lib/vpn-connections.js b/packages/spaces/lib/vpn-connections.js deleted file mode 100644 index 9db7270c41..0000000000 --- a/packages/spaces/lib/vpn-connections.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict' -const cli = require('@heroku/heroku-cli-util') - -module.exports = function (heroku) { - function postVPNConnections(space, name, ip, cidrs) { - return request('POST', `/spaces/${space}/vpn-connections`, { - name: name, - public_ip: ip, - routable_cidrs: cidrs, - }) - } - - function patchVPNConnections(space, name, cidrs) { - return request('PATCH', `/spaces/${space}/vpn-connections/${name}`, { - routable_cidrs: cidrs, - }) - } - - function getVPNConnections(space) { - return request('GET', `/spaces/${space}/vpn-connections`) - } - - function getVPNConnection(space, name) { - return request('GET', `/spaces/${space}/vpn-connections/${name}`) - } - - function deleteVPNConnection(space, name) { - return request('DELETE', `/spaces/${space}/vpn-connections/${name}`) - } - - function request(method, path, body) { - return heroku.request({ - method: method, - path: encodeURI(path), - body: body, - }) - } - - function displayVPNConfigInfo(space, name, config) { - cli.styledHeader(`${name} VPN Tunnels`) - config.tunnels.forEach((val, i) => { - val.tunnel_id = 'Tunnel ' + (i + 1) - val.routable_cidr = config.space_cidr_block - val.ike_version = config.ike_version - }) - - cli.table(config.tunnels, { - columns: [ - {key: 'tunnel_id', label: 'VPN Tunnel'}, - {key: 'customer_ip', label: 'Customer Gateway'}, - {key: 'ip', label: 'VPN Gateway'}, - {key: 'pre_shared_key', label: 'Pre-shared Key'}, - {key: 'routable_cidr', label: 'Routable Subnets'}, - {key: 'ike_version', label: 'IKE Version'}, - ], - }) - } - - return { - postVPNConnections, - patchVPNConnections, - getVPNConnections, - getVPNConnection, - deleteVPNConnection, - displayVPNConfigInfo, - } -} diff --git a/packages/spaces/lib/vpn.js b/packages/spaces/lib/vpn.js deleted file mode 100644 index 0615fe7bd7..0000000000 --- a/packages/spaces/lib/vpn.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' - -module.exports = function (heroku) { - function postVPN(space, ip, cidrs) { - return request('POST', `/spaces/${space}/vpn`, {public_ip: ip, routable_cidrs: cidrs}) - } - - function deleteVPN(space) { - return request('DELETE', `/spaces/${space}/vpn`) - } - - function getVPNInfo(space) { - return request('GET', `/spaces/${space}/vpn`) - } - - function getVPNConfig(space) { - return request('GET', `/spaces/${space}/vpn/config`) - } - - function request(method, path, body) { - return heroku.request({ - method: method, - path: path, - body: body, - headers: {Accept: 'application/vnd.heroku+json; version=3.dogwood'}, - }) - } - - return { - postVPN, - deleteVPN, - getVPNInfo, - getVPNConfig, - } -} diff --git a/packages/spaces/package.json b/packages/spaces/package.json deleted file mode 100644 index 4f8c291a1e..0000000000 --- a/packages/spaces/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@heroku-cli/plugin-spaces", - "description": "Heroku plugin to manage Heroku Private Spaces", - "version": "9.0.0-alpha.1", - "author": "Heroku", - "bugs": "https://github.com/heroku/cli/issues", - "cli-engine": { - "bin": "heroku", - "topics": { - "spaces": { - "description": "manage heroku private spaces" - }, - "trusted-ips": { - "hidden": true - } - }, - "repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/spaces/<%- commandPath %>" - }, - "dependencies": { - "@heroku-cli/command": "^9.0.2", - "@heroku-cli/notifications": "^1.2.4", - "@heroku/heroku-cli-util": "^8.0.13", - "lodash": "^4.17.21", - "strftime": "^0.10.0" - }, - "devDependencies": { - "@oclif/plugin-legacy": "^1.3.0", - "chai": "^4.2.0", - "chai-as-promised": "^7.1.1", - "mocha": "^9.2.2", - "nock": "^10.0.6", - "nyc": "^15.1.0", - "oclif": "3.11.3", - "sinon": "^7.2.3" - }, - "files": [ - "oclif.manifest.json", - "index.js", - "commands", - "lib" - ], - "homepage": "https://github.com/heroku/cli/tree/main/packages/spaces", - "keywords": [ - "heroku-plugin" - ], - "license": "ISC", - "main": "index.js", - "mocha": { - "require": [ - "./test/helpers.js" - ], - "reporter": "list", - "recursive": true, - "timeout": 360000 - }, - "repository": "heroku/cli", - "scripts": { - "lint": "eslint . --ext .js --config ../../.eslintrc --ignore-path ../../.eslintignore", - "postpublish": "rm oclif.manifest.json", - "prepack": "oclif manifest", - "test": "nyc mocha --forbid-only \"test/**/*.unit.test.js\"", - "version": "oclif readme && git add README.md" - } -} diff --git a/packages/spaces/test/helpers.js b/packages/spaces/test/helpers.js deleted file mode 100644 index 07cae76b07..0000000000 --- a/packages/spaces/test/helpers.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -// set column width to 80 so test runs are all consistent -global.columns = 80 - -let cli = require('@heroku/heroku-cli-util') -cli.raiseErrors = true - -let nock = require('nock') -nock.disableNetConnect() -if (process.env.ENABLE_NET_CONNECT === 'true') { - nock.enableNetConnect() -} diff --git a/packages/spaces/test/unit/commands/vpn/index.unit.test.js b/packages/spaces/test/unit/commands/vpn/index.unit.test.js deleted file mode 100644 index c3cee42883..0000000000 --- a/packages/spaces/test/unit/commands/vpn/index.unit.test.js +++ /dev/null @@ -1,130 +0,0 @@ -'use strict' -/* globals beforeEach */ - -const cli = require('@heroku/heroku-cli-util') -const nock = require('nock') -const cmd = require('../../../../commands/vpn/index') -const expect = require('chai').expect - -describe('spaces:vpn:connections', function () { - beforeEach(() => cli.mockConsole()) - - let space = { - id: '123456789012', - name: 'office', - public_ip: '35.161.69.30', - routable_cidrs: [ - '172.16.0.0/16', - ], - ike_version: 1, - space_cidr_block: '10.0.0.0/16', - status: 'active', - status_message: 'Active', - tunnels: [ - { - last_status_change: '2016-10-25T22:10:05Z', - ip: '52.44.146.197', - customer_ip: '52.44.146.197', - pre_shared_key: 'secret', - status: 'UP', - status_message: 'status message', - }, - { - last_status_change: '2016-10-25T22:09:05Z', - ip: '52.44.146.196', - customer_ip: '52.44.146.196', - pre_shared_key: 'secret', - status: 'UP', - status_message: 'status message', - }, - ], - } - it('displays no connection message if none exist', function () { - let api = nock('https://api.heroku.com:443') - .get('/spaces/my-space/vpn-connections') - .reply(200, []) - return cmd.run({flags: { - space: 'my-space', - }}) - .then(() => expect(cli.stdout).to.equal('No VPN Connections have been created yet\n')) - .then(() => api.done()) - }) - it('displays VPN Connections', function () { - let api = nock('https://api.heroku.com:443') - .get('/spaces/my-space/vpn-connections') - .reply(200, [space]) - return cmd.run({flags: { - space: 'my-space', - }}) - .then(() => expect(cli.stdout).to.equal( - `=== my-space VPN Connections -Name Status Tunnels -────── ────── ─────── -office active UP/UP -`, - )) - .then(() => api.done()) - }) - it('displays VPN Connection ID when name is unavailable', function () { - let conn = {...space, name: ''} - let api = nock('https://api.heroku.com:443') - .get('/spaces/my-space/vpn-connections') - .reply(200, [conn]) - return cmd.run({flags: { - space: 'my-space', - }}) - .then(() => expect(cli.stdout).to.equal( - `=== my-space VPN Connections -Name Status Tunnels -──────────── ────── ─────── -123456789012 active UP/UP -`, - )) - .then(() => api.done()) - }) - it('displays VPN Connections in json', function () { - let api = nock('https://api.heroku.com:443') - .get('/spaces/my-space/vpn-connections') - .reply(200, [space]) - return cmd.run({flags: { - space: 'my-space', - json: true, - }}) - .then(() => expect(cli.stdout).to.equal( - `[ - { - "id": "123456789012", - "name": "office", - "public_ip": "35.161.69.30", - "routable_cidrs": [ - "172.16.0.0/16" - ], - "ike_version": 1, - "space_cidr_block": "10.0.0.0/16", - "status": "active", - "status_message": "Active", - "tunnels": [ - { - "last_status_change": "2016-10-25T22:10:05Z", - "ip": "52.44.146.197", - "customer_ip": "52.44.146.197", - "pre_shared_key": "secret", - "status": "UP", - "status_message": "status message" - }, - { - "last_status_change": "2016-10-25T22:09:05Z", - "ip": "52.44.146.196", - "customer_ip": "52.44.146.196", - "pre_shared_key": "secret", - "status": "UP", - "status_message": "status message" - } - ] - } -] -`, - )) - .then(() => api.done()) - }) -}) diff --git a/packages/spaces/test/unit/lib/format.unit.test.js b/packages/spaces/test/unit/lib/format.unit.test.js deleted file mode 100644 index 5fb213d883..0000000000 --- a/packages/spaces/test/unit/lib/format.unit.test.js +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable new-cap */ -'use strict' - -let expect = require('chai').expect -let format = require('../../../lib/format')() - -describe('CIDRBlocksOrCIDRBlock', function () { - it('formats an array of cidrs', function () { - return expect(format.CIDRBlocksOrCIDRBlock(['a', 'b'])).to.eq('a, b') - }) - - it('formats an array with a single cidr', function () { - return expect(format.CIDRBlocksOrCIDRBlock(['a'])).to.eq('a') - }) - - it('falls back to extracting cidr_block from the fallback row when undefined', function () { - let peer = { - cidr_block: 'a', - } - return expect(format.CIDRBlocksOrCIDRBlock(undefined, peer)).to.eq('a') - }) - - it('falls back to extracting cidr_block from the fallback row when empty array', function () { - let peer = { - cidr_block: 'a', - } - return expect(format.CIDRBlocksOrCIDRBlock([], peer)).to.eq('a') - }) -}) - -describe('CIDR', function () { - it('returns empty string if cidr has no value', function () { - return expect(format.CIDR()).to.eq('') - }) -}) - -describe('Percent', function () { - it('formats a truthy number', function () { - return expect(format.Percent(100)).to.eq('100%') - }) - - it('formats a falsey number', function () { - return expect(format.Percent(0)).to.eq('0%') - }) - - it('formats a non-empty string', function () { - return expect(format.Percent('100')).to.eq('100%') - }) - - it('does not format a empty string', function () { - return expect(format.Percent('')).to.eq('') - }) - - it('does not format null', function () { - return expect(format.Percent(null)).to.eq(null) - }) - - it('does not format undefined', function () { - return expect(format.Percent()).to.eq() - }) -}) - -describe('VPN Status', function () { - it('returns VPN status if status meets switch statement condition', function () { - expect(format.VPNStatus('pending')).to.eq('pending') - expect(format.VPNStatus('provisioning')).to.eq('provisioning') - expect(format.VPNStatus('deprovisioning')).to.eq('deprovisioning') - }) - - it('returns VPN status if status = "DOWN" or "deleting" or "deleted"', function () { - expect(format.VPNStatus('DOWN')).to.eq('DOWN') - expect(format.VPNStatus('deleting')).to.eq('deleting') - expect(format.VPNStatus('deleted')).to.eq('deleted') - }) -}) - -describe('Peering Status', function () { - it('returns peering status if default case is reached in switch statement', function () { - return expect(format.PeeringStatus('foo')).to.eq('foo') - }) -}) - -describe('Host Status', function () { - it('returns host status if status meets switch statement condition', function () { - expect(format.HostStatus('under-assessment')).to.eq('under-assessment') - expect(format.HostStatus('permanent-failure')).to.eq('permanent-failure') - expect(format.HostStatus('released-permanent-failure')).to.eq('released-permanent-failure') - expect(format.HostStatus('foo')).to.eq('foo') - }) -}) diff --git a/packages/spaces/test/unit/lib/parsers.unit.test.js b/packages/spaces/test/unit/lib/parsers.unit.test.js deleted file mode 100644 index 70d380ed5c..0000000000 --- a/packages/spaces/test/unit/lib/parsers.unit.test.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' - -let expect = require('chai').expect -let parsers = require('../../../lib/parsers')() - -describe('splitCsv', function () { - it('splits single value', function () { - return expect(parsers.splitCsv('a')).to.deep.equal(['a']) - }) - - it('splits multiple values', function () { - return expect(parsers.splitCsv('a,b')).to.deep.equal(['a', 'b']) - }) - - it('splits trims values', function () { - return expect(parsers.splitCsv(' a , b ')).to.deep.equal(['a', 'b']) - }) - - it('removes empty component strings', function () { - return expect(parsers.splitCsv('a,,c')).to.deep.equal(['a', 'c']) - }) - - it('returns empty array for null string', function () { - return expect(parsers.splitCsv(null)).to.deep.equal([]) - }) - - it('returns empty array for empty string', function () { - return expect(parsers.splitCsv('')).to.deep.equal([]) - }) -}) diff --git a/packages/spaces/test/unwrap.js b/packages/spaces/test/unwrap.js deleted file mode 100644 index be2a2e01b2..0000000000 --- a/packages/spaces/test/unwrap.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' - -function unwrap(str) { - let sanitize = str.replace(/\n ([▸!]) {3}/g, '') - sanitize = sanitize.replace(/ ([▸!]) {4}/g, '') - - return sanitize -} - -module.exports = unwrap diff --git a/yarn.lock b/yarn.lock index 44cbf7199a..fdf9ae3d7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1282,26 +1282,6 @@ __metadata: languageName: unknown linkType: soft -"@heroku-cli/plugin-ci-v5@npm:^9.0.0-alpha.0": - version: 9.0.0-alpha.0 - resolution: "@heroku-cli/plugin-ci-v5@npm:9.0.0-alpha.0" - dependencies: - "@heroku-cli/command": ^9.0.2 - "@heroku-cli/plugin-run-v5": ^9.0.0-alpha.0 - ansi-escapes: 3.2.0 - bluebird: ^3.5.3 - github-url-to-object: ^4.0.4 - got: ^9.6.0 - heroku-cli-util: ^8.0.11 - inquirer: ^7.0.0 - lodash.flatten: ^4.4.0 - shell-escape: ^0.2.0 - temp: ^0.9.4 - validator: ^13.7.0 - checksum: 764c44f4e36c4add89d96093d238fd0f5a2bee204c77ec315a9d452ab86a5875555b6cf417829a041d7c5bd125055ad2b56dfc1b796271db65260f11803ee87e - languageName: node - linkType: hard - "@heroku-cli/plugin-oauth-v5@workspace:packages/oauth-v5": version: 0.0.0-use.local resolution: "@heroku-cli/plugin-oauth-v5@workspace:packages/oauth-v5" @@ -1344,7 +1324,7 @@ __metadata: languageName: node linkType: hard -"@heroku-cli/plugin-run-v5@^9.0.0-alpha.0, @heroku-cli/plugin-run-v5@workspace:packages/run-v5": +"@heroku-cli/plugin-run-v5@workspace:packages/run-v5": version: 0.0.0-use.local resolution: "@heroku-cli/plugin-run-v5@workspace:packages/run-v5" dependencies: @@ -1386,26 +1366,6 @@ __metadata: languageName: node linkType: hard -"@heroku-cli/plugin-spaces@^9.0.0-alpha.0, @heroku-cli/plugin-spaces@workspace:packages/spaces": - version: 0.0.0-use.local - resolution: "@heroku-cli/plugin-spaces@workspace:packages/spaces" - dependencies: - "@heroku-cli/command": ^9.0.2 - "@heroku-cli/notifications": ^1.2.4 - "@heroku/heroku-cli-util": ^8.0.13 - "@oclif/plugin-legacy": ^1.3.0 - chai: ^4.2.0 - chai-as-promised: ^7.1.1 - lodash: ^4.17.21 - mocha: ^9.2.2 - nock: ^10.0.6 - nyc: ^15.1.0 - oclif: 3.11.3 - sinon: ^7.2.3 - strftime: ^0.10.0 - languageName: unknown - linkType: soft - "@heroku-cli/schema@npm:^1.0.25": version: 1.0.25 resolution: "@heroku-cli/schema@npm:1.0.25" @@ -6576,7 +6536,7 @@ __metadata: languageName: node linkType: hard -"bluebird@npm:^3.5.1, bluebird@npm:^3.5.3": +"bluebird@npm:^3.5.1": version: 3.7.1 resolution: "bluebird@npm:3.7.1" checksum: 58c295399e109925149977ebcb40e42fd109d3e458899e71441bc7e5e0867bbd796fdd20278b425fa29f13377fe335fbfc2a6e68e5ca1da03b1c3afdc439d097 @@ -7296,13 +7256,6 @@ __metadata: languageName: node linkType: hard -"cli-width@npm:^2.0.0": - version: 2.2.1 - resolution: "cli-width@npm:2.2.1" - checksum: 3c21b897a2ff551ae5b3c3ab32c866ed2965dcf7fb442f81adf0e27f4a397925c8f84619af7bcc6354821303f6ee9b2aa31d248306174f32c287986158cf4eed - languageName: node - linkType: hard - "cli-width@npm:^3.0.0": version: 3.0.0 resolution: "cli-width@npm:3.0.0" @@ -10927,7 +10880,7 @@ __metadata: languageName: node linkType: hard -"heroku-cli-util@npm:^8.0.11, heroku-cli-util@npm:^8.0.12": +"heroku-cli-util@npm:^8.0.12": version: 8.0.12 resolution: "heroku-cli-util@npm:8.0.12" dependencies: @@ -10992,11 +10945,9 @@ __metadata: "@heroku-cli/command-v9": "npm:@heroku-cli/command@^9.0.2" "@heroku-cli/notifications": ^1.2.4 "@heroku-cli/plugin-certs-v5": ^9.0.0-alpha.0 - "@heroku-cli/plugin-ci-v5": ^9.0.0-alpha.0 "@heroku-cli/plugin-ps": ^8.1.7 "@heroku-cli/plugin-ps-exec": ^2.4.0 "@heroku-cli/plugin-run": 8.1.4 - "@heroku-cli/plugin-spaces": ^9.0.0-alpha.0 "@heroku-cli/schema": ^1.0.25 "@heroku/buildpack-registry": ^1.0.1 "@heroku/eventsource": ^1.0.7 @@ -11528,27 +11479,6 @@ __metadata: languageName: node linkType: hard -"inquirer@npm:^7.0.0": - version: 7.0.0 - resolution: "inquirer@npm:7.0.0" - dependencies: - ansi-escapes: ^4.2.1 - chalk: ^2.4.2 - cli-cursor: ^3.1.0 - cli-width: ^2.0.0 - external-editor: ^3.0.3 - figures: ^3.0.0 - lodash: ^4.17.15 - mute-stream: 0.0.8 - run-async: ^2.2.0 - rxjs: ^6.4.0 - string-width: ^4.1.0 - strip-ansi: ^5.1.0 - through: ^2.3.6 - checksum: 0e02dc507abd571a6153dc4ec54b87aee4ad32593ddf9fe22cf5aac1627c7f1afc626c5ae48055c1ee7462e6f65bd7dcaeadd407c5104a91b585b0b2d69dfa1d - languageName: node - linkType: hard - "inquirer@npm:^8.0.0, inquirer@npm:^8.2.4": version: 8.2.5 resolution: "inquirer@npm:8.2.5" @@ -11999,13 +11929,6 @@ __metadata: languageName: node linkType: hard -"is-promise@npm:^2.1.0": - version: 2.1.0 - resolution: "is-promise@npm:2.1.0" - checksum: ae31d22c2e0b8a8706bb4a6890998a94a993e70f07323c826e5ea39a8b373ac7ffb50bedfcab465dcbe973a599f3cd337547eed5cd8c7d073ff6a5e13dcf50f7 - languageName: node - linkType: hard - "is-regex@npm:^1.1.4": version: 1.1.4 resolution: "is-regex@npm:1.1.4" @@ -12908,13 +12831,6 @@ __metadata: languageName: node linkType: hard -"lodash.flatten@npm:^4.4.0": - version: 4.4.0 - resolution: "lodash.flatten@npm:4.4.0" - checksum: 0ac34a393d4b795d4b7421153d27c13ae67e08786c9cbb60ff5b732210d46f833598eee3fb3844bb10070e8488efe390ea53bb567377e0cb47e9e630bf0811cb - languageName: node - linkType: hard - "lodash.flattendeep@npm:^4.4.0": version: 4.4.0 resolution: "lodash.flattendeep@npm:4.4.0" @@ -13667,7 +13583,7 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:^0.5.0, mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.2, mkdirp@npm:^0.5.6, mkdirp@npm:~0.5.1": +"mkdirp@npm:^0.5.0, mkdirp@npm:^0.5.2, mkdirp@npm:^0.5.6, mkdirp@npm:~0.5.1": version: 0.5.6 resolution: "mkdirp@npm:0.5.6" dependencies: @@ -13947,7 +13863,7 @@ __metadata: languageName: node linkType: hard -"nock@npm:10.0.6, nock@npm:^10.0.6": +"nock@npm:10.0.6": version: 10.0.6 resolution: "nock@npm:10.0.6" dependencies: @@ -16732,15 +16648,6 @@ __metadata: languageName: node linkType: hard -"run-async@npm:^2.2.0": - version: 2.3.0 - resolution: "run-async@npm:2.3.0" - dependencies: - is-promise: ^2.1.0 - checksum: 9d713151c7a3a5f3ed7c37f27d4a133bca685fd19799fe160d9709037bac0beb489c3517278db8ec07d98ebaa998e453374717236ae05ff6283fc8189663f436 - languageName: node - linkType: hard - "run-parallel@npm:^1.1.9": version: 1.1.9 resolution: "run-parallel@npm:1.1.9" @@ -16748,15 +16655,6 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^6.4.0": - version: 6.5.3 - resolution: "rxjs@npm:6.5.3" - dependencies: - tslib: ^1.9.0 - checksum: 8e9b18f7e3cc255722e3042461142ca2278de5556ec3ca2aaa17d6872711451694e25c5d9aa3913d6e5a453e6805fd754dcd43311475e3a926cbb00ea4bd2a30 - languageName: node - linkType: hard - "rxjs@npm:^7.0.0, rxjs@npm:^7.5.5": version: 7.8.0 resolution: "rxjs@npm:7.8.0" @@ -17802,7 +17700,7 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^5.0.0, strip-ansi@npm:^5.1.0, strip-ansi@npm:^5.2.0": +"strip-ansi@npm:^5.0.0, strip-ansi@npm:^5.2.0": version: 5.2.0 resolution: "strip-ansi@npm:5.2.0" dependencies: @@ -18077,16 +17975,6 @@ __metadata: languageName: node linkType: hard -"temp@npm:^0.9.4": - version: 0.9.4 - resolution: "temp@npm:0.9.4" - dependencies: - mkdirp: ^0.5.1 - rimraf: ~2.6.2 - checksum: 8709d4d63278bd309ca0e49e80a268308dea543a949e71acd427b3314cd9417da9a2cc73425dd9c21c6780334dbffd67e05e7be5aaa73e9affe8479afc6f20e3 - languageName: node - linkType: hard - "term-img@npm:^4.1.0": version: 4.1.0 resolution: "term-img@npm:4.1.0"