digitalocean/ts/do.classes.dodroplet.ts

33 lines
899 B
TypeScript
Raw Normal View History

2024-01-24 14:24:53 +00:00
import * as plugins from './do.plugins.js';
2019-01-05 21:00:02 +00:00
2024-01-24 14:24:53 +00:00
import { type TDropletSizes, type TRegions, type TImages } from './interfaces/index.js';
import { DigitalOceanAccount } from './do.classes.doaccount.js';
2019-01-05 21:00:02 +00:00
export class DigitalOceanDroplet {
public static async createDroplet(dropletCreateOptions: {
account: DigitalOceanAccount;
name: string;
size: TDropletSizes;
region: TRegions;
image: string | TImages;
}) {
const response = await dropletCreateOptions.account.request('/droplets', 'POST', {
name: dropletCreateOptions.name,
region: dropletCreateOptions.region,
size: dropletCreateOptions.size,
image: dropletCreateOptions.image,
ssh_keys: null,
backups: false,
ipv6: true,
user_data: null,
private_networking: null,
volumes: null,
tags: ['web']
});
console.log(response);
}
constructor() {}
}