shincloud-cli 1.2.2 → 1.4.0
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 +44 -31
- package/dist/index.js +2076 -261
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,17 @@ import { Command } from "commander";
|
|
|
5
5
|
|
|
6
6
|
// ../../shared/dist/api-client.js
|
|
7
7
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
8
|
+
var SENSITIVE_FIELD_PATTERN = /(?:password|passphrase|private_key|secret|token|user_pass|auth_code)$/i;
|
|
9
|
+
function redactSensitiveValues(value) {
|
|
10
|
+
if (Array.isArray(value))
|
|
11
|
+
return value.map(redactSensitiveValues);
|
|
12
|
+
if (typeof value !== "object" || value === null)
|
|
13
|
+
return value;
|
|
14
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [
|
|
15
|
+
key,
|
|
16
|
+
SENSITIVE_FIELD_PATTERN.test(key) ? "[REDACTED]" : redactSensitiveValues(child)
|
|
17
|
+
]));
|
|
18
|
+
}
|
|
8
19
|
var ApiError = class extends Error {
|
|
9
20
|
httpStatus;
|
|
10
21
|
errorCode;
|
|
@@ -36,6 +47,27 @@ var ApiClient = class {
|
|
|
36
47
|
return `/v1/server/${encodeURIComponent(this.servername)}`;
|
|
37
48
|
}
|
|
38
49
|
// ================================================================
|
|
50
|
+
// サーバーサービスAPI(/v1/server・servername非依存)
|
|
51
|
+
// ================================================================
|
|
52
|
+
async listServerPlans(params) {
|
|
53
|
+
return this.get("/v1/server/plans", params);
|
|
54
|
+
}
|
|
55
|
+
async registerServer(data, idempotencyKey) {
|
|
56
|
+
return this.post("/v1/server", data, idempotencyHeaders(idempotencyKey));
|
|
57
|
+
}
|
|
58
|
+
async listServers() {
|
|
59
|
+
return this.get("/v1/server");
|
|
60
|
+
}
|
|
61
|
+
async getServerSignupStatus(servername2) {
|
|
62
|
+
return this.get(`/v1/server/${enc(servername2)}/signup-status`);
|
|
63
|
+
}
|
|
64
|
+
async getServerMemo(servername2) {
|
|
65
|
+
return this.get(`/v1/server/${enc(servername2)}/memo`);
|
|
66
|
+
}
|
|
67
|
+
async updateServerMemo(servername2, data) {
|
|
68
|
+
return this.put(`/v1/server/${enc(servername2)}/memo`, data);
|
|
69
|
+
}
|
|
70
|
+
// ================================================================
|
|
39
71
|
// サーバー情報
|
|
40
72
|
// ================================================================
|
|
41
73
|
async getServerInfo() {
|
|
@@ -477,6 +509,258 @@ var ApiClient = class {
|
|
|
477
509
|
return this.get("/v1/me");
|
|
478
510
|
}
|
|
479
511
|
// ================================================================
|
|
512
|
+
// ドメインサービスAPI(/v1/domain・servername非依存)
|
|
513
|
+
// ================================================================
|
|
514
|
+
domainPath(domainName) {
|
|
515
|
+
return `/v1/domain/${enc(domainName)}`;
|
|
516
|
+
}
|
|
517
|
+
async listDomains() {
|
|
518
|
+
return this.get("/v1/domain");
|
|
519
|
+
}
|
|
520
|
+
async getDomainDetail(domainName) {
|
|
521
|
+
return this.get(this.domainPath(domainName));
|
|
522
|
+
}
|
|
523
|
+
async getDomainNameservers(domainName) {
|
|
524
|
+
return this.get(`${this.domainPath(domainName)}/nameservers`);
|
|
525
|
+
}
|
|
526
|
+
async updateDomainNameservers(domainName, data) {
|
|
527
|
+
return this.put(`${this.domainPath(domainName)}/nameservers`, data);
|
|
528
|
+
}
|
|
529
|
+
async getDomainWhois(domainName) {
|
|
530
|
+
return this.get(`${this.domainPath(domainName)}/whois`);
|
|
531
|
+
}
|
|
532
|
+
async updateDomainWhois(domainName, data) {
|
|
533
|
+
return this.put(`${this.domainPath(domainName)}/whois`, data);
|
|
534
|
+
}
|
|
535
|
+
async getDomainRegistrarLock(domainName) {
|
|
536
|
+
return this.get(`${this.domainPath(domainName)}/registrar-lock`);
|
|
537
|
+
}
|
|
538
|
+
async updateDomainRegistrarLock(domainName, data) {
|
|
539
|
+
return this.put(`${this.domainPath(domainName)}/registrar-lock`, data);
|
|
540
|
+
}
|
|
541
|
+
async listDomainDns(domainName) {
|
|
542
|
+
return this.get(`${this.domainPath(domainName)}/dns`);
|
|
543
|
+
}
|
|
544
|
+
async addDomainDns(domainName, data) {
|
|
545
|
+
return this.post(`${this.domainPath(domainName)}/dns`, data);
|
|
546
|
+
}
|
|
547
|
+
async updateDomainDns(domainName, dnsId, data) {
|
|
548
|
+
return this.put(`${this.domainPath(domainName)}/dns/${enc(dnsId)}`, data);
|
|
549
|
+
}
|
|
550
|
+
async deleteDomainDns(domainName, dnsId) {
|
|
551
|
+
return this.delete(`${this.domainPath(domainName)}/dns/${enc(dnsId)}`);
|
|
552
|
+
}
|
|
553
|
+
async checkDomain(domainName) {
|
|
554
|
+
return this.get("/v1/domain/check", { domain_name: domainName });
|
|
555
|
+
}
|
|
556
|
+
async getDomainPricing(params) {
|
|
557
|
+
return this.get("/v1/domain/pricing", params);
|
|
558
|
+
}
|
|
559
|
+
async registerDomain(data, idempotencyKey) {
|
|
560
|
+
return this.post("/v1/domain", data, idempotencyHeaders(idempotencyKey));
|
|
561
|
+
}
|
|
562
|
+
async transferDomain(domainName, data, idempotencyKey) {
|
|
563
|
+
return this.post(`${this.domainPath(domainName)}/transfer`, data, idempotencyHeaders(idempotencyKey));
|
|
564
|
+
}
|
|
565
|
+
async renewDomain(domainName, data, idempotencyKey) {
|
|
566
|
+
return this.post(`${this.domainPath(domainName)}/renew`, data, idempotencyHeaders(idempotencyKey));
|
|
567
|
+
}
|
|
568
|
+
// ================================================================
|
|
569
|
+
// WPhosting API(/v1/wphosting/{contract_id})
|
|
570
|
+
// ================================================================
|
|
571
|
+
wphostingPath(contractId2) {
|
|
572
|
+
return `/v1/wphosting/${enc(contractId2)}`;
|
|
573
|
+
}
|
|
574
|
+
wphostingSitePath(contractId2, servername2) {
|
|
575
|
+
return `${this.wphostingPath(contractId2)}/sites/${enc(servername2)}`;
|
|
576
|
+
}
|
|
577
|
+
async listWphostingPlans(params) {
|
|
578
|
+
return this.get("/v1/wphosting/plans", params);
|
|
579
|
+
}
|
|
580
|
+
async registerWphosting(data, idempotencyKey) {
|
|
581
|
+
return this.post("/v1/wphosting", data, idempotencyHeaders(idempotencyKey));
|
|
582
|
+
}
|
|
583
|
+
async listWphostingContracts() {
|
|
584
|
+
return this.get("/v1/wphosting");
|
|
585
|
+
}
|
|
586
|
+
async getWphostingMemo(contractId2) {
|
|
587
|
+
return this.get(`${this.wphostingPath(contractId2)}/memo`);
|
|
588
|
+
}
|
|
589
|
+
async updateWphostingMemo(contractId2, data) {
|
|
590
|
+
return this.put(`${this.wphostingPath(contractId2)}/memo`, data);
|
|
591
|
+
}
|
|
592
|
+
async listWphostingSites(contractId2) {
|
|
593
|
+
return this.get(`${this.wphostingPath(contractId2)}/sites`);
|
|
594
|
+
}
|
|
595
|
+
async getWphostingSite(contractId2, servername2) {
|
|
596
|
+
return this.get(this.wphostingSitePath(contractId2, servername2));
|
|
597
|
+
}
|
|
598
|
+
async createWphostingSite(contractId2, data, idempotencyKey) {
|
|
599
|
+
return this.post(`${this.wphostingPath(contractId2)}/sites`, data, idempotencyHeaders(idempotencyKey));
|
|
600
|
+
}
|
|
601
|
+
async deleteWphostingSite(contractId2, servername2, idempotencyKey) {
|
|
602
|
+
return this.delete(this.wphostingSitePath(contractId2, servername2), void 0, idempotencyHeaders(idempotencyKey));
|
|
603
|
+
}
|
|
604
|
+
async getWphostingUsage(contractId2) {
|
|
605
|
+
return this.get(`${this.wphostingPath(contractId2)}/usage`);
|
|
606
|
+
}
|
|
607
|
+
async createWphostingStaging(contractId2, servername2, data, idempotencyKey) {
|
|
608
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/staging`, data, idempotencyHeaders(idempotencyKey));
|
|
609
|
+
}
|
|
610
|
+
async listWphostingBackups(contractId2, servername2) {
|
|
611
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/backups`);
|
|
612
|
+
}
|
|
613
|
+
async createWphostingBackup(contractId2, servername2, data, idempotencyKey) {
|
|
614
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/backups`, data, idempotencyHeaders(idempotencyKey));
|
|
615
|
+
}
|
|
616
|
+
async restoreWphostingBackup(contractId2, servername2, backupId, idempotencyKey) {
|
|
617
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/backups/${enc(backupId)}/restore`, void 0, idempotencyHeaders(idempotencyKey));
|
|
618
|
+
}
|
|
619
|
+
async listWphostingBackupRestoreHistory(contractId2, servername2) {
|
|
620
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/backups/restore-history`);
|
|
621
|
+
}
|
|
622
|
+
async deleteWphostingBackup(contractId2, servername2, backupId) {
|
|
623
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/backups/${enc(backupId)}`);
|
|
624
|
+
}
|
|
625
|
+
async getWphostingWordPress(contractId2, servername2) {
|
|
626
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wordpress`);
|
|
627
|
+
}
|
|
628
|
+
async updateWphostingWordPress(contractId2, servername2, data) {
|
|
629
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/wordpress`, data);
|
|
630
|
+
}
|
|
631
|
+
async upgradeWphostingWordPress(contractId2, servername2) {
|
|
632
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/wordpress/update`);
|
|
633
|
+
}
|
|
634
|
+
async getWphostingMaintenanceMode(contractId2, servername2) {
|
|
635
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/maintenance-mode`);
|
|
636
|
+
}
|
|
637
|
+
async updateWphostingMaintenanceMode(contractId2, servername2, data) {
|
|
638
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/maintenance-mode`, data);
|
|
639
|
+
}
|
|
640
|
+
async listWphostingPlugins(contractId2, servername2) {
|
|
641
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/plugins`);
|
|
642
|
+
}
|
|
643
|
+
async installWphostingPlugin(contractId2, servername2, data) {
|
|
644
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/plugins`, data);
|
|
645
|
+
}
|
|
646
|
+
async updateWphostingPlugin(contractId2, servername2, plugin, data) {
|
|
647
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}`, data);
|
|
648
|
+
}
|
|
649
|
+
async upgradeWphostingPlugin(contractId2, servername2, plugin) {
|
|
650
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}/update`);
|
|
651
|
+
}
|
|
652
|
+
async deleteWphostingPlugin(contractId2, servername2, plugin) {
|
|
653
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/plugins/${enc(plugin)}`);
|
|
654
|
+
}
|
|
655
|
+
async listWphostingThemes(contractId2, servername2) {
|
|
656
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/themes`);
|
|
657
|
+
}
|
|
658
|
+
async installWphostingTheme(contractId2, servername2, data) {
|
|
659
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/themes`, data);
|
|
660
|
+
}
|
|
661
|
+
async updateWphostingTheme(contractId2, servername2, theme, data) {
|
|
662
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}`, data);
|
|
663
|
+
}
|
|
664
|
+
async upgradeWphostingTheme(contractId2, servername2, theme) {
|
|
665
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}/update`);
|
|
666
|
+
}
|
|
667
|
+
async deleteWphostingTheme(contractId2, servername2, theme) {
|
|
668
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/themes/${enc(theme)}`);
|
|
669
|
+
}
|
|
670
|
+
async listWphostingDomains(contractId2, servername2) {
|
|
671
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/domains`);
|
|
672
|
+
}
|
|
673
|
+
async addWphostingDomain(contractId2, servername2, data) {
|
|
674
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains`, data);
|
|
675
|
+
}
|
|
676
|
+
async verifyWphostingDomain(contractId2, servername2, domain) {
|
|
677
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/verify`);
|
|
678
|
+
}
|
|
679
|
+
async deleteWphostingDomain(contractId2, servername2, domain) {
|
|
680
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}`);
|
|
681
|
+
}
|
|
682
|
+
async updateWphostingSiteUrl(contractId2, servername2, data) {
|
|
683
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/site-url`, data);
|
|
684
|
+
}
|
|
685
|
+
async listWphostingDnsRecords(contractId2, servername2, domain) {
|
|
686
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns`);
|
|
687
|
+
}
|
|
688
|
+
async addWphostingDnsRecord(contractId2, servername2, domain, data) {
|
|
689
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns`, data);
|
|
690
|
+
}
|
|
691
|
+
async updateWphostingDnsRecord(contractId2, servername2, domain, dnsId, data) {
|
|
692
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns/${enc(dnsId)}`, data);
|
|
693
|
+
}
|
|
694
|
+
async deleteWphostingDnsRecord(contractId2, servername2, domain, dnsId) {
|
|
695
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/domains/${enc(domain)}/dns/${enc(dnsId)}`);
|
|
696
|
+
}
|
|
697
|
+
async getWphostingPhpVersion(contractId2, servername2) {
|
|
698
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/php-version`);
|
|
699
|
+
}
|
|
700
|
+
async updateWphostingPhpVersion(contractId2, servername2, data) {
|
|
701
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/php-version`, data);
|
|
702
|
+
}
|
|
703
|
+
async getWphostingAccessLog(contractId2, servername2, params) {
|
|
704
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/access-log`, params);
|
|
705
|
+
}
|
|
706
|
+
async getWphostingErrorLog(contractId2, servername2, params) {
|
|
707
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/error-log`, params);
|
|
708
|
+
}
|
|
709
|
+
async listWphostingCron(contractId2, servername2) {
|
|
710
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/cron`);
|
|
711
|
+
}
|
|
712
|
+
async addWphostingCron(contractId2, servername2, data) {
|
|
713
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/cron`, data);
|
|
714
|
+
}
|
|
715
|
+
async updateWphostingCron(contractId2, servername2, cronId, data) {
|
|
716
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/cron/${enc(cronId)}`, data);
|
|
717
|
+
}
|
|
718
|
+
async deleteWphostingCron(contractId2, servername2, cronId) {
|
|
719
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/cron/${enc(cronId)}`);
|
|
720
|
+
}
|
|
721
|
+
async getWphostingSsh(contractId2, servername2) {
|
|
722
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/ssh`);
|
|
723
|
+
}
|
|
724
|
+
async updateWphostingSsh(contractId2, servername2, data) {
|
|
725
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/ssh`, data);
|
|
726
|
+
}
|
|
727
|
+
async listWphostingSshKeys(contractId2, servername2) {
|
|
728
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key`);
|
|
729
|
+
}
|
|
730
|
+
async addWphostingSshKey(contractId2, servername2, data) {
|
|
731
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key`, data);
|
|
732
|
+
}
|
|
733
|
+
async updateWphostingSshKey(contractId2, servername2, keyId, data) {
|
|
734
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key/${enc(keyId)}`, data);
|
|
735
|
+
}
|
|
736
|
+
async deleteWphostingSshKey(contractId2, servername2, keyId) {
|
|
737
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/ssh/key/${enc(keyId)}`);
|
|
738
|
+
}
|
|
739
|
+
async listWphostingWpUserRoles(contractId2, servername2) {
|
|
740
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/roles`);
|
|
741
|
+
}
|
|
742
|
+
async listWphostingWpUsers(contractId2, servername2, params) {
|
|
743
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users`, params);
|
|
744
|
+
}
|
|
745
|
+
async createWphostingWpUser(contractId2, servername2, data) {
|
|
746
|
+
return this.post(`${this.wphostingSitePath(contractId2, servername2)}/wp-users`, data);
|
|
747
|
+
}
|
|
748
|
+
async getWphostingWpUser(contractId2, servername2, userId) {
|
|
749
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`);
|
|
750
|
+
}
|
|
751
|
+
async updateWphostingWpUser(contractId2, servername2, userId, data) {
|
|
752
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`, data);
|
|
753
|
+
}
|
|
754
|
+
async deleteWphostingWpUser(contractId2, servername2, userId) {
|
|
755
|
+
return this.delete(`${this.wphostingSitePath(contractId2, servername2)}/wp-users/${enc(userId)}`);
|
|
756
|
+
}
|
|
757
|
+
async getWphostingSecurity(contractId2, servername2) {
|
|
758
|
+
return this.get(`${this.wphostingSitePath(contractId2, servername2)}/security`);
|
|
759
|
+
}
|
|
760
|
+
async updateWphostingSecurity(contractId2, servername2, key, data) {
|
|
761
|
+
return this.put(`${this.wphostingSitePath(contractId2, servername2)}/security/${enc(key)}`, data);
|
|
762
|
+
}
|
|
763
|
+
// ================================================================
|
|
480
764
|
// HTTP 基盤
|
|
481
765
|
// ================================================================
|
|
482
766
|
async get(path2, params) {
|
|
@@ -486,19 +770,20 @@ var ApiClient = class {
|
|
|
486
770
|
}
|
|
487
771
|
return this.request("GET", url);
|
|
488
772
|
}
|
|
489
|
-
async post(path2, data) {
|
|
490
|
-
return this.request("POST", `${this.apiBase}${path2}`, data);
|
|
773
|
+
async post(path2, data, headers) {
|
|
774
|
+
return this.request("POST", `${this.apiBase}${path2}`, data, headers);
|
|
491
775
|
}
|
|
492
776
|
async put(path2, data) {
|
|
493
777
|
return this.request("PUT", `${this.apiBase}${path2}`, data);
|
|
494
778
|
}
|
|
495
|
-
async delete(path2, data) {
|
|
496
|
-
return this.request("DELETE", `${this.apiBase}${path2}`, data);
|
|
779
|
+
async delete(path2, data, headers) {
|
|
780
|
+
return this.request("DELETE", `${this.apiBase}${path2}`, data, headers);
|
|
497
781
|
}
|
|
498
|
-
async request(method, url, body) {
|
|
782
|
+
async request(method, url, body, additionalHeaders) {
|
|
499
783
|
const headers = {
|
|
500
784
|
"Authorization": `Bearer ${this.apiKey}`,
|
|
501
|
-
"Accept": "application/json"
|
|
785
|
+
"Accept": "application/json",
|
|
786
|
+
...additionalHeaders
|
|
502
787
|
};
|
|
503
788
|
const init = {
|
|
504
789
|
method,
|
|
@@ -513,8 +798,8 @@ var ApiClient = class {
|
|
|
513
798
|
const dbg = (msg) => process.stderr.write(`[DEBUG] ${msg}
|
|
514
799
|
`);
|
|
515
800
|
dbg(`${method} ${url}`);
|
|
516
|
-
if (
|
|
517
|
-
dbg(`Body: ${
|
|
801
|
+
if (body)
|
|
802
|
+
dbg(`Body: ${JSON.stringify(redactSensitiveValues(body))}`);
|
|
518
803
|
}
|
|
519
804
|
let response;
|
|
520
805
|
try {
|
|
@@ -565,9 +850,170 @@ var ApiClient = class {
|
|
|
565
850
|
function enc(s) {
|
|
566
851
|
return encodeURIComponent(s);
|
|
567
852
|
}
|
|
853
|
+
function idempotencyHeaders(idempotencyKey) {
|
|
854
|
+
return idempotencyKey === void 0 ? void 0 : { "Idempotency-Key": idempotencyKey };
|
|
855
|
+
}
|
|
568
856
|
|
|
569
|
-
//
|
|
570
|
-
|
|
857
|
+
// ../../shared/dist/billing-confirmation.js
|
|
858
|
+
function formatYen(value) {
|
|
859
|
+
return `${String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}\u5186`;
|
|
860
|
+
}
|
|
861
|
+
function planLabel(planId, planName) {
|
|
862
|
+
return planName === void 0 || planName === planId ? `\u30D7\u30E9\u30F3 ${planId}` : `${planName}\u30D7\u30E9\u30F3\uFF08${planId}\uFF09`;
|
|
863
|
+
}
|
|
864
|
+
function planNameFromPlans(plans, planId) {
|
|
865
|
+
const list = plans?.plans;
|
|
866
|
+
if (!Array.isArray(list))
|
|
867
|
+
return void 0;
|
|
868
|
+
for (const plan of list) {
|
|
869
|
+
const record3 = plan;
|
|
870
|
+
if (record3?.plan_id !== planId)
|
|
871
|
+
continue;
|
|
872
|
+
if (typeof record3.plan_name !== "string" || record3.plan_name === "") {
|
|
873
|
+
return void 0;
|
|
874
|
+
}
|
|
875
|
+
return record3.plan_name;
|
|
876
|
+
}
|
|
877
|
+
return void 0;
|
|
878
|
+
}
|
|
879
|
+
async function resolvePlanName(fetchPlans, planId) {
|
|
880
|
+
try {
|
|
881
|
+
return planNameFromPlans(await fetchPlans(), planId);
|
|
882
|
+
} catch {
|
|
883
|
+
return void 0;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
function billingConfirmationDetailLines(details) {
|
|
887
|
+
const lines = [];
|
|
888
|
+
for (const detail of details) {
|
|
889
|
+
lines.push(`${detail.label}: ${detail.value}`);
|
|
890
|
+
if (detail.note !== void 0)
|
|
891
|
+
lines.push(` \u203B ${detail.note}`);
|
|
892
|
+
}
|
|
893
|
+
return lines;
|
|
894
|
+
}
|
|
895
|
+
function billingPaymentLines(totalPrice) {
|
|
896
|
+
return [
|
|
897
|
+
`\u304A\u652F\u6255\u3044\u91D1\u984D: ${formatYen(totalPrice)}\uFF08\u7A0E\u8FBC\u30FB\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u9069\u7528\u5F8C\u306E\u5B9F\u652F\u6255\u984D\uFF09`,
|
|
898
|
+
"\u304A\u652F\u6255\u3044\u65B9\u6CD5: \u30D7\u30EA\u30DA\u30A4\u30C9\u6B8B\u9AD8\u304B\u3089\u306E\u5F15\u304D\u843D\u3068\u3057"
|
|
899
|
+
];
|
|
900
|
+
}
|
|
901
|
+
function autoRenewDetail(autoRenew, options = {}) {
|
|
902
|
+
if (!autoRenew) {
|
|
903
|
+
return {
|
|
904
|
+
label: "\u81EA\u52D5\u66F4\u65B0",
|
|
905
|
+
value: "\u7121\u52B9",
|
|
906
|
+
note: "\u5951\u7D04\u671F\u9650\u307E\u3067\u306B\u624B\u52D5\u3067\u66F4\u65B0\u3057\u306A\u3044\u5834\u5408\u306F\u5931\u52B9\u3057\u307E\u3059\u3002"
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
label: "\u81EA\u52D5\u66F4\u65B0",
|
|
911
|
+
value: "\u6709\u52B9\uFF08\u6B21\u56DE\u4EE5\u964D\u306E\u66F4\u65B0\u3082\u81EA\u52D5\u3067\u8AB2\u91D1\u3055\u308C\u307E\u3059\uFF09",
|
|
912
|
+
note: options.fromDefault ? `${options.optionName ?? "--auto-renew"} \u3092\u6307\u5B9A\u3057\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u65E2\u5B9A\u5024\u306E\u6709\u52B9\u304C\u9069\u7528\u3055\u308C\u307E\u3059\u3002` : void 0
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
function partnerCodeDetail(partnerCode) {
|
|
916
|
+
if (partnerCode === void 0)
|
|
917
|
+
return void 0;
|
|
918
|
+
return {
|
|
919
|
+
label: "\u304A\u53D6\u6B21\u5E97\u30B3\u30FC\u30C9",
|
|
920
|
+
value: partnerCode,
|
|
921
|
+
note: "\u5B58\u5728\u3057\u306A\u3044\u30B3\u30FC\u30C9\u3067\u3082\u7533\u8FBC\u306F\u6210\u7ACB\u3057\u3001\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u305B\u3093\u3002\u8868\u8A18\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
function serverIdDetail(serverId) {
|
|
925
|
+
return {
|
|
926
|
+
label: "\u5E0C\u671B\u30B5\u30FC\u30D0\u30FCID",
|
|
927
|
+
value: serverId ?? "\u6307\u5B9A\u306A\u3057\uFF08\u81EA\u52D5\u3067\u63A1\u756A\u3055\u308C\u307E\u3059\uFF09"
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
function compactDetails(details) {
|
|
931
|
+
return details.filter((detail) => detail !== void 0);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// ../../shared/dist/brand-config.js
|
|
935
|
+
function resolveServerPlanBrand(brand, service, planId) {
|
|
936
|
+
if (service === "server" && planId !== void 0) {
|
|
937
|
+
const override = brand.serverPlanOverrides?.find((o) => planId.startsWith(o.planIdPrefix));
|
|
938
|
+
if (override !== void 0) {
|
|
939
|
+
return {
|
|
940
|
+
serviceName: override.serviceName,
|
|
941
|
+
termsUrl: override.termsUrl,
|
|
942
|
+
privacyUrl: override.privacyUrl
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return service === "server" ? {
|
|
947
|
+
serviceName: brand.serverServiceName,
|
|
948
|
+
termsUrl: brand.serverTermsUrl,
|
|
949
|
+
privacyUrl: brand.serverPrivacyUrl
|
|
950
|
+
} : {
|
|
951
|
+
serviceName: brand.wphostingServiceName,
|
|
952
|
+
termsUrl: brand.wphostingTermsUrl,
|
|
953
|
+
privacyUrl: brand.wphostingPrivacyUrl
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function domainLegalNoticeLines(brand) {
|
|
957
|
+
return [
|
|
958
|
+
`\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04: ${brand.domainTermsUrl}`,
|
|
959
|
+
`\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066: ${brand.domainPrivacyUrl}`
|
|
960
|
+
];
|
|
961
|
+
}
|
|
962
|
+
function signupOperationName(brand, service, planId) {
|
|
963
|
+
const { serviceName } = resolveServerPlanBrand(brand, service, planId);
|
|
964
|
+
if (serviceName === void 0) {
|
|
965
|
+
throw new Error(`${service}\u306E\u30B5\u30FC\u30D3\u30B9\u540D\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093`);
|
|
966
|
+
}
|
|
967
|
+
return `${serviceName} \u65B0\u898F\u304A\u7533\u3057\u8FBC\u307F`;
|
|
968
|
+
}
|
|
969
|
+
function signupLegalNoticeLines(brand, service, planId) {
|
|
970
|
+
const { termsUrl, privacyUrl } = resolveServerPlanBrand(brand, service, planId);
|
|
971
|
+
if (termsUrl === void 0 || privacyUrl === void 0) {
|
|
972
|
+
throw new Error(`${service}\u306E\u5229\u7528\u898F\u7D04\u30FB\u500B\u4EBA\u60C5\u5831URL\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093`);
|
|
973
|
+
}
|
|
974
|
+
return [
|
|
975
|
+
`\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04: ${termsUrl}`,
|
|
976
|
+
`\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066: ${privacyUrl}`
|
|
977
|
+
];
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// ../../shared/dist/domain-acquisition-permission.js
|
|
981
|
+
function record(value) {
|
|
982
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
983
|
+
}
|
|
984
|
+
function diagnosedForbidden(message) {
|
|
985
|
+
return new ApiError(message, 403, "FORBIDDEN", []);
|
|
986
|
+
}
|
|
987
|
+
async function withDomainAcquisitionPermissionDiagnosis(client2, request) {
|
|
988
|
+
try {
|
|
989
|
+
return await request();
|
|
990
|
+
} catch (error) {
|
|
991
|
+
if (!(error instanceof ApiError) || error.httpStatus !== 403 || error.errorCode !== "FORBIDDEN") {
|
|
992
|
+
throw error;
|
|
993
|
+
}
|
|
994
|
+
let meData;
|
|
995
|
+
try {
|
|
996
|
+
meData = await client2.getMe();
|
|
997
|
+
} catch {
|
|
998
|
+
throw error;
|
|
999
|
+
}
|
|
1000
|
+
const services = record(meData.services);
|
|
1001
|
+
const domain = record(services?.domain);
|
|
1002
|
+
if (!domain) {
|
|
1003
|
+
throw diagnosedForbidden("\u3053\u306EAPI\u30AD\u30FC\u3067\u306FDomain API\u3092\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002Domain\u30B5\u30FC\u30D3\u30B9\u3092\u542B\u3080API\u30AD\u30FC\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
1004
|
+
}
|
|
1005
|
+
if (domain.allow_acquisition === false) {
|
|
1006
|
+
throw diagnosedForbidden("\u3053\u306EAPI\u30AD\u30FC\u3067\u306F\u3001\u30C9\u30E1\u30A4\u30F3\u306E\u53D6\u5F97\u53EF\u80FD\u6027\u30FB\u4FA1\u683C\u78BA\u8A8D\u30FB\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u5951\u7D04\u66F4\u65B0\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002API\u30AD\u30FC\u7BA1\u7406\u753B\u9762\u3067\u300C\u3053\u306E\u30AD\u30FC\u3067\u30C9\u30E1\u30A4\u30F3\u306E\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0\uFF08\u304A\u7533\u3057\u8FBC\u307F\uFF09\u3092\u8A31\u53EF\u3059\u308B\u300D\u3092\u6709\u52B9\u306B\u3057\u305FAPI\u30AD\u30FC\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
1007
|
+
}
|
|
1008
|
+
throw error;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// ../core/dist/lib/command-helper.js
|
|
1013
|
+
import { createInterface } from "readline/promises";
|
|
1014
|
+
import { randomUUID } from "crypto";
|
|
1015
|
+
import { stdin as input, stderr as output } from "process";
|
|
1016
|
+
import { confirm } from "@inquirer/prompts";
|
|
571
1017
|
|
|
572
1018
|
// ../core/dist/lib/config.js
|
|
573
1019
|
import fs from "fs";
|
|
@@ -595,6 +1041,10 @@ function saveConfig(brand, config) {
|
|
|
595
1041
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
596
1042
|
}
|
|
597
1043
|
function getActiveProfile(brand, profileName) {
|
|
1044
|
+
if (profileName) {
|
|
1045
|
+
const config2 = loadConfig(brand);
|
|
1046
|
+
return config2.profiles[profileName] || null;
|
|
1047
|
+
}
|
|
598
1048
|
const envPrefix = brand.brand.toUpperCase();
|
|
599
1049
|
const envApiKey = process.env[`${envPrefix}_API_KEY`] || process.env["XSERVER_API_KEY"];
|
|
600
1050
|
const envServername = process.env[`${envPrefix}_SERVERNAME`] || process.env["XSERVER_SERVERNAME"];
|
|
@@ -605,12 +1055,15 @@ function getActiveProfile(brand, profileName) {
|
|
|
605
1055
|
};
|
|
606
1056
|
}
|
|
607
1057
|
const config = loadConfig(brand);
|
|
608
|
-
const name =
|
|
1058
|
+
const name = config.defaultProfile || "default";
|
|
609
1059
|
return config.profiles[name] || null;
|
|
610
1060
|
}
|
|
611
1061
|
|
|
612
|
-
// ../core/dist/lib/
|
|
613
|
-
|
|
1062
|
+
// ../core/dist/lib/api-base.js
|
|
1063
|
+
function resolveApiBase(brand) {
|
|
1064
|
+
const envPrefix = brand.brand.toUpperCase();
|
|
1065
|
+
return (process.env[`${envPrefix}_API_BASE_URL`] ?? process.env.XSERVER_API_BASE_URL ?? brand.apiBase).replace(/\/+$/, "");
|
|
1066
|
+
}
|
|
614
1067
|
|
|
615
1068
|
// ../core/dist/lib/output.js
|
|
616
1069
|
function formatOutput(data, format) {
|
|
@@ -712,6 +1165,134 @@ function padRight(str, targetWidth) {
|
|
|
712
1165
|
return str + " ".repeat(padding);
|
|
713
1166
|
}
|
|
714
1167
|
|
|
1168
|
+
// ../core/dist/lib/domain-validation.js
|
|
1169
|
+
var DNS_TYPES = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SRV"]);
|
|
1170
|
+
var IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9_-]{8,64}$/;
|
|
1171
|
+
function isObject(value) {
|
|
1172
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1173
|
+
}
|
|
1174
|
+
function parseInteger(value, optionName, minimum, maximum) {
|
|
1175
|
+
if (!/^\d+$/.test(value)) {
|
|
1176
|
+
throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1177
|
+
}
|
|
1178
|
+
const parsed = Number(value);
|
|
1179
|
+
if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
|
|
1180
|
+
const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
|
|
1181
|
+
throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1182
|
+
}
|
|
1183
|
+
return parsed;
|
|
1184
|
+
}
|
|
1185
|
+
function parseStrictBoolean(value, optionName) {
|
|
1186
|
+
if (value === "true")
|
|
1187
|
+
return true;
|
|
1188
|
+
if (value === "false")
|
|
1189
|
+
return false;
|
|
1190
|
+
throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1191
|
+
}
|
|
1192
|
+
function parseNameservers(value) {
|
|
1193
|
+
const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1194
|
+
if (nameservers.length < 1 || nameservers.length > 13) {
|
|
1195
|
+
throw new Error("--nameservers \u306F1\uFF5E13\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1196
|
+
}
|
|
1197
|
+
validateNameserverHostnames(nameservers, 253);
|
|
1198
|
+
if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
|
|
1199
|
+
throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
|
|
1200
|
+
}
|
|
1201
|
+
return nameservers;
|
|
1202
|
+
}
|
|
1203
|
+
function parseRegistrationNameservers(value) {
|
|
1204
|
+
const nameservers = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1205
|
+
if (nameservers.length < 1 || nameservers.length > 6) {
|
|
1206
|
+
throw new Error("--nameservers \u306F1\uFF5E6\u4EF6\u3092\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1207
|
+
}
|
|
1208
|
+
validateNameserverHostnames(nameservers, 255);
|
|
1209
|
+
if (new Set(nameservers.map((item) => item.toLowerCase())).size !== nameservers.length) {
|
|
1210
|
+
throw new Error("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u91CD\u8907\u3057\u3066\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
|
|
1211
|
+
}
|
|
1212
|
+
return nameservers;
|
|
1213
|
+
}
|
|
1214
|
+
function validateNameserverHostnames(nameservers, maximumLength) {
|
|
1215
|
+
const hostnamePattern = /^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/;
|
|
1216
|
+
for (const nameserver of nameservers) {
|
|
1217
|
+
if (nameserver.length > maximumLength || !hostnamePattern.test(nameserver)) {
|
|
1218
|
+
throw new Error(`\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u306F\u5404${maximumLength}\u6587\u5B57\u4EE5\u5185\u306E\u30DB\u30B9\u30C8\u540D\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function parseWhoisData(value) {
|
|
1223
|
+
let parsed;
|
|
1224
|
+
try {
|
|
1225
|
+
parsed = JSON.parse(value);
|
|
1226
|
+
} catch {
|
|
1227
|
+
throw new Error("--data \u306F\u6709\u52B9\u306AJSON\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1228
|
+
}
|
|
1229
|
+
if (!isObject(parsed)) {
|
|
1230
|
+
throw new Error("--data \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1231
|
+
}
|
|
1232
|
+
if (Object.prototype.hasOwnProperty.call(parsed, "whois_privacy_flag")) {
|
|
1233
|
+
throw new Error("whois_privacy_flag \u306F\u5EC3\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002whois_privacy \u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1234
|
+
}
|
|
1235
|
+
const hasPrivacy = Object.prototype.hasOwnProperty.call(parsed, "whois_privacy");
|
|
1236
|
+
const hasFields = Object.prototype.hasOwnProperty.call(parsed, "fields");
|
|
1237
|
+
if (!hasPrivacy && !hasFields) {
|
|
1238
|
+
throw new Error("--data \u306B\u306F whois_privacy \u307E\u305F\u306F fields \u306E\u3044\u305A\u308C\u304B\u304C\u5FC5\u8981\u3067\u3059");
|
|
1239
|
+
}
|
|
1240
|
+
if (hasPrivacy && typeof parsed.whois_privacy !== "boolean") {
|
|
1241
|
+
throw new Error("whois_privacy \u306Fboolean\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1242
|
+
}
|
|
1243
|
+
if (hasFields && !isObject(parsed.fields)) {
|
|
1244
|
+
throw new Error("fields \u306FJSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1245
|
+
}
|
|
1246
|
+
return parsed;
|
|
1247
|
+
}
|
|
1248
|
+
function validateDnsType(value) {
|
|
1249
|
+
const type = value.toUpperCase();
|
|
1250
|
+
if (!DNS_TYPES.has(type)) {
|
|
1251
|
+
throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / NS / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1252
|
+
}
|
|
1253
|
+
return type;
|
|
1254
|
+
}
|
|
1255
|
+
function validateDnsHost(value) {
|
|
1256
|
+
if (value.length === 0 || value.length > 64) {
|
|
1257
|
+
throw new Error("--host \u306F1\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1258
|
+
}
|
|
1259
|
+
return value;
|
|
1260
|
+
}
|
|
1261
|
+
function validateDnsContent(value) {
|
|
1262
|
+
if (value.length === 0 || value.length > 1024) {
|
|
1263
|
+
throw new Error("--content \u306F1\uFF5E1024\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1264
|
+
}
|
|
1265
|
+
return value;
|
|
1266
|
+
}
|
|
1267
|
+
function validateDnsId(value) {
|
|
1268
|
+
if (!/^[1-9]\d*$/.test(value)) {
|
|
1269
|
+
throw new Error("dns_id \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1270
|
+
}
|
|
1271
|
+
return value;
|
|
1272
|
+
}
|
|
1273
|
+
function validateIdempotencyKey(value) {
|
|
1274
|
+
if (!IDEMPOTENCY_KEY_PATTERN.test(value)) {
|
|
1275
|
+
throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1276
|
+
}
|
|
1277
|
+
return value;
|
|
1278
|
+
}
|
|
1279
|
+
function validateDate(value, optionName) {
|
|
1280
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
1281
|
+
throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1282
|
+
}
|
|
1283
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
1284
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
1285
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
|
|
1286
|
+
throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1287
|
+
}
|
|
1288
|
+
return value;
|
|
1289
|
+
}
|
|
1290
|
+
function requireAtLeastOneField(data, message) {
|
|
1291
|
+
if (Object.keys(data).length === 0) {
|
|
1292
|
+
throw new Error(message);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
|
|
715
1296
|
// ../core/dist/lib/command-helper.js
|
|
716
1297
|
function findRoot(cmd) {
|
|
717
1298
|
let root = cmd;
|
|
@@ -728,11 +1309,11 @@ function resolveClient(cmd, brand) {
|
|
|
728
1309
|
process.exit(1);
|
|
729
1310
|
}
|
|
730
1311
|
const debug = !!(rootOpts.debug || process.env.XSERVER_DEBUG === "1");
|
|
731
|
-
const
|
|
1312
|
+
const servername2 = resolveServername(cmd) ?? profile.servername;
|
|
732
1313
|
return new ApiClient({
|
|
733
1314
|
apiKey: profile.apiKey,
|
|
734
|
-
apiBase: brand
|
|
735
|
-
servername,
|
|
1315
|
+
apiBase: resolveApiBase(brand),
|
|
1316
|
+
servername: servername2,
|
|
736
1317
|
debug
|
|
737
1318
|
});
|
|
738
1319
|
}
|
|
@@ -753,6 +1334,9 @@ function getFormat(cmd) {
|
|
|
753
1334
|
function printResult(data, format) {
|
|
754
1335
|
console.log(formatOutput(data, format));
|
|
755
1336
|
}
|
|
1337
|
+
function printPreview(data, format) {
|
|
1338
|
+
console.error(formatOutput(data, format));
|
|
1339
|
+
}
|
|
756
1340
|
async function confirmDestructiveAction(cmd, message) {
|
|
757
1341
|
const root = findRoot(cmd);
|
|
758
1342
|
if (root.opts().yes || process.argv.includes("--yes") || process.argv.includes("-y"))
|
|
@@ -763,6 +1347,135 @@ async function confirmDestructiveAction(cmd, message) {
|
|
|
763
1347
|
process.exit(1);
|
|
764
1348
|
}
|
|
765
1349
|
}
|
|
1350
|
+
var defaultBillingConfirmationIo = { input, output };
|
|
1351
|
+
function billingPurchasePhrase(subject, totalPrice) {
|
|
1352
|
+
return `${subject} \u3092\u7A0E\u8FBC${formatYen(totalPrice)}\u3067\u627F\u8A8D`;
|
|
1353
|
+
}
|
|
1354
|
+
function billingConfirmationMessage(params) {
|
|
1355
|
+
const phrase = billingPurchasePhrase(params.confirmSubject, params.totalPrice);
|
|
1356
|
+
return [
|
|
1357
|
+
`\u8AB2\u91D1\u78BA\u8A8D: ${params.operation}`,
|
|
1358
|
+
`${params.targetLabel}: ${params.target}`,
|
|
1359
|
+
...billingConfirmationDetailLines(params.details ?? []),
|
|
1360
|
+
...billingPaymentLines(params.totalPrice),
|
|
1361
|
+
...params.legalNoticeLines,
|
|
1362
|
+
"\u7533\u8ACB\u3059\u308B\u3068\u8AB2\u91D1\u3055\u308C\u3001\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002",
|
|
1363
|
+
`\u7D9A\u884C\u3059\u308B\u5834\u5408\u306F\u6B21\u3092\u6B63\u78BA\u306B\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: ${phrase}`,
|
|
1364
|
+
""
|
|
1365
|
+
].join("\n");
|
|
1366
|
+
}
|
|
1367
|
+
function assertBillingTty(io) {
|
|
1368
|
+
if (!io.input.isTTY || !io.output.isTTY) {
|
|
1369
|
+
throw new Error("\u8AB2\u91D1\u3092\u4F34\u3046\u5B9F\u7533\u8ACB\u306F\u5BFE\u8A71\u7AEF\u672B\uFF08TTY\uFF09\u3067\u306E\u307F\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002\u975E\u5BFE\u8A71\u74B0\u5883\u3067\u306F --dry-run \u306E\u307F\u5229\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
var BillingCancelledError = class extends Error {
|
|
1373
|
+
constructor(message) {
|
|
1374
|
+
super(message);
|
|
1375
|
+
this.name = "BillingCancelledError";
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
var RESEND_GUIDANCE = /* @__PURE__ */ Symbol.for("xnp.cli.billingResendGuidance");
|
|
1379
|
+
function attachResendGuidance(error, lines) {
|
|
1380
|
+
if (typeof error === "object" && error !== null) {
|
|
1381
|
+
error[RESEND_GUIDANCE] = lines;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
function billingResendGuidance(error) {
|
|
1385
|
+
if (typeof error === "object" && error !== null) {
|
|
1386
|
+
const lines = error[RESEND_GUIDANCE];
|
|
1387
|
+
if (Array.isArray(lines))
|
|
1388
|
+
return lines;
|
|
1389
|
+
}
|
|
1390
|
+
return void 0;
|
|
1391
|
+
}
|
|
1392
|
+
async function confirmBillingPurchase(params, io = defaultBillingConfirmationIo) {
|
|
1393
|
+
assertBillingTty(io);
|
|
1394
|
+
io.output.write(billingConfirmationMessage(params));
|
|
1395
|
+
const phrase = billingPurchasePhrase(params.confirmSubject, params.totalPrice);
|
|
1396
|
+
const rl = createInterface({
|
|
1397
|
+
input: io.input,
|
|
1398
|
+
output: io.output,
|
|
1399
|
+
terminal: true
|
|
1400
|
+
});
|
|
1401
|
+
try {
|
|
1402
|
+
const answer = (await rl.question("> ")).trim();
|
|
1403
|
+
if (answer !== phrase) {
|
|
1404
|
+
throw new BillingCancelledError("\u78BA\u8A8D\u6587\u5B57\u5217\u304C\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\u3002");
|
|
1405
|
+
}
|
|
1406
|
+
} finally {
|
|
1407
|
+
rl.close();
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
async function executeBillingPurchase(params) {
|
|
1411
|
+
console.error(`Idempotency-Key: ${params.idempotencyKey}`);
|
|
1412
|
+
try {
|
|
1413
|
+
const result = await params.execute();
|
|
1414
|
+
console.error(`${params.operation}\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002`);
|
|
1415
|
+
return result;
|
|
1416
|
+
} catch (error) {
|
|
1417
|
+
attachResendGuidance(error, [
|
|
1418
|
+
"\u5165\u529B\u4E0D\u5099\u30FB\u6B8B\u9AD8\u4E0D\u8DB3\u30FB\u4FA1\u683C\u4E0D\u4E00\u81F4\u306A\u3069\u3067\u5374\u4E0B\u3055\u308C\u305F\u5834\u5408\u306F\u3001\u3053\u306E\u30AD\u30FC\u306E\u307E\u307E\u518D\u5B9F\u884C\u3067\u304D\u307E\u3059\u3002",
|
|
1419
|
+
`\u5FDC\u7B54\u3092\u53D7\u3051\u53D6\u308C\u306A\u304B\u3063\u305F\u5834\u5408\u3084\u30B5\u30FC\u30D0\u30FC\u30A8\u30E9\u30FC\u306E\u5834\u5408\u306F\u3001\u307E\u305A\u540C\u3058\u30AD\u30FC\u3067\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u5B8C\u4E86\u6E08\u307F\u306A\u3089\u524D\u56DE\u306E\u7D50\u679C\u3092\u53D6\u5F97\u3067\u304D\u307E\u3059\u3002\u51E6\u7406\u304C\u5B8C\u4E86\u3057\u3066\u3044\u306A\u3044\u5834\u5408\u306F48\u6642\u9593 409 DUPLICATE_REQUEST \u306B\u306A\u308B\u305F\u3081\u3001${params.statusCommand ?? `domain show ${params.subject}`} \u3068\u8ACB\u6C42\u5C65\u6B74\u3067\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3001\u672A\u5B9F\u884C\u3068\u78BA\u8A8D\u3067\u304D\u305F\u3068\u304D\u306E\u307F\u65B0\u3057\u3044\u30AD\u30FC\u3067\u518D\u7533\u8ACB\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
|
|
1420
|
+
]);
|
|
1421
|
+
throw error;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
async function runBillingPurchase(flow) {
|
|
1425
|
+
if (!flow.options.agreeToTerms) {
|
|
1426
|
+
throw new Error("\u7533\u8FBC\u306Edry-run\u304A\u3088\u3073\u5B9F\u7533\u8ACB\u306B\u306F --agree-to-terms \u306B\u3088\u308B\u5229\u7528\u898F\u7D04\u3078\u306E\u660E\u793A\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059");
|
|
1427
|
+
}
|
|
1428
|
+
const preview = await flow.preview();
|
|
1429
|
+
if (flow.options.dryRun) {
|
|
1430
|
+
printResult(preview, flow.format);
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
const expectedTotalPrice = parseNonnegativeInteger(flow.options.expectedTotalPrice, "--expected-total-price");
|
|
1434
|
+
const idempotencyKey = validateIdempotencyKey(flow.options.idempotencyKey ?? randomUUID());
|
|
1435
|
+
const totalPrice = totalPriceFromPreview(preview, expectedTotalPrice);
|
|
1436
|
+
if (!flow.options.confirmPurchase) {
|
|
1437
|
+
throw new Error("\u5B9F\u7533\u8ACB\u306B\u306F --confirm-purchase \u304C\u5FC5\u8981\u3067\u3059\uFF08--yes \u3067\u306F\u7701\u7565\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u7D9A\u3051\u3066TTY\u3067\u78BA\u8A8D\u6587\u5B57\u5217\u306E\u5165\u529B\u3082\u5FC5\u8981\u3067\u3059");
|
|
1438
|
+
}
|
|
1439
|
+
const confirmationIo = flow.confirmationIo ?? defaultBillingConfirmationIo;
|
|
1440
|
+
assertBillingTty(confirmationIo);
|
|
1441
|
+
const { target, confirmSubject } = await flow.resolveTarget();
|
|
1442
|
+
await confirmBillingPurchase({
|
|
1443
|
+
operation: flow.operation,
|
|
1444
|
+
target,
|
|
1445
|
+
targetLabel: flow.targetLabel,
|
|
1446
|
+
details: flow.details,
|
|
1447
|
+
totalPrice,
|
|
1448
|
+
legalNoticeLines: flow.legalNoticeLines,
|
|
1449
|
+
confirmSubject
|
|
1450
|
+
}, confirmationIo);
|
|
1451
|
+
const result = await executeBillingPurchase({
|
|
1452
|
+
idempotencyKey,
|
|
1453
|
+
operation: flow.operation,
|
|
1454
|
+
subject: target,
|
|
1455
|
+
statusCommand: flow.statusCommand,
|
|
1456
|
+
execute: () => flow.execute(idempotencyKey)
|
|
1457
|
+
});
|
|
1458
|
+
printResult(result, flow.format);
|
|
1459
|
+
}
|
|
1460
|
+
function parseNonnegativeInteger(value, optionName) {
|
|
1461
|
+
if (!/^\d+$/.test(value))
|
|
1462
|
+
throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1463
|
+
const parsed = Number(value);
|
|
1464
|
+
if (!Number.isSafeInteger(parsed) || parsed < 0) {
|
|
1465
|
+
throw new Error(`${optionName} \u306F0\u4EE5\u4E0A\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
1466
|
+
}
|
|
1467
|
+
return parsed;
|
|
1468
|
+
}
|
|
1469
|
+
function totalPriceFromPreview(preview, expectedTotalPrice) {
|
|
1470
|
+
const totalPrice = Number(preview?.total_price);
|
|
1471
|
+
if (!Number.isFinite(totalPrice)) {
|
|
1472
|
+
throw new Error("dry-run\u7D50\u679C\u304B\u3089\u5408\u8A08\u91D1\u984D\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
|
|
1473
|
+
}
|
|
1474
|
+
if (totalPrice !== expectedTotalPrice) {
|
|
1475
|
+
throw new Error(`\u4FA1\u683C\u4E0D\u4E00\u81F4\u306E\u305F\u3081\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\uFF08\u898B\u7A4D ${totalPrice}\u5186 / \u6307\u5B9A ${expectedTotalPrice}\u5186\uFF09\u3002`);
|
|
1476
|
+
}
|
|
1477
|
+
return totalPrice;
|
|
1478
|
+
}
|
|
766
1479
|
function pickDefined(obj) {
|
|
767
1480
|
const result = {};
|
|
768
1481
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -772,6 +1485,112 @@ function pickDefined(obj) {
|
|
|
772
1485
|
return result;
|
|
773
1486
|
}
|
|
774
1487
|
|
|
1488
|
+
// ../core/dist/commands/auth/login.js
|
|
1489
|
+
import { password, select } from "@inquirer/prompts";
|
|
1490
|
+
|
|
1491
|
+
// ../core/dist/lib/auth-service-info.js
|
|
1492
|
+
var SERVICE_ORDER = ["server", "domain", "wphosting"];
|
|
1493
|
+
var NO_DEFAULT_SERVER = "__XSERVER_NO_DEFAULT_SERVER__";
|
|
1494
|
+
function servernameChoices(targets) {
|
|
1495
|
+
return [
|
|
1496
|
+
...targets.map((target) => ({ value: target, name: target })),
|
|
1497
|
+
{
|
|
1498
|
+
value: NO_DEFAULT_SERVER,
|
|
1499
|
+
name: "\u56FA\u5B9A\u3057\u306A\u3044\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09"
|
|
1500
|
+
}
|
|
1501
|
+
];
|
|
1502
|
+
}
|
|
1503
|
+
function record2(value) {
|
|
1504
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
1505
|
+
}
|
|
1506
|
+
function strings(value) {
|
|
1507
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
|
|
1508
|
+
}
|
|
1509
|
+
function stringValue(value, fallback) {
|
|
1510
|
+
return typeof value === "string" && value !== "" ? value : fallback;
|
|
1511
|
+
}
|
|
1512
|
+
function parseAuthApiKeyInfo(meData) {
|
|
1513
|
+
const rawServices = record2(meData.services);
|
|
1514
|
+
const services = [];
|
|
1515
|
+
for (const name of SERVICE_ORDER) {
|
|
1516
|
+
const block = record2(rawServices?.[name]);
|
|
1517
|
+
if (!block)
|
|
1518
|
+
continue;
|
|
1519
|
+
const service = {
|
|
1520
|
+
name,
|
|
1521
|
+
permissionType: stringValue(block.permission_type, "unknown"),
|
|
1522
|
+
targetMode: stringValue(block.target_mode, "unknown"),
|
|
1523
|
+
targets: strings(block.targets)
|
|
1524
|
+
};
|
|
1525
|
+
if (name === "domain" && typeof block.allow_acquisition === "boolean") {
|
|
1526
|
+
service.allowAcquisition = block.allow_acquisition;
|
|
1527
|
+
}
|
|
1528
|
+
if (name === "wphosting") {
|
|
1529
|
+
service.siteTargetMode = stringValue(block.site_target_mode, "unknown");
|
|
1530
|
+
service.sites = strings(block.sites);
|
|
1531
|
+
}
|
|
1532
|
+
services.push(service);
|
|
1533
|
+
}
|
|
1534
|
+
return {
|
|
1535
|
+
expiresAt: typeof meData.expires_at === "string" ? meData.expires_at : null,
|
|
1536
|
+
services
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
function hasAuthService(info, name) {
|
|
1540
|
+
return info.services.some((service) => service.name === name);
|
|
1541
|
+
}
|
|
1542
|
+
function permissionLabel(value) {
|
|
1543
|
+
if (value === "full")
|
|
1544
|
+
return "\u3059\u3079\u3066\u306E\u64CD\u4F5C";
|
|
1545
|
+
if (value === "read")
|
|
1546
|
+
return "\u8AAD\u307F\u53D6\u308A\u5C02\u7528";
|
|
1547
|
+
if (value === "custom")
|
|
1548
|
+
return "\u30AB\u30B9\u30BF\u30E0";
|
|
1549
|
+
return value === "unknown" ? "\u4E0D\u660E" : value;
|
|
1550
|
+
}
|
|
1551
|
+
function targetLines(service) {
|
|
1552
|
+
if (service.name === "wphosting") {
|
|
1553
|
+
if (service.targetMode === "all")
|
|
1554
|
+
return [" \u5BFE\u8C61\u5951\u7D04: \u3059\u3079\u3066"];
|
|
1555
|
+
return [" \u5BFE\u8C61\u5951\u7D04:", ...service.targets.map((target) => ` - ${target}`)];
|
|
1556
|
+
}
|
|
1557
|
+
const label = service.name === "server" ? "\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC" : "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3";
|
|
1558
|
+
if (service.targetMode === "all") {
|
|
1559
|
+
return [` ${label}: \u3059\u3079\u3066`];
|
|
1560
|
+
}
|
|
1561
|
+
const lines = [` ${label}:`];
|
|
1562
|
+
lines.push(...service.targets.map((target) => ` - ${target}`));
|
|
1563
|
+
return lines;
|
|
1564
|
+
}
|
|
1565
|
+
function siteTargetLines(service) {
|
|
1566
|
+
if (service.name !== "wphosting")
|
|
1567
|
+
return [];
|
|
1568
|
+
if (service.siteTargetMode === "all")
|
|
1569
|
+
return [" \u5BFE\u8C61\u30B5\u30A4\u30C8: \u3059\u3079\u3066"];
|
|
1570
|
+
const sites = service.sites ?? [];
|
|
1571
|
+
return [" \u5BFE\u8C61\u30B5\u30A4\u30C8:", ...sites.map((site) => ` - ${site}`)];
|
|
1572
|
+
}
|
|
1573
|
+
function formatAuthApiKeyInfo(info) {
|
|
1574
|
+
const lines = ["\u5229\u7528\u53EF\u80FD\u306A\u30B5\u30FC\u30D3\u30B9:"];
|
|
1575
|
+
if (info.services.length === 0) {
|
|
1576
|
+
lines.push(" \u306A\u3057");
|
|
1577
|
+
}
|
|
1578
|
+
for (const service of info.services) {
|
|
1579
|
+
const label = service.name === "server" ? "Server" : service.name === "domain" ? "Domain" : "XServer for WordPress";
|
|
1580
|
+
lines.push(` ${label}`);
|
|
1581
|
+
lines.push(` \u6A29\u9650: ${permissionLabel(service.permissionType)}`);
|
|
1582
|
+
lines.push(...targetLines(service));
|
|
1583
|
+
lines.push(...siteTargetLines(service));
|
|
1584
|
+
if (service.name === "domain" && service.allowAcquisition !== void 0) {
|
|
1585
|
+
lines.push(` \u53D6\u5F97\u30FB\u79FB\u7BA1\u30FB\u66F4\u65B0: ${service.allowAcquisition ? "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u3059" : "\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}`);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
if (info.expiresAt) {
|
|
1589
|
+
lines.push("", `API\u30AD\u30FC\u6709\u52B9\u671F\u9650: ${info.expiresAt}`);
|
|
1590
|
+
}
|
|
1591
|
+
return lines;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
775
1594
|
// ../core/dist/lib/resolve-servername-from-me.js
|
|
776
1595
|
function resolveServernameFromMe(meData) {
|
|
777
1596
|
const services = meData.services;
|
|
@@ -825,9 +1644,13 @@ async function resolveLoginServername(meData, brand) {
|
|
|
825
1644
|
if (outcome.status === "choose") {
|
|
826
1645
|
if (process.stdin.isTTY) {
|
|
827
1646
|
const chosen = await select({
|
|
828
|
-
message: "\
|
|
829
|
-
choices: outcome.targets
|
|
1647
|
+
message: "\u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u306E\u65E2\u5B9A\u30B5\u30FC\u30D0\u30FC\u3092\u9078\u629E:",
|
|
1648
|
+
choices: servernameChoices(outcome.targets)
|
|
830
1649
|
});
|
|
1650
|
+
if (chosen === NO_DEFAULT_SERVER) {
|
|
1651
|
+
console.error(" \u30B5\u30FC\u30D0\u30FC\u540D: \u672A\u56FA\u5B9A\uFF08\u30B3\u30DE\u30F3\u30C9\u5B9F\u884C\u6642\u306B --servername \u3067\u6307\u5B9A\uFF09");
|
|
1652
|
+
return void 0;
|
|
1653
|
+
}
|
|
831
1654
|
console.error(` \u30B5\u30FC\u30D0\u30FC\u540D: ${chosen}`);
|
|
832
1655
|
return chosen;
|
|
833
1656
|
}
|
|
@@ -844,10 +1667,10 @@ async function resolveLoginServername(meData, brand) {
|
|
|
844
1667
|
}
|
|
845
1668
|
function registerAuthCommands(program, brand) {
|
|
846
1669
|
const auth = program.command("auth").description("\u8A8D\u8A3C\u8A2D\u5B9A");
|
|
847
|
-
auth.command("login").description("API\u30AD\u30FC\u3092\
|
|
1670
|
+
auth.command("login").description("API\u30AD\u30FC\u3092\u691C\u8A3C\u3057\u3001\u5229\u7528\u53EF\u80FD\u30B5\u30FC\u30D3\u30B9\u3068\u8A8D\u8A3C\u8A2D\u5B9A\u3092\u4FDD\u5B58").option("--api-key <key>", "API\u30AD\u30FC").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u81EA\u52D5\u691C\u51FA\u3092\u4E0A\u66F8\u304D\uFF09").action(async (opts, cmd) => {
|
|
848
1671
|
const profileName = cmd.optsWithGlobals().profile ?? "default";
|
|
849
1672
|
let apiKey = opts.apiKey;
|
|
850
|
-
let
|
|
1673
|
+
let servername2 = opts.servername;
|
|
851
1674
|
if (!apiKey) {
|
|
852
1675
|
apiKey = await password({ message: "API\u30AD\u30FC\u3092\u5165\u529B:", mask: true });
|
|
853
1676
|
}
|
|
@@ -856,10 +1679,11 @@ function registerAuthCommands(program, brand) {
|
|
|
856
1679
|
process.exit(1);
|
|
857
1680
|
}
|
|
858
1681
|
console.error("\u8A8D\u8A3C\u60C5\u5831\u3092\u691C\u8A3C\u4E2D...");
|
|
859
|
-
const
|
|
1682
|
+
const apiBase = resolveApiBase(brand);
|
|
1683
|
+
const client2 = new ApiClient({ apiKey, apiBase });
|
|
860
1684
|
let meData;
|
|
861
1685
|
try {
|
|
862
|
-
meData = await
|
|
1686
|
+
meData = await client2.getMe();
|
|
863
1687
|
} catch (err) {
|
|
864
1688
|
if (err instanceof ApiError && err.errorCode === "UNAUTHORIZED") {
|
|
865
1689
|
console.error("\u30A8\u30E9\u30FC: API\u30AD\u30FC\u304C\u7121\u52B9\u3067\u3059\u3002\u6B63\u3057\u3044API\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
@@ -868,13 +1692,19 @@ function registerAuthCommands(program, brand) {
|
|
|
868
1692
|
throw err;
|
|
869
1693
|
}
|
|
870
1694
|
console.error("\u2713 \u8A8D\u8A3C\u306B\u6210\u529F\u3057\u307E\u3057\u305F");
|
|
871
|
-
|
|
872
|
-
|
|
1695
|
+
const apiKeyInfo = parseAuthApiKeyInfo(meData);
|
|
1696
|
+
console.error("");
|
|
1697
|
+
for (const line of formatAuthApiKeyInfo(apiKeyInfo)) {
|
|
1698
|
+
console.error(line);
|
|
1699
|
+
}
|
|
1700
|
+
console.error("");
|
|
1701
|
+
if (!servername2 && hasAuthService(apiKeyInfo, "server")) {
|
|
1702
|
+
servername2 = await resolveLoginServername(meData, brand);
|
|
873
1703
|
}
|
|
874
1704
|
const config = loadConfig(brand);
|
|
875
1705
|
config.profiles[profileName] = {
|
|
876
1706
|
apiKey,
|
|
877
|
-
...
|
|
1707
|
+
...servername2 ? { servername: servername2 } : {}
|
|
878
1708
|
};
|
|
879
1709
|
if (!config.defaultProfile) {
|
|
880
1710
|
config.defaultProfile = profileName;
|
|
@@ -907,7 +1737,7 @@ function registerAuthCommands(program, brand) {
|
|
|
907
1737
|
profile: profileName,
|
|
908
1738
|
api_key: maskApiKey(profile.apiKey),
|
|
909
1739
|
servername: profile.servername ?? null,
|
|
910
|
-
api_base: brand
|
|
1740
|
+
api_base: resolveApiBase(brand)
|
|
911
1741
|
}, format);
|
|
912
1742
|
return;
|
|
913
1743
|
}
|
|
@@ -918,7 +1748,7 @@ function registerAuthCommands(program, brand) {
|
|
|
918
1748
|
} else {
|
|
919
1749
|
console.log("\u30B5\u30FC\u30D0\u30FC\u540D: \u672A\u56FA\u5B9A\uFF08\u30B5\u30FC\u30D0\u30FC\u7CFB\u30B3\u30DE\u30F3\u30C9\u3067\u306F --servername \u3067\u6307\u5B9A\uFF09");
|
|
920
1750
|
}
|
|
921
|
-
console.log(`API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8: ${brand
|
|
1751
|
+
console.log(`API\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8: ${resolveApiBase(brand)}`);
|
|
922
1752
|
});
|
|
923
1753
|
auth.command("profiles").description("\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u4E00\u89A7\u3092\u8868\u793A").action((_opts, cmd) => {
|
|
924
1754
|
const format = getFormat(cmd);
|
|
@@ -966,12 +1796,119 @@ function registerAuthCommands(program, brand) {
|
|
|
966
1796
|
// ../core/dist/commands/server/info.js
|
|
967
1797
|
function registerServerInfoCommands(parent, brand) {
|
|
968
1798
|
parent.command("info").description("\u30B5\u30FC\u30D0\u30FC\u60C5\u5831\u3092\u53D6\u5F97").action(async () => {
|
|
969
|
-
const
|
|
970
|
-
printResult(await
|
|
1799
|
+
const client2 = resolveClient(parent, brand);
|
|
1800
|
+
printResult(await client2.getServerInfo(), getFormat(parent));
|
|
971
1801
|
});
|
|
972
1802
|
parent.command("usage").description("\u30B5\u30FC\u30D0\u30FC\u5229\u7528\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
|
|
973
|
-
const
|
|
974
|
-
printResult(await
|
|
1803
|
+
const client2 = resolveClient(parent, brand);
|
|
1804
|
+
printResult(await client2.getServerUsage(), getFormat(parent));
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
// ../core/dist/lib/signup-validation.js
|
|
1809
|
+
function parsePlanIds(value) {
|
|
1810
|
+
const plans = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1811
|
+
if (plans.length === 0)
|
|
1812
|
+
throw new Error("--plan-id \u306F1\u4EF6\u4EE5\u4E0A\u306E\u30D7\u30E9\u30F3ID\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1813
|
+
return plans.join(",");
|
|
1814
|
+
}
|
|
1815
|
+
function parseSignupPeriod(value) {
|
|
1816
|
+
return parseInteger(value, "--period", 1, 60);
|
|
1817
|
+
}
|
|
1818
|
+
function parseWphostingSignupPeriod(value) {
|
|
1819
|
+
return parseSignupPeriod(value);
|
|
1820
|
+
}
|
|
1821
|
+
function parseAutoRenew(value) {
|
|
1822
|
+
return parseStrictBoolean(value, "--auto-renew");
|
|
1823
|
+
}
|
|
1824
|
+
function validatePartnerCode(value) {
|
|
1825
|
+
if (value.length === 0 || value.length > 50 || !/^[A-Za-z0-9]+$/.test(value)) {
|
|
1826
|
+
throw new Error("--partner-code \u306F50\u6587\u5B57\u4EE5\u5185\u306EASCII\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1827
|
+
}
|
|
1828
|
+
return value;
|
|
1829
|
+
}
|
|
1830
|
+
function validateSignupServerId(value) {
|
|
1831
|
+
if (!/^[a-z][0-9a-z]+$/.test(value)) {
|
|
1832
|
+
throw new Error("--server-id \u306F\u5C0F\u6587\u5B57\u82F1\u5B57\u3067\u59CB\u307E\u308B2\u6587\u5B57\u4EE5\u4E0A\u306E\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1833
|
+
}
|
|
1834
|
+
return value;
|
|
1835
|
+
}
|
|
1836
|
+
function validateSignupMemo(value) {
|
|
1837
|
+
if (value.length > 500)
|
|
1838
|
+
throw new Error("--memo \u306F500\u6587\u5B57\u4EE5\u5185\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1839
|
+
return value;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// ../core/dist/commands/server/account.js
|
|
1843
|
+
function explicitServername(parent) {
|
|
1844
|
+
const value = parent.opts().servername;
|
|
1845
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
1846
|
+
throw new Error("--servername \u3067\u5BFE\u8C61\u30B5\u30FC\u30D0\u30FC\u540D\u3092\u660E\u793A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1847
|
+
}
|
|
1848
|
+
return value;
|
|
1849
|
+
}
|
|
1850
|
+
function registerServerAccountCommands(parent, brand) {
|
|
1851
|
+
parent.command("plans").description("\u7533\u8FBC\u53EF\u80FD\u306A\u30B5\u30FC\u30D0\u30FC\u30D7\u30E9\u30F3\u3092\u53D6\u5F97").option("--plan-id <list>", "\u30D7\u30E9\u30F3ID\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
|
|
1852
|
+
const params = opts.planId === void 0 ? void 0 : { plan_id: parsePlanIds(opts.planId) };
|
|
1853
|
+
printResult(await resolveClient(parent, brand).listServerPlans(params), getFormat(parent));
|
|
1854
|
+
});
|
|
1855
|
+
parent.command("contracts").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04").command("list").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
1856
|
+
printResult(await resolveClient(parent, brand).listServers(), getFormat(parent));
|
|
1857
|
+
});
|
|
1858
|
+
parent.command("signup-status").description("\u30B5\u30FC\u30D0\u30FC\u7533\u8FBC\u51E6\u7406\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
|
|
1859
|
+
printResult(await resolveClient(parent, brand).getServerSignupStatus(explicitServername(parent)), getFormat(parent));
|
|
1860
|
+
});
|
|
1861
|
+
const memo = parent.command("memo").description("\u30B5\u30FC\u30D0\u30FC\u5951\u7D04\u30E1\u30E2");
|
|
1862
|
+
memo.command("show").description("\u30E1\u30E2\u3092\u53D6\u5F97").action(async () => {
|
|
1863
|
+
printResult(await resolveClient(parent, brand).getServerMemo(explicitServername(parent)), getFormat(parent));
|
|
1864
|
+
});
|
|
1865
|
+
memo.command("update").description("\u30E1\u30E2\u3092\u66F4\u65B0").requiredOption("--memo <memo>", "\u30E1\u30E2\uFF08\u7A7A\u6587\u5B57\u53EF\u3001500\u6587\u5B57\u4EE5\u5185\uFF09").action(async (opts) => {
|
|
1866
|
+
printResult(await resolveClient(parent, brand).updateServerMemo(explicitServername(parent), {
|
|
1867
|
+
memo: validateSignupMemo(opts.memo)
|
|
1868
|
+
}), getFormat(parent));
|
|
1869
|
+
});
|
|
1870
|
+
parent.command("signup").description("\u30B5\u30FC\u30D0\u30FC\u3092\u65B0\u898F\u5951\u7D04").requiredOption("--plan-id <id>", "\u30D7\u30E9\u30F3ID").requiredOption("--period <months>", "\u5951\u7D04\u671F\u9593\uFF08\u6708\u6570\u3002server plans \u304C\u8FD4\u3057\u305F months \u304B\u3089\u6307\u5B9A\uFF09").requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--server-id <id>", "\u5E0C\u671B\u30B5\u30FC\u30D0\u30FCID").option("--partner-code <code>", "\u30D1\u30FC\u30C8\u30CA\u30FC\u30B3\u30FC\u30C9\uFF08ASCII\u82F1\u6570\u5B57\u300150\u6587\u5B57\u4EE5\u5185\uFF09").option("--auto-renew <bool>", "\u81EA\u52D5\u66F4\u65B0\uFF08true / false\uFF09").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--agree-to-terms", "\u5229\u7528\u898F\u7D04\u306B\u540C\u610F").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09").action(async (opts) => {
|
|
1871
|
+
const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
|
|
1872
|
+
const period = parseSignupPeriod(opts.period);
|
|
1873
|
+
const serverId = opts.serverId === void 0 ? void 0 : validateSignupServerId(opts.serverId);
|
|
1874
|
+
const partnerCode = opts.partnerCode === void 0 ? void 0 : validatePartnerCode(opts.partnerCode);
|
|
1875
|
+
const autoRenew = opts.autoRenew === void 0 ? void 0 : parseAutoRenew(opts.autoRenew);
|
|
1876
|
+
const baseData = {
|
|
1877
|
+
plan_id: opts.planId,
|
|
1878
|
+
period,
|
|
1879
|
+
expected_total_price: expectedTotalPrice,
|
|
1880
|
+
agree_to_terms: true,
|
|
1881
|
+
...pickDefined({
|
|
1882
|
+
server_id: serverId,
|
|
1883
|
+
partner_code: partnerCode,
|
|
1884
|
+
auto_renew: autoRenew
|
|
1885
|
+
})
|
|
1886
|
+
};
|
|
1887
|
+
const client2 = resolveClient(parent, brand);
|
|
1888
|
+
await runBillingPurchase({
|
|
1889
|
+
format: getFormat(parent),
|
|
1890
|
+
options: opts,
|
|
1891
|
+
operation: signupOperationName(brand, "server", opts.planId),
|
|
1892
|
+
targetLabel: "\u7533\u8FBC\u5185\u5BB9",
|
|
1893
|
+
resolveTarget: async () => {
|
|
1894
|
+
const planName = await resolvePlanName(() => client2.listServerPlans({ plan_id: opts.planId }), opts.planId);
|
|
1895
|
+
return {
|
|
1896
|
+
target: `${planLabel(opts.planId, planName)} / \u5951\u7D04\u671F\u9593 ${period}\u304B\u6708`,
|
|
1897
|
+
confirmSubject: `${planName ?? opts.planId} ${period}\u304B\u6708`
|
|
1898
|
+
};
|
|
1899
|
+
},
|
|
1900
|
+
details: compactDetails([
|
|
1901
|
+
serverIdDetail(serverId),
|
|
1902
|
+
autoRenewDetail(autoRenew ?? true, {
|
|
1903
|
+
fromDefault: autoRenew === void 0
|
|
1904
|
+
}),
|
|
1905
|
+
partnerCodeDetail(partnerCode)
|
|
1906
|
+
]),
|
|
1907
|
+
legalNoticeLines: signupLegalNoticeLines(brand, "server", opts.planId),
|
|
1908
|
+
statusCommand: `${brand.commandName} server contracts list`,
|
|
1909
|
+
preview: () => client2.registerServer({ ...baseData, dry_run: true }),
|
|
1910
|
+
execute: (idempotencyKey) => client2.registerServer({ ...baseData, dry_run: false }, idempotencyKey)
|
|
1911
|
+
});
|
|
975
1912
|
});
|
|
976
1913
|
}
|
|
977
1914
|
|
|
@@ -979,11 +1916,11 @@ function registerServerInfoCommands(parent, brand) {
|
|
|
979
1916
|
function registerCronCommands(parent, brand) {
|
|
980
1917
|
const cron = parent.command("cron").description("Cron\u8A2D\u5B9A");
|
|
981
1918
|
cron.command("list").description("Cron\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
982
|
-
const
|
|
983
|
-
printResult(await
|
|
1919
|
+
const client2 = resolveClient(parent, brand);
|
|
1920
|
+
printResult(await client2.listCron(), getFormat(parent));
|
|
984
1921
|
});
|
|
985
1922
|
cron.command("add").description("Cron\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--minute <value>", "\u5206\uFF08\u4F8B: */5, 0, *\uFF09").requiredOption("--hour <value>", "\u6642\uFF08\u4F8B: *, 3, 0-6\uFF09").requiredOption("--command <value>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--day <value>", "\u65E5", "*").option("--month <value>", "\u6708", "*").option("--weekday <value>", "\u66DC\u65E5", "*").option("--comment <value>", "\u30E1\u30E2").action(async (opts) => {
|
|
986
|
-
const
|
|
1923
|
+
const client2 = resolveClient(parent, brand);
|
|
987
1924
|
const data = pickDefined({
|
|
988
1925
|
minute: opts.minute,
|
|
989
1926
|
hour: opts.hour,
|
|
@@ -993,10 +1930,10 @@ function registerCronCommands(parent, brand) {
|
|
|
993
1930
|
command: opts.command,
|
|
994
1931
|
comment: opts.comment
|
|
995
1932
|
});
|
|
996
|
-
printResult(await
|
|
1933
|
+
printResult(await client2.addCron(data), getFormat(parent));
|
|
997
1934
|
});
|
|
998
1935
|
cron.command("update <cronId>").description("Cron\u3092\u66F4\u65B0").option("--minute <value>", "\u5206").option("--hour <value>", "\u6642").option("--day <value>", "\u65E5").option("--month <value>", "\u6708").option("--weekday <value>", "\u66DC\u65E5").option("--command <value>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <value>", "\u30E1\u30E2").option("--enabled <value>", "\u6709\u52B9/\u7121\u52B9 (true/false)").action(async (cronId, opts) => {
|
|
999
|
-
const
|
|
1936
|
+
const client2 = resolveClient(parent, brand);
|
|
1000
1937
|
const data = pickDefined({
|
|
1001
1938
|
minute: opts.minute,
|
|
1002
1939
|
hour: opts.hour,
|
|
@@ -1008,12 +1945,12 @@ function registerCronCommands(parent, brand) {
|
|
|
1008
1945
|
});
|
|
1009
1946
|
if (opts.enabled !== void 0)
|
|
1010
1947
|
data.enabled = opts.enabled === "true";
|
|
1011
|
-
printResult(await
|
|
1948
|
+
printResult(await client2.updateCron(cronId, data), getFormat(parent));
|
|
1012
1949
|
});
|
|
1013
1950
|
cron.command("delete <cronId>").description("Cron\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (cronId) => {
|
|
1014
1951
|
await confirmDestructiveAction(parent, `Cron "${cronId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1015
|
-
const
|
|
1016
|
-
printResult(await
|
|
1952
|
+
const client2 = resolveClient(parent, brand);
|
|
1953
|
+
printResult(await client2.deleteCron(cronId), getFormat(parent));
|
|
1017
1954
|
});
|
|
1018
1955
|
}
|
|
1019
1956
|
|
|
@@ -1021,14 +1958,14 @@ function registerCronCommands(parent, brand) {
|
|
|
1021
1958
|
function registerWpCommands(parent, brand) {
|
|
1022
1959
|
const wp = parent.command("wp").description("WordPress\u7C21\u5358\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB");
|
|
1023
1960
|
wp.command("list").description("WordPress\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1024
|
-
const
|
|
1961
|
+
const client2 = resolveClient(parent, brand);
|
|
1025
1962
|
const params = {};
|
|
1026
1963
|
if (opts.domain)
|
|
1027
1964
|
params.domain = opts.domain;
|
|
1028
|
-
printResult(await
|
|
1965
|
+
printResult(await client2.listWordpress(params), getFormat(parent));
|
|
1029
1966
|
});
|
|
1030
1967
|
wp.command("add").description("WordPress\u3092\u65B0\u898F\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").requiredOption("--url <url>", "\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u5148URL\uFF08\u4F8B: example.com/blog\uFF09").requiredOption("--title <title>", "\u30B5\u30A4\u30C8\u30BF\u30A4\u30C8\u30EB").requiredOption("--admin-username <username>", "\u7BA1\u7406\u8005\u30E6\u30FC\u30B6\u30FC\u540D").requiredOption("--admin-password <password>", "\u7BA1\u7406\u8005\u30D1\u30B9\u30EF\u30FC\u30C9").requiredOption("--admin-email <email>", "\u7BA1\u7406\u8005\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").option("--memo <value>", "\u30E1\u30E2").action(async (opts) => {
|
|
1031
|
-
const
|
|
1968
|
+
const client2 = resolveClient(parent, brand);
|
|
1032
1969
|
const data = pickDefined({
|
|
1033
1970
|
url: opts.url,
|
|
1034
1971
|
title: opts.title,
|
|
@@ -1037,21 +1974,21 @@ function registerWpCommands(parent, brand) {
|
|
|
1037
1974
|
admin_email: opts.adminEmail,
|
|
1038
1975
|
memo: opts.memo
|
|
1039
1976
|
});
|
|
1040
|
-
printResult(await
|
|
1977
|
+
printResult(await client2.addWordpress(data), getFormat(parent));
|
|
1041
1978
|
});
|
|
1042
1979
|
wp.command("update <wpId>").description("WordPress\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (wpId, opts) => {
|
|
1043
|
-
const
|
|
1044
|
-
printResult(await
|
|
1980
|
+
const client2 = resolveClient(parent, brand);
|
|
1981
|
+
printResult(await client2.updateWordpress(wpId, pickDefined({ memo: opts.memo })), getFormat(parent));
|
|
1045
1982
|
});
|
|
1046
1983
|
wp.command("delete <wpId>").description("WordPress\u3092\u524A\u9664").option("--delete-db <value>", "\u95A2\u9023\u3059\u308BMySQL\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--delete-db-user <value>", "\u95A2\u9023\u3059\u308BMySQL\u30E6\u30FC\u30B6\u30FC\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: false\uFF09").option("--delete-cron <value>", "\u30AD\u30E3\u30C3\u30B7\u30E5\u81EA\u52D5\u524A\u9664Cron\u3082\u524A\u9664\u3059\u308B\u304B\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (wpId, opts) => {
|
|
1047
1984
|
await confirmDestructiveAction(parent, `WordPress "${wpId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1048
|
-
const
|
|
1985
|
+
const client2 = resolveClient(parent, brand);
|
|
1049
1986
|
const data = pickDefined({
|
|
1050
1987
|
delete_db: opts.deleteDb !== void 0 ? opts.deleteDb === "true" : void 0,
|
|
1051
1988
|
delete_db_user: opts.deleteDbUser !== void 0 ? opts.deleteDbUser === "true" : void 0,
|
|
1052
1989
|
delete_cron: opts.deleteCron !== void 0 ? opts.deleteCron === "true" : void 0
|
|
1053
1990
|
});
|
|
1054
|
-
printResult(await
|
|
1991
|
+
printResult(await client2.deleteWordpress(wpId, data), getFormat(parent));
|
|
1055
1992
|
});
|
|
1056
1993
|
}
|
|
1057
1994
|
|
|
@@ -1059,29 +1996,29 @@ function registerWpCommands(parent, brand) {
|
|
|
1059
1996
|
function registerMailCommands(parent, brand) {
|
|
1060
1997
|
const mail = parent.command("mail").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
|
|
1061
1998
|
mail.command("list").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1062
|
-
const
|
|
1999
|
+
const client2 = resolveClient(parent, brand);
|
|
1063
2000
|
const params = {};
|
|
1064
2001
|
if (opts.domain)
|
|
1065
2002
|
params.domain = opts.domain;
|
|
1066
|
-
printResult(await
|
|
2003
|
+
printResult(await client2.listMail(params), getFormat(parent));
|
|
1067
2004
|
});
|
|
1068
2005
|
mail.command("get <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
|
|
1069
|
-
const
|
|
1070
|
-
printResult(await
|
|
2006
|
+
const client2 = resolveClient(parent, brand);
|
|
2007
|
+
printResult(await client2.getMail(mailAccount), getFormat(parent));
|
|
1071
2008
|
});
|
|
1072
2009
|
mail.command("add <mailAddress>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--quota-mb <mb>", "\u5BB9\u91CF\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (mailAddress, opts) => {
|
|
1073
|
-
const
|
|
2010
|
+
const client2 = resolveClient(parent, brand);
|
|
1074
2011
|
const data = pickDefined({
|
|
1075
2012
|
mail_address: mailAddress,
|
|
1076
2013
|
password: opts.password,
|
|
1077
2014
|
quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
|
|
1078
2015
|
memo: opts.memo
|
|
1079
2016
|
});
|
|
1080
|
-
printResult(await
|
|
2017
|
+
printResult(await client2.addMail(data), getFormat(parent));
|
|
1081
2018
|
});
|
|
1082
2019
|
mail.command("update <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--quota-mb <mb>", "\u5BB9\u91CF\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (mailAccount, opts) => {
|
|
1083
|
-
const
|
|
1084
|
-
printResult(await
|
|
2020
|
+
const client2 = resolveClient(parent, brand);
|
|
2021
|
+
printResult(await client2.updateMail(mailAccount, pickDefined({
|
|
1085
2022
|
password: opts.password,
|
|
1086
2023
|
quota_mb: opts.quotaMb !== void 0 ? parseInt(opts.quotaMb, 10) : void 0,
|
|
1087
2024
|
memo: opts.memo
|
|
@@ -1089,21 +2026,21 @@ function registerMailCommands(parent, brand) {
|
|
|
1089
2026
|
});
|
|
1090
2027
|
mail.command("delete <mailAccount>").description("\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (mailAccount) => {
|
|
1091
2028
|
await confirmDestructiveAction(parent, `\u30E1\u30FC\u30EB\u30A2\u30AB\u30A6\u30F3\u30C8 "${mailAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1092
|
-
const
|
|
1093
|
-
printResult(await
|
|
2029
|
+
const client2 = resolveClient(parent, brand);
|
|
2030
|
+
printResult(await client2.deleteMail(mailAccount), getFormat(parent));
|
|
1094
2031
|
});
|
|
1095
2032
|
mail.command("forwarding-get <mailAccount>").description("\u30E1\u30FC\u30EB\u8EE2\u9001\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (mailAccount) => {
|
|
1096
|
-
const
|
|
1097
|
-
printResult(await
|
|
2033
|
+
const client2 = resolveClient(parent, brand);
|
|
2034
|
+
printResult(await client2.getMailForwarding(mailAccount), getFormat(parent));
|
|
1098
2035
|
});
|
|
1099
2036
|
mail.command("forwarding-update <mailAccount>").description("\u30E1\u30FC\u30EB\u8EE2\u9001\u8A2D\u5B9A\u3092\u66F4\u65B0").option("--forwarding-addresses <addresses>", "\u8EE2\u9001\u5148\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").option("--keep-in-mailbox <value>", "\u8EE2\u9001\u5F8C\u3082\u30E1\u30FC\u30EB\u30DC\u30C3\u30AF\u30B9\u306B\u6B8B\u3059\u304B\uFF08true/false\uFF09").action(async (mailAccount, opts) => {
|
|
1100
|
-
const
|
|
2037
|
+
const client2 = resolveClient(parent, brand);
|
|
1101
2038
|
const data = {};
|
|
1102
2039
|
if (opts.forwardingAddresses)
|
|
1103
2040
|
data.forwarding_addresses = opts.forwardingAddresses.split(",").map((a) => a.trim());
|
|
1104
2041
|
if (opts.keepInMailbox !== void 0)
|
|
1105
2042
|
data.keep_in_mailbox = opts.keepInMailbox === "true";
|
|
1106
|
-
printResult(await
|
|
2043
|
+
printResult(await client2.updateMailForwarding(mailAccount, data), getFormat(parent));
|
|
1107
2044
|
});
|
|
1108
2045
|
}
|
|
1109
2046
|
|
|
@@ -1117,11 +2054,11 @@ function parseAddressList(value) {
|
|
|
1117
2054
|
function registerSpamFilterCommands(parent, brand) {
|
|
1118
2055
|
const spamFilter = parent.command("spam-filter").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A");
|
|
1119
2056
|
spamFilter.command("list").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1120
|
-
const
|
|
2057
|
+
const client2 = resolveClient(parent, brand);
|
|
1121
2058
|
const params = {};
|
|
1122
2059
|
if (opts.domain)
|
|
1123
2060
|
params.domain = opts.domain;
|
|
1124
|
-
printResult(await
|
|
2061
|
+
printResult(await client2.listSpamFilter(params), getFormat(parent));
|
|
1125
2062
|
});
|
|
1126
2063
|
spamFilter.command("update <domain>").description("\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--filter-type <value>", "\u8FF7\u60D1\u30E1\u30FC\u30EB\u30D5\u30A3\u30EB\u30BF\uFF08off / standard / cloudmark_authority\uFF09").option("--detection-action <action>", "\u691C\u77E5\u6642\u306E\u51E6\u7406\uFF08inbox / spam / trash / delete\uFF09").option("--white-list <addresses>", "\u30DB\u30EF\u30A4\u30C8\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").option("--black-list <addresses>", "\u30D6\u30E9\u30C3\u30AF\u30EA\u30B9\u30C8\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3002\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").option("--spam-level <level>", "\u6A19\u6E96\u30B9\u30D1\u30E0\u30D5\u30A3\u30EB\u30BF\u5224\u5B9A\u57FA\u6E96\uFF08very_lenient / lenient / normal / strict / very_strict / strictest\uFF09").option("--strict-non-japanese-subject <value>", "\u65E5\u672C\u8A9E\u3092\u542B\u307E\u306A\u3044\u4EF6\u540D\u306B\u5BFE\u3057\u3066\u5224\u5B9A\u3092\u53B3\u3057\u304F\u3059\u308B\uFF08true/false\uFF09").option("--strict-html-mail <value>", "HTML\u30E1\u30FC\u30EB\u306B\u5BFE\u3057\u3066\u5224\u5B9A\u3092\u53B3\u3057\u304F\u3059\u308B\uFF08true/false\uFF09").action(async (domain, opts) => {
|
|
1127
2064
|
const data = {};
|
|
@@ -1144,12 +2081,12 @@ function registerSpamFilterCommands(parent, brand) {
|
|
|
1144
2081
|
if (Object.keys(data).length === 0) {
|
|
1145
2082
|
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1146
2083
|
}
|
|
1147
|
-
const
|
|
1148
|
-
printResult(await
|
|
2084
|
+
const client2 = resolveClient(parent, brand);
|
|
2085
|
+
printResult(await client2.updateSpamFilter(domain, data), getFormat(parent));
|
|
1149
2086
|
});
|
|
1150
2087
|
spamFilter.command("dmarc-receiver-update <domain>").description("\u53D7\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u66F4\u65B0").requiredOption("--dmarc-receiver <value>", "\u53D7\u4FE1\u5074DMARC\u8A2D\u5B9A\uFF08true/false\uFF09").action(async (domain, opts) => {
|
|
1151
|
-
const
|
|
1152
|
-
printResult(await
|
|
2088
|
+
const client2 = resolveClient(parent, brand);
|
|
2089
|
+
printResult(await client2.updateSpamFilterDmarcReceiver(domain, {
|
|
1153
2090
|
dmarc_receiver: opts.dmarcReceiver
|
|
1154
2091
|
}), getFormat(parent));
|
|
1155
2092
|
});
|
|
@@ -1159,14 +2096,14 @@ function registerSpamFilterCommands(parent, brand) {
|
|
|
1159
2096
|
function registerMailFilterCommands(parent, brand) {
|
|
1160
2097
|
const mailFilter = parent.command("mail-filter").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A");
|
|
1161
2098
|
mailFilter.command("list").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1162
|
-
const
|
|
2099
|
+
const client2 = resolveClient(parent, brand);
|
|
1163
2100
|
const params = {};
|
|
1164
2101
|
if (opts.domain)
|
|
1165
2102
|
params.domain = opts.domain;
|
|
1166
|
-
printResult(await
|
|
2103
|
+
printResult(await client2.listMailFilter(params), getFormat(parent));
|
|
1167
2104
|
});
|
|
1168
2105
|
mailFilter.command("add").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--condition-keyword <keyword>", "\u6761\u4EF6\u30AD\u30FC\u30EF\u30FC\u30C9").requiredOption("--condition-field <field>", "\u6761\u4EF6\u5BFE\u8C61\uFF08subject / from / to / body / header\uFF09").option("--condition-match-type <type>", "\u4E00\u81F4\u6761\u4EF6\uFF08contain / match / start_from\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: contain\uFF09").requiredOption("--action-type <type>", "\u30A2\u30AF\u30B7\u30E7\u30F3\u7A2E\u5225\uFF08mail_address / spam_folder / trash / delete\uFF09").option("--action-target <target>", "\u8EE2\u9001\u5148\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08action-type\u304Cmail_address\u306E\u5834\u5408\uFF09").option("--action-method <method>", "\u51E6\u7406\u65B9\u6CD5\uFF08move / copy\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: move\uFF09").action(async (opts) => {
|
|
1169
|
-
const
|
|
2106
|
+
const client2 = resolveClient(parent, brand);
|
|
1170
2107
|
const data = {
|
|
1171
2108
|
domain: opts.domain,
|
|
1172
2109
|
conditions: [{
|
|
@@ -1180,12 +2117,12 @@ function registerMailFilterCommands(parent, brand) {
|
|
|
1180
2117
|
method: opts.actionMethod || "move"
|
|
1181
2118
|
}
|
|
1182
2119
|
};
|
|
1183
|
-
printResult(await
|
|
2120
|
+
printResult(await client2.addMailFilter(data), getFormat(parent));
|
|
1184
2121
|
});
|
|
1185
2122
|
mailFilter.command("delete <filterId>").description("\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (filterId) => {
|
|
1186
2123
|
await confirmDestructiveAction(parent, `\u30E1\u30FC\u30EB\u632F\u308A\u5206\u3051\u8A2D\u5B9A "${filterId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1187
|
-
const
|
|
1188
|
-
printResult(await
|
|
2124
|
+
const client2 = resolveClient(parent, brand);
|
|
2125
|
+
printResult(await client2.deleteMailFilter(filterId), getFormat(parent));
|
|
1189
2126
|
});
|
|
1190
2127
|
}
|
|
1191
2128
|
|
|
@@ -1193,19 +2130,19 @@ function registerMailFilterCommands(parent, brand) {
|
|
|
1193
2130
|
function registerAutoReplyCommands(parent, brand) {
|
|
1194
2131
|
const autoReply = parent.command("auto-reply").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A");
|
|
1195
2132
|
autoReply.command("list").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1196
|
-
const
|
|
2133
|
+
const client2 = resolveClient(parent, brand);
|
|
1197
2134
|
const params = {};
|
|
1198
2135
|
if (opts.domain)
|
|
1199
2136
|
params.domain = opts.domain;
|
|
1200
|
-
printResult(await
|
|
2137
|
+
printResult(await client2.listAutoReply(params), getFormat(parent));
|
|
1201
2138
|
});
|
|
1202
2139
|
autoReply.command("get <mailAddress>").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (mailAccount) => {
|
|
1203
|
-
const
|
|
1204
|
-
printResult(await
|
|
2140
|
+
const client2 = resolveClient(parent, brand);
|
|
2141
|
+
printResult(await client2.getAutoReply(mailAccount), getFormat(parent));
|
|
1205
2142
|
});
|
|
1206
2143
|
autoReply.command("add").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--mail-address <address>", "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").requiredOption("--from-name <name>", "\u9001\u4FE1\u8005\u540D").requiredOption("--subject <subject>", "\u4EF6\u540D").requiredOption("--body <body>", "\u672C\u6587").requiredOption("--quote-incoming <value>", "\u53D7\u4FE1\u30E1\u30FC\u30EB\u306E\u5F15\u7528\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (opts) => {
|
|
1207
|
-
const
|
|
1208
|
-
printResult(await
|
|
2144
|
+
const client2 = resolveClient(parent, brand);
|
|
2145
|
+
printResult(await client2.addAutoReply({
|
|
1209
2146
|
domain: opts.domain,
|
|
1210
2147
|
mail_address: opts.mailAddress,
|
|
1211
2148
|
from_name: opts.fromName,
|
|
@@ -1228,13 +2165,13 @@ function registerAutoReplyCommands(parent, brand) {
|
|
|
1228
2165
|
if (Object.keys(data).length === 0) {
|
|
1229
2166
|
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08--from-name / --subject / --body / --quote-incoming\uFF09");
|
|
1230
2167
|
}
|
|
1231
|
-
const
|
|
1232
|
-
printResult(await
|
|
2168
|
+
const client2 = resolveClient(parent, brand);
|
|
2169
|
+
printResult(await client2.updateAutoReply(mailAccount, data), getFormat(parent));
|
|
1233
2170
|
});
|
|
1234
2171
|
autoReply.command("delete <mailAddress>").description("\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (mailAccount) => {
|
|
1235
2172
|
await confirmDestructiveAction(parent, `\u81EA\u52D5\u5FDC\u7B54\u8A2D\u5B9A "${mailAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1236
|
-
const
|
|
1237
|
-
printResult(await
|
|
2173
|
+
const client2 = resolveClient(parent, brand);
|
|
2174
|
+
printResult(await client2.deleteAutoReply(mailAccount), getFormat(parent));
|
|
1238
2175
|
});
|
|
1239
2176
|
}
|
|
1240
2177
|
|
|
@@ -1242,15 +2179,15 @@ function registerAutoReplyCommands(parent, brand) {
|
|
|
1242
2179
|
function registerSmtpAbroadRestrictionCommands(parent, brand) {
|
|
1243
2180
|
const smtpAbroadRestriction = parent.command("smtp-abroad-restriction").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A");
|
|
1244
2181
|
smtpAbroadRestriction.command("list").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1245
|
-
const
|
|
2182
|
+
const client2 = resolveClient(parent, brand);
|
|
1246
2183
|
const params = {};
|
|
1247
2184
|
if (opts.domain)
|
|
1248
2185
|
params.domain = opts.domain;
|
|
1249
|
-
printResult(await
|
|
2186
|
+
printResult(await client2.listSmtpAbroadRestriction(params), getFormat(parent));
|
|
1250
2187
|
});
|
|
1251
2188
|
smtpAbroadRestriction.command("update <domain>").description("SMTP\u8A8D\u8A3C\u306E\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u8A2D\u5B9A\u3092\u66F4\u65B0").requiredOption("--abroad-access-restriction <value>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (domain, opts) => {
|
|
1252
|
-
const
|
|
1253
|
-
printResult(await
|
|
2189
|
+
const client2 = resolveClient(parent, brand);
|
|
2190
|
+
printResult(await client2.updateSmtpAbroadRestriction(domain, {
|
|
1254
2191
|
abroad_access_restriction: opts.abroadAccessRestriction
|
|
1255
2192
|
}), getFormat(parent));
|
|
1256
2193
|
});
|
|
@@ -1260,19 +2197,19 @@ function registerSmtpAbroadRestrictionCommands(parent, brand) {
|
|
|
1260
2197
|
function registerDkimCommands(parent, brand) {
|
|
1261
2198
|
const dkim = parent.command("dkim").description("DKIM\u8A2D\u5B9A");
|
|
1262
2199
|
dkim.command("list").description("DKIM\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1263
|
-
const
|
|
2200
|
+
const client2 = resolveClient(parent, brand);
|
|
1264
2201
|
const params = {};
|
|
1265
2202
|
if (opts.domain)
|
|
1266
2203
|
params.domain = opts.domain;
|
|
1267
|
-
printResult(await
|
|
2204
|
+
printResult(await client2.listDkim(params), getFormat(parent));
|
|
1268
2205
|
});
|
|
1269
2206
|
dkim.command("get <fqdn>").description("DKIM\u8A2D\u5B9A\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (fqdn) => {
|
|
1270
|
-
const
|
|
1271
|
-
printResult(await
|
|
2207
|
+
const client2 = resolveClient(parent, brand);
|
|
2208
|
+
printResult(await client2.getDkim(fqdn), getFormat(parent));
|
|
1272
2209
|
});
|
|
1273
2210
|
dkim.command("update <fqdn>").description("DKIM\u8A2D\u5B9A\u306E\u6709\u52B9/\u7121\u52B9\u3092\u5207\u308A\u66FF\u3048").requiredOption("--enabled <value>", "DKIM\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (fqdn, opts) => {
|
|
1274
|
-
const
|
|
1275
|
-
printResult(await
|
|
2211
|
+
const client2 = resolveClient(parent, brand);
|
|
2212
|
+
printResult(await client2.updateDkim(fqdn, { enabled: opts.enabled }), getFormat(parent));
|
|
1276
2213
|
});
|
|
1277
2214
|
}
|
|
1278
2215
|
|
|
@@ -1286,11 +2223,11 @@ function parseNotificationMailAddresses(value) {
|
|
|
1286
2223
|
function registerDmarcCommands(parent, brand) {
|
|
1287
2224
|
const dmarc = parent.command("dmarc").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A");
|
|
1288
2225
|
dmarc.command("list").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1289
|
-
const
|
|
2226
|
+
const client2 = resolveClient(parent, brand);
|
|
1290
2227
|
const params = {};
|
|
1291
2228
|
if (opts.domain)
|
|
1292
2229
|
params.domain = opts.domain;
|
|
1293
|
-
printResult(await
|
|
2230
|
+
printResult(await client2.listDmarc(params), getFormat(parent));
|
|
1294
2231
|
});
|
|
1295
2232
|
dmarc.command("update <domain>").description("\u9001\u4FE1\u5074DMARC\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--policy <policy>", "DMARC\u30DD\u30EA\u30B7\u30FC\uFF08none / quarantine / reject\uFF09").option("--report-enabled <value>", "\u30EC\u30DD\u30FC\u30C8\u901A\u77E5\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false \u307E\u305F\u306F 1/0\uFF09\u3002false \u306E\u3068\u304D\u901A\u77E5\u5148\u306F\u81EA\u52D5\u7684\u306B\u7A7A\u306B\u306A\u308B").option("--notification-mail-addresses <addresses>", "\u30EC\u30DD\u30FC\u30C8\u901A\u77E5\u5148\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09\u3002--report-enabled true \u306E\u3068\u304D\u306F1\u4EF6\u4EE5\u4E0A\u5FC5\u9808").action(async (domain, opts) => {
|
|
1296
2233
|
const data = {};
|
|
@@ -1305,8 +2242,8 @@ function registerDmarcCommands(parent, brand) {
|
|
|
1305
2242
|
if (Object.keys(data).length === 0) {
|
|
1306
2243
|
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1307
2244
|
}
|
|
1308
|
-
const
|
|
1309
|
-
printResult(await
|
|
2245
|
+
const client2 = resolveClient(parent, brand);
|
|
2246
|
+
printResult(await client2.updateDmarc(domain, data), getFormat(parent));
|
|
1310
2247
|
});
|
|
1311
2248
|
}
|
|
1312
2249
|
|
|
@@ -1315,26 +2252,26 @@ var UPDATE_ACTIONS = ["reset", "enable_gmail", "custom"];
|
|
|
1315
2252
|
function registerSpfCommands(parent, brand) {
|
|
1316
2253
|
const spf = parent.command("spf").description("SPF\u8A2D\u5B9A");
|
|
1317
2254
|
spf.command("list").description("SPF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1318
|
-
const
|
|
2255
|
+
const client2 = resolveClient(parent, brand);
|
|
1319
2256
|
const params = {};
|
|
1320
2257
|
if (opts.domain)
|
|
1321
2258
|
params.domain = opts.domain;
|
|
1322
|
-
printResult(await
|
|
2259
|
+
printResult(await client2.listSpf(params), getFormat(parent));
|
|
1323
2260
|
});
|
|
1324
2261
|
spf.command("add").description("SPF\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--fqdn <fqdn>", "FQDN\uFF08example.com \u307E\u305F\u306F sub.example.com\uFF09").action(async (opts) => {
|
|
1325
|
-
const
|
|
1326
|
-
printResult(await
|
|
2262
|
+
const client2 = resolveClient(parent, brand);
|
|
2263
|
+
printResult(await client2.addSpf({ fqdn: opts.fqdn }), getFormat(parent));
|
|
1327
2264
|
});
|
|
1328
2265
|
spf.command("update <fqdn>").description("SPF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08reset / enable_gmail / custom\uFF09").requiredOption("--action <action>", `\u64CD\u4F5C\u7A2E\u5225\uFF08${UPDATE_ACTIONS.join(" / ")}\uFF09`).option("--spf-record <record>", "\u30AB\u30B9\u30BF\u30E0SPF\u30EC\u30B3\u30FC\u30C9\uFF08action=custom \u306E\u3068\u304D\u5FC5\u9808\uFF09").action(async (fqdn, opts) => {
|
|
1329
2266
|
const body = { action: opts.action };
|
|
1330
2267
|
if (opts.spfRecord !== void 0)
|
|
1331
2268
|
body.spf_record = opts.spfRecord;
|
|
1332
|
-
const
|
|
1333
|
-
printResult(await
|
|
2269
|
+
const client2 = resolveClient(parent, brand);
|
|
2270
|
+
printResult(await client2.updateSpf(fqdn, body), getFormat(parent));
|
|
1334
2271
|
});
|
|
1335
2272
|
spf.command("delete <fqdn>").description("SPF\u8A2D\u5B9A\u3092\u524A\u9664").action(async (fqdn) => {
|
|
1336
|
-
const
|
|
1337
|
-
printResult(await
|
|
2273
|
+
const client2 = resolveClient(parent, brand);
|
|
2274
|
+
printResult(await client2.deleteSpf(fqdn), getFormat(parent));
|
|
1338
2275
|
});
|
|
1339
2276
|
}
|
|
1340
2277
|
|
|
@@ -1342,14 +2279,14 @@ function registerSpfCommands(parent, brand) {
|
|
|
1342
2279
|
function registerFtpCommands(parent, brand) {
|
|
1343
2280
|
const ftp = parent.command("ftp").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A");
|
|
1344
2281
|
ftp.command("list").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1345
|
-
const
|
|
2282
|
+
const client2 = resolveClient(parent, brand);
|
|
1346
2283
|
const params = {};
|
|
1347
2284
|
if (opts.domain)
|
|
1348
2285
|
params.domain = opts.domain;
|
|
1349
|
-
printResult(await
|
|
2286
|
+
printResult(await client2.listFtp(params), getFormat(parent));
|
|
1350
2287
|
});
|
|
1351
2288
|
ftp.command("add <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--directory <dir>", "\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("--quota <mb>", "\u5BB9\u91CF\u5236\u9650\uFF08MB\u30020\u3067\u7121\u5236\u9650\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (ftpAccount, opts) => {
|
|
1352
|
-
const
|
|
2289
|
+
const client2 = resolveClient(parent, brand);
|
|
1353
2290
|
const data = pickDefined({
|
|
1354
2291
|
ftp_account: ftpAccount,
|
|
1355
2292
|
password: opts.password,
|
|
@@ -1357,11 +2294,11 @@ function registerFtpCommands(parent, brand) {
|
|
|
1357
2294
|
quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
|
|
1358
2295
|
memo: opts.memo
|
|
1359
2296
|
});
|
|
1360
|
-
printResult(await
|
|
2297
|
+
printResult(await client2.addFtp(data), getFormat(parent));
|
|
1361
2298
|
});
|
|
1362
2299
|
ftp.command("update <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--directory <dir>", "\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA").option("--quota <mb>", "\u5BB9\u91CF\u5236\u9650\uFF08MB\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (ftpAccount, opts) => {
|
|
1363
|
-
const
|
|
1364
|
-
printResult(await
|
|
2300
|
+
const client2 = resolveClient(parent, brand);
|
|
2301
|
+
printResult(await client2.updateFtp(ftpAccount, pickDefined({
|
|
1365
2302
|
password: opts.password,
|
|
1366
2303
|
directory: opts.directory,
|
|
1367
2304
|
quota_mb: opts.quota !== void 0 ? parseInt(opts.quota, 10) : void 0,
|
|
@@ -1370,8 +2307,8 @@ function registerFtpCommands(parent, brand) {
|
|
|
1370
2307
|
});
|
|
1371
2308
|
ftp.command("delete <ftpAccount>").description("FTP\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (ftpAccount) => {
|
|
1372
2309
|
await confirmDestructiveAction(parent, `FTP\u30A2\u30AB\u30A6\u30F3\u30C8 "${ftpAccount}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1373
|
-
const
|
|
1374
|
-
printResult(await
|
|
2310
|
+
const client2 = resolveClient(parent, brand);
|
|
2311
|
+
printResult(await client2.deleteFtp(ftpAccount), getFormat(parent));
|
|
1375
2312
|
});
|
|
1376
2313
|
}
|
|
1377
2314
|
|
|
@@ -1379,64 +2316,64 @@ function registerFtpCommands(parent, brand) {
|
|
|
1379
2316
|
function registerDbCommands(parent, brand) {
|
|
1380
2317
|
const db = parent.command("db").description("MySQL\u8A2D\u5B9A");
|
|
1381
2318
|
db.command("list").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
1382
|
-
const
|
|
1383
|
-
printResult(await
|
|
2319
|
+
const client2 = resolveClient(parent, brand);
|
|
2320
|
+
printResult(await client2.listDb(), getFormat(parent));
|
|
1384
2321
|
});
|
|
1385
2322
|
db.command("add <nameSuffix>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u65B0\u898F\u4F5C\u6210").option("--character-set <charset>", "\u6587\u5B57\u30B3\u30FC\u30C9\uFF08utf8mb4 / UTF-8 / EUC-JP / SHIFT-JIS / Binary\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: utf8mb4\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (nameSuffix, opts) => {
|
|
1386
|
-
const
|
|
1387
|
-
printResult(await
|
|
2323
|
+
const client2 = resolveClient(parent, brand);
|
|
2324
|
+
printResult(await client2.addDb(pickDefined({
|
|
1388
2325
|
name_suffix: nameSuffix,
|
|
1389
2326
|
character_set: opts.characterSet,
|
|
1390
2327
|
memo: opts.memo
|
|
1391
2328
|
})), getFormat(parent));
|
|
1392
2329
|
});
|
|
1393
2330
|
db.command("update <dbName>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <value>", "\u30E1\u30E2").action(async (dbName, opts) => {
|
|
1394
|
-
const
|
|
1395
|
-
printResult(await
|
|
2331
|
+
const client2 = resolveClient(parent, brand);
|
|
2332
|
+
printResult(await client2.updateDb(dbName, pickDefined({
|
|
1396
2333
|
memo: opts.memo
|
|
1397
2334
|
})), getFormat(parent));
|
|
1398
2335
|
});
|
|
1399
2336
|
db.command("delete <dbName>").description("\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbName) => {
|
|
1400
2337
|
await confirmDestructiveAction(parent, `\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${dbName}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1401
|
-
const
|
|
1402
|
-
printResult(await
|
|
2338
|
+
const client2 = resolveClient(parent, brand);
|
|
2339
|
+
printResult(await client2.deleteDb(dbName), getFormat(parent));
|
|
1403
2340
|
});
|
|
1404
2341
|
db.command("user-list").description("MySQL\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
1405
|
-
const
|
|
1406
|
-
printResult(await
|
|
2342
|
+
const client2 = resolveClient(parent, brand);
|
|
2343
|
+
printResult(await client2.listDbUser(), getFormat(parent));
|
|
1407
2344
|
});
|
|
1408
2345
|
db.command("user-add <nameSuffix>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u3092\u65B0\u898F\u4F5C\u6210").requiredOption("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--memo <value>", "\u30E1\u30E2").action(async (nameSuffix, opts) => {
|
|
1409
|
-
const
|
|
1410
|
-
printResult(await
|
|
2346
|
+
const client2 = resolveClient(parent, brand);
|
|
2347
|
+
printResult(await client2.addDbUser(pickDefined({
|
|
1411
2348
|
name_suffix: nameSuffix,
|
|
1412
2349
|
password: opts.password,
|
|
1413
2350
|
memo: opts.memo
|
|
1414
2351
|
})), getFormat(parent));
|
|
1415
2352
|
});
|
|
1416
2353
|
db.command("user-update <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u8A2D\u5B9A\u3092\u5909\u66F4").option("--password <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9").option("--memo <value>", "\u30E1\u30E2").action(async (dbUser, opts) => {
|
|
1417
|
-
const
|
|
1418
|
-
printResult(await
|
|
2354
|
+
const client2 = resolveClient(parent, brand);
|
|
2355
|
+
printResult(await client2.updateDbUser(dbUser, pickDefined({
|
|
1419
2356
|
password: opts.password,
|
|
1420
2357
|
memo: opts.memo
|
|
1421
2358
|
})), getFormat(parent));
|
|
1422
2359
|
});
|
|
1423
2360
|
db.command("user-delete <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbUser) => {
|
|
1424
2361
|
await confirmDestructiveAction(parent, `MySQL\u30E6\u30FC\u30B6\u30FC "${dbUser}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1425
|
-
const
|
|
1426
|
-
printResult(await
|
|
2362
|
+
const client2 = resolveClient(parent, brand);
|
|
2363
|
+
printResult(await client2.deleteDbUser(dbUser), getFormat(parent));
|
|
1427
2364
|
});
|
|
1428
2365
|
db.command("grant-list <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306E\u6A29\u9650\u4E00\u89A7\u3092\u53D6\u5F97").action(async (dbUser) => {
|
|
1429
|
-
const
|
|
1430
|
-
printResult(await
|
|
2366
|
+
const client2 = resolveClient(parent, brand);
|
|
2367
|
+
printResult(await client2.listDbUserGrant(dbUser), getFormat(parent));
|
|
1431
2368
|
});
|
|
1432
2369
|
db.command("grant-add <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306B\u6A29\u9650\u3092\u8FFD\u52A0").requiredOption("--db-name <dbName>", "\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").action(async (dbUser, opts) => {
|
|
1433
|
-
const
|
|
1434
|
-
printResult(await
|
|
2370
|
+
const client2 = resolveClient(parent, brand);
|
|
2371
|
+
printResult(await client2.addDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
|
|
1435
2372
|
});
|
|
1436
2373
|
db.command("grant-delete <dbUser>").description("MySQL\u30E6\u30FC\u30B6\u30FC\u306E\u6A29\u9650\u3092\u524A\u9664").requiredOption("--db-name <dbName>", "\u5BFE\u8C61\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dbUser, opts) => {
|
|
1437
2374
|
await confirmDestructiveAction(parent, `MySQL\u30E6\u30FC\u30B6\u30FC "${dbUser}" \u306E\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${opts.dbName}" \u3078\u306E\u6A29\u9650\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1438
|
-
const
|
|
1439
|
-
printResult(await
|
|
2375
|
+
const client2 = resolveClient(parent, brand);
|
|
2376
|
+
printResult(await client2.deleteDbUserGrant(dbUser, { db_name: opts.dbName }), getFormat(parent));
|
|
1440
2377
|
});
|
|
1441
2378
|
}
|
|
1442
2379
|
|
|
@@ -1444,15 +2381,15 @@ function registerDbCommands(parent, brand) {
|
|
|
1444
2381
|
function registerPhpVersionCommands(parent, brand) {
|
|
1445
2382
|
const phpVer = parent.command("php-version").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u8A2D\u5B9A");
|
|
1446
2383
|
phpVer.command("get").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u78BA\u8A8D").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1447
|
-
const
|
|
2384
|
+
const client2 = resolveClient(parent, brand);
|
|
1448
2385
|
const params = {};
|
|
1449
2386
|
if (opts.domain)
|
|
1450
2387
|
params.domain = opts.domain;
|
|
1451
|
-
printResult(await
|
|
2388
|
+
printResult(await client2.getPhpVersion(params), getFormat(parent));
|
|
1452
2389
|
});
|
|
1453
2390
|
phpVer.command("update <domain>").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5909\u66F4").requiredOption("--php <version>", "PHP\u30D0\u30FC\u30B8\u30E7\u30F3\uFF08\u4F8B: 8.2\uFF09").action(async (domain, opts) => {
|
|
1454
|
-
const
|
|
1455
|
-
printResult(await
|
|
2391
|
+
const client2 = resolveClient(parent, brand);
|
|
2392
|
+
printResult(await client2.updatePhpVersion(domain, { version: opts.php }), getFormat(parent));
|
|
1456
2393
|
});
|
|
1457
2394
|
}
|
|
1458
2395
|
|
|
@@ -1460,15 +2397,15 @@ function registerPhpVersionCommands(parent, brand) {
|
|
|
1460
2397
|
function registerServerDomainCommands(parent, brand) {
|
|
1461
2398
|
const domain = parent.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
|
|
1462
2399
|
domain.command("list").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
1463
|
-
const
|
|
1464
|
-
printResult(await
|
|
2400
|
+
const client2 = resolveClient(parent, brand);
|
|
2401
|
+
printResult(await client2.listDomain(), getFormat(parent));
|
|
1465
2402
|
});
|
|
1466
2403
|
domain.command("get <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u8A73\u7D30\u3092\u53D6\u5F97").action(async (domainName) => {
|
|
1467
|
-
const
|
|
1468
|
-
printResult(await
|
|
2404
|
+
const client2 = resolveClient(parent, brand);
|
|
2405
|
+
printResult(await client2.getDomain(domainName), getFormat(parent));
|
|
1469
2406
|
});
|
|
1470
2407
|
domain.command("add <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u65B0\u898F\u8FFD\u52A0").option("--ssl <value>", "SSL\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--redirect-https <value>", "HTTPS\u8EE2\u9001\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: ssl\u3068\u540C\u3058\u5024\uFF09").option("--ai-crawler-block <value>", "AI\u30AF\u30ED\u30FC\u30E9\u30FC\u906E\u65AD\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (domainName, opts) => {
|
|
1471
|
-
const
|
|
2408
|
+
const client2 = resolveClient(parent, brand);
|
|
1472
2409
|
const data = { domain: domainName };
|
|
1473
2410
|
if (opts.ssl !== void 0)
|
|
1474
2411
|
data.ssl = opts.ssl === "true";
|
|
@@ -1478,27 +2415,27 @@ function registerServerDomainCommands(parent, brand) {
|
|
|
1478
2415
|
data.ai_crawler_block_enabled = opts.aiCrawlerBlock === "true";
|
|
1479
2416
|
if (opts.memo !== void 0)
|
|
1480
2417
|
data.memo = opts.memo;
|
|
1481
|
-
printResult(await
|
|
2418
|
+
printResult(await client2.addDomain(data), getFormat(parent));
|
|
1482
2419
|
});
|
|
1483
2420
|
domain.command("update <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u5909\u66F4").option("--memo <value>", "\u30E1\u30E2").action(async (domainName, opts) => {
|
|
1484
|
-
const
|
|
1485
|
-
printResult(await
|
|
2421
|
+
const client2 = resolveClient(parent, brand);
|
|
2422
|
+
printResult(await client2.updateDomain(domainName, pickDefined({
|
|
1486
2423
|
memo: opts.memo
|
|
1487
2424
|
})), getFormat(parent));
|
|
1488
2425
|
});
|
|
1489
2426
|
domain.command("delete <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u524A\u9664").option("--delete-files", "\u30E6\u30FC\u30B6\u30FC\u516C\u958B\u9818\u57DF\u306E\u30C9\u30E1\u30A4\u30F3\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3082\u524A\u9664\u3059\u308B").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domainName, opts) => {
|
|
1490
2427
|
const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
|
|
1491
2428
|
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domainName}" \u3092\u524A\u9664\u3057\u307E\u3059${suffix}\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1492
|
-
const
|
|
2429
|
+
const client2 = resolveClient(parent, brand);
|
|
1493
2430
|
const data = {};
|
|
1494
2431
|
if (opts.deleteFiles)
|
|
1495
2432
|
data.delete_files = true;
|
|
1496
|
-
printResult(await
|
|
2433
|
+
printResult(await client2.deleteDomain(domainName, data), getFormat(parent));
|
|
1497
2434
|
});
|
|
1498
2435
|
domain.command("reset <domain>").description("\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u3092\u521D\u671F\u5316").requiredOption("--type <type>", "\u30EA\u30BB\u30C3\u30C8\u7A2E\u5225\uFF08all: \u5168\u521D\u671F\u5316 / web: Web\u9818\u57DF\u306E\u307F / other: Web\u4EE5\u5916\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domainName, opts) => {
|
|
1499
2436
|
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domainName}" \u3092 "${opts.type}" \u3067\u521D\u671F\u5316\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1500
|
-
const
|
|
1501
|
-
printResult(await
|
|
2437
|
+
const client2 = resolveClient(parent, brand);
|
|
2438
|
+
printResult(await client2.resetDomain(domainName, { type: opts.type }), getFormat(parent));
|
|
1502
2439
|
});
|
|
1503
2440
|
}
|
|
1504
2441
|
|
|
@@ -1506,14 +2443,14 @@ function registerServerDomainCommands(parent, brand) {
|
|
|
1506
2443
|
function registerSubdomainCommands(parent, brand) {
|
|
1507
2444
|
const subdomain = parent.command("subdomain").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
|
|
1508
2445
|
subdomain.command("list").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1509
|
-
const
|
|
2446
|
+
const client2 = resolveClient(parent, brand);
|
|
1510
2447
|
const params = {};
|
|
1511
2448
|
if (opts.domain)
|
|
1512
2449
|
params.domain = opts.domain;
|
|
1513
|
-
printResult(await
|
|
2450
|
+
printResult(await client2.listSubdomain(params), getFormat(parent));
|
|
1514
2451
|
});
|
|
1515
2452
|
subdomain.command("add <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u3092\u65B0\u898F\u8FFD\u52A0").option("--document-root-type <type>", "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30EB\u30FC\u30C8\u7A2E\u5225\uFF08subdomain_only: /public_html/sub, full_subdomain: /public_html/sub.example.com\uFF09").option("--ssl <value>", "SSL\u8A2D\u5B9A\uFF08\u30C7\u30D5\u30A9\u30EB\u30C8: true\uFF09").option("--memo <value>", "\u30E1\u30E2").action(async (subdomainName, opts) => {
|
|
1516
|
-
const
|
|
2453
|
+
const client2 = resolveClient(parent, brand);
|
|
1517
2454
|
const data = { subdomain: subdomainName };
|
|
1518
2455
|
if (opts.documentRootType !== void 0)
|
|
1519
2456
|
data.document_root_type = opts.documentRootType;
|
|
@@ -1521,22 +2458,22 @@ function registerSubdomainCommands(parent, brand) {
|
|
|
1521
2458
|
data.ssl = opts.ssl === "true";
|
|
1522
2459
|
if (opts.memo !== void 0)
|
|
1523
2460
|
data.memo = opts.memo;
|
|
1524
|
-
printResult(await
|
|
2461
|
+
printResult(await client2.addSubdomain(data), getFormat(parent));
|
|
1525
2462
|
});
|
|
1526
2463
|
subdomain.command("update <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <value>", "\u30E1\u30E2").action(async (subdomainName, opts) => {
|
|
1527
|
-
const
|
|
1528
|
-
printResult(await
|
|
2464
|
+
const client2 = resolveClient(parent, brand);
|
|
2465
|
+
printResult(await client2.updateSubdomain(subdomainName, pickDefined({
|
|
1529
2466
|
memo: opts.memo
|
|
1530
2467
|
})), getFormat(parent));
|
|
1531
2468
|
});
|
|
1532
2469
|
subdomain.command("delete <subdomain>").description("\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3\u3092\u524A\u9664").option("--delete-files", "\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3059\u308B").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (subdomainName, opts) => {
|
|
1533
2470
|
const suffix = opts.deleteFiles ? "\uFF08\u95A2\u9023\u30D5\u30A1\u30A4\u30EB\u3082\u524A\u9664\u3057\u307E\u3059\uFF09" : "";
|
|
1534
2471
|
await confirmDestructiveAction(parent, `\u30B5\u30D6\u30C9\u30E1\u30A4\u30F3 "${subdomainName}" \u3092\u524A\u9664\u3057\u307E\u3059${suffix}\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1535
|
-
const
|
|
2472
|
+
const client2 = resolveClient(parent, brand);
|
|
1536
2473
|
const data = {};
|
|
1537
2474
|
if (opts.deleteFiles)
|
|
1538
2475
|
data.delete_files = true;
|
|
1539
|
-
printResult(await
|
|
2476
|
+
printResult(await client2.deleteSubdomain(subdomainName, data), getFormat(parent));
|
|
1540
2477
|
});
|
|
1541
2478
|
}
|
|
1542
2479
|
|
|
@@ -1544,22 +2481,22 @@ function registerSubdomainCommands(parent, brand) {
|
|
|
1544
2481
|
function registerSslCommands(parent, brand) {
|
|
1545
2482
|
const ssl = parent.command("ssl").description("SSL\u8A2D\u5B9A");
|
|
1546
2483
|
ssl.command("list").description("SSL\u8A2D\u5B9A\u306E\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1547
|
-
const
|
|
2484
|
+
const client2 = resolveClient(parent, brand);
|
|
1548
2485
|
const params = {};
|
|
1549
2486
|
if (opts.domain)
|
|
1550
2487
|
params.domain = opts.domain;
|
|
1551
|
-
printResult(await
|
|
2488
|
+
printResult(await client2.listSsl(params), getFormat(parent));
|
|
1552
2489
|
});
|
|
1553
2490
|
ssl.command("install <commonName>").description("\u7121\u6599SSL\u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").action(async (commonName) => {
|
|
1554
|
-
const
|
|
1555
|
-
printResult(await
|
|
2491
|
+
const client2 = resolveClient(parent, brand);
|
|
2492
|
+
printResult(await client2.installSsl(pickDefined({
|
|
1556
2493
|
common_name: commonName
|
|
1557
2494
|
})), getFormat(parent));
|
|
1558
2495
|
});
|
|
1559
2496
|
ssl.command("uninstall <commonName>").description("\u7121\u6599SSL\u3092\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (commonName) => {
|
|
1560
2497
|
await confirmDestructiveAction(parent, `\u7121\u6599SSL "${commonName}" \u3092\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1561
|
-
const
|
|
1562
|
-
printResult(await
|
|
2498
|
+
const client2 = resolveClient(parent, brand);
|
|
2499
|
+
printResult(await client2.uninstallSsl(commonName), getFormat(parent));
|
|
1563
2500
|
});
|
|
1564
2501
|
}
|
|
1565
2502
|
|
|
@@ -1567,15 +2504,15 @@ function registerSslCommands(parent, brand) {
|
|
|
1567
2504
|
function registerDnsCommands(parent, brand) {
|
|
1568
2505
|
const dns = parent.command("dns").description("DNS\u30EC\u30B3\u30FC\u30C9\u8A2D\u5B9A");
|
|
1569
2506
|
dns.command("list").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1570
|
-
const
|
|
2507
|
+
const client2 = resolveClient(parent, brand);
|
|
1571
2508
|
const params = {};
|
|
1572
2509
|
if (opts.domain)
|
|
1573
2510
|
params.domain = opts.domain;
|
|
1574
|
-
printResult(await
|
|
2511
|
+
printResult(await client2.listDns(params), getFormat(parent));
|
|
1575
2512
|
});
|
|
1576
2513
|
dns.command("add").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u65B0\u898F\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09").requiredOption("--type <type>", "\u30EC\u30B3\u30FC\u30C9\u30BF\u30A4\u30D7\uFF08A / AAAA / CNAME / MX / TXT / SRV / CAA\uFF09").requiredOption("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860-86400\u3002\u30C7\u30D5\u30A9\u30EB\u30C8: 3600\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF08MX/SRV\u30EC\u30B3\u30FC\u30C9\u7528\uFF09").action(async (opts) => {
|
|
1577
|
-
const
|
|
1578
|
-
printResult(await
|
|
2514
|
+
const client2 = resolveClient(parent, brand);
|
|
2515
|
+
printResult(await client2.addDns(pickDefined({
|
|
1579
2516
|
domain: opts.domain,
|
|
1580
2517
|
host: opts.host,
|
|
1581
2518
|
type: opts.type,
|
|
@@ -1585,8 +2522,8 @@ function registerDnsCommands(parent, brand) {
|
|
|
1585
2522
|
})), getFormat(parent));
|
|
1586
2523
|
});
|
|
1587
2524
|
dns.command("update <dnsId>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u66F4\u65B0").option("--domain <domain>", "\u30C9\u30E1\u30A4\u30F3").option("--host <host>", "\u30DB\u30B9\u30C8\u540D").option("--type <type>", "\u30EC\u30B3\u30FC\u30C9\u30BF\u30A4\u30D7").option("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860-86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6").action(async (dnsId, opts) => {
|
|
1588
|
-
const
|
|
1589
|
-
printResult(await
|
|
2525
|
+
const client2 = resolveClient(parent, brand);
|
|
2526
|
+
printResult(await client2.updateDns(dnsId, pickDefined({
|
|
1590
2527
|
domain: opts.domain,
|
|
1591
2528
|
host: opts.host,
|
|
1592
2529
|
type: opts.type,
|
|
@@ -1597,8 +2534,8 @@ function registerDnsCommands(parent, brand) {
|
|
|
1597
2534
|
});
|
|
1598
2535
|
dns.command("delete <dnsId>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (dnsId) => {
|
|
1599
2536
|
await confirmDestructiveAction(parent, `DNS\u30EC\u30B3\u30FC\u30C9 "${dnsId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1600
|
-
const
|
|
1601
|
-
printResult(await
|
|
2537
|
+
const client2 = resolveClient(parent, brand);
|
|
2538
|
+
printResult(await client2.deleteDns(dnsId), getFormat(parent));
|
|
1602
2539
|
});
|
|
1603
2540
|
}
|
|
1604
2541
|
|
|
@@ -1606,25 +2543,25 @@ function registerDnsCommands(parent, brand) {
|
|
|
1606
2543
|
function registerSshCommands(parent, brand) {
|
|
1607
2544
|
const ssh = parent.command("ssh").description("SSH\u8A2D\u5B9A");
|
|
1608
2545
|
ssh.command("show").description("SSH\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async () => {
|
|
1609
|
-
const
|
|
1610
|
-
printResult(await
|
|
2546
|
+
const client2 = resolveClient(parent, brand);
|
|
2547
|
+
printResult(await client2.getSsh(), getFormat(parent));
|
|
1611
2548
|
});
|
|
1612
2549
|
ssh.command("update").description("SSH\u8A2D\u5B9A\u3092\u5909\u66F4").option("--ssh-enabled <value>", "SSH\u63A5\u7D9A\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false\uFF09").option("--abroad-access-restriction <value>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\u306E\u6709\u52B9/\u7121\u52B9\uFF08true/false\uFF09").action(async (opts) => {
|
|
1613
|
-
const
|
|
2550
|
+
const client2 = resolveClient(parent, brand);
|
|
1614
2551
|
const data = {};
|
|
1615
2552
|
if (opts.sshEnabled !== void 0)
|
|
1616
2553
|
data.ssh_enabled = opts.sshEnabled === "true";
|
|
1617
2554
|
if (opts.abroadAccessRestriction !== void 0)
|
|
1618
2555
|
data.abroad_access_restriction = opts.abroadAccessRestriction === "true";
|
|
1619
|
-
printResult(await
|
|
2556
|
+
printResult(await client2.updateSsh(data), getFormat(parent));
|
|
1620
2557
|
});
|
|
1621
2558
|
const key = ssh.command("key").description("SSH\u516C\u958B\u9375\u7BA1\u7406");
|
|
1622
2559
|
key.command("list").description("SSH\u516C\u958B\u9375\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
1623
|
-
const
|
|
1624
|
-
printResult(await
|
|
2560
|
+
const client2 = resolveClient(parent, brand);
|
|
2561
|
+
printResult(await client2.listSshKey(), getFormat(parent));
|
|
1625
2562
|
});
|
|
1626
2563
|
key.command("add").description("SSH\u516C\u958B\u9375\u3092\u767B\u9332").option("--public-key <key>", "\u516C\u958B\u9375\uFF08\u624B\u52D5\u767B\u9332\u6642\uFF09").option("--generate", "\u30B5\u30FC\u30D0\u30FC\u5074\u3067\u9375\u30DA\u30A2\u3092\u81EA\u52D5\u751F\u6210").option("--passphrase <value>", "\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA\uFF08\u81EA\u52D5\u751F\u6210\u6642\uFF09").requiredOption("--label <value>", "\u30E9\u30D9\u30EB").action(async (opts) => {
|
|
1627
|
-
const
|
|
2564
|
+
const client2 = resolveClient(parent, brand);
|
|
1628
2565
|
const data = { label: opts.label };
|
|
1629
2566
|
if (opts.generate) {
|
|
1630
2567
|
data.generate = true;
|
|
@@ -1634,19 +2571,19 @@ function registerSshCommands(parent, brand) {
|
|
|
1634
2571
|
if (opts.publicKey)
|
|
1635
2572
|
data.public_key = opts.publicKey;
|
|
1636
2573
|
}
|
|
1637
|
-
printResult(await
|
|
2574
|
+
printResult(await client2.addSshKey(data), getFormat(parent));
|
|
1638
2575
|
});
|
|
1639
2576
|
key.command("update <keyId>").description("SSH\u516C\u958B\u9375\u3092\u66F4\u65B0").option("--label <value>", "\u30E9\u30D9\u30EB").option("--status <value>", "\u30B9\u30C6\u30FC\u30BF\u30B9\uFF08on/off\uFF09").action(async (keyId, opts) => {
|
|
1640
|
-
const
|
|
1641
|
-
printResult(await
|
|
2577
|
+
const client2 = resolveClient(parent, brand);
|
|
2578
|
+
printResult(await client2.updateSshKey(keyId, pickDefined({
|
|
1642
2579
|
label: opts.label,
|
|
1643
2580
|
status: opts.status
|
|
1644
2581
|
})), getFormat(parent));
|
|
1645
2582
|
});
|
|
1646
2583
|
key.command("delete <keyId>").description("SSH\u516C\u958B\u9375\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (keyId) => {
|
|
1647
2584
|
await confirmDestructiveAction(parent, `SSH\u516C\u958B\u9375 "${keyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1648
|
-
const
|
|
1649
|
-
printResult(await
|
|
2585
|
+
const client2 = resolveClient(parent, brand);
|
|
2586
|
+
printResult(await client2.deleteSshKey(keyId), getFormat(parent));
|
|
1650
2587
|
});
|
|
1651
2588
|
}
|
|
1652
2589
|
|
|
@@ -1654,22 +2591,22 @@ function registerSshCommands(parent, brand) {
|
|
|
1654
2591
|
function registerLogCommands(parent, brand) {
|
|
1655
2592
|
const log = parent.command("log").description("\u30ED\u30B0");
|
|
1656
2593
|
log.command("access").description("\u30A2\u30AF\u30BB\u30B9\u30ED\u30B0\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").option("--lines <n>", "\u53D6\u5F97\u884C\u6570").option("--keyword <keyword>", "\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22").action(async (opts) => {
|
|
1657
|
-
const
|
|
2594
|
+
const client2 = resolveClient(parent, brand);
|
|
1658
2595
|
const params = { domain: opts.domain };
|
|
1659
2596
|
if (opts.lines)
|
|
1660
2597
|
params.lines = opts.lines;
|
|
1661
2598
|
if (opts.keyword)
|
|
1662
2599
|
params.keyword = opts.keyword;
|
|
1663
|
-
printResult(await
|
|
2600
|
+
printResult(await client2.getAccessLog(params), getFormat(parent));
|
|
1664
2601
|
});
|
|
1665
2602
|
log.command("error").description("\u30A8\u30E9\u30FC\u30ED\u30B0\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").option("--lines <n>", "\u53D6\u5F97\u884C\u6570").option("--keyword <keyword>", "\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22").action(async (opts) => {
|
|
1666
|
-
const
|
|
2603
|
+
const client2 = resolveClient(parent, brand);
|
|
1667
2604
|
const params = { domain: opts.domain };
|
|
1668
2605
|
if (opts.lines)
|
|
1669
2606
|
params.lines = opts.lines;
|
|
1670
2607
|
if (opts.keyword)
|
|
1671
2608
|
params.keyword = opts.keyword;
|
|
1672
|
-
printResult(await
|
|
2609
|
+
printResult(await client2.getErrorLog(params), getFormat(parent));
|
|
1673
2610
|
});
|
|
1674
2611
|
}
|
|
1675
2612
|
|
|
@@ -1677,8 +2614,8 @@ function registerLogCommands(parent, brand) {
|
|
|
1677
2614
|
function registerResourceMonitorCommands(parent, brand) {
|
|
1678
2615
|
const resourceMonitor = parent.command("resource-monitor").description("\u30EA\u30BD\u30FC\u30B9\u30E2\u30CB\u30BF\u30FC");
|
|
1679
2616
|
resourceMonitor.command("get").description("\u6307\u5B9A\u65E5\u306ECPU\u30FB\u30E1\u30E2\u30EA\u30FB\u8EE2\u9001\u91CF\u6642\u7CFB\u5217\u3092\u53D6\u5F97").requiredOption("--date <date>", "\u5BFE\u8C61\u65E5\uFF08Y-m-d \u307E\u305F\u306F Ymd\u3002\u5F53\u65E5\u542B\u3080\u76F4\u8FD11\u304B\u6708\uFF09").action(async (opts) => {
|
|
1680
|
-
const
|
|
1681
|
-
printResult(await
|
|
2617
|
+
const client2 = resolveClient(parent, brand);
|
|
2618
|
+
printResult(await client2.getResourceMonitor(opts.date), getFormat(parent));
|
|
1682
2619
|
});
|
|
1683
2620
|
}
|
|
1684
2621
|
|
|
@@ -1686,11 +2623,11 @@ function registerResourceMonitorCommands(parent, brand) {
|
|
|
1686
2623
|
function registerWafCommands(parent, brand) {
|
|
1687
2624
|
const waf = parent.command("waf").description("WAF\u8A2D\u5B9A");
|
|
1688
2625
|
waf.command("list").description("WAF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1689
|
-
const
|
|
2626
|
+
const client2 = resolveClient(parent, brand);
|
|
1690
2627
|
const params = {};
|
|
1691
2628
|
if (opts.domain)
|
|
1692
2629
|
params.domain = opts.domain;
|
|
1693
|
-
printResult(await
|
|
2630
|
+
printResult(await client2.listWaf(params), getFormat(parent));
|
|
1694
2631
|
});
|
|
1695
2632
|
waf.command("update <domain>").description("WAF\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09").option("--xss-protection <value>", "XSS\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--sql-injection-protection <value>", "SQL\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--file-protection <value>", "\u30D5\u30A1\u30A4\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--mail-protection <value>", "\u30E1\u30FC\u30EB\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--command-protection <value>", "\u30B3\u30DE\u30F3\u30C9\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").option("--php-protection <value>", "PHP\u5BFE\u7B56\uFF08true/false \u307E\u305F\u306F 1/0\uFF09").action(async (domain, opts) => {
|
|
1696
2633
|
const data = {};
|
|
@@ -1709,8 +2646,8 @@ function registerWafCommands(parent, brand) {
|
|
|
1709
2646
|
if (Object.keys(data).length === 0) {
|
|
1710
2647
|
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1711
2648
|
}
|
|
1712
|
-
const
|
|
1713
|
-
printResult(await
|
|
2649
|
+
const client2 = resolveClient(parent, brand);
|
|
2650
|
+
printResult(await client2.updateWaf(domain, data), getFormat(parent));
|
|
1714
2651
|
});
|
|
1715
2652
|
}
|
|
1716
2653
|
|
|
@@ -1761,11 +2698,11 @@ function buildUpdateData(opts) {
|
|
|
1761
2698
|
function registerPhpIniCommands(parent, brand) {
|
|
1762
2699
|
const phpIni = parent.command("php-ini").description("php.ini\u8A2D\u5B9A\uFF08php-version \u3068\u306F\u5225\uFF09");
|
|
1763
2700
|
phpIni.command("list").description("php.ini\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1764
|
-
const
|
|
2701
|
+
const client2 = resolveClient(parent, brand);
|
|
1765
2702
|
const params = {};
|
|
1766
2703
|
if (opts.domain)
|
|
1767
2704
|
params.domain = opts.domain;
|
|
1768
|
-
printResult(await
|
|
2705
|
+
printResult(await client2.listPhpIni(params), getFormat(parent));
|
|
1769
2706
|
});
|
|
1770
2707
|
const update = phpIni.command("update <domain>").description("php.ini\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
|
|
1771
2708
|
for (const { cli, desc } of PHP_INI_UPDATE_OPTIONS) {
|
|
@@ -1776,13 +2713,13 @@ function registerPhpIniCommands(parent, brand) {
|
|
|
1776
2713
|
if (Object.keys(data).length === 0) {
|
|
1777
2714
|
throw new Error("\u66F4\u65B0\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
1778
2715
|
}
|
|
1779
|
-
const
|
|
1780
|
-
printResult(await
|
|
2716
|
+
const client2 = resolveClient(parent, brand);
|
|
2717
|
+
printResult(await client2.updatePhpIni(domain, data), getFormat(parent));
|
|
1781
2718
|
});
|
|
1782
2719
|
phpIni.command("reset <domain>").description("php.ini\u8A2D\u5B9A\u3092\u521D\u671F\u5024\u306B\u623B\u3059").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
|
|
1783
2720
|
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E php.ini \u3092\u521D\u671F\u5024\u306B\u623B\u3057\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1784
|
-
const
|
|
1785
|
-
printResult(await
|
|
2721
|
+
const client2 = resolveClient(parent, brand);
|
|
2722
|
+
printResult(await client2.resetPhpIni(domain), getFormat(parent));
|
|
1786
2723
|
});
|
|
1787
2724
|
}
|
|
1788
2725
|
|
|
@@ -1877,11 +2814,11 @@ function buildUpdateData2(domain, opts) {
|
|
|
1877
2814
|
function registerWordPressSecurityCommands(parent, brand) {
|
|
1878
2815
|
const wordpressSecurity = parent.command("wordpress-security").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
|
|
1879
2816
|
wordpressSecurity.command("get").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1880
|
-
const
|
|
2817
|
+
const client2 = resolveClient(parent, brand);
|
|
1881
2818
|
const params = {};
|
|
1882
2819
|
if (opts.domain)
|
|
1883
2820
|
params.domain = opts.domain;
|
|
1884
|
-
printResult(await
|
|
2821
|
+
printResult(await client2.getWordPressSecurity(params), getFormat(parent));
|
|
1885
2822
|
});
|
|
1886
2823
|
const update = wordpressSecurity.command("update <domain>").description("WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u66F4\u65B0\uFF08\u6307\u5B9A\u3057\u305F\u9805\u76EE\u306E\u307F\uFF09");
|
|
1887
2824
|
for (const { cli, desc } of UPDATE_OPTIONS) {
|
|
@@ -1889,8 +2826,8 @@ function registerWordPressSecurityCommands(parent, brand) {
|
|
|
1889
2826
|
}
|
|
1890
2827
|
update.action(async (domain, opts) => {
|
|
1891
2828
|
const data = buildUpdateData2(domain, opts);
|
|
1892
|
-
const
|
|
1893
|
-
printResult(await
|
|
2829
|
+
const client2 = resolveClient(parent, brand);
|
|
2830
|
+
printResult(await client2.updateWordPressSecurity(data), getFormat(parent));
|
|
1894
2831
|
});
|
|
1895
2832
|
}
|
|
1896
2833
|
|
|
@@ -1898,15 +2835,15 @@ function registerWordPressSecurityCommands(parent, brand) {
|
|
|
1898
2835
|
function registerXAcceleratorCommands(parent, brand) {
|
|
1899
2836
|
const xAccelerator = parent.command("x-accelerator").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A");
|
|
1900
2837
|
xAccelerator.command("list").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1901
|
-
const
|
|
2838
|
+
const client2 = resolveClient(parent, brand);
|
|
1902
2839
|
const params = {};
|
|
1903
2840
|
if (opts.domain)
|
|
1904
2841
|
params.domain = opts.domain;
|
|
1905
|
-
printResult(await
|
|
2842
|
+
printResult(await client2.listXAccelerator(params), getFormat(parent));
|
|
1906
2843
|
});
|
|
1907
2844
|
xAccelerator.command("update <domain>").description("X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--xaccelerator-status <status>", "X\u30A2\u30AF\u30BB\u30E9\u30EC\u30FC\u30BF\u8A2D\u5B9A\uFF08off / v1 / v2\uFF09").action(async (domain, opts) => {
|
|
1908
|
-
const
|
|
1909
|
-
printResult(await
|
|
2845
|
+
const client2 = resolveClient(parent, brand);
|
|
2846
|
+
printResult(await client2.updateXAccelerator(domain, { xaccelerator_status: opts.xacceleratorStatus }), getFormat(parent));
|
|
1910
2847
|
});
|
|
1911
2848
|
}
|
|
1912
2849
|
|
|
@@ -1914,20 +2851,20 @@ function registerXAcceleratorCommands(parent, brand) {
|
|
|
1914
2851
|
function registerServerCacheCommands(parent, brand) {
|
|
1915
2852
|
const serverCache = parent.command("server-cache").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
|
|
1916
2853
|
serverCache.command("list").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1917
|
-
const
|
|
2854
|
+
const client2 = resolveClient(parent, brand);
|
|
1918
2855
|
const params = {};
|
|
1919
2856
|
if (opts.domain)
|
|
1920
2857
|
params.domain = opts.domain;
|
|
1921
|
-
printResult(await
|
|
2858
|
+
printResult(await client2.listServerCache(params), getFormat(parent));
|
|
1922
2859
|
});
|
|
1923
2860
|
serverCache.command("update <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--server-cache-status <status>", "\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08on / off\uFF09").action(async (domain, opts) => {
|
|
1924
|
-
const
|
|
1925
|
-
printResult(await
|
|
2861
|
+
const client2 = resolveClient(parent, brand);
|
|
2862
|
+
printResult(await client2.updateServerCache(domain, { server_cache_status: opts.serverCacheStatus }), getFormat(parent));
|
|
1926
2863
|
});
|
|
1927
2864
|
serverCache.command("clear-cache <domain>").description("\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u306E\u5185\u5BB9\u3092\u524A\u9664\uFF08\u30D1\u30FC\u30B8\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (domain) => {
|
|
1928
2865
|
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306E\u30B5\u30FC\u30D0\u30FC\u30AD\u30E3\u30C3\u30B7\u30E5\u5185\u5BB9\u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1929
|
-
const
|
|
1930
|
-
printResult(await
|
|
2866
|
+
const client2 = resolveClient(parent, brand);
|
|
2867
|
+
printResult(await client2.clearServerCache(domain), getFormat(parent));
|
|
1931
2868
|
});
|
|
1932
2869
|
}
|
|
1933
2870
|
|
|
@@ -1935,15 +2872,15 @@ function registerServerCacheCommands(parent, brand) {
|
|
|
1935
2872
|
function registerBrowserCacheCommands(parent, brand) {
|
|
1936
2873
|
const browserCache = parent.command("browser-cache").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A");
|
|
1937
2874
|
browserCache.command("list").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1938
|
-
const
|
|
2875
|
+
const client2 = resolveClient(parent, brand);
|
|
1939
2876
|
const params = {};
|
|
1940
2877
|
if (opts.domain)
|
|
1941
2878
|
params.domain = opts.domain;
|
|
1942
|
-
printResult(await
|
|
2879
|
+
printResult(await client2.listBrowserCache(params), getFormat(parent));
|
|
1943
2880
|
});
|
|
1944
2881
|
browserCache.command("update <domain>").description("\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--browser-cache-status <status>", "\u30D6\u30E9\u30A6\u30B6\u30AD\u30E3\u30C3\u30B7\u30E5\u8A2D\u5B9A\uFF08all / ignore-css-js / off\uFF09").action(async (domain, opts) => {
|
|
1945
|
-
const
|
|
1946
|
-
printResult(await
|
|
2882
|
+
const client2 = resolveClient(parent, brand);
|
|
2883
|
+
printResult(await client2.updateBrowserCache(domain, { browser_cache_status: opts.browserCacheStatus }), getFormat(parent));
|
|
1947
2884
|
});
|
|
1948
2885
|
}
|
|
1949
2886
|
|
|
@@ -1951,14 +2888,14 @@ function registerBrowserCacheCommands(parent, brand) {
|
|
|
1951
2888
|
function registerUrlRedirectCommands(parent, brand) {
|
|
1952
2889
|
const urlRedirect = parent.command("url-redirect").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A");
|
|
1953
2890
|
urlRedirect.command("list").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1954
|
-
const
|
|
2891
|
+
const client2 = resolveClient(parent, brand);
|
|
1955
2892
|
const params = {};
|
|
1956
2893
|
if (opts.domain)
|
|
1957
2894
|
params.domain = opts.domain;
|
|
1958
|
-
printResult(await
|
|
2895
|
+
printResult(await client2.listUrlRedirect(params), getFormat(parent));
|
|
1959
2896
|
});
|
|
1960
2897
|
urlRedirect.command("add").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--from-host <host>", "\u8EE2\u9001\u5143\u30DB\u30B9\u30C8\uFF08FQDN\uFF09").option("--from-path <path>", "\u8EE2\u9001\u5143\u30D1\u30B9\uFF08\u7701\u7565\u6642\u306F /\u3002\u5148\u982D\u304C / \u3067\u306A\u3044\u5834\u5408\u306F API \u5074\u3067 / \u3092\u4ED8\u4E0E\uFF09").requiredOption("--redirect-to-url <url>", "\u8EE2\u9001\u5148URL\uFF08http \u307E\u305F\u306F https\uFF09").requiredOption("--status-code <code>", "\u8EE2\u9001\u6642\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u30B3\u30FC\u30C9\uFF08301 / 302\uFF09").action(async (opts) => {
|
|
1961
|
-
const
|
|
2898
|
+
const client2 = resolveClient(parent, brand);
|
|
1962
2899
|
const data = {
|
|
1963
2900
|
domain: opts.domain,
|
|
1964
2901
|
from_host: opts.fromHost,
|
|
@@ -1967,12 +2904,12 @@ function registerUrlRedirectCommands(parent, brand) {
|
|
|
1967
2904
|
};
|
|
1968
2905
|
if (opts.fromPath !== void 0)
|
|
1969
2906
|
data.from_path = opts.fromPath;
|
|
1970
|
-
printResult(await
|
|
2907
|
+
printResult(await client2.addUrlRedirect(data), getFormat(parent));
|
|
1971
2908
|
});
|
|
1972
2909
|
urlRedirect.command("delete <redirectId>").description("\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (redirectId) => {
|
|
1973
2910
|
await confirmDestructiveAction(parent, `\u30B5\u30A4\u30C8\u8EE2\u9001\u8A2D\u5B9A "${redirectId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
1974
|
-
const
|
|
1975
|
-
printResult(await
|
|
2911
|
+
const client2 = resolveClient(parent, brand);
|
|
2912
|
+
printResult(await client2.deleteUrlRedirect(redirectId), getFormat(parent));
|
|
1976
2913
|
});
|
|
1977
2914
|
}
|
|
1978
2915
|
|
|
@@ -1980,33 +2917,33 @@ function registerUrlRedirectCommands(parent, brand) {
|
|
|
1980
2917
|
function registerAccessDenyCommands(parent, brand) {
|
|
1981
2918
|
const accessDeny = parent.command("access-deny").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A");
|
|
1982
2919
|
accessDeny.command("list").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
1983
|
-
const
|
|
2920
|
+
const client2 = resolveClient(parent, brand);
|
|
1984
2921
|
const params = {};
|
|
1985
2922
|
if (opts.domain)
|
|
1986
2923
|
params.domain = opts.domain;
|
|
1987
|
-
printResult(await
|
|
2924
|
+
printResult(await client2.listAccessDeny(params), getFormat(parent));
|
|
1988
2925
|
});
|
|
1989
2926
|
accessDeny.command("add").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5951\u7D04\u30C9\u30E1\u30A4\u30F3").requiredOption("--ip-address <address>", "\u62D2\u5426IP\u30A2\u30C9\u30EC\u30B9\u30FB\u30DB\u30B9\u30C8\uFF08IPv4 / CIDR / \u90E8\u5206IP / \u30DB\u30B9\u30C8\u540D\uFF09").option("--memo <memo>", "\u30E1\u30E2\uFF08\u6700\u5927500\u6587\u5B57\uFF09").action(async (opts) => {
|
|
1990
|
-
const
|
|
2927
|
+
const client2 = resolveClient(parent, brand);
|
|
1991
2928
|
const data = {
|
|
1992
2929
|
domain: opts.domain,
|
|
1993
2930
|
ip_address: opts.ipAddress
|
|
1994
2931
|
};
|
|
1995
2932
|
if (opts.memo !== void 0)
|
|
1996
2933
|
data.memo = opts.memo;
|
|
1997
|
-
printResult(await
|
|
2934
|
+
printResult(await client2.addAccessDeny(data), getFormat(parent));
|
|
1998
2935
|
});
|
|
1999
2936
|
accessDeny.command("update <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u306E\u30E1\u30E2\u3092\u66F4\u65B0").option("--memo <memo>", "\u30E1\u30E2\uFF08\u7701\u7565\u307E\u305F\u306F\u7A7A\u6587\u5B57\u3067\u30AF\u30EA\u30A2\uFF09").action(async (denyId, opts) => {
|
|
2000
2937
|
if (opts.memo === void 0) {
|
|
2001
2938
|
throw new Error("--memo \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
2002
2939
|
}
|
|
2003
|
-
const
|
|
2004
|
-
printResult(await
|
|
2940
|
+
const client2 = resolveClient(parent, brand);
|
|
2941
|
+
printResult(await client2.updateAccessDeny(denyId, { memo: opts.memo }), getFormat(parent));
|
|
2005
2942
|
});
|
|
2006
2943
|
accessDeny.command("delete <denyId>").description("\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A\u3092\u524A\u9664").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (denyId) => {
|
|
2007
2944
|
await confirmDestructiveAction(parent, `\u30A2\u30AF\u30BB\u30B9\u62D2\u5426\u8A2D\u5B9A "${denyId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
2008
|
-
const
|
|
2009
|
-
printResult(await
|
|
2945
|
+
const client2 = resolveClient(parent, brand);
|
|
2946
|
+
printResult(await client2.deleteAccessDeny(denyId), getFormat(parent));
|
|
2010
2947
|
});
|
|
2011
2948
|
}
|
|
2012
2949
|
|
|
@@ -2047,11 +2984,11 @@ function buildUpdateData3(opts) {
|
|
|
2047
2984
|
function registerXPageSpeedCommands(parent, brand) {
|
|
2048
2985
|
const xPageSpeed = parent.command("xpagespeed").description("XPageSpeed\u8A2D\u5B9A");
|
|
2049
2986
|
xPageSpeed.command("list").description("XPageSpeed\u8A2D\u5B9A\u4E00\u89A7\u3092\u53D6\u5F97").option("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u3067\u7D5E\u308A\u8FBC\u307F").action(async (opts) => {
|
|
2050
|
-
const
|
|
2987
|
+
const client2 = resolveClient(parent, brand);
|
|
2051
2988
|
const params = {};
|
|
2052
2989
|
if (opts.domain)
|
|
2053
2990
|
params.domain = opts.domain;
|
|
2054
|
-
printResult(await
|
|
2991
|
+
printResult(await client2.listXPageSpeed(params), getFormat(parent));
|
|
2055
2992
|
});
|
|
2056
2993
|
const update = xPageSpeed.command("update <domain>").description("XPageSpeed\u306E\u6700\u9069\u5316\u6A5F\u80FD\u3092\u5909\u66F4\uFF081\u30EA\u30AF\u30A8\u30B9\u30C8\u30671\u6A5F\u80FD\u306E\u307F\uFF09");
|
|
2057
2994
|
for (const { cli, desc } of UPDATE_OPTIONS2) {
|
|
@@ -2059,8 +2996,8 @@ function registerXPageSpeedCommands(parent, brand) {
|
|
|
2059
2996
|
}
|
|
2060
2997
|
update.action(async (domain, opts) => {
|
|
2061
2998
|
const data = buildUpdateData3(opts);
|
|
2062
|
-
const
|
|
2063
|
-
printResult(await
|
|
2999
|
+
const client2 = resolveClient(parent, brand);
|
|
3000
|
+
printResult(await client2.updateXPageSpeed(domain, data), getFormat(parent));
|
|
2064
3001
|
});
|
|
2065
3002
|
}
|
|
2066
3003
|
|
|
@@ -2097,16 +3034,16 @@ function parseDomainElements(values) {
|
|
|
2097
3034
|
function registerAutoBackupCommands(parent, brand) {
|
|
2098
3035
|
const autoBackup = parent.command("auto-backup").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
|
|
2099
3036
|
autoBackup.command("backup-dates").description("\u9078\u629E\u53EF\u80FD\u306A\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2100
|
-
const
|
|
2101
|
-
printResult(await
|
|
3037
|
+
const client2 = resolveClient(parent, brand);
|
|
3038
|
+
printResult(await client2.listAutoBackupBackupDates(), getFormat(parent));
|
|
2102
3039
|
});
|
|
2103
3040
|
autoBackup.command("list").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2104
|
-
const
|
|
2105
|
-
printResult(await
|
|
3041
|
+
const client2 = resolveClient(parent, brand);
|
|
3042
|
+
printResult(await client2.listAutoBackup(), getFormat(parent));
|
|
2106
3043
|
});
|
|
2107
3044
|
autoBackup.command("show <requestId>").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
|
|
2108
|
-
const
|
|
2109
|
-
printResult(await
|
|
3045
|
+
const client2 = resolveClient(parent, brand);
|
|
3046
|
+
printResult(await client2.getAutoBackup(requestId), getFormat(parent));
|
|
2110
3047
|
});
|
|
2111
3048
|
autoBackup.command("create").description("\u81EA\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").requiredOption("--scope <scope>", "\u51E6\u7406\u65B9\u6CD5\uFF08all / selected\uFF09").option("--domain-elements <value>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\uFF08scope=selected \u306E\u3068\u304D\u5FC5\u9808\u3002\u7E70\u308A\u8FD4\u3057\u53EF\uFF09\u3002\u5F62\u5F0F: example.com=web,setting\uFF08elements: web / setting / mail\uFF09", collectFlagValue, []).option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
|
|
2112
3049
|
const operationType = opts.operationType;
|
|
@@ -2128,8 +3065,8 @@ function registerAutoBackupCommands(parent, brand) {
|
|
|
2128
3065
|
} else if (domainElementValues.length > 0) {
|
|
2129
3066
|
validationError("\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F \u51E6\u7406\u65B9\u6CD5 \u304C selected \u306E\u5834\u5408\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002");
|
|
2130
3067
|
}
|
|
2131
|
-
const
|
|
2132
|
-
printResult(await
|
|
3068
|
+
const client2 = resolveClient(parent, brand);
|
|
3069
|
+
printResult(await client2.createAutoBackup(data), getFormat(parent));
|
|
2133
3070
|
});
|
|
2134
3071
|
}
|
|
2135
3072
|
|
|
@@ -2137,24 +3074,24 @@ function registerAutoBackupCommands(parent, brand) {
|
|
|
2137
3074
|
function registerMysqlBackupCommands(parent, brand) {
|
|
2138
3075
|
const mysqlBackup = parent.command("mysql-backup").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u30FB\u5FA9\u5143");
|
|
2139
3076
|
mysqlBackup.command("databases").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async () => {
|
|
2140
|
-
const
|
|
2141
|
-
printResult(await
|
|
3077
|
+
const client2 = resolveClient(parent, brand);
|
|
3078
|
+
printResult(await client2.listMysqlBackupDatabases(), getFormat(parent));
|
|
2142
3079
|
});
|
|
2143
3080
|
mysqlBackup.command("list").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
2144
|
-
const
|
|
2145
|
-
printResult(await
|
|
3081
|
+
const client2 = resolveClient(parent, brand);
|
|
3082
|
+
printResult(await client2.listMysqlBackup(), getFormat(parent));
|
|
2146
3083
|
});
|
|
2147
3084
|
mysqlBackup.command("show <requestId>").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u7533\u8FBC\u5C65\u6B74\u8A73\u7D30\u3092\u53D6\u5F97").action(async (requestId) => {
|
|
2148
|
-
const
|
|
2149
|
-
printResult(await
|
|
3085
|
+
const client2 = resolveClient(parent, brand);
|
|
3086
|
+
printResult(await client2.getMysqlBackup(requestId), getFormat(parent));
|
|
2150
3087
|
});
|
|
2151
3088
|
mysqlBackup.command("create").description("MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u53D6\u5F97\u307E\u305F\u306F\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u3080").requiredOption("--db-name <name>", "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u540D").requiredOption("--backup-date <date>", "\u5BFE\u8C61\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u65E5\uFF08Y-m-d\uFF09").requiredOption("--operation-type <type>", "\u51E6\u7406\u7A2E\u5225\uFF08fetch / restore\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7\uFF08restore \u6642\uFF09").action(async (opts) => {
|
|
2152
3089
|
const operationType = opts.operationType;
|
|
2153
3090
|
if (operationType === "restore") {
|
|
2154
3091
|
await confirmDestructiveAction(parent, `\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 "${opts.dbName}" \u306E MySQL\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u5FA9\u5143\u3092\u7533\u3057\u8FBC\u307F\u307E\u3059\u3002\u5BFE\u8C61 DB \u304C\u4E0A\u66F8\u304D\u3055\u308C\u3001\u53D6\u308A\u6D88\u3057\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
2155
3092
|
}
|
|
2156
|
-
const
|
|
2157
|
-
printResult(await
|
|
3093
|
+
const client2 = resolveClient(parent, brand);
|
|
3094
|
+
printResult(await client2.createMysqlBackup({
|
|
2158
3095
|
db_name: opts.dbName,
|
|
2159
3096
|
backup_date: opts.backupDate,
|
|
2160
3097
|
operation_type: operationType
|
|
@@ -2173,18 +3110,863 @@ function registerMeCommand(program, brand) {
|
|
|
2173
3110
|
process.exit(1);
|
|
2174
3111
|
}
|
|
2175
3112
|
const debug = !!(rootOpts.debug || process.env.XSERVER_DEBUG === "1");
|
|
2176
|
-
const
|
|
3113
|
+
const client2 = new ApiClient({
|
|
2177
3114
|
apiKey: profile.apiKey,
|
|
2178
|
-
apiBase: brand
|
|
3115
|
+
apiBase: resolveApiBase(brand),
|
|
2179
3116
|
servername: profile.servername,
|
|
2180
3117
|
debug
|
|
2181
3118
|
});
|
|
2182
|
-
printResult(await
|
|
3119
|
+
printResult(await client2.getMe(), getFormat(cmd));
|
|
3120
|
+
});
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// ../core/dist/commands/domain/index.js
|
|
3124
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3125
|
+
function dnsData(opts) {
|
|
3126
|
+
return pickDefined({
|
|
3127
|
+
host: opts.host === void 0 ? void 0 : validateDnsHost(opts.host),
|
|
3128
|
+
type: opts.type === void 0 ? void 0 : validateDnsType(opts.type),
|
|
3129
|
+
content: opts.content === void 0 ? void 0 : validateDnsContent(opts.content),
|
|
3130
|
+
ttl: opts.ttl === void 0 ? void 0 : parseInteger(opts.ttl, "--ttl", 60, 86400),
|
|
3131
|
+
priority: opts.priority === void 0 ? void 0 : parseInteger(opts.priority, "--priority", 0, 999)
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
function addPurchaseOptions(command) {
|
|
3135
|
+
return command.requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09");
|
|
3136
|
+
}
|
|
3137
|
+
function purchaseValues(opts) {
|
|
3138
|
+
const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
|
|
3139
|
+
const idempotencyKey = validateIdempotencyKey(opts.idempotencyKey ?? randomUUID2());
|
|
3140
|
+
return { expectedTotalPrice, idempotencyKey };
|
|
3141
|
+
}
|
|
3142
|
+
function requirePurchaseConfirmation(opts) {
|
|
3143
|
+
if (!opts.confirmPurchase) {
|
|
3144
|
+
throw new Error("\u5B9F\u7533\u8ACB\u306B\u306F --confirm-purchase \u304C\u5FC5\u8981\u3067\u3059\uFF08--yes \u3067\u306F\u7701\u7565\u3067\u304D\u307E\u305B\u3093\uFF09\u3002\u7D9A\u3051\u3066TTY\u3067\u78BA\u8A8D\u6587\u5B57\u5217\u306E\u5165\u529B\u3082\u5FC5\u8981\u3067\u3059");
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
function requireTermsAgreement(opts) {
|
|
3148
|
+
if (!opts.agreeToTerms) {
|
|
3149
|
+
throw new Error("\u65B0\u898F\u53D6\u5F97\u30FB\u79FB\u7BA1\u306B\u306F --agree-to-terms \u306B\u3088\u308B\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u3078\u306E\u660E\u793A\u540C\u610F\u304C\u5FC5\u8981\u3067\u3059");
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
function totalPriceFromPreview2(preview, expectedTotalPrice) {
|
|
3153
|
+
const totalPrice = Number(preview?.total_price);
|
|
3154
|
+
if (!Number.isFinite(totalPrice)) {
|
|
3155
|
+
throw new Error("dry-run\u7D50\u679C\u304B\u3089\u5408\u8A08\u91D1\u984D\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");
|
|
3156
|
+
}
|
|
3157
|
+
if (totalPrice !== expectedTotalPrice) {
|
|
3158
|
+
throw new Error(`\u4FA1\u683C\u4E0D\u4E00\u81F4\u306E\u305F\u3081\u5B9F\u7533\u8ACB\u3092\u4E2D\u6B62\u3057\u307E\u3057\u305F\uFF08\u898B\u7A4D ${totalPrice}\u5186 / \u6307\u5B9A ${expectedTotalPrice}\u5186\uFF09\u3002`);
|
|
3159
|
+
}
|
|
3160
|
+
return totalPrice;
|
|
3161
|
+
}
|
|
3162
|
+
function registerDomainCommands(parent, brand) {
|
|
3163
|
+
parent.command("list").description("\u4FDD\u6709\u30C9\u30E1\u30A4\u30F3\u306E\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
3164
|
+
const client2 = resolveClient(parent, brand);
|
|
3165
|
+
printResult(await client2.listDomains(), getFormat(parent));
|
|
3166
|
+
});
|
|
3167
|
+
parent.command("show <domain>").description("\u4FDD\u6709\u30C9\u30E1\u30A4\u30F3\u306E\u8A73\u7D30\u3092\u53D6\u5F97").action(async (domain) => {
|
|
3168
|
+
const client2 = resolveClient(parent, brand);
|
|
3169
|
+
printResult(await client2.getDomainDetail(domain), getFormat(parent));
|
|
3170
|
+
});
|
|
3171
|
+
const nameservers = parent.command("nameservers").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u5074\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u8A2D\u5B9A");
|
|
3172
|
+
nameservers.command("show <domain>").description("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u53D6\u5F97").action(async (domain) => {
|
|
3173
|
+
const client2 = resolveClient(parent, brand);
|
|
3174
|
+
printResult(await client2.getDomainNameservers(domain), getFormat(parent));
|
|
3175
|
+
});
|
|
3176
|
+
nameservers.command("update <domain>").description("\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\u3092\u5168\u7F6E\u63DB").requiredOption("--nameservers <list>", "\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\uFF081\uFF5E13\u4EF6\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (domain, opts) => {
|
|
3177
|
+
const client2 = resolveClient(parent, brand);
|
|
3178
|
+
printResult(await client2.updateDomainNameservers(domain, { nameservers: parseNameservers(String(opts.nameservers)) }), getFormat(parent));
|
|
3179
|
+
});
|
|
3180
|
+
const whois = parent.command("whois").description("Whois\u60C5\u5831\u8A2D\u5B9A");
|
|
3181
|
+
whois.command("show <domain>").description("Whois\u60C5\u5831\u3092\u53D6\u5F97").action(async (domain) => {
|
|
3182
|
+
const client2 = resolveClient(parent, brand);
|
|
3183
|
+
printResult(await client2.getDomainWhois(domain), getFormat(parent));
|
|
3184
|
+
});
|
|
3185
|
+
whois.command("update <domain>").description("Whois\u60C5\u5831\u3092\u66F4\u65B0").requiredOption("--data <json>", "whois_privacy \u307E\u305F\u306F fields \u3092\u542B\u3080JSON\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8").action(async (domain, opts) => {
|
|
3186
|
+
const client2 = resolveClient(parent, brand);
|
|
3187
|
+
printResult(await client2.updateDomainWhois(domain, parseWhoisData(String(opts.data))), getFormat(parent));
|
|
3188
|
+
});
|
|
3189
|
+
const registrarLock = parent.command("registrar-lock").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u8A2D\u5B9A");
|
|
3190
|
+
registrarLock.command("show <domain>").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u306E\u72B6\u614B\u3092\u53D6\u5F97").action(async (domain) => {
|
|
3191
|
+
const client2 = resolveClient(parent, brand);
|
|
3192
|
+
printResult(await client2.getDomainRegistrarLock(domain), getFormat(parent));
|
|
3193
|
+
});
|
|
3194
|
+
registrarLock.command("update <domain>").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u30ED\u30C3\u30AF\u3092\u5909\u66F4").requiredOption("--locked <bool>", "\u30ED\u30C3\u30AF\u72B6\u614B\uFF08true / false\uFF09").action(async (domain, opts) => {
|
|
3195
|
+
const client2 = resolveClient(parent, brand);
|
|
3196
|
+
printResult(await client2.updateDomainRegistrarLock(domain, {
|
|
3197
|
+
locked: parseStrictBoolean(String(opts.locked), "--locked")
|
|
3198
|
+
}), getFormat(parent));
|
|
3199
|
+
});
|
|
3200
|
+
const dns = parent.command("dns").description("\u30EC\u30B8\u30B9\u30C8\u30E9\u5074DNS\u30EC\u30B3\u30FC\u30C9\u8A2D\u5B9A");
|
|
3201
|
+
dns.command("list <domain>").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").action(async (domain) => {
|
|
3202
|
+
const client2 = resolveClient(parent, brand);
|
|
3203
|
+
printResult(await client2.listDomainDns(domain), getFormat(parent));
|
|
3204
|
+
});
|
|
3205
|
+
dns.command("add <domain>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u8FFD\u52A0").requiredOption("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09").requiredOption("--type <type>", "A / AAAA / CNAME / MX / TXT / NS / SRV").requiredOption("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF080\uFF5E999\uFF09").action(async (domain, opts) => {
|
|
3206
|
+
const client2 = resolveClient(parent, brand);
|
|
3207
|
+
printResult(await client2.addDomainDns(domain, dnsData(opts)), getFormat(parent));
|
|
3208
|
+
});
|
|
3209
|
+
dns.command("update <domain> <dns_id>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u90E8\u5206\u66F4\u65B0").option("--host <host>", "\u30DB\u30B9\u30C8\u540D").option("--type <type>", "A / AAAA / CNAME / MX / TXT / NS / SRV").option("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024").option("--ttl <ttl>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <priority>", "\u512A\u5148\u5EA6\uFF080\uFF5E999\uFF09").action(async (domain, dnsId, opts) => {
|
|
3210
|
+
const data = dnsData(opts);
|
|
3211
|
+
requireAtLeastOneField(data, "DNS\u66F4\u65B0\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3212
|
+
const client2 = resolveClient(parent, brand);
|
|
3213
|
+
printResult(await client2.updateDomainDns(domain, validateDnsId(dnsId), data), getFormat(parent));
|
|
3214
|
+
});
|
|
3215
|
+
dns.command("delete <domain> <dns_id>").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").action(async (domain, dnsId) => {
|
|
3216
|
+
const validatedDnsId = validateDnsId(dnsId);
|
|
3217
|
+
const client2 = resolveClient(parent, brand);
|
|
3218
|
+
const response = await client2.listDomainDns(domain);
|
|
3219
|
+
const records = typeof response === "object" && response !== null && Array.isArray(response.records) ? response.records : [];
|
|
3220
|
+
const target = records.find((record3) => String(record3.id) === validatedDnsId);
|
|
3221
|
+
if (!target) {
|
|
3222
|
+
throw new Error(`DNS\u30EC\u30B3\u30FC\u30C9 ${validatedDnsId} \u3092\u4E00\u89A7\u304B\u3089\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F`);
|
|
3223
|
+
}
|
|
3224
|
+
printPreview(target, getFormat(parent));
|
|
3225
|
+
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3 "${domain}" \u306EDNS\u30EC\u30B3\u30FC\u30C9 "${validatedDnsId}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3226
|
+
printResult(await client2.deleteDomainDns(domain, validatedDnsId), getFormat(parent));
|
|
3227
|
+
});
|
|
3228
|
+
parent.command("check <domain>").description("\u30C9\u30E1\u30A4\u30F3\u306E\u53D6\u5F97\u53EF\u5426\u3068\u898B\u7A4D\u3092\u78BA\u8A8D").action(async (domain) => {
|
|
3229
|
+
const client2 = resolveClient(parent, brand);
|
|
3230
|
+
printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.checkDomain(domain)), getFormat(parent));
|
|
3231
|
+
});
|
|
3232
|
+
parent.command("pricing").description("TLD\u5225\u306E\u4FA1\u683C\u4E00\u89A7\u3092\u53D6\u5F97").option("--tld <list>", "TLD\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
|
|
3233
|
+
const client2 = resolveClient(parent, brand);
|
|
3234
|
+
const params = opts.tld === void 0 ? void 0 : { tld: String(opts.tld) };
|
|
3235
|
+
printResult(await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.getDomainPricing(params)), getFormat(parent));
|
|
3236
|
+
});
|
|
3237
|
+
addPurchaseOptions(parent.command("register <domain>").description("\u30C9\u30E1\u30A4\u30F3\u3092\u65B0\u898F\u53D6\u5F97").requiredOption("--years <n>", "\u5951\u7D04\u5E74\u6570\uFF081\uFF5E5\uFF09").option("--agree-to-terms", "\u30C9\u30E1\u30A4\u30F3\u53D6\u5F97\u306E\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u306B\u540C\u610F").option("--nameservers <list>", "\u53D6\u5F97\u6642\u306B\u8A2D\u5B9A\u3059\u308B\u30CD\u30FC\u30E0\u30B5\u30FC\u30D0\u30FC\uFF081\uFF5E6\u4EF6\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09")).action(async (domain, opts) => {
|
|
3238
|
+
requireTermsAgreement(opts);
|
|
3239
|
+
const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
|
|
3240
|
+
const client2 = resolveClient(parent, brand);
|
|
3241
|
+
const baseData = {
|
|
3242
|
+
domain_name: domain,
|
|
3243
|
+
years: parseInteger(opts.years, "--years", 1, 5),
|
|
3244
|
+
expected_total_price: expectedTotalPrice,
|
|
3245
|
+
agree_to_terms: true,
|
|
3246
|
+
...opts.nameservers === void 0 ? {} : { nameservers: parseRegistrationNameservers(opts.nameservers) }
|
|
3247
|
+
};
|
|
3248
|
+
const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: true }));
|
|
3249
|
+
if (opts.dryRun) {
|
|
3250
|
+
printResult(preview, getFormat(parent));
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
|
|
3254
|
+
requirePurchaseConfirmation(opts);
|
|
3255
|
+
await confirmBillingPurchase({
|
|
3256
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97",
|
|
3257
|
+
target: domain,
|
|
3258
|
+
targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
|
|
3259
|
+
totalPrice,
|
|
3260
|
+
legalNoticeLines: domainLegalNoticeLines(brand),
|
|
3261
|
+
confirmSubject: domain
|
|
3262
|
+
});
|
|
3263
|
+
const result = await executeBillingPurchase({
|
|
3264
|
+
idempotencyKey,
|
|
3265
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u65B0\u898F\u53D6\u5F97",
|
|
3266
|
+
subject: domain,
|
|
3267
|
+
execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.registerDomain({ ...baseData, dry_run: false }, idempotencyKey))
|
|
3268
|
+
});
|
|
3269
|
+
printResult(result, getFormat(parent));
|
|
3270
|
+
});
|
|
3271
|
+
addPurchaseOptions(parent.command("transfer <domain>").description("\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u3092\u7533\u8ACB").option("--agree-to-terms", "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1\u306E\u300C\u30B5\u30FC\u30D3\u30B9\u5229\u7528\u898F\u7D04\u300D\u304A\u3088\u3073\u300C\u500B\u4EBA\u60C5\u5831\u306E\u53D6\u308A\u6271\u3044\u306B\u3064\u3044\u3066\u300D\u306B\u540C\u610F").requiredOption("--auth-code <code>", "\u79FB\u7BA1\u5143\u3067\u53D6\u5F97\u3057\u305FAuthCode")).action(async (domain, opts) => {
|
|
3272
|
+
requireTermsAgreement(opts);
|
|
3273
|
+
const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
|
|
3274
|
+
const client2 = resolveClient(parent, brand);
|
|
3275
|
+
const baseData = {
|
|
3276
|
+
auth_code: opts.authCode,
|
|
3277
|
+
expected_total_price: expectedTotalPrice,
|
|
3278
|
+
agree_to_terms: true
|
|
3279
|
+
};
|
|
3280
|
+
const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: true }));
|
|
3281
|
+
if (opts.dryRun) {
|
|
3282
|
+
printResult(preview, getFormat(parent));
|
|
3283
|
+
return;
|
|
3284
|
+
}
|
|
3285
|
+
const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
|
|
3286
|
+
requirePurchaseConfirmation(opts);
|
|
3287
|
+
await confirmBillingPurchase({
|
|
3288
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1",
|
|
3289
|
+
target: domain,
|
|
3290
|
+
targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
|
|
3291
|
+
totalPrice,
|
|
3292
|
+
legalNoticeLines: domainLegalNoticeLines(brand),
|
|
3293
|
+
confirmSubject: domain
|
|
3294
|
+
});
|
|
3295
|
+
const result = await executeBillingPurchase({
|
|
3296
|
+
idempotencyKey,
|
|
3297
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u79FB\u7BA1",
|
|
3298
|
+
subject: domain,
|
|
3299
|
+
execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.transferDomain(domain, { ...baseData, dry_run: false }, idempotencyKey))
|
|
3300
|
+
});
|
|
3301
|
+
printResult(result, getFormat(parent));
|
|
3302
|
+
});
|
|
3303
|
+
addPurchaseOptions(parent.command("renew <domain>").description("\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u3092\u66F4\u65B0").requiredOption("--years <n>", "\u66F4\u65B0\u5E74\u6570\uFF081\uFF5E5\uFF09").requiredOption("--current-expiry-date <date>", "\u73FE\u5728\u306E\u6709\u52B9\u671F\u9650\uFF08YYYY-MM-DD\uFF09")).action(async (domain, opts) => {
|
|
3304
|
+
const { expectedTotalPrice, idempotencyKey } = purchaseValues(opts);
|
|
3305
|
+
const client2 = resolveClient(parent, brand);
|
|
3306
|
+
const baseData = {
|
|
3307
|
+
years: parseInteger(opts.years, "--years", 1, 5),
|
|
3308
|
+
current_expiry_date: validateDate(opts.currentExpiryDate, "--current-expiry-date"),
|
|
3309
|
+
expected_total_price: expectedTotalPrice
|
|
3310
|
+
};
|
|
3311
|
+
const preview = await withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: true }));
|
|
3312
|
+
if (opts.dryRun) {
|
|
3313
|
+
printResult(preview, getFormat(parent));
|
|
3314
|
+
return;
|
|
3315
|
+
}
|
|
3316
|
+
const totalPrice = totalPriceFromPreview2(preview, expectedTotalPrice);
|
|
3317
|
+
requirePurchaseConfirmation(opts);
|
|
3318
|
+
await confirmBillingPurchase({
|
|
3319
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0",
|
|
3320
|
+
target: domain,
|
|
3321
|
+
targetLabel: "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3",
|
|
3322
|
+
totalPrice,
|
|
3323
|
+
legalNoticeLines: domainLegalNoticeLines(brand),
|
|
3324
|
+
confirmSubject: domain
|
|
3325
|
+
});
|
|
3326
|
+
const result = await executeBillingPurchase({
|
|
3327
|
+
idempotencyKey,
|
|
3328
|
+
operation: "\u30C9\u30E1\u30A4\u30F3\u5951\u7D04\u66F4\u65B0",
|
|
3329
|
+
subject: domain,
|
|
3330
|
+
execute: () => withDomainAcquisitionPermissionDiagnosis(client2, () => client2.renewDomain(domain, { ...baseData, dry_run: false }, idempotencyKey))
|
|
3331
|
+
});
|
|
3332
|
+
printResult(result, getFormat(parent));
|
|
3333
|
+
});
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
// ../core/dist/commands/wphosting/index.js
|
|
3337
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
3338
|
+
|
|
3339
|
+
// ../core/dist/lib/wphosting-validation.js
|
|
3340
|
+
var DNS_TYPES2 = /* @__PURE__ */ new Set(["A", "AAAA", "CNAME", "MX", "TXT", "SRV"]);
|
|
3341
|
+
var IDEMPOTENCY_KEY_PATTERN2 = /^[A-Za-z0-9_-]{8,64}$/;
|
|
3342
|
+
function isWphostingSupportedBrand(brand) {
|
|
3343
|
+
return brand.brand === "xserver";
|
|
3344
|
+
}
|
|
3345
|
+
function parseWphostingInteger(value, optionName, minimum, maximum) {
|
|
3346
|
+
if (!/^\d+$/.test(value))
|
|
3347
|
+
throw new Error(`${optionName} \u306F\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3348
|
+
const parsed = Number(value);
|
|
3349
|
+
if (!Number.isSafeInteger(parsed) || parsed < minimum || maximum !== void 0 && parsed > maximum) {
|
|
3350
|
+
const range = maximum === void 0 ? `${minimum}\u4EE5\u4E0A` : `${minimum}\uFF5E${maximum}`;
|
|
3351
|
+
throw new Error(`${optionName} \u306F${range}\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3352
|
+
}
|
|
3353
|
+
return parsed;
|
|
3354
|
+
}
|
|
3355
|
+
function parseWphostingBoolean(value, optionName) {
|
|
3356
|
+
if (value === "true")
|
|
3357
|
+
return true;
|
|
3358
|
+
if (value === "false")
|
|
3359
|
+
return false;
|
|
3360
|
+
throw new Error(`${optionName} \u306F true \u307E\u305F\u306F false \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3361
|
+
}
|
|
3362
|
+
function validateWphostingEnum(value, optionName, allowed) {
|
|
3363
|
+
if (!allowed.includes(value)) {
|
|
3364
|
+
throw new Error(`${optionName} \u306F ${allowed.join(" / ")} \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3365
|
+
}
|
|
3366
|
+
return value;
|
|
3367
|
+
}
|
|
3368
|
+
function validateWphostingContractId(value) {
|
|
3369
|
+
if (value.length > 64 || !/^WP-[A-Za-z0-9]+$/.test(value)) {
|
|
3370
|
+
throw new Error("--contract-id \u306F WP- \u3067\u59CB\u307E\u308B\u82F1\u6570\u5B57\u306E\u5951\u7D04ID\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3371
|
+
}
|
|
3372
|
+
return value;
|
|
3373
|
+
}
|
|
3374
|
+
function validateWphostingServername(value) {
|
|
3375
|
+
if (value.length > 255 || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value)) {
|
|
3376
|
+
throw new Error("--servername \u306F\u82F1\u6570\u5B57\u3067\u59CB\u307E\u308B255\u6587\u5B57\u4EE5\u5185\u306E\u8B58\u5225\u5B50\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3377
|
+
}
|
|
3378
|
+
return value;
|
|
3379
|
+
}
|
|
3380
|
+
function validateWphostingPositiveId(value, optionName) {
|
|
3381
|
+
if (!/^[1-9]\d*$/.test(value))
|
|
3382
|
+
throw new Error(`${optionName} \u306F\u6B63\u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3383
|
+
return value;
|
|
3384
|
+
}
|
|
3385
|
+
function validateWphostingOpaqueId(value, optionName) {
|
|
3386
|
+
if (value.length > 255 || !/^[A-Za-z0-9_-]+$/.test(value)) {
|
|
3387
|
+
throw new Error(`${optionName} \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E255\u6587\u5B57\u4EE5\u5185\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3388
|
+
}
|
|
3389
|
+
return value;
|
|
3390
|
+
}
|
|
3391
|
+
function validateWphostingDnsType(value) {
|
|
3392
|
+
const type = value.toUpperCase();
|
|
3393
|
+
if (!DNS_TYPES2.has(type)) {
|
|
3394
|
+
throw new Error("--type \u306F A / AAAA / CNAME / MX / TXT / SRV \u306E\u3044\u305A\u308C\u304B\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3395
|
+
}
|
|
3396
|
+
return type;
|
|
3397
|
+
}
|
|
3398
|
+
function validateWphostingDate(value, optionName = "--date") {
|
|
3399
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
3400
|
+
throw new Error(`${optionName} \u306FYYYY-MM-DD\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3401
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
3402
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
3403
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
|
|
3404
|
+
throw new Error(`${optionName} \u306B\u5B58\u5728\u3059\u308B\u65E5\u4ED8\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3405
|
+
}
|
|
3406
|
+
return value;
|
|
3407
|
+
}
|
|
3408
|
+
function validateWphostingIdempotencyKey(value) {
|
|
3409
|
+
if (!IDEMPOTENCY_KEY_PATTERN2.test(value)) {
|
|
3410
|
+
throw new Error("--idempotency-key \u306F\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3411
|
+
}
|
|
3412
|
+
return value;
|
|
3413
|
+
}
|
|
3414
|
+
function validateWphostingSecurityKey(value) {
|
|
3415
|
+
if (value.length > 100 || !/^[a-z0-9_]+$/.test(value)) {
|
|
3416
|
+
throw new Error("--key \u306F security list \u3067\u53D6\u5F97\u3057\u305F\u8A2D\u5B9A\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3417
|
+
}
|
|
3418
|
+
return value;
|
|
3419
|
+
}
|
|
3420
|
+
function validateWphostingServerId(value) {
|
|
3421
|
+
if (!/^[a-z][a-z0-9]{0,11}$/.test(value)) {
|
|
3422
|
+
throw new Error("--server-id \u306F\u5C0F\u6587\u5B57\u82F1\u5B57\u3067\u59CB\u307E\u308B12\u6587\u5B57\u4EE5\u5185\u306E\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3423
|
+
}
|
|
3424
|
+
return value;
|
|
3425
|
+
}
|
|
3426
|
+
function validateWphostingLength(value, optionName, maximum, minimum = 1) {
|
|
3427
|
+
if (value.length < minimum || value.length > maximum) {
|
|
3428
|
+
throw new Error(`${optionName} \u306F${minimum}\uFF5E${maximum}\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3429
|
+
}
|
|
3430
|
+
return value;
|
|
3431
|
+
}
|
|
3432
|
+
function validateWphostingEmail(value, optionName) {
|
|
3433
|
+
validateWphostingLength(value, optionName, 100);
|
|
3434
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
3435
|
+
throw new Error(`${optionName} \u306F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3436
|
+
}
|
|
3437
|
+
return value;
|
|
3438
|
+
}
|
|
3439
|
+
function validateWphostingWpLogin(value, optionName, maximum, allowSpace = false) {
|
|
3440
|
+
validateWphostingLength(value, optionName, maximum);
|
|
3441
|
+
const pattern = allowSpace ? /^[0-9A-Za-z _\-.@]+$/ : /^[0-9A-Za-z_\-.@]+$/;
|
|
3442
|
+
if (!pattern.test(value)) {
|
|
3443
|
+
throw new Error(`${optionName} \u306B\u4F7F\u7528\u3067\u304D\u306A\u3044\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059`);
|
|
3444
|
+
}
|
|
3445
|
+
return value;
|
|
3446
|
+
}
|
|
3447
|
+
function validateWphostingSitePassword(value, username) {
|
|
3448
|
+
validateWphostingLength(value, "--wp-password", 64, 7);
|
|
3449
|
+
if (!/^[A-Za-z0-9!#$%=~^|:_\[\]().+\-*\/@&<>`;?,]+$/.test(value) || !/[A-Za-z]/.test(value) || !/[^A-Za-z]/.test(value)) {
|
|
3450
|
+
throw new Error("--wp-password \u306F\u534A\u89D2\u82F1\u5B57\u3068\u6570\u5B57\u307E\u305F\u306F\u8A18\u53F7\u3092\u542B\u3080\u8A31\u53EF\u6587\u5B57\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3451
|
+
}
|
|
3452
|
+
if (value === username)
|
|
3453
|
+
throw new Error("--wp-password \u306F --wp-username \u3068\u7570\u306A\u308B\u6587\u5B57\u5217\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3454
|
+
return value;
|
|
3455
|
+
}
|
|
3456
|
+
function requireWphostingFields(data, message = "\u66F4\u65B0\u9805\u76EE\u30921\u3064\u4EE5\u4E0A\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044") {
|
|
3457
|
+
if (Object.keys(data).length === 0)
|
|
3458
|
+
throw new Error(message);
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// ../core/dist/commands/wphosting/index.js
|
|
3462
|
+
function client(parent, brand) {
|
|
3463
|
+
return resolveClient(parent, brand);
|
|
3464
|
+
}
|
|
3465
|
+
function contractId(parent) {
|
|
3466
|
+
return validateWphostingContractId(String(parent.opts().contractId));
|
|
3467
|
+
}
|
|
3468
|
+
function servername(opts) {
|
|
3469
|
+
return validateWphostingServername(String(opts.servername));
|
|
3470
|
+
}
|
|
3471
|
+
function siteCategory(parent, name, description) {
|
|
3472
|
+
const category = parent.command(name).description(description).requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09");
|
|
3473
|
+
category.hook("preAction", (_command, actionCommand) => {
|
|
3474
|
+
actionCommand.setOptionValue("servername", actionCommand.optsWithGlobals().servername);
|
|
3475
|
+
});
|
|
3476
|
+
return category;
|
|
3477
|
+
}
|
|
3478
|
+
function asyncKey(opts) {
|
|
3479
|
+
const key = validateWphostingIdempotencyKey(String(opts.idempotencyKey ?? randomUUID3()));
|
|
3480
|
+
console.error(`Idempotency-Key: ${key}\uFF08\u518D\u5B9F\u884C\u6642\u306F\u540C\u3058\u30AD\u30FC\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF09`);
|
|
3481
|
+
return key;
|
|
3482
|
+
}
|
|
3483
|
+
function asyncOption(command) {
|
|
3484
|
+
return command.option("--idempotency-key <key>", "\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u672A\u6307\u5B9A\u6642\u306F\u81EA\u52D5\u751F\u6210\uFF09");
|
|
3485
|
+
}
|
|
3486
|
+
function objectRows(response, keys) {
|
|
3487
|
+
if (typeof response !== "object" || response === null)
|
|
3488
|
+
return [];
|
|
3489
|
+
const record3 = response;
|
|
3490
|
+
for (const key of keys) {
|
|
3491
|
+
if (Array.isArray(record3[key]))
|
|
3492
|
+
return record3[key];
|
|
3493
|
+
}
|
|
3494
|
+
return [];
|
|
3495
|
+
}
|
|
3496
|
+
function findTarget(response, keys, id, idKeys) {
|
|
3497
|
+
return objectRows(response, keys).find((row) => idKeys.some((key) => String(row[key]) === id));
|
|
3498
|
+
}
|
|
3499
|
+
async function previewListTarget(parent, response, keys, id, idKeys, label) {
|
|
3500
|
+
const target = findTarget(response, keys, id, idKeys);
|
|
3501
|
+
if (!target)
|
|
3502
|
+
throw new Error(`${label} "${id}" \u3092\u4E00\u89A7\u304B\u3089\u78BA\u8A8D\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F`);
|
|
3503
|
+
printPreview(target, getFormat(parent));
|
|
3504
|
+
}
|
|
3505
|
+
function resourceData(opts) {
|
|
3506
|
+
return {
|
|
3507
|
+
disk_limit_gb: parseWphostingInteger(String(opts.diskLimitGb), "--disk-limit-gb", 10),
|
|
3508
|
+
vcpu_limit: parseWphostingInteger(String(opts.vcpuLimit), "--vcpu-limit", 1),
|
|
3509
|
+
memory_limit_gb: parseWphostingInteger(String(opts.memoryLimitGb), "--memory-limit-gb", 1)
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
function pluginThemeData(opts, theme) {
|
|
3513
|
+
const data = pickDefined({
|
|
3514
|
+
status: opts.status === void 0 ? void 0 : validateWphostingEnum(String(opts.status), "--status", theme ? ["active"] : ["active", "inactive"]),
|
|
3515
|
+
auto_update: opts.autoUpdate === void 0 ? void 0 : parseWphostingBoolean(String(opts.autoUpdate), "--auto-update")
|
|
3516
|
+
});
|
|
3517
|
+
requireWphostingFields(data);
|
|
3518
|
+
return data;
|
|
3519
|
+
}
|
|
3520
|
+
function dnsData2(opts, required) {
|
|
3521
|
+
const data = pickDefined({
|
|
3522
|
+
host: opts.host,
|
|
3523
|
+
type: opts.type === void 0 ? void 0 : validateWphostingDnsType(String(opts.type)),
|
|
3524
|
+
content: opts.content,
|
|
3525
|
+
ttl: opts.ttl === void 0 ? void 0 : parseWphostingInteger(String(opts.ttl), "--ttl", 60, 86400),
|
|
3526
|
+
priority: opts.priority === void 0 ? void 0 : parseWphostingInteger(String(opts.priority), "--priority", 0, 65535)
|
|
3527
|
+
});
|
|
3528
|
+
if (!required)
|
|
3529
|
+
requireWphostingFields(data);
|
|
3530
|
+
return data;
|
|
3531
|
+
}
|
|
3532
|
+
function addDnsOptions(command, required) {
|
|
3533
|
+
const option = required ? "requiredOption" : "option";
|
|
3534
|
+
command[option]("--host <host>", "\u30DB\u30B9\u30C8\u540D\uFF08@\u3067apex\uFF09");
|
|
3535
|
+
command[option]("--type <type>", "A / AAAA / CNAME / MX / TXT / SRV");
|
|
3536
|
+
command[option]("--content <content>", "\u30EC\u30B3\u30FC\u30C9\u5024");
|
|
3537
|
+
return command.option("--ttl <seconds>", "TTL\uFF0860\uFF5E86400\uFF09").option("--priority <n>", "\u512A\u5148\u5EA6\uFF080\uFF5E65535\uFF09");
|
|
3538
|
+
}
|
|
3539
|
+
function cronData(opts, required) {
|
|
3540
|
+
const data = pickDefined({
|
|
3541
|
+
minute: opts.minute,
|
|
3542
|
+
hour: opts.hour,
|
|
3543
|
+
day: opts.day,
|
|
3544
|
+
month: opts.month,
|
|
3545
|
+
weekday: opts.weekday,
|
|
3546
|
+
command: opts.command,
|
|
3547
|
+
comment: opts.comment,
|
|
3548
|
+
enabled: opts.enabled === void 0 ? void 0 : parseWphostingBoolean(String(opts.enabled), "--enabled")
|
|
3549
|
+
});
|
|
3550
|
+
if (!required)
|
|
3551
|
+
requireWphostingFields(data);
|
|
3552
|
+
return data;
|
|
3553
|
+
}
|
|
3554
|
+
function registerWphostingCommands(parent, brand) {
|
|
3555
|
+
const cid = () => contractId(parent);
|
|
3556
|
+
const api = () => client(parent, brand);
|
|
3557
|
+
const sites = parent.command("sites").description("\u30B5\u30A4\u30C8\u60C5\u5831\u30FB\u4F5C\u6210\u30FB\u524A\u9664");
|
|
3558
|
+
sites.command("list").description("\u30B5\u30A4\u30C8\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
3559
|
+
printResult(await api().listWphostingSites(cid()), getFormat(parent));
|
|
3560
|
+
});
|
|
3561
|
+
sites.command("show").description("\u30B5\u30A4\u30C8\u8A73\u7D30\u3092\u53D6\u5F97").requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09").action(async (opts) => {
|
|
3562
|
+
printResult(await api().getWphostingSite(cid(), servername(opts)), getFormat(parent));
|
|
3563
|
+
});
|
|
3564
|
+
asyncOption(sites.command("create").description("\u30B5\u30A4\u30C8\u3092\u4F5C\u6210").requiredOption("--wp-sitename <name>", "WordPress\u30B5\u30A4\u30C8\u540D").requiredOption("--wp-username <name>", "WordPress\u7BA1\u7406\u30E6\u30FC\u30B6\u30FC").requiredOption("--wp-password <password>", "WordPress\u7BA1\u7406\u30D1\u30B9\u30EF\u30FC\u30C9\uFF087\uFF5E64\u6587\u5B57\uFF09").requiredOption("--wp-mailaddress <email>", "WordPress\u7BA1\u7406\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9").requiredOption("--disk-limit-gb <gb>", "\u30C7\u30A3\u30B9\u30AF\u4E0A\u9650GB\uFF0810\u4EE5\u4E0A\uFF09").requiredOption("--vcpu-limit <n>", "vCPU\u4E0A\u9650\uFF081\u4EE5\u4E0A\uFF09").requiredOption("--memory-limit-gb <gb>", "\u30E1\u30E2\u30EA\u4E0A\u9650GB\uFF081\u4EE5\u4E0A\uFF09").option("--wp-theme <theme>", "default / cocoon-master / lightning").option("--server-id <id>", "\u521D\u671FURL\u306E\u30B5\u30FC\u30D0\u30FCID").option("--security-auto-optimize <bool>", "\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u81EA\u52D5\u6700\u9069\u5316\uFF08true / false\uFF09").option("--memo <memo>", "\u30E1\u30E2\uFF08255\u6587\u5B57\u4EE5\u5185\uFF09")).action(async (opts) => {
|
|
3565
|
+
const data = {
|
|
3566
|
+
...resourceData(opts),
|
|
3567
|
+
wp_sitename: validateWphostingLength(String(opts.wpSitename), "--wp-sitename", 255),
|
|
3568
|
+
wp_username: validateWphostingWpLogin(String(opts.wpUsername), "--wp-username", 255, true),
|
|
3569
|
+
wp_password: validateWphostingSitePassword(String(opts.wpPassword), String(opts.wpUsername)),
|
|
3570
|
+
wp_mailaddress: validateWphostingEmail(String(opts.wpMailaddress), "--wp-mailaddress"),
|
|
3571
|
+
...pickDefined({
|
|
3572
|
+
wp_theme: opts.wpTheme === void 0 ? void 0 : validateWphostingEnum(String(opts.wpTheme), "--wp-theme", ["default", "cocoon-master", "lightning"]),
|
|
3573
|
+
server_id: opts.serverId === void 0 ? void 0 : validateWphostingServerId(String(opts.serverId)),
|
|
3574
|
+
security_auto_optimize: opts.securityAutoOptimize === void 0 ? void 0 : parseWphostingBoolean(String(opts.securityAutoOptimize), "--security-auto-optimize"),
|
|
3575
|
+
memo: opts.memo === void 0 ? void 0 : validateWphostingLength(String(opts.memo), "--memo", 255)
|
|
3576
|
+
})
|
|
3577
|
+
};
|
|
3578
|
+
const result = await api().createWphostingSite(cid(), data, asyncKey(opts));
|
|
3579
|
+
printResult(result, getFormat(parent));
|
|
3580
|
+
});
|
|
3581
|
+
asyncOption(sites.command("delete").description("\u30B5\u30A4\u30C8\u3092\u524A\u9664").requiredOption("--servername <site>", "\u5BFE\u8C61\u30B5\u30A4\u30C8\u306Eservername\uFF08\u660E\u793A\u6307\u5B9A\u5FC5\u9808\uFF09").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7")).action(async (opts) => {
|
|
3582
|
+
const site = servername(opts);
|
|
3583
|
+
const detail = await api().getWphostingSite(cid(), site);
|
|
3584
|
+
printPreview(detail, getFormat(parent));
|
|
3585
|
+
console.error("\u8B66\u544A: \u672C\u756A\u30B5\u30A4\u30C8\u3092\u524A\u9664\u3059\u308B\u3068\u3001\u7D10\u3065\u304F\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883\u3082\u9023\u52D5\u3057\u3066\u524A\u9664\u3055\u308C\u307E\u3059\u3002");
|
|
3586
|
+
await confirmDestructiveAction(parent, `\u30B5\u30A4\u30C8 "${site}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3587
|
+
printResult(await api().deleteWphostingSite(cid(), site, asyncKey(opts)), getFormat(parent));
|
|
3588
|
+
});
|
|
3589
|
+
parent.command("usage").description("\u5951\u7D04\u4E0A\u9650\u3068\u30B5\u30A4\u30C8\u5225\u4F7F\u7528\u91CF").command("show").description("\u5229\u7528\u72B6\u6CC1\u3092\u53D6\u5F97").action(async () => {
|
|
3590
|
+
printResult(await api().getWphostingUsage(cid()), getFormat(parent));
|
|
3591
|
+
});
|
|
3592
|
+
const staging = siteCategory(parent, "staging", "\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883");
|
|
3593
|
+
asyncOption(staging.command("create").description("\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0\u74B0\u5883\u3092\u4F5C\u6210").requiredOption("--disk-limit-gb <gb>", "\u30C7\u30A3\u30B9\u30AF\u4E0A\u9650GB\uFF0810\u4EE5\u4E0A\uFF09").requiredOption("--vcpu-limit <n>", "vCPU\u4E0A\u9650\uFF081\u4EE5\u4E0A\uFF09").requiredOption("--memory-limit-gb <gb>", "\u30E1\u30E2\u30EA\u4E0A\u9650GB\uFF081\u4EE5\u4E0A\uFF09").option("--server-id <id>", "\u30B9\u30C6\u30FC\u30B8\u30F3\u30B0URL\u306E\u30B5\u30FC\u30D0\u30FCID").option("--security-auto-optimize <bool>", "\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u81EA\u52D5\u6700\u9069\u5316\uFF08true / false\uFF09")).action(async (opts) => {
|
|
3594
|
+
const data = {
|
|
3595
|
+
...resourceData(opts),
|
|
3596
|
+
...pickDefined({
|
|
3597
|
+
server_id: opts.serverId === void 0 ? void 0 : validateWphostingServerId(String(opts.serverId)),
|
|
3598
|
+
security_auto_optimize: opts.securityAutoOptimize === void 0 ? void 0 : parseWphostingBoolean(String(opts.securityAutoOptimize), "--security-auto-optimize")
|
|
3599
|
+
})
|
|
3600
|
+
};
|
|
3601
|
+
const result = await api().createWphostingStaging(cid(), servername(opts), data, asyncKey(opts));
|
|
3602
|
+
printResult(result, getFormat(parent));
|
|
3603
|
+
});
|
|
3604
|
+
const backups = siteCategory(parent, "backups", "\u624B\u52D5\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
|
|
3605
|
+
backups.command("list").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3606
|
+
printResult(await api().listWphostingBackups(cid(), servername(opts)), getFormat(parent));
|
|
3607
|
+
});
|
|
3608
|
+
asyncOption(backups.command("create").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u4F5C\u6210").option("--memo <memo>", "\u30E1\u30E2\uFF08255\u6587\u5B57\u4EE5\u5185\uFF09")).action(async (opts) => {
|
|
3609
|
+
const site = servername(opts);
|
|
3610
|
+
const data = pickDefined({
|
|
3611
|
+
memo: opts.memo === void 0 ? void 0 : validateWphostingLength(String(opts.memo), "--memo", 255)
|
|
3612
|
+
});
|
|
3613
|
+
printResult(await api().createWphostingBackup(cid(), site, data, asyncKey(opts)), getFormat(parent));
|
|
3614
|
+
});
|
|
3615
|
+
asyncOption(backups.command("restore").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u5FA9\u5143").requiredOption("--backup-id <id>", "\u5FA9\u5143\u3059\u308B\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7")).action(async (opts) => {
|
|
3616
|
+
const site = servername(opts);
|
|
3617
|
+
const backupId = validateWphostingOpaqueId(String(opts.backupId), "--backup-id");
|
|
3618
|
+
const list = await api().listWphostingBackups(cid(), site);
|
|
3619
|
+
await previewListTarget(parent, list, ["backups"], backupId, ["id", "backup_id"], "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
|
|
3620
|
+
console.error("\u8B66\u544A: \u73FE\u5728\u306E\u30B5\u30A4\u30C8\u5185\u5BB9\u306F\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u5185\u5BB9\u3067\u4E0A\u66F8\u304D\u3055\u308C\u3001\u5FA9\u5143\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002");
|
|
3621
|
+
await confirmDestructiveAction(parent, `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7 "${backupId}" \u3092\u5FA9\u5143\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3622
|
+
printResult(await api().restoreWphostingBackup(cid(), site, backupId, asyncKey(opts)), getFormat(parent));
|
|
3623
|
+
});
|
|
3624
|
+
backups.command("restore-history").description("\u5FA9\u5143\u5C65\u6B74\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3625
|
+
printResult(await api().listWphostingBackupRestoreHistory(cid(), servername(opts)), getFormat(parent));
|
|
3626
|
+
});
|
|
3627
|
+
backups.command("delete").description("\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3092\u524A\u9664").requiredOption("--backup-id <id>", "\u524A\u9664\u3059\u308B\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3628
|
+
const site = servername(opts);
|
|
3629
|
+
const id = validateWphostingOpaqueId(String(opts.backupId), "--backup-id");
|
|
3630
|
+
await previewListTarget(parent, await api().listWphostingBackups(cid(), site), ["backups"], id, ["id", "backup_id"], "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7");
|
|
3631
|
+
await confirmDestructiveAction(parent, `\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u524A\u9664\u5F8C\u306F\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3632
|
+
printResult(await api().deleteWphostingBackup(cid(), site, id), getFormat(parent));
|
|
3633
|
+
});
|
|
3634
|
+
const wordpress = siteCategory(parent, "wordpress", "WordPress\u672C\u4F53");
|
|
3635
|
+
wordpress.command("show").description("WordPress\u60C5\u5831\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3636
|
+
printResult(await api().getWphostingWordPress(cid(), servername(opts)), getFormat(parent));
|
|
3637
|
+
});
|
|
3638
|
+
wordpress.command("update").description("WordPress\u81EA\u52D5\u66F4\u65B0\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--auto-update-scope <scope>", "none / minor / all").action(async (opts) => {
|
|
3639
|
+
const data = { auto_update_scope: validateWphostingEnum(String(opts.autoUpdateScope), "--auto-update-scope", ["none", "minor", "all"]) };
|
|
3640
|
+
printResult(await api().updateWphostingWordPress(cid(), servername(opts), data), getFormat(parent));
|
|
3641
|
+
});
|
|
3642
|
+
wordpress.command("upgrade").description("WordPress\u672C\u4F53\u3092\u66F4\u65B0").action(async (opts) => {
|
|
3643
|
+
printResult(await api().upgradeWphostingWordPress(cid(), servername(opts)), getFormat(parent));
|
|
3644
|
+
});
|
|
3645
|
+
const maintenance = siteCategory(parent, "maintenance-mode", "\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u30E2\u30FC\u30C9");
|
|
3646
|
+
maintenance.command("show").description("\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3647
|
+
printResult(await api().getWphostingMaintenanceMode(cid(), servername(opts)), getFormat(parent));
|
|
3648
|
+
});
|
|
3649
|
+
maintenance.command("update").description("\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--enabled <bool>", "true / false").action(async (opts) => {
|
|
3650
|
+
printResult(await api().updateWphostingMaintenanceMode(cid(), servername(opts), {
|
|
3651
|
+
enabled: parseWphostingBoolean(String(opts.enabled), "--enabled")
|
|
3652
|
+
}), getFormat(parent));
|
|
3653
|
+
});
|
|
3654
|
+
registerExtensionCommands(parent, brand, "plugins");
|
|
3655
|
+
registerExtensionCommands(parent, brand, "themes");
|
|
3656
|
+
const domains = siteCategory(parent, "domains", "\u30B5\u30A4\u30C8\u306E\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A");
|
|
3657
|
+
domains.command("list").description("\u30C9\u30E1\u30A4\u30F3\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3658
|
+
printResult(await api().listWphostingDomains(cid(), servername(opts)), getFormat(parent));
|
|
3659
|
+
});
|
|
3660
|
+
domains.command("add").description("\u30C9\u30E1\u30A4\u30F3\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u8FFD\u52A0\u3059\u308B\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
|
|
3661
|
+
printResult(await api().addWphostingDomain(cid(), servername(opts), { domain: String(opts.domain) }), getFormat(parent));
|
|
3662
|
+
});
|
|
3663
|
+
domains.command("verify").description("\u30C9\u30E1\u30A4\u30F3\u6240\u6709\u8005\u78BA\u8A8D\u3092\u5B9F\u884C").requiredOption("--domain <domain>", "\u78BA\u8A8D\u3059\u308B\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
|
|
3664
|
+
printResult(await api().verifyWphostingDomain(cid(), servername(opts), String(opts.domain)), getFormat(parent));
|
|
3665
|
+
});
|
|
3666
|
+
domains.command("delete").description("\u30C9\u30E1\u30A4\u30F3\u3092\u524A\u9664").requiredOption("--domain <domain>", "\u524A\u9664\u3059\u308B\u30C9\u30E1\u30A4\u30F3").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3667
|
+
const site = servername(opts);
|
|
3668
|
+
const domain = String(opts.domain);
|
|
3669
|
+
await previewListTarget(parent, await api().listWphostingDomains(cid(), site), ["domains"], domain, ["domain", "name"], "\u30C9\u30E1\u30A4\u30F3");
|
|
3670
|
+
await confirmDestructiveAction(parent, `\u30C9\u30E1\u30A4\u30F3\u8A2D\u5B9A "${domain}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3671
|
+
printResult(await api().deleteWphostingDomain(cid(), site, domain), getFormat(parent));
|
|
3672
|
+
});
|
|
3673
|
+
const siteUrl = siteCategory(parent, "site-url", "\u30D7\u30E9\u30A4\u30DE\u30EA\u30C9\u30E1\u30A4\u30F3");
|
|
3674
|
+
siteUrl.command("update").description("\u30B5\u30A4\u30C8URL\u3092\u5909\u66F4").requiredOption("--domain <domain>", "\u5909\u66F4\u5148\u30C9\u30E1\u30A4\u30F3").option("--auto-redirect <bool>", "\u65E7URL\u304B\u3089\u65B0URL\u3078\u81EA\u52D5\u8EE2\u9001\uFF08true / false\u3001\u672A\u6307\u5B9A\u6642true\uFF09").action(async (opts) => {
|
|
3675
|
+
printResult(await api().updateWphostingSiteUrl(cid(), servername(opts), pickDefined({
|
|
3676
|
+
domain: String(opts.domain),
|
|
3677
|
+
auto_redirect: opts.autoRedirect === void 0 ? void 0 : parseWphostingBoolean(String(opts.autoRedirect), "--auto-redirect")
|
|
3678
|
+
})), getFormat(parent));
|
|
3679
|
+
});
|
|
3680
|
+
const dns = siteCategory(parent, "dns", "WPhosting\u30B5\u30A4\u30C8\u306EDNS\u30EC\u30B3\u30FC\u30C9");
|
|
3681
|
+
dns.command("list").description("DNS\u30EC\u30B3\u30FC\u30C9\u4E00\u89A7\u3092\u53D6\u5F97").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").action(async (opts) => {
|
|
3682
|
+
printResult(await api().listWphostingDnsRecords(cid(), servername(opts), String(opts.domain)), getFormat(parent));
|
|
3683
|
+
});
|
|
3684
|
+
addDnsOptions(dns.command("add").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u8FFD\u52A0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3"), true).action(async (opts) => {
|
|
3685
|
+
printResult(await api().addWphostingDnsRecord(cid(), servername(opts), String(opts.domain), dnsData2(opts, true)), getFormat(parent));
|
|
3686
|
+
});
|
|
3687
|
+
addDnsOptions(dns.command("update").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u66F4\u65B0").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--dns-id <id>", "DNS\u30EC\u30B3\u30FC\u30C9ID"), false).action(async (opts) => {
|
|
3688
|
+
printResult(await api().updateWphostingDnsRecord(cid(), servername(opts), String(opts.domain), validateWphostingPositiveId(String(opts.dnsId), "--dns-id"), dnsData2(opts, false)), getFormat(parent));
|
|
3689
|
+
});
|
|
3690
|
+
dns.command("delete").description("DNS\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664").requiredOption("--domain <domain>", "\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3").requiredOption("--dns-id <id>", "DNS\u30EC\u30B3\u30FC\u30C9ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3691
|
+
const site = servername(opts);
|
|
3692
|
+
const domain = String(opts.domain);
|
|
3693
|
+
const id = validateWphostingPositiveId(String(opts.dnsId), "--dns-id");
|
|
3694
|
+
await previewListTarget(parent, await api().listWphostingDnsRecords(cid(), site, domain), ["records", "dns_records"], id, ["id", "dns_id"], "DNS\u30EC\u30B3\u30FC\u30C9");
|
|
3695
|
+
await confirmDestructiveAction(parent, `DNS\u30EC\u30B3\u30FC\u30C9 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3696
|
+
printResult(await api().deleteWphostingDnsRecord(cid(), site, domain, id), getFormat(parent));
|
|
3697
|
+
});
|
|
3698
|
+
const phpVersion = siteCategory(parent, "php-version", "PHP\u30D0\u30FC\u30B8\u30E7\u30F3");
|
|
3699
|
+
phpVersion.command("show").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3700
|
+
printResult(await api().getWphostingPhpVersion(cid(), servername(opts)), getFormat(parent));
|
|
3701
|
+
});
|
|
3702
|
+
phpVersion.command("update").description("PHP\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u5909\u66F4").requiredOption("--php <version>", "GET\u3067\u53D6\u5F97\u3057\u305Favailable\u306E\u5024").action(async (opts) => {
|
|
3703
|
+
if (!/^\d+\.\d+$/.test(String(opts.php)))
|
|
3704
|
+
throw new Error("--php \u306F 8.3 \u306E\u3088\u3046\u306A\u5F62\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
3705
|
+
printResult(await api().updateWphostingPhpVersion(cid(), servername(opts), { version: String(opts.php) }), getFormat(parent));
|
|
3706
|
+
});
|
|
3707
|
+
registerLogCommand(parent, brand, "access-log", true);
|
|
3708
|
+
registerLogCommand(parent, brand, "error-log", false);
|
|
3709
|
+
registerWphostingCron(parent, brand);
|
|
3710
|
+
registerWphostingSsh(parent, brand);
|
|
3711
|
+
registerWphostingUsers(parent, brand);
|
|
3712
|
+
const security = siteCategory(parent, "security", "WordPress\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A");
|
|
3713
|
+
security.command("list").description("\u516C\u958B\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3714
|
+
printResult(await api().getWphostingSecurity(cid(), servername(opts)), getFormat(parent));
|
|
3715
|
+
});
|
|
3716
|
+
security.command("update").description("\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption("--key <key>", "\u516C\u958B\u5BFE\u8C61\u306E\u8A2D\u5B9A\u30AD\u30FC").requiredOption("--enabled <bool>", "true / false").action(async (opts) => {
|
|
3717
|
+
printResult(await api().updateWphostingSecurity(cid(), servername(opts), validateWphostingSecurityKey(String(opts.key)), { is_enable: parseWphostingBoolean(String(opts.enabled), "--enabled") }), getFormat(parent));
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
function registerExtensionCommands(parent, brand, kind) {
|
|
3721
|
+
const singular = kind === "plugins" ? "plugin" : "theme";
|
|
3722
|
+
const category = siteCategory(parent, kind, kind === "plugins" ? "WordPress\u30D7\u30E9\u30B0\u30A4\u30F3" : "WordPress\u30C6\u30FC\u30DE");
|
|
3723
|
+
const methodKind = kind === "plugins" ? "Plugin" : "Theme";
|
|
3724
|
+
const api = () => client(parent, brand);
|
|
3725
|
+
const cid = () => contractId(parent);
|
|
3726
|
+
category.command("list").description("\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3727
|
+
printResult(await api()[`listWphosting${methodKind}s`](cid(), servername(opts)), getFormat(parent));
|
|
3728
|
+
});
|
|
3729
|
+
category.command("install").description("\u516C\u5F0F\u30EA\u30DD\u30B8\u30C8\u30EA\u304B\u3089\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("--activate <bool>", "\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u5F8C\u306B\u6709\u52B9\u5316\uFF08true / false\u3001\u672A\u6307\u5B9A\u6642false\uFF09").action(async (opts) => {
|
|
3730
|
+
const slug = String(opts[singular]);
|
|
3731
|
+
printResult(await api()[`installWphosting${methodKind}`](cid(), servername(opts), pickDefined({
|
|
3732
|
+
[singular]: slug,
|
|
3733
|
+
activate: opts.activate === void 0 ? void 0 : parseWphostingBoolean(String(opts.activate), "--activate")
|
|
3734
|
+
})), getFormat(parent));
|
|
3735
|
+
});
|
|
3736
|
+
category.command("update").description("\u72B6\u614B\u30FB\u81EA\u52D5\u66F4\u65B0\u8A2D\u5B9A\u3092\u5909\u66F4").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("--status <status>", kind === "plugins" ? "active / inactive" : "active").option("--auto-update <bool>", "true / false").action(async (opts) => {
|
|
3737
|
+
printResult(await api()[`updateWphosting${methodKind}`](cid(), servername(opts), String(opts[singular]), pluginThemeData(opts, kind === "themes")), getFormat(parent));
|
|
3738
|
+
});
|
|
3739
|
+
category.command("upgrade").description("\u30D0\u30FC\u30B8\u30E7\u30F3\u66F4\u65B0\u3092\u5B9F\u884C").requiredOption(`--${singular} <slug>`, `${singular} slug`).action(async (opts) => {
|
|
3740
|
+
printResult(await api()[`upgradeWphosting${methodKind}`](cid(), servername(opts), String(opts[singular])), getFormat(parent));
|
|
3741
|
+
});
|
|
3742
|
+
category.command("delete").description("\u524A\u9664").requiredOption(`--${singular} <slug>`, `${singular} slug`).option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3743
|
+
const site = servername(opts);
|
|
3744
|
+
const slug = String(opts[singular]);
|
|
3745
|
+
const list = await api()[`listWphosting${methodKind}s`](cid(), site);
|
|
3746
|
+
await previewListTarget(parent, list, [kind], slug, [singular, "slug", "name"], singular);
|
|
3747
|
+
await confirmDestructiveAction(parent, `${singular} "${slug}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3748
|
+
printResult(await api()[`deleteWphosting${methodKind}`](cid(), site, slug), getFormat(parent));
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
function registerLogCommand(parent, brand, name, hasDate) {
|
|
3752
|
+
const category = siteCategory(parent, name, name === "access-log" ? "\u30A2\u30AF\u30BB\u30B9\u30ED\u30B0" : "\u30A8\u30E9\u30FC\u30ED\u30B0");
|
|
3753
|
+
const command = category.command("show").description("\u30ED\u30B0\u3092\u53D6\u5F97").option("--keyword <keyword>", "\u7D5E\u308A\u8FBC\u307F\u30AD\u30FC\u30EF\u30FC\u30C9").option("--line-number <n>", "\u53D6\u5F97\u884C\u6570\uFF081\uFF5E50000\uFF09");
|
|
3754
|
+
if (hasDate)
|
|
3755
|
+
command.option("--date <date>", "\u5BFE\u8C61\u65E5\uFF08YYYY-MM-DD\uFF09");
|
|
3756
|
+
command.action(async (opts) => {
|
|
3757
|
+
const params = pickDefined({
|
|
3758
|
+
date: opts.date === void 0 ? void 0 : validateWphostingDate(String(opts.date)),
|
|
3759
|
+
keyword: opts.keyword === void 0 ? void 0 : String(opts.keyword),
|
|
3760
|
+
line_number: opts.lineNumber === void 0 ? void 0 : String(parseWphostingInteger(String(opts.lineNumber), "--line-number", 1, 5e4))
|
|
3761
|
+
});
|
|
3762
|
+
const method = hasDate ? "getWphostingAccessLog" : "getWphostingErrorLog";
|
|
3763
|
+
printResult(await client(parent, brand)[method](contractId(parent), servername(opts), params), getFormat(parent));
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
function registerWphostingCron(parent, brand) {
|
|
3767
|
+
const cron = siteCategory(parent, "cron", "WPhosting\u30B5\u30A4\u30C8\u306ECron\u8A2D\u5B9A");
|
|
3768
|
+
const api = () => client(parent, brand);
|
|
3769
|
+
const cid = () => contractId(parent);
|
|
3770
|
+
cron.command("list").description("Cron\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3771
|
+
printResult(await api().listWphostingCron(cid(), servername(opts)), getFormat(parent));
|
|
3772
|
+
});
|
|
3773
|
+
cron.command("add").description("Cron\u3092\u8FFD\u52A0").requiredOption("--minute <value>", "\u5206").requiredOption("--hour <value>", "\u6642").requiredOption("--day <value>", "\u65E5").requiredOption("--month <value>", "\u6708").requiredOption("--weekday <value>", "\u66DC\u65E5").requiredOption("--command <command>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <comment>", "\u30B3\u30E1\u30F3\u30C8").action(async (opts) => {
|
|
3774
|
+
printResult(await api().addWphostingCron(cid(), servername(opts), cronData(opts, true)), getFormat(parent));
|
|
3775
|
+
});
|
|
3776
|
+
cron.command("update").description("Cron\u3092\u66F4\u65B0").requiredOption("--cron-id <id>", "Cron ID").option("--minute <value>", "\u5206").option("--hour <value>", "\u6642").option("--day <value>", "\u65E5").option("--month <value>", "\u6708").option("--weekday <value>", "\u66DC\u65E5").option("--command <command>", "\u5B9F\u884C\u30B3\u30DE\u30F3\u30C9").option("--comment <comment>", "\u30B3\u30E1\u30F3\u30C8").option("--enabled <bool>", "true / false").action(async (opts) => {
|
|
3777
|
+
printResult(await api().updateWphostingCron(cid(), servername(opts), validateWphostingOpaqueId(String(opts.cronId), "--cron-id"), cronData(opts, false)), getFormat(parent));
|
|
3778
|
+
});
|
|
3779
|
+
cron.command("delete").description("Cron\u3092\u524A\u9664").requiredOption("--cron-id <id>", "Cron ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3780
|
+
const site = servername(opts);
|
|
3781
|
+
const id = validateWphostingOpaqueId(String(opts.cronId), "--cron-id");
|
|
3782
|
+
await previewListTarget(parent, await api().listWphostingCron(cid(), site), ["cron", "crons"], id, ["id", "cron_id"], "Cron");
|
|
3783
|
+
await confirmDestructiveAction(parent, `Cron "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3784
|
+
printResult(await api().deleteWphostingCron(cid(), site, id), getFormat(parent));
|
|
3785
|
+
});
|
|
3786
|
+
}
|
|
3787
|
+
function registerWphostingSsh(parent, brand) {
|
|
3788
|
+
const ssh = siteCategory(parent, "ssh", "WPhosting\u30B5\u30A4\u30C8\u306ESSH\u8A2D\u5B9A");
|
|
3789
|
+
const api = () => client(parent, brand);
|
|
3790
|
+
const cid = () => contractId(parent);
|
|
3791
|
+
ssh.command("show").description("SSH\u8A2D\u5B9A\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3792
|
+
printResult(await api().getWphostingSsh(cid(), servername(opts)), getFormat(parent));
|
|
3793
|
+
});
|
|
3794
|
+
ssh.command("update").description("SSH\u8A2D\u5B9A\u3092\u5909\u66F4").option("--ssh-enabled <bool>", "SSH\u3092\u6709\u52B9\u5316\uFF08true / false\uFF09").option("--abroad-access-restriction <bool>", "\u56FD\u5916\u30A2\u30AF\u30BB\u30B9\u5236\u9650\uFF08true / false\uFF09").action(async (opts) => {
|
|
3795
|
+
const data = pickDefined({
|
|
3796
|
+
ssh_enabled: opts.sshEnabled === void 0 ? void 0 : parseWphostingBoolean(String(opts.sshEnabled), "--ssh-enabled"),
|
|
3797
|
+
abroad_access_restriction: opts.abroadAccessRestriction === void 0 ? void 0 : parseWphostingBoolean(String(opts.abroadAccessRestriction), "--abroad-access-restriction")
|
|
3798
|
+
});
|
|
3799
|
+
requireWphostingFields(data);
|
|
3800
|
+
printResult(await api().updateWphostingSsh(cid(), servername(opts), data), getFormat(parent));
|
|
3801
|
+
});
|
|
3802
|
+
const keys = ssh.command("keys").description("SSH\u516C\u958B\u9375");
|
|
3803
|
+
keys.command("list").description("\u516C\u958B\u9375\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3804
|
+
printResult(await api().listWphostingSshKeys(cid(), servername(opts)), getFormat(parent));
|
|
3805
|
+
});
|
|
3806
|
+
keys.command("add").description("\u516C\u958B\u9375\u3092\u767B\u9332\u307E\u305F\u306F\u751F\u6210").requiredOption("--label <label>", "\u30E9\u30D9\u30EB\uFF081\uFF5E500\u6587\u5B57\uFF09").option("--public-key <key>", "\u767B\u9332\u3059\u308B\u516C\u958B\u9375").option("--generate <bool>", "\u9375\u30DA\u30A2\u3092\u751F\u6210\uFF08true / false\uFF09").option("--passphrase <passphrase>", "\u751F\u6210\u9375\u306E\u30D1\u30B9\u30D5\u30EC\u30FC\u30BA").action(async (opts) => {
|
|
3807
|
+
const generate = opts.generate === void 0 ? false : parseWphostingBoolean(String(opts.generate), "--generate");
|
|
3808
|
+
if (!generate && opts.publicKey === void 0)
|
|
3809
|
+
throw new Error("--public-key \u307E\u305F\u306F --generate true \u304C\u5FC5\u8981\u3067\u3059");
|
|
3810
|
+
if (generate && opts.publicKey !== void 0)
|
|
3811
|
+
throw new Error("--generate true \u3068 --public-key \u306F\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093");
|
|
3812
|
+
if (!generate && opts.passphrase !== void 0)
|
|
3813
|
+
throw new Error("--passphrase \u306F --generate true \u306E\u5834\u5408\u3060\u3051\u6307\u5B9A\u3067\u304D\u307E\u3059");
|
|
3814
|
+
const data = pickDefined({
|
|
3815
|
+
label: validateWphostingLength(String(opts.label), "--label", 500),
|
|
3816
|
+
public_key: opts.publicKey,
|
|
3817
|
+
generate: generate || void 0,
|
|
3818
|
+
passphrase: opts.passphrase === void 0 ? void 0 : validateWphostingLength(String(opts.passphrase), "--passphrase", 32, 6)
|
|
3819
|
+
});
|
|
3820
|
+
if (generate)
|
|
3821
|
+
console.error("\u6CE8\u610F: \u751F\u6210\u3055\u308C\u305Fprivate_key\u306F\u3053\u306E\u5FDC\u7B54\u3067\u4E00\u5EA6\u3060\u3051\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u5B89\u5168\u306A\u5834\u6240\u3078\u76F4\u3061\u306B\u4FDD\u5B58\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
3822
|
+
printResult(await api().addWphostingSshKey(cid(), servername(opts), data), getFormat(parent));
|
|
3823
|
+
});
|
|
3824
|
+
keys.command("update").description("\u516C\u958B\u9375\u3092\u66F4\u65B0").requiredOption("--key-id <id>", "\u516C\u958B\u9375ID").option("--label <label>", "\u30E9\u30D9\u30EB\uFF081\uFF5E500\u6587\u5B57\uFF09").option("--status <status>", "on / off").action(async (opts) => {
|
|
3825
|
+
const data = pickDefined({
|
|
3826
|
+
label: opts.label === void 0 ? void 0 : validateWphostingLength(String(opts.label), "--label", 500),
|
|
3827
|
+
status: opts.status === void 0 ? void 0 : validateWphostingEnum(String(opts.status), "--status", ["on", "off"])
|
|
3828
|
+
});
|
|
3829
|
+
requireWphostingFields(data);
|
|
3830
|
+
printResult(await api().updateWphostingSshKey(cid(), servername(opts), validateWphostingPositiveId(String(opts.keyId), "--key-id"), data), getFormat(parent));
|
|
3831
|
+
});
|
|
3832
|
+
keys.command("delete").description("\u516C\u958B\u9375\u3092\u524A\u9664").requiredOption("--key-id <id>", "\u516C\u958B\u9375ID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3833
|
+
const site = servername(opts);
|
|
3834
|
+
const id = validateWphostingPositiveId(String(opts.keyId), "--key-id");
|
|
3835
|
+
await previewListTarget(parent, await api().listWphostingSshKeys(cid(), site), ["keys", "ssh_keys"], id, ["id", "key_id"], "SSH\u516C\u958B\u9375");
|
|
3836
|
+
await confirmDestructiveAction(parent, `SSH\u516C\u958B\u9375 "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3837
|
+
printResult(await api().deleteWphostingSshKey(cid(), site, id), getFormat(parent));
|
|
3838
|
+
});
|
|
3839
|
+
}
|
|
3840
|
+
function wpUserData(opts, create) {
|
|
3841
|
+
const data = pickDefined({
|
|
3842
|
+
user_login: opts.userLogin === void 0 ? void 0 : validateWphostingWpLogin(String(opts.userLogin), "--user-login", 60),
|
|
3843
|
+
user_email: opts.userEmail === void 0 ? void 0 : validateWphostingEmail(String(opts.userEmail), "--user-email"),
|
|
3844
|
+
user_pass: opts.userPass === void 0 ? void 0 : validateWphostingLength(String(opts.userPass), "--user-pass", 64, 7),
|
|
3845
|
+
role: opts.role === void 0 ? void 0 : validateWphostingLength(String(opts.role), "--role", 64),
|
|
3846
|
+
display_name: opts.displayName === void 0 ? void 0 : validateWphostingLength(String(opts.displayName), "--display-name", 255),
|
|
3847
|
+
first_name: opts.firstName === void 0 ? void 0 : validateWphostingLength(String(opts.firstName), "--first-name", 255),
|
|
3848
|
+
last_name: opts.lastName === void 0 ? void 0 : validateWphostingLength(String(opts.lastName), "--last-name", 255),
|
|
3849
|
+
user_url: opts.userUrl === void 0 ? void 0 : validateWphostingLength(String(opts.userUrl), "--user-url", 255),
|
|
3850
|
+
send_email: opts.sendEmail === void 0 ? void 0 : parseWphostingBoolean(String(opts.sendEmail), "--send-email")
|
|
3851
|
+
});
|
|
3852
|
+
if (!create)
|
|
3853
|
+
requireWphostingFields(data);
|
|
3854
|
+
return data;
|
|
3855
|
+
}
|
|
3856
|
+
function addWpUserFields(command, create) {
|
|
3857
|
+
const option = create ? "requiredOption" : "option";
|
|
3858
|
+
if (create)
|
|
3859
|
+
command.requiredOption("--user-login <login>", "\u30E6\u30FC\u30B6\u30FC\u540D\uFF0860\u6587\u5B57\u4EE5\u5185\uFF09");
|
|
3860
|
+
command[option]("--user-email <email>", "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08100\u6587\u5B57\u4EE5\u5185\uFF09");
|
|
3861
|
+
command[option]("--user-pass <password>", "\u30D1\u30B9\u30EF\u30FC\u30C9\uFF0864\u6587\u5B57\u4EE5\u5185\uFF09");
|
|
3862
|
+
command[option]("--role <role>", "\u6A29\u9650\u30B0\u30EB\u30FC\u30D7");
|
|
3863
|
+
command.option("--display-name <name>", "\u8868\u793A\u540D").option("--first-name <name>", "\u540D").option("--last-name <name>", "\u59D3").option("--user-url <url>", "\u30B5\u30A4\u30C8URL");
|
|
3864
|
+
if (create)
|
|
3865
|
+
command.option("--send-email <bool>", "\u901A\u77E5\u30E1\u30FC\u30EB\u9001\u4FE1\uFF08true / false\uFF09");
|
|
3866
|
+
return command;
|
|
3867
|
+
}
|
|
3868
|
+
function registerWphostingUsers(parent, brand) {
|
|
3869
|
+
const users = siteCategory(parent, "wp-users", "WordPress\u30E6\u30FC\u30B6\u30FC");
|
|
3870
|
+
const api = () => client(parent, brand);
|
|
3871
|
+
const cid = () => contractId(parent);
|
|
3872
|
+
users.command("roles").description("\u6A29\u9650\u30B0\u30EB\u30FC\u30D7\u4E00\u89A7\u3092\u53D6\u5F97").action(async (opts) => {
|
|
3873
|
+
printResult(await api().listWphostingWpUserRoles(cid(), servername(opts)), getFormat(parent));
|
|
3874
|
+
});
|
|
3875
|
+
users.command("list").description("\u30E6\u30FC\u30B6\u30FC\u4E00\u89A7\u3092\u53D6\u5F97").option("--search <value>", "\u691C\u7D22\u8A9E").option("--orderby <field>", "ID / user_login / display_name / user_email / user_registered").option("--order <order>", "asc / desc").action(async (opts) => {
|
|
3876
|
+
const params = pickDefined({
|
|
3877
|
+
search: opts.search === void 0 ? void 0 : String(opts.search),
|
|
3878
|
+
orderby: opts.orderby === void 0 ? void 0 : validateWphostingEnum(String(opts.orderby), "--orderby", ["ID", "user_login", "display_name", "user_email", "user_registered"]),
|
|
3879
|
+
order: opts.order === void 0 ? void 0 : validateWphostingEnum(String(opts.order), "--order", ["asc", "desc"])
|
|
3880
|
+
});
|
|
3881
|
+
printResult(await api().listWphostingWpUsers(cid(), servername(opts), params), getFormat(parent));
|
|
3882
|
+
});
|
|
3883
|
+
addWpUserFields(users.command("create").description("\u30E6\u30FC\u30B6\u30FC\u3092\u4F5C\u6210"), true).action(async (opts) => {
|
|
3884
|
+
printResult(await api().createWphostingWpUser(cid(), servername(opts), wpUserData(opts, true)), getFormat(parent));
|
|
3885
|
+
});
|
|
3886
|
+
users.command("show").description("\u30E6\u30FC\u30B6\u30FC\u8A73\u7D30\u3092\u53D6\u5F97").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID").action(async (opts) => {
|
|
3887
|
+
printResult(await api().getWphostingWpUser(cid(), servername(opts), validateWphostingPositiveId(String(opts.userId), "--user-id")), getFormat(parent));
|
|
3888
|
+
});
|
|
3889
|
+
addWpUserFields(users.command("update").description("\u30E6\u30FC\u30B6\u30FC\u3092\u66F4\u65B0").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID"), false).action(async (opts) => {
|
|
3890
|
+
printResult(await api().updateWphostingWpUser(cid(), servername(opts), validateWphostingPositiveId(String(opts.userId), "--user-id"), wpUserData(opts, false)), getFormat(parent));
|
|
3891
|
+
});
|
|
3892
|
+
users.command("delete").description("\u30E6\u30FC\u30B6\u30FC\u3092\u524A\u9664").requiredOption("--user-id <id>", "\u30E6\u30FC\u30B6\u30FCID").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").action(async (opts) => {
|
|
3893
|
+
const site = servername(opts);
|
|
3894
|
+
const id = validateWphostingPositiveId(String(opts.userId), "--user-id");
|
|
3895
|
+
const target = await api().getWphostingWpUser(cid(), site, id);
|
|
3896
|
+
printPreview(target, getFormat(parent));
|
|
3897
|
+
console.error("\u8B66\u544A: \u3053\u306E\u30E6\u30FC\u30B6\u30FC\u304C\u6240\u6709\u3059\u308B\u6295\u7A3F\u306A\u3069\u3082\u524A\u9664\u3055\u308C\u307E\u3059\u3002");
|
|
3898
|
+
await confirmDestructiveAction(parent, `WordPress\u30E6\u30FC\u30B6\u30FC "${id}" \u3092\u524A\u9664\u3057\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F`);
|
|
3899
|
+
printResult(await api().deleteWphostingWpUser(cid(), site, id), getFormat(parent));
|
|
3900
|
+
});
|
|
3901
|
+
}
|
|
3902
|
+
|
|
3903
|
+
// ../core/dist/commands/wphosting/account.js
|
|
3904
|
+
function explicitContractId(parent) {
|
|
3905
|
+
return validateWphostingContractId(String(parent.opts().contractId));
|
|
3906
|
+
}
|
|
3907
|
+
function registerWphostingAccountCommands(parent, brand) {
|
|
3908
|
+
parent.command("plans").description("\u7533\u8FBC\u53EF\u80FD\u306AWPhosting\u30D7\u30E9\u30F3\u3092\u53D6\u5F97").option("--plan-id <list>", "\u30D7\u30E9\u30F3ID\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\uFF09").action(async (opts) => {
|
|
3909
|
+
const params = opts.planId === void 0 ? void 0 : { plan_id: parsePlanIds(opts.planId) };
|
|
3910
|
+
printResult(await resolveClient(parent, brand).listWphostingPlans(params), getFormat(parent));
|
|
3911
|
+
});
|
|
3912
|
+
parent.command("contracts").description("WPhosting\u5951\u7D04").command("list").description("WPhosting\u5951\u7D04\u4E00\u89A7\u3092\u53D6\u5F97").action(async () => {
|
|
3913
|
+
printResult(await resolveClient(parent, brand).listWphostingContracts(), getFormat(parent));
|
|
3914
|
+
});
|
|
3915
|
+
const memo = parent.command("memo").description("WPhosting\u5951\u7D04\u30E1\u30E2");
|
|
3916
|
+
memo.command("show").description("\u30E1\u30E2\u3092\u53D6\u5F97").action(async () => {
|
|
3917
|
+
const contractId2 = explicitContractId(parent);
|
|
3918
|
+
printResult(await resolveClient(parent, brand).getWphostingMemo(contractId2), getFormat(parent));
|
|
3919
|
+
});
|
|
3920
|
+
memo.command("update").description("\u30E1\u30E2\u3092\u66F4\u65B0").requiredOption("--memo <memo>", "\u30E1\u30E2\uFF08\u7A7A\u6587\u5B57\u53EF\u3001500\u6587\u5B57\u4EE5\u5185\uFF09").action(async (opts) => {
|
|
3921
|
+
const contractId2 = explicitContractId(parent);
|
|
3922
|
+
printResult(await resolveClient(parent, brand).updateWphostingMemo(contractId2, {
|
|
3923
|
+
memo: validateSignupMemo(opts.memo)
|
|
3924
|
+
}), getFormat(parent));
|
|
3925
|
+
});
|
|
3926
|
+
parent.command("signup").description("WPhosting\u3092\u65B0\u898F\u5951\u7D04").requiredOption("--plan-id <id>", "\u30D7\u30E9\u30F3ID").requiredOption("--period <months>", "\u5951\u7D04\u671F\u9593\uFF08\u6708\u6570\u3002wphosting plans \u304C\u8FD4\u3057\u305F months \u304B\u3089\u6307\u5B9A\uFF09").requiredOption("--expected-total-price <yen>", "\u4E8B\u524D\u78BA\u8A8D\u3057\u305F\u7A0E\u8FBC\u5408\u8A08\u91D1\u984D\uFF080\u4EE5\u4E0A\u306E\u6574\u6570\uFF09").option("--partner-code <code>", "\u30D1\u30FC\u30C8\u30CA\u30FC\u30B3\u30FC\u30C9\uFF08ASCII\u82F1\u6570\u5B57\u300150\u6587\u5B57\u4EE5\u5185\uFF09").option("--auto-renew <bool>", "\u81EA\u52D5\u66F4\u65B0\uFF08true / false\uFF09").option("--dry-run", "\u30D7\u30EC\u30D3\u30E5\u30FC\u306E\u307F\u5B9F\u884C").option("--confirm-purchase", "\u8AB2\u91D1\u3092\u4F34\u3046\u7533\u8ACB\u3092\u660E\u793A\u7684\u306B\u78BA\u8A8D").option("--agree-to-terms", "\u5229\u7528\u898F\u7D04\u306B\u540C\u610F").option("--idempotency-key <key>", "\u5B9F\u7533\u8ACB\u306E\u51AA\u7B49\u6027\u30AD\u30FC\uFF08\u82F1\u6570\u5B57\u30FB_\u30FB-\u306E8\uFF5E64\u6587\u5B57\uFF09").action(async (opts) => {
|
|
3927
|
+
const expectedTotalPrice = parseInteger(opts.expectedTotalPrice, "--expected-total-price", 0);
|
|
3928
|
+
const period = parseWphostingSignupPeriod(opts.period);
|
|
3929
|
+
const partnerCode = opts.partnerCode === void 0 ? void 0 : validatePartnerCode(opts.partnerCode);
|
|
3930
|
+
const autoRenew = opts.autoRenew === void 0 ? void 0 : parseAutoRenew(opts.autoRenew);
|
|
3931
|
+
const baseData = {
|
|
3932
|
+
plan_id: opts.planId,
|
|
3933
|
+
period,
|
|
3934
|
+
expected_total_price: expectedTotalPrice,
|
|
3935
|
+
agree_to_terms: true,
|
|
3936
|
+
...pickDefined({
|
|
3937
|
+
partner_code: partnerCode,
|
|
3938
|
+
auto_renew: autoRenew
|
|
3939
|
+
})
|
|
3940
|
+
};
|
|
3941
|
+
const client2 = resolveClient(parent, brand);
|
|
3942
|
+
await runBillingPurchase({
|
|
3943
|
+
format: getFormat(parent),
|
|
3944
|
+
options: opts,
|
|
3945
|
+
operation: signupOperationName(brand, "wphosting"),
|
|
3946
|
+
targetLabel: "\u7533\u8FBC\u5185\u5BB9",
|
|
3947
|
+
resolveTarget: async () => {
|
|
3948
|
+
const planName = await resolvePlanName(() => client2.listWphostingPlans({ plan_id: opts.planId }), opts.planId);
|
|
3949
|
+
return {
|
|
3950
|
+
target: `${planLabel(opts.planId, planName)} / \u5951\u7D04\u671F\u9593 ${period}\u304B\u6708`,
|
|
3951
|
+
confirmSubject: `${planName ?? opts.planId} ${period}\u304B\u6708`
|
|
3952
|
+
};
|
|
3953
|
+
},
|
|
3954
|
+
details: compactDetails([
|
|
3955
|
+
autoRenewDetail(autoRenew ?? true, {
|
|
3956
|
+
fromDefault: autoRenew === void 0
|
|
3957
|
+
}),
|
|
3958
|
+
partnerCodeDetail(partnerCode)
|
|
3959
|
+
]),
|
|
3960
|
+
legalNoticeLines: signupLegalNoticeLines(brand, "wphosting"),
|
|
3961
|
+
statusCommand: `${brand.commandName} wphosting contracts list`,
|
|
3962
|
+
preview: () => client2.registerWphosting({ ...baseData, dry_run: true }),
|
|
3963
|
+
execute: (idempotencyKey) => client2.registerWphosting({ ...baseData, dry_run: false }, idempotencyKey)
|
|
3964
|
+
});
|
|
2183
3965
|
});
|
|
2184
3966
|
}
|
|
2185
3967
|
|
|
2186
3968
|
// ../core/dist/index.js
|
|
2187
|
-
function
|
|
3969
|
+
function createProgram(brand, version = "0.0.0") {
|
|
2188
3970
|
const program = new Command();
|
|
2189
3971
|
program.name(brand.commandName).description(`${brand.displayName} CLI`).version(version).option("--format <format>", "\u51FA\u529B\u5F62\u5F0F (json, table)", (value) => {
|
|
2190
3972
|
if (!["json", "table"].includes(value)) {
|
|
@@ -2194,7 +3976,15 @@ function run(brand, version = "0.0.0") {
|
|
|
2194
3976
|
}, "table").option("--profile <name>", "\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB").option("-y, --yes", "\u78BA\u8A8D\u30D7\u30ED\u30F3\u30D7\u30C8\u3092\u30B9\u30AD\u30C3\u30D7").option("--debug", "\u30C7\u30D0\u30C3\u30B0\u51FA\u529B\u3092\u6709\u52B9\u5316\uFF08\u30EA\u30AF\u30A8\u30B9\u30C8URL\u30FB\u30EC\u30B9\u30DD\u30F3\u30B9\u30D8\u30C3\u30C0\u3092\u8868\u793A\uFF09");
|
|
2195
3977
|
registerAuthCommands(program, brand);
|
|
2196
3978
|
registerMeCommand(program, brand);
|
|
3979
|
+
if (isWphostingSupportedBrand(brand)) {
|
|
3980
|
+
const wphosting = program.command("wphosting").description("XServer for WordPress API").option("--contract-id <id>", "WPhosting\u5951\u7D04ID\uFF08\u4F8B: WP-AB234567\uFF09");
|
|
3981
|
+
registerWphostingAccountCommands(wphosting, brand);
|
|
3982
|
+
registerWphostingCommands(wphosting, brand);
|
|
3983
|
+
}
|
|
3984
|
+
const domain = program.command("domain").description("\u30C9\u30E1\u30A4\u30F3\u30B5\u30FC\u30D3\u30B9API\uFF08\u53D6\u5F97\u30FB\u5951\u7D04\u30FBDNS\u30FBWhois\u306A\u3069\uFF09");
|
|
3985
|
+
registerDomainCommands(domain, brand);
|
|
2197
3986
|
const server = program.command("server").description("\u30B5\u30FC\u30D0\u30FC\u7BA1\u7406API\uFF08WordPress\u30FB\u30E1\u30FC\u30EB\u30FBDB\u306A\u3069\uFF09").option("--servername <name>", "\u30B5\u30FC\u30D0\u30FC\u540D\uFF08\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u4E0A\u66F8\u304D\uFF09");
|
|
3987
|
+
registerServerAccountCommands(server, brand);
|
|
2198
3988
|
registerServerInfoCommands(server, brand);
|
|
2199
3989
|
registerCronCommands(server, brand);
|
|
2200
3990
|
registerSshCommands(server, brand);
|
|
@@ -2227,7 +4017,17 @@ function run(brand, version = "0.0.0") {
|
|
|
2227
4017
|
registerXPageSpeedCommands(server, brand);
|
|
2228
4018
|
registerAutoBackupCommands(server, brand);
|
|
2229
4019
|
registerMysqlBackupCommands(server, brand);
|
|
4020
|
+
return program;
|
|
4021
|
+
}
|
|
4022
|
+
function run(brand, version = "0.0.0") {
|
|
4023
|
+
const program = createProgram(brand, version);
|
|
2230
4024
|
program.parseAsync(process.argv).catch((err) => {
|
|
4025
|
+
const resendGuidance = billingResendGuidance(err);
|
|
4026
|
+
const printResendGuidance = () => {
|
|
4027
|
+
for (const line of resendGuidance ?? []) {
|
|
4028
|
+
console.error(line);
|
|
4029
|
+
}
|
|
4030
|
+
};
|
|
2231
4031
|
if (err instanceof ApiError) {
|
|
2232
4032
|
console.error(`\u30A8\u30E9\u30FC [${err.errorCode}]: ${err.message}`);
|
|
2233
4033
|
if (err.errors.length > 0) {
|
|
@@ -2235,21 +4035,31 @@ function run(brand, version = "0.0.0") {
|
|
|
2235
4035
|
console.error(` - ${e}`);
|
|
2236
4036
|
}
|
|
2237
4037
|
}
|
|
2238
|
-
|
|
4038
|
+
printResendGuidance();
|
|
4039
|
+
process.exitCode = 1;
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
if (err instanceof BillingCancelledError) {
|
|
4043
|
+
console.error(err.message);
|
|
4044
|
+
process.exitCode = 1;
|
|
4045
|
+
return;
|
|
2239
4046
|
}
|
|
2240
4047
|
if (err instanceof Error) {
|
|
2241
4048
|
console.error(`\u30A8\u30E9\u30FC: ${err.message}`);
|
|
2242
|
-
|
|
4049
|
+
printResendGuidance();
|
|
4050
|
+
process.exitCode = 1;
|
|
4051
|
+
return;
|
|
2243
4052
|
}
|
|
2244
4053
|
console.error("\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F");
|
|
2245
|
-
|
|
4054
|
+
printResendGuidance();
|
|
4055
|
+
process.exitCode = 1;
|
|
2246
4056
|
});
|
|
2247
4057
|
}
|
|
2248
4058
|
|
|
2249
4059
|
// package.json
|
|
2250
4060
|
var package_default = {
|
|
2251
4061
|
name: "shincloud-cli",
|
|
2252
|
-
version: "1.
|
|
4062
|
+
version: "1.4.0",
|
|
2253
4063
|
description: "Official CLI for Shincloud API \u2014 manage your Shincloud hosting from the terminal",
|
|
2254
4064
|
type: "module",
|
|
2255
4065
|
bin: {
|
|
@@ -2296,6 +4106,11 @@ run({
|
|
|
2296
4106
|
brand: "shincloud",
|
|
2297
4107
|
apiBase: "https://api.shin-server.jp",
|
|
2298
4108
|
displayName: "\u30B7\u30F3\u30AF\u30E9\u30A6\u30C9 API",
|
|
4109
|
+
serverServiceName: "\u30B7\u30F3\u30EC\u30F3\u30BF\u30EB\u30B5\u30FC\u30D0\u30FC",
|
|
4110
|
+
domainTermsUrl: "https://www.shin-domain.jp/rule/rule.php",
|
|
4111
|
+
domainPrivacyUrl: "https://www.shin-domain.jp/privacy_announcement.php",
|
|
4112
|
+
serverTermsUrl: "https://www.shin-server.jp/rule.php",
|
|
4113
|
+
serverPrivacyUrl: "https://www.shin-server.jp/privacy_announcement.php",
|
|
2299
4114
|
commandName: "shincloud",
|
|
2300
4115
|
configDir: "shincloud-cli"
|
|
2301
4116
|
}, package_default.version);
|