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