@mittwald/cli 1.0.0-alpha.10 → 1.0.0-alpha.13
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 +1136 -579
- package/dist/esm/DeleteBaseCommand.js +1 -1
- package/dist/esm/Formatter.js +3 -0
- package/dist/esm/Helpers.d.ts +1 -0
- package/dist/esm/Helpers.js +7 -1
- package/dist/esm/ListBaseCommand.js +6 -1
- package/dist/esm/Translator.d.ts +1 -0
- package/dist/esm/Translator.js +11 -0
- package/dist/esm/commands/app/install/wordpress.js +1 -1
- package/dist/esm/commands/context/set.js +4 -3
- package/dist/esm/commands/database/mysql/charsets.d.ts +14 -3
- package/dist/esm/commands/database/mysql/charsets.js +25 -2
- package/dist/esm/commands/database/mysql/create.d.ts +23 -0
- package/dist/esm/commands/database/mysql/create.js +103 -0
- package/dist/esm/commands/database/mysql/delete.d.ts +14 -0
- package/dist/esm/commands/database/mysql/delete.js +20 -0
- package/dist/esm/commands/database/mysql/dump.d.ts +15 -0
- package/dist/esm/commands/database/mysql/dump.js +70 -0
- package/dist/esm/commands/database/mysql/get.d.ts +14 -2
- package/dist/esm/commands/database/mysql/get.js +14 -5
- package/dist/esm/commands/database/mysql/list.d.ts +11 -3
- package/dist/esm/commands/database/mysql/list.js +23 -13
- package/dist/esm/commands/database/mysql/phpmyadmin.d.ts +8 -0
- package/dist/esm/commands/database/mysql/phpmyadmin.js +25 -0
- package/dist/esm/commands/database/mysql/port-forward.d.ts +14 -0
- package/dist/esm/commands/database/mysql/port-forward.js +44 -0
- package/dist/esm/commands/database/mysql/shell.d.ts +14 -0
- package/dist/esm/commands/database/mysql/shell.js +39 -0
- package/dist/esm/commands/database/mysql/user/get.d.ts +13 -2
- package/dist/esm/commands/database/mysql/user/get.js +18 -5
- package/dist/esm/commands/database/mysql/user/list.d.ts +13 -3
- package/dist/esm/commands/database/mysql/user/list.js +38 -2
- package/dist/esm/commands/database/mysql/versions.d.ts +13 -3
- package/dist/esm/commands/database/mysql/versions.js +19 -2
- package/dist/esm/commands/database/redis/get.d.ts +15 -2
- package/dist/esm/commands/database/redis/get.js +21 -5
- package/dist/esm/commands/database/redis/list.d.ts +13 -3
- package/dist/esm/commands/database/redis/list.js +26 -2
- package/dist/esm/commands/database/redis/shell.d.ts +13 -0
- package/dist/esm/commands/database/redis/shell.js +26 -0
- package/dist/esm/commands/database/redis/versions.d.ts +11 -3
- package/dist/esm/commands/database/redis/versions.js +12 -2
- package/dist/esm/commands/domain/ownership/list.js +1 -0
- package/dist/esm/commands/domain/virtualhost/create.d.ts +26 -0
- package/dist/esm/commands/domain/virtualhost/create.js +122 -0
- package/dist/esm/commands/domain/virtualhost/delete.d.ts +13 -0
- package/dist/esm/commands/domain/virtualhost/delete.js +21 -0
- package/dist/esm/commands/domain/virtualhost/get.d.ts +13 -2
- package/dist/esm/commands/domain/virtualhost/get.js +85 -5
- package/dist/esm/commands/domain/virtualhost/list.d.ts +1 -1
- package/dist/esm/commands/domain/virtualhost/list.js +29 -13
- package/dist/esm/commands/login/reset.js +1 -1
- package/dist/esm/commands/mail/address/create.d.ts +16 -8
- package/dist/esm/commands/mail/address/create.js +52 -10
- package/dist/esm/commands/org/delete.d.ts +13 -0
- package/dist/esm/commands/org/delete.js +16 -0
- package/dist/esm/commands/org/invite/list-own.d.ts +46 -5
- package/dist/esm/commands/org/invite/list-own.js +38 -3
- package/dist/esm/commands/org/invite/list.d.ts +13 -3
- package/dist/esm/commands/org/invite/list.js +31 -2
- package/dist/esm/commands/org/invite/revoke.d.ts +17 -0
- package/dist/esm/commands/org/invite/revoke.js +39 -0
- package/dist/esm/commands/org/invite.d.ts +21 -0
- package/dist/esm/commands/org/invite.js +66 -0
- package/dist/esm/commands/org/list.d.ts +13 -4
- package/dist/esm/commands/org/list.js +21 -3
- package/dist/esm/commands/org/membership/list-own.d.ts +45 -5
- package/dist/esm/commands/org/membership/list-own.js +41 -3
- package/dist/esm/commands/org/membership/list.d.ts +33 -5
- package/dist/esm/commands/org/membership/list.js +40 -3
- package/dist/esm/commands/org/membership/revoke.d.ts +17 -0
- package/dist/esm/commands/org/membership/revoke.js +43 -0
- package/dist/esm/commands/project/create.js +1 -1
- package/dist/esm/commands/project/get.js +8 -4
- package/dist/esm/commands/project/list-react.js +1 -1
- package/dist/esm/commands/user/api-token/create.js +1 -1
- package/dist/esm/commands/user/ssh-key/create.js +1 -1
- package/dist/esm/generated/domain/listDomainOwnerships.d.ts +1 -1
- package/dist/esm/generated/domain/listDomainOwnerships.js +3 -6
- package/dist/esm/lib/context_flags.js +2 -1
- package/dist/esm/lib/database/common.d.ts +8 -0
- package/dist/esm/lib/database/common.js +17 -0
- package/dist/esm/lib/database/mysql/connect.d.ts +19 -0
- package/dist/esm/lib/database/mysql/connect.js +50 -0
- package/dist/esm/lib/database/mysql/flags.d.ts +10 -0
- package/dist/esm/lib/database/mysql/flags.js +48 -0
- package/dist/esm/lib/database/redis/connect.d.ts +8 -0
- package/dist/esm/lib/database/redis/connect.js +22 -0
- package/dist/esm/lib/database/redis/flags.d.ts +7 -0
- package/dist/esm/lib/database/redis/flags.js +35 -0
- package/dist/esm/lib/handleError.js +11 -0
- package/dist/esm/lib/org/flags.js +2 -1
- package/dist/esm/rendering/process/components/ProcessConfirmation.d.ts +6 -0
- package/dist/esm/rendering/process/components/ProcessConfirmation.js +12 -0
- package/dist/esm/rendering/process/components/ProcessConfirmationStateSummary.d.ts +5 -0
- package/dist/esm/rendering/process/components/ProcessConfirmationStateSummary.js +18 -0
- package/dist/esm/rendering/process/components/ProcessError.d.ts +4 -0
- package/dist/esm/rendering/process/components/ProcessError.js +10 -0
- package/dist/esm/rendering/process/components/ProcessInput.d.ts +6 -0
- package/dist/esm/rendering/process/components/ProcessInput.js +15 -0
- package/dist/esm/rendering/process/components/ProcessInputStateSummary.d.ts +5 -0
- package/dist/esm/rendering/process/components/ProcessInputStateSummary.js +13 -0
- package/dist/esm/rendering/process/components/ProcessState.d.ts +5 -0
- package/dist/esm/rendering/process/components/ProcessState.js +8 -0
- package/dist/esm/rendering/process/components/ProcessStateIcon.d.ts +5 -0
- package/dist/esm/rendering/process/components/ProcessStateIcon.js +22 -0
- package/dist/esm/rendering/process/components/ProcessStateSummary.d.ts +5 -0
- package/dist/esm/rendering/process/components/ProcessStateSummary.js +27 -0
- package/dist/esm/rendering/process/components/ProcessValidationErrors.d.ts +7 -0
- package/dist/esm/rendering/process/components/ProcessValidationErrors.js +15 -0
- package/dist/esm/rendering/{react → process}/process.d.ts +5 -5
- package/dist/esm/rendering/{react → process}/process_fancy.d.ts +1 -12
- package/dist/esm/rendering/process/process_fancy.js +119 -0
- package/dist/esm/rendering/process/process_flags.d.ts +20 -0
- package/dist/esm/rendering/process/process_flags.js +29 -0
- package/dist/esm/rendering/{react → process}/process_quiet.d.ts +2 -2
- package/dist/esm/rendering/react/components/ErrorBox.d.ts +11 -0
- package/dist/esm/rendering/react/components/ErrorBox.js +45 -0
- package/dist/esm/rendering/react/components/Ingress/DnsValidationErrors.d.ts +8 -0
- package/dist/esm/rendering/react/components/Ingress/DnsValidationErrors.js +17 -0
- package/dist/esm/rendering/react/components/Ingress/DomainOwnership.d.ts +8 -0
- package/dist/esm/rendering/react/components/Ingress/DomainOwnership.js +7 -0
- package/dist/esm/rendering/react/components/Note.d.ts +1 -2
- package/dist/esm/rendering/react/components/{ProjectReadiness.js → Project/ProjectReadiness.js} +1 -1
- package/dist/esm/rendering/react/components/Project/ProjectStatus.d.ts +18 -0
- package/dist/esm/rendering/react/components/Warning.d.ts +4 -0
- package/dist/esm/rendering/react/components/Warning.js +7 -0
- package/dist/esm/rendering/react/error.d.ts +7 -0
- package/dist/esm/rendering/react/error.js +12 -0
- package/package.json +28 -8
- package/dist/esm/commands/database/mysql/user/getMysqlUserPhpMyAdminUrl.d.ts +0 -3
- package/dist/esm/commands/database/mysql/user/getMysqlUserPhpMyAdminUrl.js +0 -7
- package/dist/esm/commands/org/invite/get.d.ts +0 -3
- package/dist/esm/commands/org/invite/get.js +0 -6
- package/dist/esm/commands/org/membership/get.d.ts +0 -3
- package/dist/esm/commands/org/membership/get.js +0 -6
- package/dist/esm/generated/customer/getCustomerCategory.d.ts +0 -16
- package/dist/esm/generated/customer/getCustomerCategory.js +0 -25
- package/dist/esm/generated/customer/getCustomerInvite.d.ts +0 -16
- package/dist/esm/generated/customer/getCustomerInvite.js +0 -25
- package/dist/esm/generated/customer/getCustomerMembership.d.ts +0 -16
- package/dist/esm/generated/customer/getCustomerMembership.js +0 -25
- package/dist/esm/generated/customer/listCustomerInvites.d.ts +0 -13
- package/dist/esm/generated/customer/listCustomerInvites.js +0 -17
- package/dist/esm/generated/customer/listCustomerMemberships.d.ts +0 -13
- package/dist/esm/generated/customer/listCustomerMemberships.js +0 -17
- package/dist/esm/generated/customer/listCustomers.d.ts +0 -13
- package/dist/esm/generated/customer/listCustomers.js +0 -17
- package/dist/esm/generated/customer/listInvitesForCustomer.d.ts +0 -13
- package/dist/esm/generated/customer/listInvitesForCustomer.js +0 -24
- package/dist/esm/generated/customer/listMembershipsForCustomer.d.ts +0 -13
- package/dist/esm/generated/customer/listMembershipsForCustomer.js +0 -24
- package/dist/esm/generated/customer/listOfCustomerCategories.d.ts +0 -13
- package/dist/esm/generated/customer/listOfCustomerCategories.js +0 -17
- package/dist/esm/generated/database/getMysqlDatabase.d.ts +0 -16
- package/dist/esm/generated/database/getMysqlDatabase.js +0 -25
- package/dist/esm/generated/database/getMysqlUser.d.ts +0 -16
- package/dist/esm/generated/database/getMysqlUser.js +0 -25
- package/dist/esm/generated/database/getMysqlUserPhpMyAdminUrl.d.ts +0 -14
- package/dist/esm/generated/database/getMysqlUserPhpMyAdminUrl.js +0 -24
- package/dist/esm/generated/database/getRedisDatabase.d.ts +0 -16
- package/dist/esm/generated/database/getRedisDatabase.js +0 -25
- package/dist/esm/generated/database/listMysqlCharsets.d.ts +0 -13
- package/dist/esm/generated/database/listMysqlCharsets.js +0 -17
- package/dist/esm/generated/database/listMysqlDatabases.d.ts +0 -13
- package/dist/esm/generated/database/listMysqlDatabases.js +0 -24
- package/dist/esm/generated/database/listMysqlUsers.d.ts +0 -13
- package/dist/esm/generated/database/listMysqlUsers.js +0 -24
- package/dist/esm/generated/database/listMysqlVersions.d.ts +0 -13
- package/dist/esm/generated/database/listMysqlVersions.js +0 -17
- package/dist/esm/generated/database/listRedisDatabases.d.ts +0 -13
- package/dist/esm/generated/database/listRedisDatabases.js +0 -24
- package/dist/esm/generated/database/listRedisVersions.d.ts +0 -13
- package/dist/esm/generated/database/listRedisVersions.js +0 -17
- package/dist/esm/generated/domain/ingressGetSpecific.d.ts +0 -16
- package/dist/esm/generated/domain/ingressGetSpecific.js +0 -25
- package/dist/esm/rendering/react/components/ProjectStatus.d.ts +0 -7
- package/dist/esm/rendering/react/process_fancy.js +0 -221
- package/dist/esm/rendering/react/process_flags.d.ts +0 -9
- package/dist/esm/rendering/react/process_flags.js +0 -15
- /package/dist/esm/rendering/{react → process}/process.js +0 -0
- /package/dist/esm/rendering/{react → process}/process_quiet.js +0 -0
- /package/dist/esm/rendering/react/components/{ProjectEnabled.d.ts → Project/ProjectEnabled.d.ts} +0 -0
- /package/dist/esm/rendering/react/components/{ProjectEnabled.js → Project/ProjectEnabled.js} +0 -0
- /package/dist/esm/rendering/react/components/{ProjectReadiness.d.ts → Project/ProjectReadiness.d.ts} +0 -0
- /package/dist/esm/rendering/react/components/{ProjectStatus.js → Project/ProjectStatus.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
4
|
+
import * as cp from "child_process";
|
|
5
|
+
import { Text } from "ink";
|
|
6
|
+
import { mysqlArgs, withMySQLId } from "../../../lib/database/mysql/flags.js";
|
|
7
|
+
import { getConnectionDetails } from "../../../lib/database/mysql/connect.js";
|
|
8
|
+
import { Value } from "../../../rendering/react/components/Value.js";
|
|
9
|
+
import { Flags } from "@oclif/core";
|
|
10
|
+
export class PortForward extends ExecRenderBaseCommand {
|
|
11
|
+
static summary = "Forward the TCP port of a MySQL database to a local port";
|
|
12
|
+
static flags = {
|
|
13
|
+
...processFlags,
|
|
14
|
+
port: Flags.integer({
|
|
15
|
+
summary: "The local TCP port to forward to",
|
|
16
|
+
default: 3306,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static args = { ...mysqlArgs };
|
|
20
|
+
async exec() {
|
|
21
|
+
const databaseId = await withMySQLId(this.apiClient, this.flags, this.args, this.config);
|
|
22
|
+
const p = makeProcessRenderer(this.flags, "Port-forwarding a MySQL database");
|
|
23
|
+
const { sshUser, sshHost, hostname, database } = await getConnectionDetails(this.apiClient, databaseId, p);
|
|
24
|
+
const { port } = this.flags;
|
|
25
|
+
p.complete(_jsxs(Text, { children: ["Forwarding MySQL database ", _jsx(Value, { children: database }), " to local port", " ", _jsx(Value, { children: port }), ". Use CTRL+C to cancel."] }));
|
|
26
|
+
const sshArgs = [
|
|
27
|
+
"-T",
|
|
28
|
+
"-L",
|
|
29
|
+
`${port}:${hostname}:3306`,
|
|
30
|
+
"-l",
|
|
31
|
+
sshUser,
|
|
32
|
+
sshHost,
|
|
33
|
+
"cat",
|
|
34
|
+
"/dev/zero",
|
|
35
|
+
];
|
|
36
|
+
cp.spawnSync("ssh", sshArgs, {
|
|
37
|
+
stdio: ["ignore", process.stdout, process.stderr],
|
|
38
|
+
});
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export declare class Shell extends ExecRenderBaseCommand<typeof Shell, Record<string, never>> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
"mysql-password": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
"database-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
protected exec(): Promise<Record<string, never>>;
|
|
13
|
+
protected render(): ReactNode;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
4
|
+
import * as cp from "child_process";
|
|
5
|
+
import { Text } from "ink";
|
|
6
|
+
import { mysqlArgs, mysqlConnectionFlags, withMySQLId, } from "../../../lib/database/mysql/flags.js";
|
|
7
|
+
import { getConnectionDetailsWithPassword } from "../../../lib/database/mysql/connect.js";
|
|
8
|
+
export class Shell extends ExecRenderBaseCommand {
|
|
9
|
+
static summary = "Connect to a MySQL database via the MySQL shell";
|
|
10
|
+
static flags = {
|
|
11
|
+
...processFlags,
|
|
12
|
+
...mysqlConnectionFlags,
|
|
13
|
+
};
|
|
14
|
+
static args = { ...mysqlArgs };
|
|
15
|
+
async exec() {
|
|
16
|
+
const databaseId = await withMySQLId(this.apiClient, this.flags, this.args, this.config);
|
|
17
|
+
const p = makeProcessRenderer(this.flags, "Starting a MySQL shell");
|
|
18
|
+
const { sshUser, sshHost, user, hostname, database, password } = await getConnectionDetailsWithPassword(this.apiClient, databaseId, p, this.flags);
|
|
19
|
+
p.complete(_jsx(Text, { children: "Starting MySQL shell -- get ready..." }));
|
|
20
|
+
const sshArgs = [
|
|
21
|
+
"-t",
|
|
22
|
+
"-l",
|
|
23
|
+
sshUser,
|
|
24
|
+
sshHost,
|
|
25
|
+
"mysql",
|
|
26
|
+
"-h",
|
|
27
|
+
hostname,
|
|
28
|
+
"-u",
|
|
29
|
+
user,
|
|
30
|
+
"-p" + password,
|
|
31
|
+
database,
|
|
32
|
+
];
|
|
33
|
+
cp.spawnSync("ssh", sshArgs, { stdio: "inherit" });
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
2
|
+
import { GetBaseCommand } from "../../../../GetBaseCommand.js";
|
|
3
|
+
type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["database"]["getMysqlUser"]>>;
|
|
4
|
+
export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
|
|
5
|
+
static description: string;
|
|
6
|
+
static flags: {
|
|
7
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
protected getData(): Promise<APIResponse>;
|
|
3
13
|
}
|
|
14
|
+
export {};
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { GetBaseCommand } from "../../../../GetBaseCommand.js";
|
|
2
|
+
import { Args } from "@oclif/core";
|
|
3
|
+
export default class Get extends GetBaseCommand {
|
|
4
|
+
static description = "Get a MySQL user.";
|
|
5
|
+
static flags = {
|
|
6
|
+
...GetBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
static args = {
|
|
9
|
+
id: Args.string({
|
|
10
|
+
description: "ID of the MySQL user to be retrieved.",
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
async getData() {
|
|
15
|
+
return await this.apiClient.database.getMysqlUser({
|
|
16
|
+
pathParameters: { id: this.args.id },
|
|
17
|
+
});
|
|
18
|
+
}
|
|
6
19
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ListBaseCommand } from "../../../../ListBaseCommand.js";
|
|
5
|
+
import { ListColumns } from "../../../../Formatter.js";
|
|
5
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2MysqlDatabasesDatabaseIdUsers.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export
|
|
7
|
+
export type PathParams = MittwaldAPIV2.Paths.V2MysqlDatabasesDatabaseIdUsers.Get.Parameters.Path;
|
|
8
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listMysqlUsers"]>>;
|
|
9
|
+
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static args: {};
|
|
12
|
+
static flags: {
|
|
13
|
+
"database-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
getData(): Promise<Response>;
|
|
7
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.DatabaseMySqlUser[];
|
|
17
|
+
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
8
18
|
}
|
|
9
19
|
export {};
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ListBaseCommand } from "../../../../ListBaseCommand.js";
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
3
|
+
export class List extends ListBaseCommand {
|
|
4
|
+
static description = "List MySQL users belonging to a database.";
|
|
5
|
+
static args = {};
|
|
6
|
+
static flags = {
|
|
7
|
+
...ListBaseCommand.baseFlags,
|
|
8
|
+
"database-id": Flags.string({
|
|
9
|
+
description: "ID of the MySQL database to list users for.",
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
async getData() {
|
|
14
|
+
const pathParams = {
|
|
15
|
+
databaseId: this.flags["database-id"],
|
|
16
|
+
};
|
|
17
|
+
return await this.apiClient.database.listMysqlUsers({
|
|
18
|
+
pathParameters: pathParams,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
3
21
|
mapData(data) {
|
|
4
22
|
return data;
|
|
5
23
|
}
|
|
24
|
+
getColumns(data) {
|
|
25
|
+
const baseColumns = super.getColumns(data);
|
|
26
|
+
return {
|
|
27
|
+
id: baseColumns.id,
|
|
28
|
+
name: {},
|
|
29
|
+
description: {},
|
|
30
|
+
mainUser: {
|
|
31
|
+
header: "Main user",
|
|
32
|
+
get: (i) => (i.mainUser ? "yes" : "no"),
|
|
33
|
+
},
|
|
34
|
+
enabled: { get: (item) => (item.disabled ? "no" : "yes") },
|
|
35
|
+
externalAccess: {
|
|
36
|
+
header: "External access",
|
|
37
|
+
get: (i) => (i.externalAccess ? "yes" : "no"),
|
|
38
|
+
},
|
|
39
|
+
createdAt: baseColumns.createdAt,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
6
42
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
|
+
import { ListColumns } from "../../../Formatter.js";
|
|
5
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2MysqlVersions.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export
|
|
7
|
+
export type PathParams = MittwaldAPIV2.Paths.V2MysqlVersions.Get.Parameters.Path;
|
|
8
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listMysqlVersions"]>>;
|
|
9
|
+
export declare class Versions extends ListBaseCommand<typeof Versions, ResponseItem, Response> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static args: {};
|
|
12
|
+
static flags: {
|
|
13
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
14
|
+
};
|
|
15
|
+
getData(): Promise<Response>;
|
|
7
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.DatabaseMySqlVersion[];
|
|
17
|
+
protected getColumns(): ListColumns<ResponseItem>;
|
|
8
18
|
}
|
|
9
19
|
export {};
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
1
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
|
+
export class Versions extends ListBaseCommand {
|
|
3
|
+
static description = "List available MySQL versions.";
|
|
4
|
+
static args = {};
|
|
5
|
+
static flags = {
|
|
6
|
+
...ListBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
async getData() {
|
|
9
|
+
return await this.apiClient.database.listMysqlVersions({
|
|
10
|
+
pathParameters: {},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
3
13
|
mapData(data) {
|
|
4
14
|
return data;
|
|
5
15
|
}
|
|
16
|
+
getColumns() {
|
|
17
|
+
return {
|
|
18
|
+
id: { header: "ID" },
|
|
19
|
+
name: {},
|
|
20
|
+
version: { get: (item) => item.number },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
6
23
|
}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
2
|
+
import { GetBaseCommand } from "../../../GetBaseCommand.js";
|
|
3
|
+
export type PathParams = MittwaldAPIV2.Paths.V2RedisDatabasesId.Get.Parameters.Path;
|
|
4
|
+
type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["database"]["getRedisDatabase"]>>;
|
|
5
|
+
export declare class Get extends GetBaseCommand<typeof Get, APIResponse> {
|
|
6
|
+
static description: string;
|
|
7
|
+
static flags: {
|
|
8
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
id: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
protected getData(): Promise<APIResponse>;
|
|
14
|
+
protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
|
|
3
15
|
}
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Args } from "@oclif/core";
|
|
2
|
+
import { GetBaseCommand } from "../../../GetBaseCommand.js";
|
|
3
|
+
export class Get extends GetBaseCommand {
|
|
4
|
+
static description = "Get a Redis database.";
|
|
5
|
+
static flags = {
|
|
6
|
+
...GetBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
static args = {
|
|
9
|
+
id: Args.string({
|
|
10
|
+
description: "ID of the Redis database to retrieve.",
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
async getData() {
|
|
15
|
+
return await this.apiClient.database.getRedisDatabase({
|
|
16
|
+
pathParameters: await this.mapParams(this.args),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
mapParams(input) {
|
|
20
|
+
return input;
|
|
21
|
+
}
|
|
6
22
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
|
+
import { ListColumns } from "../../../Formatter.js";
|
|
5
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdRedisDatabases.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export
|
|
7
|
+
export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdRedisDatabases.Get.Parameters.Path;
|
|
8
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listRedisDatabases"]>>;
|
|
9
|
+
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static args: {};
|
|
12
|
+
static flags: {
|
|
13
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any> | import("@oclif/core/lib/interfaces/parser.js").OptionFlag<unknown>;
|
|
14
|
+
};
|
|
15
|
+
getData(): Promise<Response>;
|
|
7
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.DatabaseRedisDatabase[];
|
|
17
|
+
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
8
18
|
}
|
|
9
19
|
export {};
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
3
|
+
export class List extends ListBaseCommand {
|
|
4
|
+
static description = "List Redis databases belonging to a project.";
|
|
5
|
+
static args = {};
|
|
6
|
+
static flags = {
|
|
7
|
+
...ListBaseCommand.baseFlags,
|
|
8
|
+
...projectFlags,
|
|
9
|
+
};
|
|
10
|
+
async getData() {
|
|
11
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
12
|
+
return await this.apiClient.database.listRedisDatabases({
|
|
13
|
+
pathParameters: { projectId },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
3
16
|
mapData(data) {
|
|
4
17
|
return data;
|
|
5
18
|
}
|
|
19
|
+
getColumns(data) {
|
|
20
|
+
const baseColumns = super.getColumns(data);
|
|
21
|
+
return {
|
|
22
|
+
id: baseColumns.id,
|
|
23
|
+
name: {},
|
|
24
|
+
version: {},
|
|
25
|
+
description: {},
|
|
26
|
+
hostname: {},
|
|
27
|
+
createdAt: baseColumns.createdAt,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
6
30
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export declare class Shell extends ExecRenderBaseCommand<typeof Shell, Record<string, never>> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
static args: {
|
|
9
|
+
"database-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
protected exec(): Promise<Record<string, never>>;
|
|
12
|
+
protected render(): ReactNode;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
4
|
+
import * as cp from "child_process";
|
|
5
|
+
import { Text } from "ink";
|
|
6
|
+
import { getConnectionDetails } from "../../../lib/database/redis/connect.js";
|
|
7
|
+
import { redisArgs, withRedisId } from "../../../lib/database/redis/flags.js";
|
|
8
|
+
export class Shell extends ExecRenderBaseCommand {
|
|
9
|
+
static summary = "Connect to a Redis database via the redis-cli";
|
|
10
|
+
static flags = {
|
|
11
|
+
...processFlags,
|
|
12
|
+
};
|
|
13
|
+
static args = { ...redisArgs };
|
|
14
|
+
async exec() {
|
|
15
|
+
const databaseId = await withRedisId(this.apiClient, this.flags, this.args, this.config);
|
|
16
|
+
const p = makeProcessRenderer(this.flags, "Starting a Redis shell");
|
|
17
|
+
const { sshUser, sshHost, hostname } = await getConnectionDetails(this.apiClient, databaseId, p);
|
|
18
|
+
p.complete(_jsx(Text, { children: "Starting Redis shell -- get ready..." }));
|
|
19
|
+
const sshArgs = ["-t", "-l", sshUser, sshHost, "redis-cli", "-h", hostname];
|
|
20
|
+
cp.spawnSync("ssh", sshArgs, { stdio: "inherit" });
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Simplify } from "@mittwald/api-client-commons";
|
|
2
|
-
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
+
import { MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
3
3
|
import { SuccessfulResponse } from "../../../types.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
5
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2RedisVersions.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
6
|
-
export
|
|
6
|
+
export type PathParams = MittwaldAPIV2.Paths.V2RedisVersions.Get.Parameters.Path;
|
|
7
|
+
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["database"]["listRedisVersions"]>>;
|
|
8
|
+
export default class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
9
|
+
static description: string;
|
|
10
|
+
static args: {};
|
|
11
|
+
static flags: {
|
|
12
|
+
[x: string]: import("@oclif/core/lib/interfaces/parser.js").CompletableFlag<any>;
|
|
13
|
+
};
|
|
14
|
+
getData(): Promise<Response>;
|
|
7
15
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.DatabaseRedisVersion[];
|
|
8
16
|
}
|
|
9
17
|
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class List extends
|
|
1
|
+
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
|
+
export default class List extends ListBaseCommand {
|
|
3
|
+
static description = "List available Redis versions.";
|
|
4
|
+
static args = {};
|
|
5
|
+
static flags = {
|
|
6
|
+
...ListBaseCommand.baseFlags,
|
|
7
|
+
};
|
|
8
|
+
async getData() {
|
|
9
|
+
return await this.apiClient.database.listRedisVersions({
|
|
10
|
+
pathParameters: {},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
3
13
|
mapData(data) {
|
|
4
14
|
return data;
|
|
5
15
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
4
|
+
import IngressIngress = MittwaldAPIV2.Components.Schemas.IngressIngress;
|
|
5
|
+
import DomainDomainOwnership = MittwaldAPIV2.Components.Schemas.DomainDomainOwnership;
|
|
6
|
+
type CreateResult = {
|
|
7
|
+
ingress: IngressIngress;
|
|
8
|
+
ownership: DomainDomainOwnership | null;
|
|
9
|
+
};
|
|
10
|
+
export default class Create extends ExecRenderBaseCommand<typeof Create, CreateResult> {
|
|
11
|
+
static description: string;
|
|
12
|
+
static examples: {
|
|
13
|
+
description: string;
|
|
14
|
+
command: string;
|
|
15
|
+
}[];
|
|
16
|
+
static flags: {
|
|
17
|
+
hostname: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
|
+
"path-to-dir": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
19
|
+
"path-to-app": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
20
|
+
"path-to-url": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
22
|
+
};
|
|
23
|
+
protected exec(): Promise<CreateResult>;
|
|
24
|
+
protected render({ ingress, ownership }: CreateResult): ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
|
+
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
4
|
+
import { projectFlags, withProjectId } from "../../../lib/project/flags.js";
|
|
5
|
+
import { assertStatus } from "@mittwald/api-client-commons";
|
|
6
|
+
import { Flags } from "@oclif/core";
|
|
7
|
+
import { Success } from "../../../rendering/react/components/Success.js";
|
|
8
|
+
import { Value } from "../../../rendering/react/components/Value.js";
|
|
9
|
+
import { waitUntil } from "../../../lib/wait.js";
|
|
10
|
+
import { Box } from "ink";
|
|
11
|
+
import { DnsValidationErrors } from "../../../rendering/react/components/Ingress/DnsValidationErrors.js";
|
|
12
|
+
import { DomainOwnership } from "../../../rendering/react/components/Ingress/DomainOwnership.js";
|
|
13
|
+
export default class Create extends ExecRenderBaseCommand {
|
|
14
|
+
static description = "Create a new ingress";
|
|
15
|
+
static examples = [
|
|
16
|
+
{
|
|
17
|
+
description: "Create a new ingress, with the root path mapping to your project's root directory",
|
|
18
|
+
command: "<%= config.bin %> <%= command.id %> --hostname mw.example --path-to-dir /:/",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "Create a new ingress, with the root path mapping to an app",
|
|
22
|
+
command: "<%= config.bin %> <%= command.id %> --hostname mw.example --path-to-app /:3ecaf1a9-6eb4-4869-b811-8a13c3a2e745",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
description: "Create a new ingress, with the root path mapping to a URL",
|
|
26
|
+
command: "<%= config.bin %> <%= command.id %> --hostname mw.example --path-to-url /:https://redirect.example",
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
static flags = {
|
|
30
|
+
...processFlags,
|
|
31
|
+
...projectFlags,
|
|
32
|
+
hostname: Flags.string({
|
|
33
|
+
description: "the hostname of the ingress",
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
"path-to-dir": Flags.string({
|
|
37
|
+
summary: "add a path mapping to a directory",
|
|
38
|
+
multiple: true,
|
|
39
|
+
description: "This flag can be used to map a specific URL path to a directory in your project's file system; the value for this flag should be the URL path and the filesystem path, separated by a colon, e.g. /:/ or /:/some/sub/path. You can specify this flag multiple times to map multiple paths to different directories, and also combine it with the other --path-to-* flags.",
|
|
40
|
+
}),
|
|
41
|
+
"path-to-app": Flags.string({
|
|
42
|
+
summary: "add a path mapping to an app",
|
|
43
|
+
description: "This flag can be used to map a specific URL path to an app; the value for this flag should be the URL path and the app ID, separated by a colon, e.g. /:3ecaf1a9-6eb4-4869-b811-8a13c3a2e745. You can specify this flag multiple times to map multiple paths to different apps, and also combine it with the other --path-to-* flags.",
|
|
44
|
+
multiple: true,
|
|
45
|
+
}),
|
|
46
|
+
"path-to-url": Flags.string({
|
|
47
|
+
summary: "add a path mapping to an external url",
|
|
48
|
+
multiple: true,
|
|
49
|
+
description: "This flag can be used to map a specific URL path to an external URL; the value for this flag should be the URL path and the external URL, separated by a colon, e.g. /:https://redirect.example. You can specify this flag multiple times to map multiple paths to different external URLs, and also combine it with the other --path-to-* flags.",
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
async exec() {
|
|
53
|
+
const projectId = await withProjectId(this.apiClient, this.flags, this.args, this.config);
|
|
54
|
+
const process = makeProcessRenderer(this.flags, "Creating a new ingress");
|
|
55
|
+
const { hostname } = this.flags;
|
|
56
|
+
const paths = [];
|
|
57
|
+
for (const pathToDir of this.flags["path-to-dir"] ?? []) {
|
|
58
|
+
const [path, directory] = pathToDir.split(":");
|
|
59
|
+
paths.push({ path, target: { directory } });
|
|
60
|
+
}
|
|
61
|
+
for (const pathToApp of this.flags["path-to-app"] ?? []) {
|
|
62
|
+
const [path, installationId] = pathToApp.split(":");
|
|
63
|
+
paths.push({ path, target: { installationId } });
|
|
64
|
+
}
|
|
65
|
+
for (const pathToUrl of this.flags["path-to-url"] ?? []) {
|
|
66
|
+
const [path, url] = pathToUrl.split(":");
|
|
67
|
+
paths.push({ path, target: { url } });
|
|
68
|
+
}
|
|
69
|
+
const { id: ingressId } = await process.runStep("creating ingress", async () => {
|
|
70
|
+
const response = await this.apiClient.domain.ingressCreate({
|
|
71
|
+
data: {
|
|
72
|
+
projectId,
|
|
73
|
+
hostname,
|
|
74
|
+
paths,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
assertStatus(response, 201);
|
|
78
|
+
return response.data;
|
|
79
|
+
});
|
|
80
|
+
const [ingress, ownership] = await process.runStep("waiting for ingress to be ready", async () => {
|
|
81
|
+
return await waitUntil(async () => {
|
|
82
|
+
const response = await this.apiClient.domain.ingressGetSpecific({
|
|
83
|
+
pathParameters: { ingressId },
|
|
84
|
+
});
|
|
85
|
+
if (response.status !== 200) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const ownershipResponse = await this.apiClient.domain.listDomainOwnerships({
|
|
89
|
+
pathParameters: { projectId },
|
|
90
|
+
});
|
|
91
|
+
if (ownershipResponse.status === 200) {
|
|
92
|
+
const ownership = ownershipResponse.data.find((o) => o.domain === hostname);
|
|
93
|
+
if (ownership) {
|
|
94
|
+
return [response.data, ownership];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (response.data.ips.v4.length === 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return [response.data, null];
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
process.complete(_jsxs(Success, { children: ["You virtual host for ", _jsx(Value, { children: hostname }), " was successfully created! \uD83D\uDE80", " ", ingress.ips.v4.length > 0
|
|
104
|
+
? "Please point your DNS records to the following IP addresses: " +
|
|
105
|
+
ingress.ips.v4.join(", ")
|
|
106
|
+
: "Please follow the instructions below to verify your domain ownership."] }));
|
|
107
|
+
return { ingress, ownership };
|
|
108
|
+
}
|
|
109
|
+
render({ ingress, ownership }) {
|
|
110
|
+
if (this.flags.quiet) {
|
|
111
|
+
this.log(ingress.id);
|
|
112
|
+
}
|
|
113
|
+
const output = [];
|
|
114
|
+
if (ingress.dnsValidationErrors.length > 0) {
|
|
115
|
+
output.push(_jsx(Box, { marginLeft: 2, children: _jsx(DnsValidationErrors, { ingress: ingress }) }, "dns"));
|
|
116
|
+
}
|
|
117
|
+
if (ownership) {
|
|
118
|
+
output.push(_jsx(Box, { marginLeft: 2, children: _jsx(DomainOwnership, { ownership: ownership }) }, "ownership"));
|
|
119
|
+
}
|
|
120
|
+
return output;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DeleteBaseCommand } from "../../../DeleteBaseCommand.js";
|
|
2
|
+
export default class Delete extends DeleteBaseCommand<typeof Delete> {
|
|
3
|
+
static description: string;
|
|
4
|
+
static resourceName: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
|
+
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
"virtual-host-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
protected deleteResource(): Promise<void>;
|
|
13
|
+
}
|