@mittwald/cli 1.0.0-alpha.27 → 1.0.0-alpha.28
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 +814 -760
- package/dist/esm/ExtendedBaseCommand.d.ts +4 -0
- package/dist/esm/ExtendedBaseCommand.js +12 -0
- package/dist/esm/Formatter.js +13 -1
- package/dist/esm/GetBaseCommand.d.ts +2 -3
- package/dist/esm/GetBaseCommand.js +2 -4
- package/dist/esm/ListBaseCommand.d.ts +2 -3
- package/dist/esm/ListBaseCommand.js +2 -4
- package/dist/esm/commands/app/copy.d.ts +1 -1
- package/dist/esm/commands/app/copy.js +3 -3
- package/dist/esm/commands/app/dependency/list.d.ts +1 -1
- package/dist/esm/commands/app/dependency/update.d.ts +1 -1
- package/dist/esm/commands/app/dependency/update.js +3 -3
- package/dist/esm/commands/app/dependency/versions.d.ts +1 -1
- package/dist/esm/commands/app/get.d.ts +1 -1
- package/dist/esm/commands/app/get.js +4 -3
- package/dist/esm/commands/app/list.d.ts +1 -1
- package/dist/esm/commands/app/list.js +4 -0
- package/dist/esm/commands/app/ssh.d.ts +4 -3
- package/dist/esm/commands/app/ssh.js +18 -9
- package/dist/esm/commands/app/uninstall.d.ts +1 -1
- package/dist/esm/commands/app/uninstall.js +3 -6
- package/dist/esm/commands/backup/create.js +2 -2
- package/dist/esm/commands/backup/list.js +2 -2
- package/dist/esm/commands/context/get.js +27 -5
- package/dist/esm/commands/conversation/show.js +1 -2
- package/dist/esm/commands/cronjob/create.d.ts +22 -0
- package/dist/esm/commands/cronjob/create.js +96 -0
- package/dist/esm/commands/cronjob/delete.d.ts +13 -0
- package/dist/esm/commands/cronjob/delete.js +21 -0
- package/dist/esm/commands/cronjob/execute.d.ts +17 -0
- package/dist/esm/commands/cronjob/execute.js +42 -0
- package/dist/esm/commands/cronjob/execution/abort.d.ts +18 -0
- package/dist/esm/commands/cronjob/execution/abort.js +41 -0
- package/dist/esm/commands/cronjob/execution/list.js +4 -5
- package/dist/esm/commands/cronjob/get.d.ts +7 -9
- package/dist/esm/commands/cronjob/get.js +22 -12
- package/dist/esm/commands/cronjob/list.js +4 -6
- package/dist/esm/commands/database/mysql/charsets.d.ts +2 -4
- package/dist/esm/commands/database/mysql/charsets.js +2 -6
- package/dist/esm/commands/database/mysql/create.js +2 -2
- package/dist/esm/commands/database/mysql/delete.js +2 -2
- package/dist/esm/commands/database/mysql/list.d.ts +1 -2
- package/dist/esm/commands/database/mysql/list.js +2 -2
- package/dist/esm/commands/database/mysql/user/list.d.ts +1 -2
- package/dist/esm/commands/database/mysql/user/list.js +2 -3
- package/dist/esm/commands/database/mysql/versions.d.ts +1 -2
- package/dist/esm/commands/database/mysql/versions.js +1 -3
- package/dist/esm/commands/database/redis/create.js +2 -2
- package/dist/esm/commands/database/redis/get.d.ts +1 -3
- package/dist/esm/commands/database/redis/get.js +0 -3
- package/dist/esm/commands/database/redis/list.d.ts +1 -2
- package/dist/esm/commands/database/redis/list.js +3 -5
- package/dist/esm/commands/database/redis/versions.d.ts +1 -2
- package/dist/esm/commands/database/redis/versions.js +2 -3
- package/dist/esm/commands/domain/dnszone/list.d.ts +1 -2
- package/dist/esm/commands/domain/dnszone/list.js +2 -2
- package/dist/esm/commands/domain/list.d.ts +1 -2
- package/dist/esm/commands/domain/list.js +3 -4
- package/dist/esm/commands/domain/ownership/list.js +3 -7
- package/dist/esm/commands/domain/virtualhost/create.js +4 -4
- package/dist/esm/commands/domain/virtualhost/delete.js +1 -1
- package/dist/esm/commands/domain/virtualhost/get.js +1 -1
- package/dist/esm/commands/domain/virtualhost/list.d.ts +1 -3
- package/dist/esm/commands/domain/virtualhost/list.js +5 -8
- package/dist/esm/commands/mail/address/create.d.ts +4 -0
- package/dist/esm/commands/mail/address/create.js +59 -5
- package/dist/esm/commands/mail/address/list.d.ts +2 -2
- package/dist/esm/commands/mail/address/list.js +2 -4
- package/dist/esm/commands/mail/deliverybox/list.js +2 -2
- package/dist/esm/commands/project/create.js +2 -2
- package/dist/esm/commands/project/delete.d.ts +0 -1
- package/dist/esm/commands/project/delete.js +4 -8
- package/dist/esm/commands/project/filesystem/usage.d.ts +1 -1
- package/dist/esm/commands/project/filesystem/usage.js +3 -3
- package/dist/esm/commands/project/get.js +5 -5
- package/dist/esm/commands/project/invite/list.js +2 -2
- package/dist/esm/commands/project/membership/list.js +5 -5
- package/dist/esm/commands/project/ssh.d.ts +2 -2
- package/dist/esm/commands/project/ssh.js +4 -5
- package/dist/esm/commands/project/update.d.ts +2 -2
- package/dist/esm/commands/project/update.js +4 -5
- package/dist/esm/commands/server/get.d.ts +1 -3
- package/dist/esm/commands/server/get.js +2 -5
- package/dist/esm/commands/sftp-user/list.js +2 -2
- package/dist/esm/commands/ssh-user/list.js +2 -2
- package/dist/esm/lib/app/flags.d.ts +4 -2
- package/dist/esm/lib/app/flags.js +3 -7
- package/dist/esm/lib/assert_success.d.ts +3 -0
- package/dist/esm/lib/assert_success.js +7 -0
- package/dist/esm/lib/context.d.ts +24 -5
- package/dist/esm/lib/context.js +21 -16
- package/dist/esm/lib/context_flags.d.ts +10 -6
- package/dist/esm/lib/context_flags.js +8 -5
- package/dist/esm/lib/context_terraform.d.ts +6 -0
- package/dist/esm/lib/context_terraform.js +61 -0
- package/dist/esm/lib/context_user.d.ts +10 -0
- package/dist/esm/lib/context_user.js +34 -0
- package/dist/esm/lib/org/flags.d.ts +1 -9
- package/dist/esm/lib/org/flags.js +1 -1
- package/dist/esm/lib/project/flags.d.ts +1 -9
- package/dist/esm/lib/project/flags.js +1 -1
- package/dist/esm/lib/project/ingress.js +4 -2
- package/dist/esm/lib/server/flags.d.ts +1 -9
- package/dist/esm/lib/server/flags.js +1 -1
- package/dist/esm/rendering/react/RenderBaseCommand.d.ts +3 -0
- package/dist/esm/rendering/react/RenderBaseCommand.js +7 -0
- package/dist/esm/rendering/react/components/AppInstallation/AppInstallationDetails.js +8 -1
- package/dist/esm/rendering/react/components/CronJob/CronJobDetails.d.ts +8 -0
- package/dist/esm/rendering/react/components/CronJob/CronJobDetails.js +48 -0
- package/dist/esm/rendering/react/components/LocalFilename.d.ts +5 -0
- package/dist/esm/rendering/react/components/LocalFilename.js +14 -0
- package/dist/esm/rendering/react/components/Note.d.ts +1 -0
- package/dist/esm/rendering/react/components/Note.js +1 -1
- package/package.json +8 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
3
3
|
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
4
|
-
import { projectFlags
|
|
4
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
5
5
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
6
6
|
import { Flags } from "@oclif/core";
|
|
7
7
|
import { Success } from "../../../rendering/react/components/Success.js";
|
|
@@ -50,7 +50,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
50
50
|
}),
|
|
51
51
|
};
|
|
52
52
|
async exec() {
|
|
53
|
-
const projectId = await withProjectId(
|
|
53
|
+
const projectId = await this.withProjectId(Create);
|
|
54
54
|
const process = makeProcessRenderer(this.flags, "Creating a new ingress");
|
|
55
55
|
const { hostname } = this.flags;
|
|
56
56
|
const paths = [];
|
|
@@ -67,7 +67,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
67
67
|
paths.push({ path, target: { url } });
|
|
68
68
|
}
|
|
69
69
|
const { id: ingressId } = await process.runStep("creating ingress", async () => {
|
|
70
|
-
const response = await this.apiClient.domain.
|
|
70
|
+
const response = await this.apiClient.domain.ingressCreateIngress({
|
|
71
71
|
data: {
|
|
72
72
|
projectId,
|
|
73
73
|
hostname,
|
|
@@ -79,7 +79,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
79
79
|
});
|
|
80
80
|
const [ingress, ownership] = await process.runStep("waiting for ingress to be ready", async () => {
|
|
81
81
|
return await waitUntil(async () => {
|
|
82
|
-
const response = await this.apiClient.domain.
|
|
82
|
+
const response = await this.apiClient.domain.ingressGetIngress({
|
|
83
83
|
ingressId,
|
|
84
84
|
});
|
|
85
85
|
if (response.status !== 200) {
|
|
@@ -13,7 +13,7 @@ export default class Delete extends DeleteBaseCommand {
|
|
|
13
13
|
};
|
|
14
14
|
async deleteResource() {
|
|
15
15
|
const ingressId = this.args["virtual-host-id"];
|
|
16
|
-
const response = await this.apiClient.domain.
|
|
16
|
+
const response = await this.apiClient.domain.ingressDeleteIngress({
|
|
17
17
|
ingressId,
|
|
18
18
|
});
|
|
19
19
|
assertStatus(response, 204);
|
|
@@ -74,7 +74,7 @@ export class Get extends RenderBaseCommand {
|
|
|
74
74
|
};
|
|
75
75
|
render() {
|
|
76
76
|
const ingressId = this.args["ingress-id"];
|
|
77
|
-
const ingressResponse = usePromise((id) => this.apiClient.domain.
|
|
77
|
+
const ingressResponse = usePromise((id) => this.apiClient.domain.ingressGetIngress({
|
|
78
78
|
ingressId: id,
|
|
79
79
|
}), [ingressId]);
|
|
80
80
|
assertStatus(ingressResponse, 200);
|
|
@@ -4,8 +4,7 @@ import { SuccessfulResponse } from "../../../types.js";
|
|
|
4
4
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
5
5
|
import { ListColumns } from "../../../Formatter.js";
|
|
6
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2Ingresses.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
7
|
-
|
|
8
|
-
export type Response = Awaited<ReturnType<MittwaldAPIV2Client["domain"]["ingressListAccessible"]>>;
|
|
7
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["domain"]["ingressListIngresses"]>>;
|
|
9
8
|
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
9
|
static description: string;
|
|
11
10
|
static args: {};
|
|
@@ -14,7 +13,6 @@ export declare class List extends ListBaseCommand<typeof List, ResponseItem, Res
|
|
|
14
13
|
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
15
14
|
};
|
|
16
15
|
getData(): Promise<Response>;
|
|
17
|
-
protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
|
|
18
16
|
protected mapData(data: SuccessfulResponse<Response, 200>["data"]): ResponseItem[] | Promise<ResponseItem[]>;
|
|
19
17
|
protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
|
|
20
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
2
2
|
import { Flags } from "@oclif/core";
|
|
3
|
-
import { projectFlags
|
|
3
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
4
4
|
export class List extends ListBaseCommand {
|
|
5
5
|
static description = "List virtualhosts for a project.";
|
|
6
6
|
static args = {};
|
|
@@ -14,16 +14,13 @@ export class List extends ListBaseCommand {
|
|
|
14
14
|
};
|
|
15
15
|
async getData() {
|
|
16
16
|
if (this.flags.all) {
|
|
17
|
-
return await this.apiClient.domain.
|
|
17
|
+
return await this.apiClient.domain.ingressListIngresses({});
|
|
18
18
|
}
|
|
19
|
-
const projectId = await withProjectId(
|
|
20
|
-
return await this.apiClient.domain.
|
|
21
|
-
projectId,
|
|
19
|
+
const projectId = await this.withProjectId(List);
|
|
20
|
+
return await this.apiClient.domain.ingressListIngresses({
|
|
21
|
+
queryParameters: { projectId },
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
mapParams(input) {
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
27
24
|
mapData(data) {
|
|
28
25
|
return data;
|
|
29
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { ProcessRenderer } from "../../../rendering/process/process.js";
|
|
4
|
+
import { FlagInput, OutputFlags } from "@oclif/core/lib/interfaces/parser.js";
|
|
4
5
|
type CreateResult = {
|
|
5
6
|
addressId: string;
|
|
6
7
|
generatedPassword: string | null;
|
|
@@ -15,6 +16,7 @@ export default class Create extends ExecRenderBaseCommand<typeof Create, CreateR
|
|
|
15
16
|
quota: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
16
17
|
password: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
18
|
"random-password": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
19
|
+
"forward-to": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
18
20
|
quiet: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
19
21
|
"project-id": import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string>;
|
|
20
22
|
};
|
|
@@ -23,6 +25,8 @@ export default class Create extends ExecRenderBaseCommand<typeof Create, CreateR
|
|
|
23
25
|
command: string;
|
|
24
26
|
}[];
|
|
25
27
|
protected getPassword(process: ProcessRenderer): Promise<[string, boolean]>;
|
|
28
|
+
protected createForwardAddress(projectId: string, process: ProcessRenderer, flags: OutputFlags<FlagInput<typeof Create.flags>>): Promise<CreateResult>;
|
|
29
|
+
protected createMailbox(projectId: string, process: ProcessRenderer, flags: OutputFlags<FlagInput<typeof Create.flags>>): Promise<CreateResult>;
|
|
26
30
|
protected exec(): Promise<CreateResult>;
|
|
27
31
|
protected render(executionResult: CreateResult): ReactNode;
|
|
28
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Flags } from "@oclif/core";
|
|
3
3
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
4
|
-
import { projectFlags
|
|
4
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
5
5
|
import { ExecRenderBaseCommand } from "../../../rendering/react/ExecRenderBaseCommand.js";
|
|
6
6
|
import { makeProcessRenderer, processFlags, } from "../../../rendering/process/process_flags.js";
|
|
7
7
|
import { Text } from "ink";
|
|
@@ -11,6 +11,14 @@ import { Value } from "../../../rendering/react/components/Value.js";
|
|
|
11
11
|
export default class Create extends ExecRenderBaseCommand {
|
|
12
12
|
static summary = "Create a new mail address";
|
|
13
13
|
static description = `\
|
|
14
|
+
This command can be used to create a new mail address in a project.
|
|
15
|
+
|
|
16
|
+
A mail address is either associated with a mailbox, or forwards to another address.
|
|
17
|
+
|
|
18
|
+
To create a forwarding address, use the --forward-to flag. This flag can be used multiple times to forward to multiple addresses.
|
|
19
|
+
|
|
20
|
+
When no --forward-to flag is given, the command will create a mailbox for the address. In this case, the --catch-all flag can be used to make the mailbox a catch-all mailbox.
|
|
21
|
+
|
|
14
22
|
When running this command with the --quiet flag, the output will contain the ID of the newly created address.
|
|
15
23
|
In addition, when run with --generated-password the output will be the ID of the newly created address, followed by a tab character and the generated password.`;
|
|
16
24
|
static flags = {
|
|
@@ -41,6 +49,24 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
41
49
|
summary: "generate a random password",
|
|
42
50
|
description: "This flag will cause the command to generate a random 32-character password for the mailbox; when running with --quiet, the address ID and the password will be printed to stdout, separated by a tab character.",
|
|
43
51
|
}),
|
|
52
|
+
"forward-to": Flags.string({
|
|
53
|
+
summary: "forward mail to another address",
|
|
54
|
+
default: undefined,
|
|
55
|
+
multiple: true,
|
|
56
|
+
description: "This flag will cause the mailbox to forward all incoming mail to the given address.\n\nNote: This flag is exclusive with --catch-all, --enable-spam-protection, --quota, --password and --random-password.",
|
|
57
|
+
relationships: [
|
|
58
|
+
{
|
|
59
|
+
type: "none",
|
|
60
|
+
flags: [
|
|
61
|
+
"catch-all",
|
|
62
|
+
"enable-spam-protection",
|
|
63
|
+
"quota",
|
|
64
|
+
"password",
|
|
65
|
+
"random-password",
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
}),
|
|
44
70
|
};
|
|
45
71
|
static examples = [
|
|
46
72
|
{
|
|
@@ -51,6 +77,10 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
51
77
|
description: "Create non-interactively with random password",
|
|
52
78
|
command: "<%= config.bin %> <%= command.id %> --random-password --address foo@bar.example",
|
|
53
79
|
},
|
|
80
|
+
{
|
|
81
|
+
description: "Create a forwarding address",
|
|
82
|
+
command: "<%= config.bin %> <%= command.id %> --address foo@bar.example --forward-to bar@bar.example --forward-to baz@bar.example",
|
|
83
|
+
},
|
|
54
84
|
];
|
|
55
85
|
async getPassword(process) {
|
|
56
86
|
if (this.flags.password) {
|
|
@@ -65,10 +95,25 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
65
95
|
}
|
|
66
96
|
return [await process.addInput(_jsx(Text, { children: "Mailbox password" }), true), false];
|
|
67
97
|
}
|
|
68
|
-
async
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
async createForwardAddress(projectId, process, flags) {
|
|
99
|
+
const response = await process.runStep("creating mail address", async () => {
|
|
100
|
+
const response = await this.apiClient.mail.createMailAddress({
|
|
101
|
+
projectId,
|
|
102
|
+
data: {
|
|
103
|
+
address: flags.address,
|
|
104
|
+
forwardAddresses: flags["forward-to"],
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
assertStatus(response, 201);
|
|
108
|
+
return response;
|
|
109
|
+
});
|
|
110
|
+
process.complete(_jsx(Success, { children: "Your mail address was successfully created." }));
|
|
111
|
+
return {
|
|
112
|
+
addressId: response.data.id,
|
|
113
|
+
generatedPassword: null,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async createMailbox(projectId, process, flags) {
|
|
72
117
|
const [password, passwordGenerated] = await this.getPassword(process);
|
|
73
118
|
const response = await process.runStep("creating mail address", async () => {
|
|
74
119
|
const response = await this.apiClient.mail.createMailAddress({
|
|
@@ -92,6 +137,15 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
92
137
|
generatedPassword: passwordGenerated ? password : null,
|
|
93
138
|
};
|
|
94
139
|
}
|
|
140
|
+
async exec() {
|
|
141
|
+
const { flags } = await this.parse(Create);
|
|
142
|
+
const projectId = await this.withProjectId(Create);
|
|
143
|
+
const process = makeProcessRenderer(flags, "Creating a new mail address");
|
|
144
|
+
if (flags["forward-to"]) {
|
|
145
|
+
return this.createForwardAddress(projectId, process, flags);
|
|
146
|
+
}
|
|
147
|
+
return this.createMailbox(projectId, process, flags);
|
|
148
|
+
}
|
|
95
149
|
render(executionResult) {
|
|
96
150
|
if (this.flags.quiet) {
|
|
97
151
|
if (executionResult.generatedPassword) {
|
|
@@ -4,8 +4,8 @@ import { SuccessfulResponse } from "../../../types.js";
|
|
|
4
4
|
import { ListColumns } from "../../../Formatter.js";
|
|
5
5
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
6
6
|
type ResponseItem = Simplify<MittwaldAPIV2.Paths.V2ProjectsProjectIdMailAddresses.Get.Responses.$200.Content.ApplicationJson[number]>;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdMailAddresses.Get.Parameters.Path;
|
|
8
|
+
type Response = Awaited<ReturnType<MittwaldAPIV2Client["mail"]["listMailAddresses"]>>;
|
|
9
9
|
export declare class List extends ListBaseCommand<typeof List, ResponseItem, Response> {
|
|
10
10
|
static description: string;
|
|
11
11
|
static args: {};
|
|
@@ -10,10 +10,8 @@ export class List extends ListBaseCommand {
|
|
|
10
10
|
...projectFlags,
|
|
11
11
|
};
|
|
12
12
|
async getData() {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
return await this.apiClient.mail.listMailAddresses((await this.mapParams(pathParams)));
|
|
13
|
+
const projectId = await this.withProjectId(List);
|
|
14
|
+
return await this.apiClient.mail.listMailAddresses({ projectId });
|
|
17
15
|
}
|
|
18
16
|
mapData(data) {
|
|
19
17
|
return data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatRelativeDate } from "../../../lib/viewhelpers/date.js";
|
|
2
2
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
3
|
-
import { projectFlags
|
|
3
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
4
4
|
export class List extends ListBaseCommand {
|
|
5
5
|
static description = "Get all deliveryboxes by project ID";
|
|
6
6
|
static args = {};
|
|
@@ -9,7 +9,7 @@ export class List extends ListBaseCommand {
|
|
|
9
9
|
...ListBaseCommand.baseFlags,
|
|
10
10
|
};
|
|
11
11
|
async getData() {
|
|
12
|
-
const projectId = await withProjectId(
|
|
12
|
+
const projectId = await this.withProjectId(List);
|
|
13
13
|
return await this.apiClient.mail.listDeliveryBoxes({ projectId });
|
|
14
14
|
}
|
|
15
15
|
mapData(data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Flags } from "@oclif/core";
|
|
3
3
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
4
|
-
import { serverFlags
|
|
4
|
+
import { serverFlags } from "../../lib/server/flags.js";
|
|
5
5
|
import { ExecRenderBaseCommand } from "../../rendering/react/ExecRenderBaseCommand.js";
|
|
6
6
|
import { Text } from "ink";
|
|
7
7
|
import { Success } from "../../rendering/react/components/Success.js";
|
|
@@ -28,7 +28,7 @@ export default class Create extends ExecRenderBaseCommand {
|
|
|
28
28
|
const { flags } = await this.parse(Create);
|
|
29
29
|
const { description } = flags;
|
|
30
30
|
const process = makeProcessRenderer(flags, "Creating project");
|
|
31
|
-
const serverId = await withServerId(
|
|
31
|
+
const serverId = await this.withServerId(Create);
|
|
32
32
|
const stepCreating = process.addStep(_jsx(Text, { children: "creating a new project" }));
|
|
33
33
|
const result = await this.apiClient.project.createProject({
|
|
34
34
|
serverId,
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { assertStatus } from "@mittwald/api-client-commons";
|
|
2
|
-
import { normalizeProjectIdToUuid } from "../../Helpers.js";
|
|
3
1
|
import { DeleteBaseCommand } from "../../DeleteBaseCommand.js";
|
|
4
|
-
import { projectArgs
|
|
2
|
+
import { projectArgs } from "../../lib/project/flags.js";
|
|
3
|
+
import assertSuccess from "../../lib/assert_success.js";
|
|
5
4
|
export default class Delete extends DeleteBaseCommand {
|
|
6
5
|
static description = "Delete a project";
|
|
7
6
|
static resourceName = "project";
|
|
8
7
|
static flags = { ...DeleteBaseCommand.baseFlags };
|
|
9
8
|
static args = { ...projectArgs };
|
|
10
9
|
async deleteResource() {
|
|
11
|
-
const projectId = await withProjectId(
|
|
10
|
+
const projectId = await this.withProjectId(Delete);
|
|
12
11
|
const response = await this.apiClient.project.deleteProject({
|
|
13
12
|
projectId,
|
|
14
13
|
});
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
mapResourceId(id) {
|
|
18
|
-
return normalizeProjectIdToUuid(this.apiClient, id);
|
|
14
|
+
assertSuccess(response);
|
|
19
15
|
}
|
|
20
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
2
|
import { RenderBaseCommand } from "../../../rendering/react/RenderBaseCommand.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
export type PathParams = MittwaldAPIV2.Paths.
|
|
4
|
+
export type PathParams = MittwaldAPIV2.Paths.V2ProjectsProjectIdFilesystemDiskUsage.Get.Parameters.Path;
|
|
5
5
|
export declare class Usage extends RenderBaseCommand<typeof Usage> {
|
|
6
6
|
static description: string;
|
|
7
7
|
static flags: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { GetBaseCommand } from "../../../GetBaseCommand.js";
|
|
3
|
-
import { projectArgs
|
|
3
|
+
import { projectArgs } from "../../../lib/project/flags.js";
|
|
4
4
|
import { RenderBaseCommand } from "../../../rendering/react/RenderBaseCommand.js";
|
|
5
5
|
import { usePromise } from "@mittwald/react-use-promise";
|
|
6
6
|
import { SingleResult } from "../../../rendering/react/components/SingleResult.js";
|
|
@@ -13,7 +13,7 @@ import { parseBytes } from "../../../lib/bytes.js";
|
|
|
13
13
|
import { Note, noteColor } from "../../../rendering/react/components/Note.js";
|
|
14
14
|
import { ListItem } from "../../../rendering/react/components/ListItem.js";
|
|
15
15
|
export class Usage extends RenderBaseCommand {
|
|
16
|
-
static description = "Get a
|
|
16
|
+
static description = "Get a project directory filesystem usage.";
|
|
17
17
|
static flags = {
|
|
18
18
|
...GetBaseCommand.baseFlags,
|
|
19
19
|
human: Flags.boolean({
|
|
@@ -22,7 +22,7 @@ export class Usage extends RenderBaseCommand {
|
|
|
22
22
|
};
|
|
23
23
|
static args = { ...projectArgs };
|
|
24
24
|
render() {
|
|
25
|
-
const projectId =
|
|
25
|
+
const projectId = this.useProjectId(Usage);
|
|
26
26
|
const project = usePromise((projectId) => this.apiClient.project.getProject({ projectId }), [projectId]);
|
|
27
27
|
const projectDiskUsage = usePromise((id) => this.apiClient.projectFileSystem.getDiskUsage({
|
|
28
28
|
projectId: id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { GetBaseCommand } from "../../GetBaseCommand.js";
|
|
3
|
-
import { projectArgs
|
|
3
|
+
import { projectArgs } from "../../lib/project/flags.js";
|
|
4
4
|
import { GetFormatter } from "../../Formatter.js";
|
|
5
5
|
import { SingleResult, SingleResultTable, } from "../../rendering/react/components/SingleResult.js";
|
|
6
6
|
import { Box, Text } from "ink";
|
|
@@ -25,7 +25,7 @@ const ProjectSpecs = ({ projectId, spec }) => {
|
|
|
25
25
|
const used = usage.data?.usedBytes ? (_jsxs(Text, { children: [" ", "(", _jsx(Value, { children: _jsx(ByteFormat, { bytes: usage.data?.usedBytes }) }), " ", "used)"] })) : undefined;
|
|
26
26
|
return (_jsx(SingleResult, { title: "Compute resources", rows: {
|
|
27
27
|
CPUs: _jsx(Value, { children: spec.cpu }),
|
|
28
|
-
Memory: _jsx(Value, { children: spec.memory }),
|
|
28
|
+
Memory: _jsx(Value, { children: spec.memory }), // eslint-disable-line
|
|
29
29
|
Storage: (_jsxs(Text, { children: [_jsx(Value, { children: spec.storage }), used] })),
|
|
30
30
|
} }));
|
|
31
31
|
}
|
|
@@ -40,8 +40,8 @@ const ProjectCustomer = ({ customer }) => {
|
|
|
40
40
|
const GetProject = ({ response }) => {
|
|
41
41
|
const { apiClient } = useRenderContext();
|
|
42
42
|
const customer = usePromise((id) => apiClient.customer.getCustomer({ customerId: id }), [response.customerId]);
|
|
43
|
-
const vhosts = usePromise((id) => apiClient.domain.
|
|
44
|
-
projectId: id,
|
|
43
|
+
const vhosts = usePromise((id) => apiClient.domain.ingressListIngresses({
|
|
44
|
+
queryParameters: { projectId: id },
|
|
45
45
|
}), [response.id]);
|
|
46
46
|
assertStatus(customer, 200);
|
|
47
47
|
assertStatus(vhosts, 200);
|
|
@@ -71,7 +71,7 @@ export class Get extends RenderBaseCommand {
|
|
|
71
71
|
static args = { ...projectArgs };
|
|
72
72
|
formatter = new GetFormatter(new ComponentPrinter((r) => _jsx(GetProject, { response: r })));
|
|
73
73
|
render() {
|
|
74
|
-
const projectId =
|
|
74
|
+
const projectId = this.useProjectId(Get);
|
|
75
75
|
const projectResponse = usePromise((projectId) => this.apiClient.project.getProject({ projectId }), [projectId]);
|
|
76
76
|
assertStatus(projectResponse, 200);
|
|
77
77
|
if (this.flags.output === "json") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatRelativeDate } from "../../../lib/viewhelpers/date.js";
|
|
2
2
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
3
|
-
import { projectFlags
|
|
3
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
4
4
|
export default class List extends ListBaseCommand {
|
|
5
5
|
static description = "List all invites belonging to a project.";
|
|
6
6
|
static args = {};
|
|
@@ -9,7 +9,7 @@ export default class List extends ListBaseCommand {
|
|
|
9
9
|
...projectFlags,
|
|
10
10
|
};
|
|
11
11
|
async getData() {
|
|
12
|
-
const projectId = await withProjectId(
|
|
12
|
+
const projectId = await this.withProjectId(List);
|
|
13
13
|
return await this.apiClient.project.listInvitesForProject({ projectId });
|
|
14
14
|
}
|
|
15
15
|
mapData(data) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatRelativeDate } from "../../../lib/viewhelpers/date.js";
|
|
2
2
|
import { ListBaseCommand } from "../../../ListBaseCommand.js";
|
|
3
|
-
import { projectFlags
|
|
3
|
+
import { projectFlags } from "../../../lib/project/flags.js";
|
|
4
4
|
export default class List extends ListBaseCommand {
|
|
5
5
|
static description = "List all memberships for a Project.";
|
|
6
6
|
static args = {};
|
|
@@ -9,10 +9,10 @@ export default class List extends ListBaseCommand {
|
|
|
9
9
|
...projectFlags,
|
|
10
10
|
};
|
|
11
11
|
async getData() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const projectId = await this.withProjectId(List);
|
|
13
|
+
return await this.apiClient.project.listMembershipsForProject({
|
|
14
|
+
projectId,
|
|
15
|
+
});
|
|
16
16
|
}
|
|
17
17
|
mapData(data) {
|
|
18
18
|
return Promise.all(data.map(async (item) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class Ssh extends
|
|
1
|
+
import { ExtendedBaseCommand } from "../../ExtendedBaseCommand.js";
|
|
2
|
+
export default class Ssh extends ExtendedBaseCommand<typeof Ssh> {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { BaseCommand } from "../../BaseCommand.js";
|
|
2
1
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
3
2
|
import * as child_process from "child_process";
|
|
4
|
-
import { projectArgs
|
|
5
|
-
|
|
3
|
+
import { projectArgs } from "../../lib/project/flags.js";
|
|
4
|
+
import { ExtendedBaseCommand } from "../../ExtendedBaseCommand.js";
|
|
5
|
+
export default class Ssh extends ExtendedBaseCommand {
|
|
6
6
|
static description = "Connect to a project via SSH";
|
|
7
7
|
static args = { ...projectArgs };
|
|
8
8
|
async run() {
|
|
9
|
-
const
|
|
10
|
-
const projectId = await withProjectId(this.apiClient, Ssh, {}, args, this.config);
|
|
9
|
+
const projectId = await this.withProjectId(Ssh);
|
|
11
10
|
const projectResponse = await this.apiClient.project.getProject({
|
|
12
11
|
projectId,
|
|
13
12
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class Update extends
|
|
1
|
+
import { ExtendedBaseCommand } from "../../ExtendedBaseCommand.js";
|
|
2
|
+
export default class Update extends ExtendedBaseCommand<typeof Update> {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
"project-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export default class Update extends
|
|
1
|
+
import { projectArgs } from "../../lib/project/flags.js";
|
|
2
|
+
import { ExtendedBaseCommand } from "../../ExtendedBaseCommand.js";
|
|
3
|
+
export default class Update extends ExtendedBaseCommand {
|
|
4
4
|
static description = "Updates a project";
|
|
5
5
|
static args = { ...projectArgs };
|
|
6
6
|
async run() {
|
|
7
|
-
const
|
|
8
|
-
const id = await withProjectId(this.apiClient, Update, {}, args, this.config);
|
|
7
|
+
const id = await this.withProjectId(Update);
|
|
9
8
|
console.log("updating project ", id);
|
|
10
9
|
console.log("TODO: Implement me");
|
|
11
10
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MittwaldAPIV2Client } from "@mittwald/api-client";
|
|
2
2
|
import { GetBaseCommand } from "../../GetBaseCommand.js";
|
|
3
|
-
type PathParams = MittwaldAPIV2.Paths.V2ServersServerId.Get.Parameters.Path;
|
|
4
3
|
type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["project"]["getServer"]>>;
|
|
5
4
|
export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
|
|
6
5
|
static description: string;
|
|
@@ -11,6 +10,5 @@ export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
|
|
|
11
10
|
"server-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
12
11
|
};
|
|
13
12
|
protected getData(): Promise<APIResponse>;
|
|
14
|
-
protected mapParams(input: PathParams): Promise<PathParams> | PathParams;
|
|
15
13
|
}
|
|
16
14
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetBaseCommand } from "../../GetBaseCommand.js";
|
|
2
|
-
import { serverArgs
|
|
2
|
+
import { serverArgs } from "../../lib/server/flags.js";
|
|
3
3
|
export default class Get extends GetBaseCommand {
|
|
4
4
|
static description = "Get a server.";
|
|
5
5
|
static flags = {
|
|
@@ -9,10 +9,7 @@ export default class Get extends GetBaseCommand {
|
|
|
9
9
|
...serverArgs,
|
|
10
10
|
};
|
|
11
11
|
async getData() {
|
|
12
|
-
const serverId = await withServerId(
|
|
12
|
+
const serverId = await this.withServerId(Get);
|
|
13
13
|
return await this.apiClient.project.getServer({ serverId });
|
|
14
14
|
}
|
|
15
|
-
mapParams(input) {
|
|
16
|
-
return input;
|
|
17
|
-
}
|
|
18
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
2
|
-
import { projectFlags
|
|
2
|
+
import { projectFlags } from "../../lib/project/flags.js";
|
|
3
3
|
export default class List extends ListBaseCommand {
|
|
4
4
|
static description = "List all SFTP users for a project.";
|
|
5
5
|
static args = {};
|
|
@@ -10,7 +10,7 @@ export default class List extends ListBaseCommand {
|
|
|
10
10
|
static aliases = ["project:sftp-user:list"];
|
|
11
11
|
static deprecateAliases = true;
|
|
12
12
|
async getData() {
|
|
13
|
-
const projectId = await withProjectId(
|
|
13
|
+
const projectId = await this.withProjectId(List);
|
|
14
14
|
return await this.apiClient.sshsftpUser.sftpUserListSftpUsers({
|
|
15
15
|
projectId,
|
|
16
16
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ListBaseCommand } from "../../ListBaseCommand.js";
|
|
2
|
-
import { projectFlags
|
|
2
|
+
import { projectFlags } from "../../lib/project/flags.js";
|
|
3
3
|
export class List extends ListBaseCommand {
|
|
4
4
|
static description = "List all SSH users for a project.";
|
|
5
5
|
static args = {};
|
|
@@ -10,7 +10,7 @@ export class List extends ListBaseCommand {
|
|
|
10
10
|
static aliases = ["project:ssh-user:list"];
|
|
11
11
|
static deprecateAliases = true;
|
|
12
12
|
async getData() {
|
|
13
|
-
const projectId = await withProjectId(
|
|
13
|
+
const projectId = await this.withProjectId(List);
|
|
14
14
|
return await this.apiClient.sshsftpUser.sshUserListSshUsers({ projectId });
|
|
15
15
|
}
|
|
16
16
|
mapData(data) {
|
|
@@ -3,8 +3,10 @@ import { ProcessRenderer } from "../../rendering/process/process.js";
|
|
|
3
3
|
import { ProcessFlags } from "../../rendering/process/process_flags.js";
|
|
4
4
|
import { BooleanFlag, FlagInput, OptionFlag, OutputFlags } from "@oclif/core/lib/interfaces/parser.js";
|
|
5
5
|
export declare const appInstallationFlags: {
|
|
6
|
-
"installation-id":
|
|
7
|
-
}
|
|
6
|
+
"installation-id": OptionFlag<string>;
|
|
7
|
+
}, appInstallationArgs: {
|
|
8
|
+
"installation-id": import("@oclif/core/lib/interfaces/parser.js").Arg<string>;
|
|
9
|
+
}, withAppInstallationId: (apiClient: MittwaldAPIV2Client, command: "flag" | "arg" | import("../context_flags.js").CommandType<"installation", "installation-id">, flags: import("@oclif/core/lib/interfaces/parser.js").FlagOutput, args: import("@oclif/core/lib/interfaces/parser.js").ArgOutput, cfg: import("@oclif/core").Config) => Promise<string>;
|
|
8
10
|
export type AvailableFlagName = keyof AvailableFlags;
|
|
9
11
|
interface AvailableFlags {
|
|
10
12
|
version: OptionFlag<string>;
|
|
@@ -6,14 +6,10 @@ import { Text } from "ink";
|
|
|
6
6
|
import { assertStatus } from "@mittwald/api-client-commons";
|
|
7
7
|
import { projectFlags } from "../project/flags.js";
|
|
8
8
|
import { processFlags, } from "../../rendering/process/process_flags.js";
|
|
9
|
-
import { Flags
|
|
9
|
+
import { Flags } from "@oclif/core";
|
|
10
10
|
import { generatePasswordWithSpecialChars } from "../password.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
description: "ID of the app installation to get",
|
|
14
|
-
required: true,
|
|
15
|
-
}),
|
|
16
|
-
};
|
|
11
|
+
import { makeFlagSet } from "../context_flags.js";
|
|
12
|
+
export const { flags: appInstallationFlags, args: appInstallationArgs, withId: withAppInstallationId, } = makeFlagSet("installation", "i", { displayName: "app installation" });
|
|
17
13
|
function buildFlagsWithDescription(appName) {
|
|
18
14
|
return {
|
|
19
15
|
version: Flags.string({
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiClientError } from "@mittwald/api-client-commons";
|
|
2
|
+
export function assertSuccess(response) {
|
|
3
|
+
if (response.status >= 300) {
|
|
4
|
+
throw ApiClientError.fromResponse(`Unexpected response status (expected <300, got: ${response.status})`, response);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export default assertSuccess;
|