ts / dist / cjs / vps.js
1,182 words
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.listActivity = exports.getAction = exports.deleteImage = exports.listImages = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.disconnectDomain = exports.connectDomain = exports.listInstanceDomains = exports.setRdns = exports.powerOn = exports.powerOff = exports.shutdown = exports.reset = exports.restart = exports.createSnapshot = exports.setQueueNotify = exports.getMetrics = exports.destroyInstance = exports.getInstance = exports.revealAppPassword = exports.getAppDeployment = exports.deployApp = exports.listAppDeployments = exports.appCatalog = exports.createInstance = exports.listInstances = exports.availability = exports.deleteSshKey = exports.addSshKey = exports.listSshKeys = exports.listSystemImages = exports.listTiers = void 0;
const gate_js_1 = require("./gate.js");
const http = __importStar(require("./http.js"));
/** GET /vps/tiers — VPS tiers. */
const listTiers = (client) => http.get(client, '/vps/tiers');
exports.listTiers = listTiers;
/** GET /vps/system-images — Bootable system images. */
const listSystemImages = (client) => http.get(client, '/vps/system-images');
exports.listSystemImages = listSystemImages;
/** GET /vps/ssh-keys — List SSH keys. */
const listSshKeys = (client) => http.get(client, '/vps/ssh-keys');
exports.listSshKeys = listSshKeys;
/** POST /vps/ssh-keys — Add an SSH key. */
const addSshKey = (client, body) => http.post(client, '/vps/ssh-keys', { body });
exports.addSshKey = addSshKey;
/** DELETE /vps/ssh-keys/{id} — Delete an SSH key. */
const deleteSshKey = (client, id) => http.del(client, '/vps/ssh-keys/{id}', { params: { id } });
exports.deleteSshKey = deleteSshKey;
/** GET /vps/availability — Tier availability. */
const availability = (client) => http.get(client, '/vps/availability');
exports.availability = availability;
/** GET /vps/instances — List your servers. */
const listInstances = (client) => http.get(client, '/vps/instances');
exports.listInstances = listInstances;
/** POST /vps/instances — Create a server (202, hourly billing starts). */
const createInstance = (client, body) => http.post(client, '/vps/instances', { body });
exports.createInstance = createInstance;
/** GET /vps/apps — One-click app catalog. */
const appCatalog = (client) => http.get(client, '/vps/apps');
exports.appCatalog = appCatalog;
/** GET /vps/apps/deployments — List your app deployments. */
const listAppDeployments = (client) => http.get(client, '/vps/apps/deployments');
exports.listAppDeployments = listAppDeployments;
/** POST /vps/apps/deployments — Deploy an app (202, hourly billing starts). */
const deployApp = (client, body) => http.post(client, '/vps/apps/deployments', { body });
exports.deployApp = deployApp;
/** GET /vps/apps/deployments/{id} — Get an app deployment. */
const getAppDeployment = (client, id) => http.get(client, '/vps/apps/deployments/{id}', { params: { id } });
exports.getAppDeployment = getAppDeployment;
/** POST /vps/apps/deployments/{id}/reveal-password — Reveal an app deployment's root password (once). */
const revealAppPassword = (client, id) => http.post(client, '/vps/apps/deployments/{id}/reveal-password', { params: { id } });
exports.revealAppPassword = revealAppPassword;
/** GET /vps/instances/{id} — Get a server. */
const getInstance = (client, id) => http.get(client, '/vps/instances/{id}', { params: { id } });
exports.getInstance = getInstance;
/** DELETE /vps/instances/{id} — Destroy a server (202; billing stops). */
const destroyInstance = (client, id) => http.del(client, '/vps/instances/{id}', { params: { id } });
exports.destroyInstance = destroyInstance;
/** GET /vps/instances/{id}/metrics — Server usage metrics. */
const getMetrics = (client, id, query) => http.get(client, '/vps/instances/{id}/metrics', { params: { id }, query });
exports.getMetrics = getMetrics;
/** POST /vps/instances/{id}/queue-notify — Toggle the queued-create outcome email. */
const setQueueNotify = (client, id, body) => http.post(client, '/vps/instances/{id}/queue-notify', { params: { id }, body });
exports.setQueueNotify = setQueueNotify;
/** POST /vps/instances/{id}/images — Snapshot a server (202). */
const createSnapshot = (client, id, body) => http.post(client, '/vps/instances/{id}/images', { params: { id }, body });
exports.createSnapshot = createSnapshot;
/** POST /vps/instances/{id}/restart — Restart a server (graceful, 202). */
const restart = (client, id) => http.post(client, '/vps/instances/{id}/restart', { params: { id } });
exports.restart = restart;
/** POST /vps/instances/{id}/reset — Force reset a server (hard, 202). */
const reset = (client, id) => http.post(client, '/vps/instances/{id}/reset', { params: { id } });
exports.reset = reset;
/** POST /vps/instances/{id}/shutdown — Shut down a server (graceful, 202). */
const shutdown = (client, id) => http.post(client, '/vps/instances/{id}/shutdown', { params: { id } });
exports.shutdown = shutdown;
/** POST /vps/instances/{id}/power-off — Force power off a server (hard, 202). */
const powerOff = (client, id) => http.post(client, '/vps/instances/{id}/power-off', { params: { id } });
exports.powerOff = powerOff;
/** POST /vps/instances/{id}/power-on — Power on a stopped server (202). */
const powerOn = (client, id) => http.post(client, '/vps/instances/{id}/power-on', { params: { id } });
exports.powerOn = powerOn;
/** PUT /vps/instances/{id}/rdns — Set a server's reverse DNS (PTR, 202). */
const setRdns = (client, id, body) => http.put(client, '/vps/instances/{id}/rdns', { params: { id }, body });
exports.setRdns = setRdns;
/** GET /vps/instances/{id}/domains — List a server's connected domains. */
const listInstanceDomains = (client, id) => http.get(client, '/vps/instances/{id}/domains', { params: { id } });
exports.listInstanceDomains = listInstanceDomains;
/** POST /vps/instances/{id}/domains — Connect a domain to a server (202). Gated on `zone`. */
const connectDomain = async (client, id, body) => {
    await (0, gate_js_1.checkGate)(client, 'POST /vps/instances/{id}/domains', { domain: body.zone });
    return http.post(client, '/vps/instances/{id}/domains', { params: { id }, body });
};
exports.connectDomain = connectDomain;
/**
 * DELETE /vps/instances/{id}/domains/{connection-id} — Disconnect a domain
 * from a server. Gated on the connection's zone (resolved via
 * `listInstanceDomains` when a gate is set).
 */
