freestyle-sandboxes 0.1.10 → 0.1.11
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/index.cjs +146 -81
- package/index.d.cts +91 -32
- package/index.d.mts +91 -32
- package/index.mjs +146 -81
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3451,7 +3451,9 @@ class DomainsNamespace {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
|
|
3453
3453
|
class GitRepoBranchesNamespace {
|
|
3454
|
-
|
|
3454
|
+
repoId;
|
|
3455
|
+
apiClient;
|
|
3456
|
+
constructor({ repoId, apiClient }) {
|
|
3455
3457
|
this.repoId = repoId;
|
|
3456
3458
|
this.apiClient = apiClient;
|
|
3457
3459
|
}
|
|
@@ -3488,7 +3490,9 @@ class GitRepoBranchesNamespace {
|
|
|
3488
3490
|
}
|
|
3489
3491
|
}
|
|
3490
3492
|
class GitRepoGitHubSyncNamespace {
|
|
3491
|
-
|
|
3493
|
+
repoId;
|
|
3494
|
+
apiClient;
|
|
3495
|
+
constructor({ repoId, apiClient }) {
|
|
3492
3496
|
this.repoId = repoId;
|
|
3493
3497
|
this.apiClient = apiClient;
|
|
3494
3498
|
}
|
|
@@ -3527,7 +3531,9 @@ class GitRepoGitHubSyncNamespace {
|
|
|
3527
3531
|
}
|
|
3528
3532
|
}
|
|
3529
3533
|
class GitRepoTriggersNamespace {
|
|
3530
|
-
|
|
3534
|
+
repoId;
|
|
3535
|
+
apiClient;
|
|
3536
|
+
constructor({ repoId, apiClient }) {
|
|
3531
3537
|
this.repoId = repoId;
|
|
3532
3538
|
this.apiClient = apiClient;
|
|
3533
3539
|
}
|
|
@@ -3566,7 +3572,9 @@ class GitRepoTriggersNamespace {
|
|
|
3566
3572
|
}
|
|
3567
3573
|
}
|
|
3568
3574
|
class GitRepoOdbBlobsNamespace {
|
|
3569
|
-
|
|
3575
|
+
repoId;
|
|
3576
|
+
apiClient;
|
|
3577
|
+
constructor({ repoId, apiClient }) {
|
|
3570
3578
|
this.repoId = repoId;
|
|
3571
3579
|
this.apiClient = apiClient;
|
|
3572
3580
|
}
|
|
@@ -3579,7 +3587,9 @@ class GitRepoOdbBlobsNamespace {
|
|
|
3579
3587
|
}
|
|
3580
3588
|
}
|
|
3581
3589
|
class GitRepoOdbTreesNamespace {
|
|
3582
|
-
|
|
3590
|
+
repoId;
|
|
3591
|
+
apiClient;
|
|
3592
|
+
constructor({ repoId, apiClient }) {
|
|
3583
3593
|
this.repoId = repoId;
|
|
3584
3594
|
this.apiClient = apiClient;
|
|
3585
3595
|
}
|
|
@@ -3592,7 +3602,9 @@ class GitRepoOdbTreesNamespace {
|
|
|
3592
3602
|
}
|
|
3593
3603
|
}
|
|
3594
3604
|
class GitRepoContentsNamespace {
|
|
3595
|
-
|
|
3605
|
+
repoId;
|
|
3606
|
+
apiClient;
|
|
3607
|
+
constructor({ repoId, apiClient }) {
|
|
3596
3608
|
this.repoId = repoId;
|
|
3597
3609
|
this.apiClient = apiClient;
|
|
3598
3610
|
}
|
|
@@ -3659,7 +3671,9 @@ class GitRepoContentsNamespace {
|
|
|
3659
3671
|
}
|
|
3660
3672
|
}
|
|
3661
3673
|
class GitRepoCommitsNamespace {
|
|
3662
|
-
|
|
3674
|
+
repoId;
|
|
3675
|
+
apiClient;
|
|
3676
|
+
constructor({ repoId, apiClient }) {
|
|
3663
3677
|
this.repoId = repoId;
|
|
3664
3678
|
this.apiClient = apiClient;
|
|
3665
3679
|
}
|
|
@@ -3684,7 +3698,9 @@ class GitRepoCommitsNamespace {
|
|
|
3684
3698
|
}
|
|
3685
3699
|
}
|
|
3686
3700
|
class GitRepoTagsNamespace {
|
|
3687
|
-
|
|
3701
|
+
repoId;
|
|
3702
|
+
apiClient;
|
|
3703
|
+
constructor({ repoId, apiClient }) {
|
|
3688
3704
|
this.repoId = repoId;
|
|
3689
3705
|
this.apiClient = apiClient;
|
|
3690
3706
|
}
|
|
@@ -3718,18 +3734,6 @@ class GitRepoTagsNamespace {
|
|
|
3718
3734
|
}
|
|
3719
3735
|
}
|
|
3720
3736
|
class GitRepo {
|
|
3721
|
-
constructor(repoId, apiClient) {
|
|
3722
|
-
this.apiClient = apiClient;
|
|
3723
|
-
this.repoId = repoId;
|
|
3724
|
-
this.branches = new GitRepoBranchesNamespace(repoId, apiClient);
|
|
3725
|
-
this.contents = new GitRepoContentsNamespace(repoId, apiClient);
|
|
3726
|
-
this.commits = new GitRepoCommitsNamespace(repoId, apiClient);
|
|
3727
|
-
this.tags = new GitRepoTagsNamespace(repoId, apiClient);
|
|
3728
|
-
this.triggers = new GitRepoTriggersNamespace(repoId, apiClient);
|
|
3729
|
-
this.githubSync = new GitRepoGitHubSyncNamespace(repoId, apiClient);
|
|
3730
|
-
this.blobs = new GitRepoOdbBlobsNamespace(repoId, apiClient);
|
|
3731
|
-
this.trees = new GitRepoOdbTreesNamespace(repoId, apiClient);
|
|
3732
|
-
}
|
|
3733
3737
|
repoId;
|
|
3734
3738
|
/**
|
|
3735
3739
|
* Manage branches in this repository.
|
|
@@ -3884,6 +3888,19 @@ class GitRepo {
|
|
|
3884
3888
|
* ```
|
|
3885
3889
|
*/
|
|
3886
3890
|
trees;
|
|
3891
|
+
apiClient;
|
|
3892
|
+
constructor({ repoId, apiClient }) {
|
|
3893
|
+
this.repoId = repoId;
|
|
3894
|
+
this.apiClient = apiClient;
|
|
3895
|
+
this.branches = new GitRepoBranchesNamespace({ repoId, apiClient });
|
|
3896
|
+
this.contents = new GitRepoContentsNamespace({ repoId, apiClient });
|
|
3897
|
+
this.commits = new GitRepoCommitsNamespace({ repoId, apiClient });
|
|
3898
|
+
this.tags = new GitRepoTagsNamespace({ repoId, apiClient });
|
|
3899
|
+
this.triggers = new GitRepoTriggersNamespace({ repoId, apiClient });
|
|
3900
|
+
this.githubSync = new GitRepoGitHubSyncNamespace({ repoId, apiClient });
|
|
3901
|
+
this.blobs = new GitRepoOdbBlobsNamespace({ repoId, apiClient });
|
|
3902
|
+
this.trees = new GitRepoOdbTreesNamespace({ repoId, apiClient });
|
|
3903
|
+
}
|
|
3887
3904
|
/**
|
|
3888
3905
|
* Compare two revs in this repository.
|
|
3889
3906
|
*
|
|
@@ -3916,7 +3933,7 @@ class GitReposNamespace {
|
|
|
3916
3933
|
const repoId = response.repoId;
|
|
3917
3934
|
return {
|
|
3918
3935
|
repoId,
|
|
3919
|
-
repo: new GitRepo(repoId, this.apiClient)
|
|
3936
|
+
repo: new GitRepo({ repoId, apiClient: this.apiClient })
|
|
3920
3937
|
};
|
|
3921
3938
|
}
|
|
3922
3939
|
/**
|
|
@@ -3935,7 +3952,7 @@ class GitReposNamespace {
|
|
|
3935
3952
|
* Get a repository instance by ID.
|
|
3936
3953
|
*/
|
|
3937
3954
|
ref({ repoId }) {
|
|
3938
|
-
return new GitRepo(repoId, this.apiClient);
|
|
3955
|
+
return new GitRepo({ repoId, apiClient: this.apiClient });
|
|
3939
3956
|
}
|
|
3940
3957
|
/**
|
|
3941
3958
|
* Delete a git repository.
|
|
@@ -3983,18 +4000,27 @@ class GitNamespace {
|
|
|
3983
4000
|
}
|
|
3984
4001
|
|
|
3985
4002
|
class Identity {
|
|
3986
|
-
constructor(identityId, apiClient) {
|
|
3987
|
-
this.apiClient = apiClient;
|
|
3988
|
-
this.identityId = identityId;
|
|
3989
|
-
this.permissions = new IdentityPermissions(identityId, apiClient);
|
|
3990
|
-
this.tokens = new IdentityTokens(identityId, apiClient);
|
|
3991
|
-
}
|
|
3992
4003
|
identityId;
|
|
3993
4004
|
permissions;
|
|
3994
4005
|
tokens;
|
|
4006
|
+
apiClient;
|
|
4007
|
+
constructor({
|
|
4008
|
+
identityId,
|
|
4009
|
+
apiClient
|
|
4010
|
+
}) {
|
|
4011
|
+
this.identityId = identityId;
|
|
4012
|
+
this.apiClient = apiClient;
|
|
4013
|
+
this.permissions = new IdentityPermissions({ identityId, apiClient });
|
|
4014
|
+
this.tokens = new IdentityTokens({ identityId, apiClient });
|
|
4015
|
+
}
|
|
3995
4016
|
}
|
|
3996
4017
|
class IdentityTokens {
|
|
3997
|
-
|
|
4018
|
+
identityId;
|
|
4019
|
+
apiClient;
|
|
4020
|
+
constructor({
|
|
4021
|
+
identityId,
|
|
4022
|
+
apiClient
|
|
4023
|
+
}) {
|
|
3998
4024
|
this.identityId = identityId;
|
|
3999
4025
|
this.apiClient = apiClient;
|
|
4000
4026
|
}
|
|
@@ -4036,17 +4062,27 @@ class IdentityTokens {
|
|
|
4036
4062
|
}
|
|
4037
4063
|
}
|
|
4038
4064
|
class IdentityPermissions {
|
|
4039
|
-
|
|
4065
|
+
git;
|
|
4066
|
+
vms;
|
|
4067
|
+
identityId;
|
|
4068
|
+
apiClient;
|
|
4069
|
+
constructor({
|
|
4070
|
+
identityId,
|
|
4071
|
+
apiClient
|
|
4072
|
+
}) {
|
|
4040
4073
|
this.identityId = identityId;
|
|
4041
4074
|
this.apiClient = apiClient;
|
|
4042
|
-
this.git = new GitPermissions(identityId, apiClient);
|
|
4043
|
-
this.vms = new VmPermissions(identityId, apiClient);
|
|
4075
|
+
this.git = new GitPermissions({ identityId, apiClient });
|
|
4076
|
+
this.vms = new VmPermissions({ identityId, apiClient });
|
|
4044
4077
|
}
|
|
4045
|
-
git;
|
|
4046
|
-
vms;
|
|
4047
4078
|
}
|
|
4048
4079
|
class GitPermissions {
|
|
4049
|
-
|
|
4080
|
+
identityId;
|
|
4081
|
+
apiClient;
|
|
4082
|
+
constructor({
|
|
4083
|
+
identityId,
|
|
4084
|
+
apiClient
|
|
4085
|
+
}) {
|
|
4050
4086
|
this.identityId = identityId;
|
|
4051
4087
|
this.apiClient = apiClient;
|
|
4052
4088
|
}
|
|
@@ -4124,7 +4160,12 @@ class GitPermissions {
|
|
|
4124
4160
|
}
|
|
4125
4161
|
}
|
|
4126
4162
|
class VmPermissions {
|
|
4127
|
-
|
|
4163
|
+
identityId;
|
|
4164
|
+
apiClient;
|
|
4165
|
+
constructor({
|
|
4166
|
+
identityId,
|
|
4167
|
+
apiClient
|
|
4168
|
+
}) {
|
|
4128
4169
|
this.identityId = identityId;
|
|
4129
4170
|
this.apiClient = apiClient;
|
|
4130
4171
|
}
|
|
@@ -4229,14 +4270,14 @@ class IdentitiesNamespace {
|
|
|
4229
4270
|
const identityId = response.id;
|
|
4230
4271
|
return {
|
|
4231
4272
|
identityId,
|
|
4232
|
-
identity: new Identity(identityId, this.apiClient)
|
|
4273
|
+
identity: new Identity({ identityId, apiClient: this.apiClient })
|
|
4233
4274
|
};
|
|
4234
4275
|
}
|
|
4235
4276
|
/**
|
|
4236
4277
|
* Create an identity instance by ID without making an api call.
|
|
4237
4278
|
*/
|
|
4238
4279
|
ref({ identityId }) {
|
|
4239
|
-
return new Identity(identityId, this.apiClient);
|
|
4280
|
+
return new Identity({ identityId, apiClient: this.apiClient });
|
|
4240
4281
|
}
|
|
4241
4282
|
/**
|
|
4242
4283
|
* Delete an identity.
|
|
@@ -4288,11 +4329,15 @@ class DnsNamespace {
|
|
|
4288
4329
|
}
|
|
4289
4330
|
|
|
4290
4331
|
class Deployment {
|
|
4291
|
-
|
|
4292
|
-
|
|
4332
|
+
deploymentId;
|
|
4333
|
+
apiClient;
|
|
4334
|
+
constructor({
|
|
4335
|
+
deploymentId,
|
|
4336
|
+
apiClient
|
|
4337
|
+
}) {
|
|
4293
4338
|
this.deploymentId = deploymentId;
|
|
4339
|
+
this.apiClient = apiClient;
|
|
4294
4340
|
}
|
|
4295
|
-
deploymentId;
|
|
4296
4341
|
/**
|
|
4297
4342
|
* Get details of this deployment (execute type).
|
|
4298
4343
|
*/
|
|
@@ -4387,7 +4432,10 @@ class DeploymentsNamespace {
|
|
|
4387
4432
|
});
|
|
4388
4433
|
return {
|
|
4389
4434
|
deploymentId: response.deploymentId,
|
|
4390
|
-
deployment: new Deployment(
|
|
4435
|
+
deployment: new Deployment({
|
|
4436
|
+
deploymentId: response.deploymentId,
|
|
4437
|
+
apiClient: this.apiClient
|
|
4438
|
+
}),
|
|
4391
4439
|
domains: body.domains || []
|
|
4392
4440
|
};
|
|
4393
4441
|
}
|
|
@@ -4407,7 +4455,7 @@ class DeploymentsNamespace {
|
|
|
4407
4455
|
* Get a deployment instance by ID.
|
|
4408
4456
|
*/
|
|
4409
4457
|
ref({ deploymentId }) {
|
|
4410
|
-
return new Deployment(deploymentId, this.apiClient);
|
|
4458
|
+
return new Deployment({ deploymentId, apiClient: this.apiClient });
|
|
4411
4459
|
}
|
|
4412
4460
|
}
|
|
4413
4461
|
class RunsNamespace {
|
|
@@ -4463,11 +4511,13 @@ class ServerlessNamespace {
|
|
|
4463
4511
|
}
|
|
4464
4512
|
|
|
4465
4513
|
class FileSystem {
|
|
4466
|
-
|
|
4514
|
+
vm = null;
|
|
4515
|
+
vmId;
|
|
4516
|
+
client;
|
|
4517
|
+
constructor({ vmId, client }) {
|
|
4467
4518
|
this.vmId = vmId;
|
|
4468
4519
|
this.client = client;
|
|
4469
4520
|
}
|
|
4470
|
-
vm = null;
|
|
4471
4521
|
/**
|
|
4472
4522
|
* @internal
|
|
4473
4523
|
* Set the parent VM instance for exec operations
|
|
@@ -4670,7 +4720,9 @@ class FileSystem {
|
|
|
4670
4720
|
}
|
|
4671
4721
|
|
|
4672
4722
|
class SystemdService {
|
|
4673
|
-
|
|
4723
|
+
serviceId;
|
|
4724
|
+
systemd;
|
|
4725
|
+
constructor({ serviceId, systemd }) {
|
|
4674
4726
|
this.serviceId = serviceId;
|
|
4675
4727
|
this.systemd = systemd;
|
|
4676
4728
|
}
|
|
@@ -4719,11 +4771,13 @@ class SystemdService {
|
|
|
4719
4771
|
}
|
|
4720
4772
|
}
|
|
4721
4773
|
class Systemd {
|
|
4722
|
-
|
|
4774
|
+
vm = null;
|
|
4775
|
+
vmId;
|
|
4776
|
+
client;
|
|
4777
|
+
constructor({ vmId, client }) {
|
|
4723
4778
|
this.vmId = vmId;
|
|
4724
4779
|
this.client = client;
|
|
4725
4780
|
}
|
|
4726
|
-
vm = null;
|
|
4727
4781
|
/**
|
|
4728
4782
|
* @internal
|
|
4729
4783
|
* Set the parent VM instance for operations
|
|
@@ -4849,7 +4903,7 @@ class Systemd {
|
|
|
4849
4903
|
* @returns A SystemdService instance
|
|
4850
4904
|
*/
|
|
4851
4905
|
service(serviceId) {
|
|
4852
|
-
return new SystemdService(serviceId, this);
|
|
4906
|
+
return new SystemdService({ serviceId, systemd: this });
|
|
4853
4907
|
}
|
|
4854
4908
|
}
|
|
4855
4909
|
|
|
@@ -5219,11 +5273,13 @@ function composeVmSpecs(specs) {
|
|
|
5219
5273
|
}
|
|
5220
5274
|
|
|
5221
5275
|
class VmTerminals {
|
|
5222
|
-
|
|
5276
|
+
vm = null;
|
|
5277
|
+
vmId;
|
|
5278
|
+
client;
|
|
5279
|
+
constructor({ vmId, client }) {
|
|
5223
5280
|
this.vmId = vmId;
|
|
5224
5281
|
this.client = client;
|
|
5225
5282
|
}
|
|
5226
|
-
vm = null;
|
|
5227
5283
|
/**
|
|
5228
5284
|
* List all terminals in the VM.
|
|
5229
5285
|
* @returns Array of terminal information
|
|
@@ -5268,15 +5324,10 @@ class VmTerminals {
|
|
|
5268
5324
|
}
|
|
5269
5325
|
}
|
|
5270
5326
|
class Vm {
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
this.
|
|
5275
|
-
this.fs._setVm(this);
|
|
5276
|
-
this.terminals = new VmTerminals(vmId, apiClient);
|
|
5277
|
-
this.terminals._setVm(this);
|
|
5278
|
-
this.systemd = new Systemd(vmId, apiClient);
|
|
5279
|
-
this.systemd._setVm(this);
|
|
5327
|
+
/** @internal */
|
|
5328
|
+
_freestyle;
|
|
5329
|
+
get apiClient() {
|
|
5330
|
+
return this._freestyle._apiClient;
|
|
5280
5331
|
}
|
|
5281
5332
|
vmId;
|
|
5282
5333
|
fs;
|
|
@@ -5284,6 +5335,16 @@ class Vm {
|
|
|
5284
5335
|
systemd;
|
|
5285
5336
|
/** @internal */
|
|
5286
5337
|
_linux_username;
|
|
5338
|
+
constructor({ vmId, freestyle }) {
|
|
5339
|
+
this.vmId = vmId;
|
|
5340
|
+
this.fs = new FileSystem({ vmId, client: freestyle._apiClient });
|
|
5341
|
+
this.fs._setVm(this);
|
|
5342
|
+
this.terminals = new VmTerminals({ vmId, client: freestyle._apiClient });
|
|
5343
|
+
this.terminals._setVm(this);
|
|
5344
|
+
this.systemd = new Systemd({ vmId, client: freestyle._apiClient });
|
|
5345
|
+
this.systemd._setVm(this);
|
|
5346
|
+
this._freestyle = freestyle;
|
|
5347
|
+
}
|
|
5287
5348
|
/**
|
|
5288
5349
|
* Get the current state and metadata of the VM.
|
|
5289
5350
|
* @returns VM state information
|
|
@@ -5294,7 +5355,7 @@ class Vm {
|
|
|
5294
5355
|
});
|
|
5295
5356
|
}
|
|
5296
5357
|
user({ username }) {
|
|
5297
|
-
let vm = new Vm(this.vmId, this.
|
|
5358
|
+
let vm = new Vm({ vmId: this.vmId, freestyle: this._freestyle });
|
|
5298
5359
|
vm._linux_username = username;
|
|
5299
5360
|
return vm;
|
|
5300
5361
|
}
|
|
@@ -5394,7 +5455,7 @@ class Vm {
|
|
|
5394
5455
|
const vmId = response.id;
|
|
5395
5456
|
return {
|
|
5396
5457
|
vmId,
|
|
5397
|
-
vm: new Vm(vmId, this.
|
|
5458
|
+
vm: new Vm({ vmId, freestyle: this._freestyle })
|
|
5398
5459
|
};
|
|
5399
5460
|
}
|
|
5400
5461
|
/**
|
|
@@ -5426,7 +5487,7 @@ class Vm {
|
|
|
5426
5487
|
* Create a VM instance by ID without making an api call.
|
|
5427
5488
|
*/
|
|
5428
5489
|
ref({ vmId }) {
|
|
5429
|
-
return new Vm(vmId, this.
|
|
5490
|
+
return new Vm({ vmId, freestyle: this._freestyle });
|
|
5430
5491
|
}
|
|
5431
5492
|
async delete({ vmId }) {
|
|
5432
5493
|
return this.apiClient.delete("/v1/vms/{vm_id}", {
|
|
@@ -5536,9 +5597,9 @@ function collectSpecBuilders(spec) {
|
|
|
5536
5597
|
return builders;
|
|
5537
5598
|
}
|
|
5538
5599
|
class VmsNamespace {
|
|
5539
|
-
constructor(
|
|
5540
|
-
this.
|
|
5541
|
-
this.snapshots = new VmSnapshotsNamespace(
|
|
5600
|
+
constructor(freestyle) {
|
|
5601
|
+
this.freestyle = freestyle;
|
|
5602
|
+
this.snapshots = new VmSnapshotsNamespace(freestyle._apiClient);
|
|
5542
5603
|
}
|
|
5543
5604
|
snapshots;
|
|
5544
5605
|
/**
|
|
@@ -5599,14 +5660,14 @@ class VmsNamespace {
|
|
|
5599
5660
|
config = await builder.configure(config);
|
|
5600
5661
|
}
|
|
5601
5662
|
}
|
|
5602
|
-
const response = await this.
|
|
5663
|
+
const response = await this.freestyle._apiClient.post("/v1/vms", {
|
|
5603
5664
|
body: {
|
|
5604
5665
|
...config,
|
|
5605
5666
|
template: config.template instanceof VmTemplate ? config.template["raw"] : config.template
|
|
5606
5667
|
}
|
|
5607
5668
|
});
|
|
5608
5669
|
const vmId = response.id;
|
|
5609
|
-
const vm = new Vm(vmId, this.
|
|
5670
|
+
const vm = new Vm({ vmId, freestyle: this.freestyle });
|
|
5610
5671
|
for (const key in builders) {
|
|
5611
5672
|
const builder = builders[key];
|
|
5612
5673
|
if (builder) {
|
|
@@ -5630,7 +5691,7 @@ class VmsNamespace {
|
|
|
5630
5691
|
* @returns List of VMs with their states and metadata
|
|
5631
5692
|
*/
|
|
5632
5693
|
async list() {
|
|
5633
|
-
return this.
|
|
5694
|
+
return this.freestyle._apiClient.get("/v1/vms", void 0);
|
|
5634
5695
|
}
|
|
5635
5696
|
/**
|
|
5636
5697
|
* Get VM by ID.
|
|
@@ -5642,7 +5703,7 @@ class VmsNamespace {
|
|
|
5642
5703
|
vmId,
|
|
5643
5704
|
spec
|
|
5644
5705
|
}) {
|
|
5645
|
-
const vm = new Vm(vmId, this.
|
|
5706
|
+
const vm = new Vm({ vmId, freestyle: this.freestyle });
|
|
5646
5707
|
if (spec) {
|
|
5647
5708
|
const allBuilders = collectSpecBuilders(spec);
|
|
5648
5709
|
for (const [key, builder] of Object.entries(allBuilders)) {
|
|
@@ -5662,7 +5723,7 @@ class VmsNamespace {
|
|
|
5662
5723
|
vmId,
|
|
5663
5724
|
spec
|
|
5664
5725
|
}) {
|
|
5665
|
-
const vm = new Vm(vmId, this.
|
|
5726
|
+
const vm = new Vm({ vmId, freestyle: this.freestyle });
|
|
5666
5727
|
if (spec) {
|
|
5667
5728
|
const allBuilders = collectSpecBuilders(spec);
|
|
5668
5729
|
for (const [key, builder] of Object.entries(allBuilders)) {
|
|
@@ -5676,7 +5737,7 @@ class VmsNamespace {
|
|
|
5676
5737
|
return vm;
|
|
5677
5738
|
}
|
|
5678
5739
|
async delete({ vmId }) {
|
|
5679
|
-
return this.
|
|
5740
|
+
return this.freestyle._apiClient.delete("/v1/vms/{vm_id}", {
|
|
5680
5741
|
params: { vm_id: vmId }
|
|
5681
5742
|
});
|
|
5682
5743
|
}
|
|
@@ -5749,7 +5810,11 @@ function linuxUsernameHeader(linux_username) {
|
|
|
5749
5810
|
}
|
|
5750
5811
|
|
|
5751
5812
|
class Freestyle {
|
|
5752
|
-
|
|
5813
|
+
/**
|
|
5814
|
+
* @internal
|
|
5815
|
+
* Internal API client instance
|
|
5816
|
+
*/
|
|
5817
|
+
_apiClient;
|
|
5753
5818
|
// Organized namespaces
|
|
5754
5819
|
domains;
|
|
5755
5820
|
git;
|
|
@@ -5775,19 +5840,19 @@ class Freestyle {
|
|
|
5775
5840
|
);
|
|
5776
5841
|
}
|
|
5777
5842
|
}
|
|
5778
|
-
this.
|
|
5779
|
-
this.domains = new DomainsNamespace(this.
|
|
5780
|
-
this.git = new GitNamespace(this.
|
|
5781
|
-
this.identities = new IdentitiesNamespace(this.
|
|
5782
|
-
this.dns = new DnsNamespace(this.
|
|
5783
|
-
this.serverless = new ServerlessNamespace(this.
|
|
5784
|
-
this.vms = new VmsNamespace(this
|
|
5843
|
+
this._apiClient = new ApiClient(options);
|
|
5844
|
+
this.domains = new DomainsNamespace(this._apiClient);
|
|
5845
|
+
this.git = new GitNamespace(this._apiClient, this);
|
|
5846
|
+
this.identities = new IdentitiesNamespace(this._apiClient);
|
|
5847
|
+
this.dns = new DnsNamespace(this._apiClient);
|
|
5848
|
+
this.serverless = new ServerlessNamespace(this._apiClient);
|
|
5849
|
+
this.vms = new VmsNamespace(this);
|
|
5785
5850
|
}
|
|
5786
5851
|
/**
|
|
5787
5852
|
* Helper method to make raw fetch requests to the API.
|
|
5788
5853
|
*/
|
|
5789
5854
|
fetch(path, init) {
|
|
5790
|
-
return this.
|
|
5855
|
+
return this._apiClient.fetch(path, init);
|
|
5791
5856
|
}
|
|
5792
5857
|
}
|
|
5793
5858
|
function createLazyFreestyle(options = {}) {
|