@highstate/timeweb 0.7.10
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.
@@ -0,0 +1,14 @@
|
|
1
|
+
// src/connection/index.ts
|
2
|
+
import { timeweb } from "@highstate/library";
|
3
|
+
import { forUnit } from "@highstate/pulumi";
|
4
|
+
var { name, secrets, outputs } = forUnit(timeweb.connection);
|
5
|
+
var connection_default = outputs({
|
6
|
+
connection: {
|
7
|
+
name,
|
8
|
+
apiToken: secrets.apiToken
|
9
|
+
}
|
10
|
+
});
|
11
|
+
export {
|
12
|
+
connection_default as default
|
13
|
+
};
|
14
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/connection/index.ts"],"sourcesContent":["import { timeweb } from \"@highstate/library\"\nimport { forUnit } from \"@highstate/pulumi\"\n\nconst { name, secrets, outputs } = forUnit(timeweb.connection)\n\nexport default outputs({\n connection: {\n name,\n apiToken: secrets.apiToken,\n },\n})\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,eAAe;AAExB,IAAM,EAAE,MAAM,SAAS,QAAQ,IAAI,QAAQ,QAAQ,UAAU;AAE7D,IAAO,qBAAQ,QAAQ;AAAA,EACrB,YAAY;AAAA,IACV;AAAA,IACA,UAAU,QAAQ;AAAA,EACpB;AACF,CAAC;","names":[]}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
// src/virtual-machine/index.ts
|
2
|
+
import { Provider, SshKey, FloatingIp, Server } from "@highstate/timeweb-sdk";
|
3
|
+
import { timeweb } from "@highstate/library";
|
4
|
+
import { forUnit, getResourceComment, output } from "@highstate/pulumi";
|
5
|
+
import { createSshTerminal, getOrCreateSshKeyPair } from "@highstate/common";
|
6
|
+
var { name, args, inputs, secrets, outputs } = forUnit(timeweb.virtualMachine);
|
7
|
+
var provider = new Provider(name, { token: inputs.connection.apiToken });
|
8
|
+
var keyPair = getOrCreateSshKeyPair(inputs, secrets);
|
9
|
+
var sshKey = new SshKey(
|
10
|
+
name,
|
11
|
+
{
|
12
|
+
name,
|
13
|
+
body: keyPair.publicKey
|
14
|
+
},
|
15
|
+
{ provider }
|
16
|
+
);
|
17
|
+
var floatingIp = new FloatingIp(
|
18
|
+
name,
|
19
|
+
{
|
20
|
+
comment: getResourceComment(),
|
21
|
+
availabilityZone: args.availabilityZone,
|
22
|
+
ddosGuard: false
|
23
|
+
},
|
24
|
+
{ provider }
|
25
|
+
);
|
26
|
+
var server = new Server(
|
27
|
+
name,
|
28
|
+
{
|
29
|
+
name,
|
30
|
+
comment: getResourceComment(),
|
31
|
+
availabilityZone: args.availabilityZone,
|
32
|
+
floatingIpId: floatingIp.id,
|
33
|
+
presetId: args.presetId,
|
34
|
+
osId: args.osId,
|
35
|
+
isRootPasswordRequired: false,
|
36
|
+
sshKeysIds: [sshKey.sshKeyId.apply(Number)]
|
37
|
+
},
|
38
|
+
{ provider }
|
39
|
+
);
|
40
|
+
var serverEntity = output({
|
41
|
+
endpoint: floatingIp.ip,
|
42
|
+
hostname: server.name,
|
43
|
+
sshCredentials: {
|
44
|
+
privateKey: keyPair.privateKey
|
45
|
+
}
|
46
|
+
});
|
47
|
+
var virtual_machine_default = outputs({
|
48
|
+
server: serverEntity,
|
49
|
+
$terminals: [serverEntity.apply(createSshTerminal)],
|
50
|
+
$status: {
|
51
|
+
ip: floatingIp.ip
|
52
|
+
}
|
53
|
+
});
|
54
|
+
export {
|
55
|
+
virtual_machine_default as default
|
56
|
+
};
|
57
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/virtual-machine/index.ts"],"sourcesContent":["import { Provider, SshKey, FloatingIp, Server } from \"@highstate/timeweb-sdk\"\nimport { common, timeweb } from \"@highstate/library\"\nimport { forUnit, getResourceComment, Output, output } from \"@highstate/pulumi\"\nimport { createSshTerminal, getOrCreateSshKeyPair } from \"@highstate/common\"\n\nconst { name, args, inputs, secrets, outputs } = forUnit(timeweb.virtualMachine)\n\nconst provider = new Provider(name, { token: inputs.connection.apiToken })\n\nconst keyPair = getOrCreateSshKeyPair(inputs, secrets)\n\nconst sshKey = new SshKey(\n name,\n {\n name,\n body: keyPair.publicKey,\n },\n { provider },\n)\n\nconst floatingIp = new FloatingIp(\n name,\n {\n comment: getResourceComment(),\n availabilityZone: args.availabilityZone,\n ddosGuard: false,\n },\n { provider },\n)\n\nconst server = new Server(\n name,\n {\n name,\n comment: getResourceComment(),\n availabilityZone: args.availabilityZone,\n floatingIpId: floatingIp.id,\n presetId: args.presetId,\n osId: args.osId,\n isRootPasswordRequired: false,\n sshKeysIds: [sshKey.sshKeyId.apply(Number)],\n },\n { provider },\n)\n\nconst serverEntity: Output<common.Server> = output({\n endpoint: floatingIp.ip,\n hostname: server.name,\n sshCredentials: {\n privateKey: keyPair.privateKey,\n },\n})\n\nexport default outputs({\n server: serverEntity,\n $terminals: [serverEntity.apply(createSshTerminal)],\n $status: {\n ip: floatingIp.ip,\n },\n})\n"],"mappings":";AAAA,SAAS,UAAU,QAAQ,YAAY,cAAc;AACrD,SAAiB,eAAe;AAChC,SAAS,SAAS,oBAA4B,cAAc;AAC5D,SAAS,mBAAmB,6BAA6B;AAEzD,IAAM,EAAE,MAAM,MAAM,QAAQ,SAAS,QAAQ,IAAI,QAAQ,QAAQ,cAAc;AAE/E,IAAM,WAAW,IAAI,SAAS,MAAM,EAAE,OAAO,OAAO,WAAW,SAAS,CAAC;AAEzE,IAAM,UAAU,sBAAsB,QAAQ,OAAO;AAErD,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,EACA;AAAA,IACE;AAAA,IACA,MAAM,QAAQ;AAAA,EAChB;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,aAAa,IAAI;AAAA,EACrB;AAAA,EACA;AAAA,IACE,SAAS,mBAAmB;AAAA,IAC5B,kBAAkB,KAAK;AAAA,IACvB,WAAW;AAAA,EACb;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,EACA;AAAA,IACE;AAAA,IACA,SAAS,mBAAmB;AAAA,IAC5B,kBAAkB,KAAK;AAAA,IACvB,cAAc,WAAW;AAAA,IACzB,UAAU,KAAK;AAAA,IACf,MAAM,KAAK;AAAA,IACX,wBAAwB;AAAA,IACxB,YAAY,CAAC,OAAO,SAAS,MAAM,MAAM,CAAC;AAAA,EAC5C;AAAA,EACA,EAAE,SAAS;AACb;AAEA,IAAM,eAAsC,OAAO;AAAA,EACjD,UAAU,WAAW;AAAA,EACrB,UAAU,OAAO;AAAA,EACjB,gBAAgB;AAAA,IACd,YAAY,QAAQ;AAAA,EACtB;AACF,CAAC;AAED,IAAO,0BAAQ,QAAQ;AAAA,EACrB,QAAQ;AAAA,EACR,YAAY,CAAC,aAAa,MAAM,iBAAiB,CAAC;AAAA,EAClD,SAAS;AAAA,IACP,IAAI,WAAW;AAAA,EACjB;AACF,CAAC;","names":[]}
|
package/package.json
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"name": "@highstate/timeweb",
|
3
|
+
"version": "0.7.10",
|
4
|
+
"type": "module",
|
5
|
+
"files": [
|
6
|
+
"dist"
|
7
|
+
],
|
8
|
+
"exports": {
|
9
|
+
"./connection": "./dist/connection/index.js",
|
10
|
+
"./virtual-machine": "./dist/virtual-machine/index.js"
|
11
|
+
},
|
12
|
+
"publishConfig": {
|
13
|
+
"access": "public"
|
14
|
+
},
|
15
|
+
"scripts": {
|
16
|
+
"build": "highstate build"
|
17
|
+
},
|
18
|
+
"dependencies": {
|
19
|
+
"@highstate/common": "^0.7.10",
|
20
|
+
"@highstate/k8s": "^0.7.10",
|
21
|
+
"@highstate/pulumi": "^0.7.10",
|
22
|
+
"@highstate/timeweb-sdk": "workspace:^0.7.8",
|
23
|
+
"@pulumi/pulumi": "^3.163.0"
|
24
|
+
},
|
25
|
+
"peerDependencies": {
|
26
|
+
"@highstate/library": "workspace:^0.4.4"
|
27
|
+
},
|
28
|
+
"devDependencies": {
|
29
|
+
"@highstate/cli": "^0.7.10"
|
30
|
+
},
|
31
|
+
"gitHead": "171465dab44ebcedd1d1eb9e5369fb1c88daa480"
|
32
|
+
}
|