const disconnectDomain = async (client, id, connectionId) => {
    if (client.gate) {
        const { connections } = await (0, exports.listInstanceDomains)(client, id);
        const zone = connections?.find((c) => String(c.id) === connectionId)?.zone_origin;
        await (0, gate_js_1.checkGate)(client, 'DELETE /vps/instances/{id}/domains/{connection-id}', { domain: zone });
    }
    return http.del(client, '/vps/instances/{id}/domains/{connection-id}', {
        params: { id, 'connection-id': connectionId },
    });
};
exports.disconnectDomain = disconnectDomain;
/** GET /vps/volumes — List your volumes. */
const listVolumes = (client) => http.get(client, '/vps/volumes');
exports.listVolumes = listVolumes;
/** POST /vps/volumes — Create a volume (202, hourly billing starts). */
const createVolume = (client, body) => http.post(client, '/vps/volumes', { body });
exports.createVolume = createVolume;
/** DELETE /vps/volumes/{id} — Delete a volume (202; billing stops). */
const deleteVolume = (client, id) => http.del(client, '/vps/volumes/{id}', { params: { id } });
exports.deleteVolume = deleteVolume;
/** GET /vps/images — List your snapshots. */
const listImages = (client) => http.get(client, '/vps/images');
exports.listImages = listImages;
/** DELETE /vps/images/{id} — Delete a snapshot (202). */
const deleteImage = (client, id) => http.del(client, '/vps/images/{id}', { params: { id } });
exports.deleteImage = deleteImage;
/** GET /vps/actions/{id} — Poll a VPS action. */
const getAction = (client, id) => http.get(client, '/vps/actions/{id}', { params: { id } });
exports.getAction = getAction;
/** GET /vps/activity — Infrastructure activity timeline. */
const listActivity = (client, query) => http.get(client, '/vps/activity', { query });
exports.listActivity = listActivity;

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/ts.git