fix(core): update
This commit is contained in:
parent
2f175e9d64
commit
5412ab524b
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@apiclient.xyz/hetznercloud',
|
name: '@apiclient.xyz/hetznercloud',
|
||||||
version: '1.0.12',
|
version: '1.0.13',
|
||||||
description: 'an unofficial api client for the hetzner cloud api'
|
description: 'an unofficial api client for the hetzner cloud api'
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@ export class HetznerAccount {
|
|||||||
return HetznerServer.getServers(this);
|
return HetznerServer.getServers(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getServerByLabel(labelArg: string, valueArg?: string) {
|
||||||
|
return HetznerServer.getServerByLabel(this, labelArg, valueArg);
|
||||||
|
}
|
||||||
|
|
||||||
public async createServer(optionsArg: plugins.tsclass.typeFestOwn.SecondArgument<typeof HetznerServer.create>) {
|
public async createServer(optionsArg: plugins.tsclass.typeFestOwn.SecondArgument<typeof HetznerServer.create>) {
|
||||||
return HetznerServer.create(this, optionsArg);
|
return HetznerServer.create(this, optionsArg);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ export class HetznerServer {
|
|||||||
name: string;
|
name: string;
|
||||||
type: types.THetznerCloudServerName;
|
type: types.THetznerCloudServerName;
|
||||||
location: types.THetznerCloudLocationName;
|
location: types.THetznerCloudLocationName;
|
||||||
labels: {[key: string]: string},
|
labels?: {[key: string]: string},
|
||||||
|
userData?: string,
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const server = new HetznerServer(hetznerAccountRefArg);
|
const server = new HetznerServer(hetznerAccountRefArg);
|
||||||
@ -23,6 +24,7 @@ export class HetznerServer {
|
|||||||
start_after_create: true,
|
start_after_create: true,
|
||||||
labels: optionsArg.labels || {} as any,
|
labels: optionsArg.labels || {} as any,
|
||||||
location: optionsArg.location,
|
location: optionsArg.location,
|
||||||
|
user_data: optionsArg.userData || '',
|
||||||
public_net: {
|
public_net: {
|
||||||
enable_ipv4: true,
|
enable_ipv4: true,
|
||||||
enable_ipv6: true,
|
enable_ipv6: true,
|
||||||
@ -50,6 +52,15 @@ export class HetznerServer {
|
|||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async getServerByLabel(hetznerAccountRefArg: HetznerAccount, labelArg: string, valueArg?: string) {
|
||||||
|
const servers = await HetznerServer.getServers(hetznerAccountRefArg);
|
||||||
|
for (const server of servers) {
|
||||||
|
if (server.data.labels[labelArg] === valueArg) {
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public hetznerAccountRef: HetznerAccount;
|
public hetznerAccountRef: HetznerAccount;
|
||||||
public data: types.IServer;
|
public data: types.IServer;
|
||||||
|
Loading…
Reference in New Issue
Block a user