@modexvpn/hcloud
Version:
SDK for Hetzner Cloud API
1,464 lines (1,430 loc) • 40 kB
TypeScript
import { z } from 'zod';
declare const MetaSchema: z.ZodObject<{
pagination: z.ZodObject<{
page: z.ZodNumber;
per_page: z.ZodNumber;
previous_page: z.ZodNullable<z.ZodNumber>;
next_page: z.ZodNullable<z.ZodNumber>;
last_page: z.ZodNumber;
total_entries: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
}, {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
}>;
}, "strip", z.ZodTypeAny, {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
}, {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
}>;
type Meta = z.infer<typeof MetaSchema>;
declare const ServerTypeSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
cores: z.ZodNumber;
memory: z.ZodNumber;
disk: z.ZodNumber;
deprecated: z.ZodBoolean;
prices: z.ZodArray<z.ZodObject<{
location: z.ZodString;
price_hourly: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
price_monthly: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
included_traffic: z.ZodNumber;
price_per_tb_traffic: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
}, "strip", z.ZodTypeAny, {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}, {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}>, "many">;
storage_type: z.ZodString;
cpu_type: z.ZodString;
architecture: z.ZodString;
deprecation: z.ZodOptional<z.ZodObject<{
announced: z.ZodString;
unavailable_after: z.ZodString;
}, "strip", z.ZodTypeAny, {
announced: string;
unavailable_after: string;
}, {
announced: string;
unavailable_after: string;
}>>;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}, {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}>;
type ServerType = z.infer<typeof ServerTypeSchema>;
/**
* Query parameters for fetching server types.
*
* @property name - Filter by exact server name (optional).
* @property page - Page number (optional, defaults to 1 on API side).
* @property per_page - Entries per page (optional, defaults to 25 on API side).
*/
type GetServerTypeQuery = {
name?: string;
page?: number;
per_page?: number;
};
type GetServersResponse$1 = {
servers: ServerType[];
meta: Meta;
};
declare const ActionSchema: z.ZodObject<{
id: z.ZodNumber;
command: z.ZodString;
status: z.ZodEnum<["running", "success", "error"]>;
progress: z.ZodNumber;
started: z.ZodString;
finished: z.ZodNullable<z.ZodString>;
resources: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
type: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
type: string;
}, {
id: number;
type: string;
}>, "many">;
error: z.ZodNullable<z.ZodObject<{
code: z.ZodString;
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
code: string;
message: string;
}, {
code: string;
message: string;
}>>;
}, "strip", z.ZodTypeAny, {
id: number;
command: string;
status: "running" | "success" | "error";
error: {
code: string;
message: string;
} | null;
progress: number;
started: string;
finished: string | null;
resources: {
id: number;
type: string;
}[];
}, {
id: number;
command: string;
status: "running" | "success" | "error";
error: {
code: string;
message: string;
} | null;
progress: number;
started: string;
finished: string | null;
resources: {
id: number;
type: string;
}[];
}>;
type Action = z.infer<typeof ActionSchema>;
declare enum ServerStatus {
Running = "running",
Initializing = "initializing",
Off = "off",
Deleting = "deleting",
Starting = "starting",
Stopping = "stopping"
}
declare const ServerSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
status: z.ZodEnum<[ServerStatus.Running, ServerStatus.Initializing, ServerStatus.Off, ServerStatus.Deleting, ServerStatus.Starting, ServerStatus.Stopping]>;
created: z.ZodString;
public_net: z.ZodObject<{
ipv4: z.ZodObject<{
id: z.ZodNumber;
ip: z.ZodString;
blocked: z.ZodBoolean;
dns_ptr: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
}, {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
}>;
ipv6: z.ZodObject<{
id: z.ZodNumber;
ip: z.ZodString;
blocked: z.ZodBoolean;
dns_ptr: z.ZodArray<z.ZodObject<{
ip: z.ZodString;
dns_ptr: z.ZodString;
}, "strip", z.ZodTypeAny, {
ip: string;
dns_ptr: string;
}, {
ip: string;
dns_ptr: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
}, {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
}>;
floating_ips: z.ZodArray<z.ZodNumber, "many">;
firewalls: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
status: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
status: string;
}, {
id: number;
status: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
ipv4: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
};
ipv6: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
};
floating_ips: number[];
firewalls: {
id: number;
status: string;
}[];
}, {
ipv4: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
};
ipv6: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
};
floating_ips: number[];
firewalls: {
id: number;
status: string;
}[];
}>;
private_net: z.ZodArray<z.ZodObject<{
network: z.ZodNumber;
ip: z.ZodString;
alias_ips: z.ZodArray<z.ZodString, "many">;
mac_address: z.ZodString;
}, "strip", z.ZodTypeAny, {
ip: string;
network: number;
alias_ips: string[];
mac_address: string;
}, {
ip: string;
network: number;
alias_ips: string[];
mac_address: string;
}>, "many">;
server_type: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
cores: z.ZodNumber;
memory: z.ZodNumber;
disk: z.ZodNumber;
deprecated: z.ZodBoolean;
prices: z.ZodArray<z.ZodObject<{
location: z.ZodString;
price_hourly: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
price_monthly: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
included_traffic: z.ZodNumber;
price_per_tb_traffic: z.ZodObject<{
net: z.ZodString;
gross: z.ZodString;
}, "strip", z.ZodTypeAny, {
net: string;
gross: string;
}, {
net: string;
gross: string;
}>;
}, "strip", z.ZodTypeAny, {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}, {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}>, "many">;
storage_type: z.ZodString;
cpu_type: z.ZodString;
architecture: z.ZodString;
deprecation: z.ZodOptional<z.ZodObject<{
announced: z.ZodString;
unavailable_after: z.ZodString;
}, "strip", z.ZodTypeAny, {
announced: string;
unavailable_after: string;
}, {
announced: string;
unavailable_after: string;
}>>;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}, {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}>;
datacenter: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
location: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
country: z.ZodString;
city: z.ZodString;
latitude: z.ZodNumber;
longitude: z.ZodNumber;
network_zone: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
}, {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
}>;
server_types: z.ZodObject<{
supported: z.ZodArray<z.ZodNumber, "many">;
available: z.ZodArray<z.ZodNumber, "many">;
available_for_migration: z.ZodArray<z.ZodNumber, "many">;
}, "strip", z.ZodTypeAny, {
supported: number[];
available: number[];
available_for_migration: number[];
}, {
supported: number[];
available: number[];
available_for_migration: number[];
}>;
}, "strip", z.ZodTypeAny, {
id: number;
location: {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
};
name: string;
description: string;
server_types: {
supported: number[];
available: number[];
available_for_migration: number[];
};
}, {
id: number;
location: {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
};
name: string;
description: string;
server_types: {
supported: number[];
available: number[];
available_for_migration: number[];
};
}>;
image: z.ZodOptional<z.ZodObject<{
id: z.ZodNumber;
type: z.ZodString;
status: z.ZodString;
name: z.ZodString;
description: z.ZodString;
image_size: z.ZodNumber;
disk_size: z.ZodNumber;
created: z.ZodString;
created_from: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
}, {
id: number;
name: string;
}>;
bound_to: z.ZodNullable<z.ZodNumber>;
os_flavor: z.ZodString;
os_version: z.ZodString;
rapid_deploy: z.ZodBoolean;
protection: z.ZodObject<{
delete: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
delete: boolean;
}, {
delete: boolean;
}>;
deprecated: z.ZodOptional<z.ZodString>;
deleted: z.ZodNullable<z.ZodString>;
labels: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>;
architecture: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
status: string;
type: string;
name: string;
description: string;
architecture: string;
image_size: number;
disk_size: number;
created: string;
created_from: {
id: number;
name: string;
};
bound_to: number | null;
os_flavor: string;
os_version: string;
rapid_deploy: boolean;
protection: {
delete: boolean;
};
deleted: string | null;
labels: Record<string, string>;
deprecated?: string | undefined;
}, {
id: number;
status: string;
type: string;
name: string;
description: string;
architecture: string;
image_size: number;
disk_size: number;
created: string;
created_from: {
id: number;
name: string;
};
bound_to: number | null;
os_flavor: string;
os_version: string;
rapid_deploy: boolean;
protection: {
delete: boolean;
};
deleted: string | null;
labels: Record<string, string>;
deprecated?: string | undefined;
}>>;
iso: z.ZodOptional<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
type: z.ZodString;
deprecation: z.ZodOptional<z.ZodObject<{
announced: z.ZodString;
unavailable_after: z.ZodString;
}, "strip", z.ZodTypeAny, {
announced: string;
unavailable_after: string;
}, {
announced: string;
unavailable_after: string;
}>>;
architecture: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
type: string;
name: string;
description: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}, {
id: number;
type: string;
name: string;
description: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
}>>;
rescue_enabled: z.ZodBoolean;
locked: z.ZodBoolean;
backup_window: z.ZodString;
outgoing_traffic: z.ZodNumber;
ingoing_traffic: z.ZodNumber;
included_traffic: z.ZodNumber;
protection: z.ZodObject<{
delete: z.ZodBoolean;
rebuild: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
delete: boolean;
rebuild: boolean;
}, {
delete: boolean;
rebuild: boolean;
}>;
labels: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>;
volumes: z.ZodArray<z.ZodNumber, "many">;
load_balancers: z.ZodArray<z.ZodNumber, "many">;
primary_disk_size: z.ZodNumber;
placement_group: z.ZodOptional<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
labels: z.ZodRecord<z.ZodString, z.ZodString>;
type: z.ZodString;
created: z.ZodString;
servers: z.ZodArray<z.ZodNumber, "many">;
}, "strip", z.ZodTypeAny, {
id: number;
type: string;
name: string;
created: string;
labels: Record<string, string>;
servers: number[];
}, {
id: number;
type: string;
name: string;
created: string;
labels: Record<string, string>;
servers: number[];
}>>;
}, "strip", z.ZodTypeAny, {
id: number;
status: ServerStatus;
included_traffic: number;
name: string;
created: string;
protection: {
delete: boolean;
rebuild: boolean;
};
labels: Record<string, string>;
public_net: {
ipv4: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
};
ipv6: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
};
floating_ips: number[];
firewalls: {
id: number;
status: string;
}[];
};
private_net: {
ip: string;
network: number;
alias_ips: string[];
mac_address: string;
}[];
server_type: {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
};
datacenter: {
id: number;
location: {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
};
name: string;
description: string;
server_types: {
supported: number[];
available: number[];
available_for_migration: number[];
};
};
rescue_enabled: boolean;
locked: boolean;
backup_window: string;
outgoing_traffic: number;
ingoing_traffic: number;
volumes: number[];
load_balancers: number[];
primary_disk_size: number;
image?: {
id: number;
status: string;
type: string;
name: string;
description: string;
architecture: string;
image_size: number;
disk_size: number;
created: string;
created_from: {
id: number;
name: string;
};
bound_to: number | null;
os_flavor: string;
os_version: string;
rapid_deploy: boolean;
protection: {
delete: boolean;
};
deleted: string | null;
labels: Record<string, string>;
deprecated?: string | undefined;
} | undefined;
iso?: {
id: number;
type: string;
name: string;
description: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
} | undefined;
placement_group?: {
id: number;
type: string;
name: string;
created: string;
labels: Record<string, string>;
servers: number[];
} | undefined;
}, {
id: number;
status: ServerStatus;
included_traffic: number;
name: string;
created: string;
protection: {
delete: boolean;
rebuild: boolean;
};
labels: Record<string, string>;
public_net: {
ipv4: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: string;
};
ipv6: {
id: number;
ip: string;
blocked: boolean;
dns_ptr: {
ip: string;
dns_ptr: string;
}[];
};
floating_ips: number[];
firewalls: {
id: number;
status: string;
}[];
};
private_net: {
ip: string;
network: number;
alias_ips: string[];
mac_address: string;
}[];
server_type: {
id: number;
name: string;
description: string;
cores: number;
memory: number;
disk: number;
deprecated: boolean;
prices: {
location: string;
price_hourly: {
net: string;
gross: string;
};
price_monthly: {
net: string;
gross: string;
};
included_traffic: number;
price_per_tb_traffic: {
net: string;
gross: string;
};
}[];
storage_type: string;
cpu_type: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
};
datacenter: {
id: number;
location: {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
};
name: string;
description: string;
server_types: {
supported: number[];
available: number[];
available_for_migration: number[];
};
};
rescue_enabled: boolean;
locked: boolean;
backup_window: string;
outgoing_traffic: number;
ingoing_traffic: number;
volumes: number[];
load_balancers: number[];
primary_disk_size: number;
image?: {
id: number;
status: string;
type: string;
name: string;
description: string;
architecture: string;
image_size: number;
disk_size: number;
created: string;
created_from: {
id: number;
name: string;
};
bound_to: number | null;
os_flavor: string;
os_version: string;
rapid_deploy: boolean;
protection: {
delete: boolean;
};
deleted: string | null;
labels: Record<string, string>;
deprecated?: string | undefined;
} | undefined;
iso?: {
id: number;
type: string;
name: string;
description: string;
architecture: string;
deprecation?: {
announced: string;
unavailable_after: string;
} | undefined;
} | undefined;
placement_group?: {
id: number;
type: string;
name: string;
created: string;
labels: Record<string, string>;
servers: number[];
} | undefined;
}>;
type Server = z.infer<typeof ServerSchema>;
/**
* Query parameters for listing servers.
*
* @property name - Filter by exact server name (optional).
* @property label_selector - Filter by label selector (optional).
* @property sort - Sort by field and direction (optional).
* Allowed values: id, name, created (+ :asc / :desc).
* @property status - Filter by server status (optional).
* Allowed values: running, initializing, starting, stopping, off, deleting, migrating, rebuilding, unknown.
* @property page - Page number (optional, defaults to 1 on API side).
* @property per_page - Entries per page (optional, defaults to 25 on API side).
*/
type GetServersQuery = {
name?: string;
label_selector?: string;
status?: string | string[];
sort?: string | string[];
page?: number;
per_page?: number;
};
type GetServersResponse = {
some(arg0: (s: any) => boolean): any;
servers: Server[];
meta: Meta;
};
declare function getServerById(serverId: number): Promise<Server>;
declare function deleteServer(serverId: number): Promise<Action>;
declare const LabelSchema: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>;
type Label = z.infer<typeof LabelSchema>;
type CreateServerOptions = {
name: string;
server_type: string;
image: string;
location?: string;
datacenter?: string;
start_after_create?: boolean;
placement_group?: number;
ssh_keys?: (string | number)[];
volumes?: number[];
networks?: number[];
firewalls?: {
firewall: number;
}[];
user_data?: string;
labels?: Label;
automount?: boolean;
public_net?: {
enable_ipv4?: boolean;
enable_ipv6?: boolean;
ipv4?: number | null;
ipv6?: number | null;
};
};
declare function createServer(options: CreateServerOptions): Promise<Server>;
type ServerMetrics = {
start: string;
end: string;
step: number;
time_series: {
[key: string]: {
values: [number, string][];
};
};
};
type GetServerMetricsParams = {
type: 'cpu' | 'disk' | 'network' | `${'cpu' | 'disk' | 'network'},${'cpu' | 'disk' | 'network'}`;
start?: string;
end?: string;
step?: number;
};
declare function getServerMetrics(serverId: number, params?: GetServerMetricsParams): Promise<ServerMetrics>;
type UpdateServerOptions = {
name?: string;
labels?: Label;
};
declare function updateServer(serverId: number, options: UpdateServerOptions): Promise<Server>;
declare function attachIso(serverId: number, iso: string | number): Promise<Action>;
declare function detachIso(serverId: number): Promise<Action>;
declare function rebuild(serverId: number, imageId: string): Promise<Action>;
declare function disableBackup(serverId: number): Promise<Action>;
declare function disableRescue(serverId: number): Promise<Action>;
type ResetPasswordResponse = {
root_password: string;
action: Action;
};
declare function resetPassword(serverId: number): Promise<ResetPasswordResponse>;
declare function changeProtection(serverId: number, deleteServer: boolean, rebuild: boolean): Promise<Action>;
type GetActionsResponse = {
actions: Action[];
meta: Meta;
};
declare function getActions(): Promise<GetActionsResponse>;
declare const LocationSchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodString;
country: z.ZodString;
city: z.ZodString;
latitude: z.ZodNumber;
longitude: z.ZodNumber;
network_zone: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
}, {
id: number;
name: string;
description: string;
country: string;
city: string;
latitude: number;
longitude: number;
network_zone: string;
}>;
type Location = z.infer<typeof LocationSchema>;
/**
* Query parameters for listing locationss.
*
* @property name - Filter by exact locations name (optional).
* @property sort - Sort by field and direction (optional).
* Allowed values: id, name, created (+ :asc / :desc).
* @property page - Page number (optional, defaults to 1 on API side).
* @property per_page - Entries per page (optional, defaults to 25 on API side).
*/
type GetLocationsQuery = {
name?: string;
sort?: string | string[];
page?: number;
per_page?: number;
};
type GetLocationsResponse = {
locations: Location[];
meta: Meta;
};
declare function getLocations(query?: GetLocationsQuery): Promise<GetLocationsResponse>;
declare function getLocation(locationId: number): Promise<Location>;
declare function sshIntoServer(ip: string, command: string, username: "root", privateKey?: string | undefined): Promise<{
stdout: string;
stderr: string;
}>;
type GetServerTypeResponse = {
server: ServerType;
};
declare function getServerTypeById(serverId: number): Promise<GetServerTypeResponse>;
declare const SSHKeySchema: z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
fingerprint: z.ZodString;
public_key: z.ZodString;
labels: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>;
created: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}, {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}>;
declare function getSSHKey(sshKeyId: number): Promise<z.infer<typeof SSHKeySchema>>;
/**
* Query parameters for listing locationss.
*
* @property name - Filter by exact locations name (optional).
* @property sort - Sort by field and direction (optional).
* Allowed values: id, name, created (+ :asc / :desc).
* @property fingerprint
* @property page - Page number (optional, defaults to 1 on API side).
* @property per_page - Entries per page (optional, defaults to 25 on API side).
*/
declare const GetSSHKeyQuerySchema: z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
sort: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
page: z.ZodOptional<z.ZodNumber>;
per_page: z.ZodOptional<z.ZodNumber>;
fingerprint: z.ZodOptional<z.ZodString>;
label_selector: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
sort?: string | string[] | undefined;
name?: string | undefined;
page?: number | undefined;
per_page?: number | undefined;
fingerprint?: string | undefined;
label_selector?: string | undefined;
}, {
sort?: string | string[] | undefined;
name?: string | undefined;
page?: number | undefined;
per_page?: number | undefined;
fingerprint?: string | undefined;
label_selector?: string | undefined;
}>;
type GetSSHKeyQuery = z.infer<typeof GetSSHKeyQuerySchema>;
declare const GetSSHKeyResponseSchema: z.ZodObject<{
ssh_keys: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
name: z.ZodString;
fingerprint: z.ZodString;
public_key: z.ZodString;
labels: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodString>;
created: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}, {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}>, "many">;
meta: z.ZodObject<{
pagination: z.ZodObject<{
page: z.ZodNumber;
per_page: z.ZodNumber;
previous_page: z.ZodNullable<z.ZodNumber>;
next_page: z.ZodNullable<z.ZodNumber>;
last_page: z.ZodNumber;
total_entries: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
}, {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
}>;
}, "strip", z.ZodTypeAny, {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
}, {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
}>;
}, "strip", z.ZodTypeAny, {
ssh_keys: {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}[];
meta: {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
};
}, {
ssh_keys: {
id: number;
name: string;
created: string;
labels: Record<string, string>;
fingerprint: string;
public_key: string;
}[];
meta: {
pagination: {
page: number;
per_page: number;
previous_page: number | null;
next_page: number | null;
last_page: number;
total_entries: number;
};
};
}>;
type GetSSHKeyResponse = z.infer<typeof GetSSHKeyResponseSchema>;
declare function getSSHKeys(query?: GetSSHKeyQuery): Promise<GetSSHKeyResponse>;
declare const hcloud: {
servers: {
list: (query?: GetServersQuery) => Promise<GetServersResponse>;
getById: typeof getServerById;
delete: typeof deleteServer;
create: typeof createServer;
getMetrics: typeof getServerMetrics;
update: typeof updateServer;
attachIso: typeof attachIso;
detachIso: typeof detachIso;
rebuild: typeof rebuild;
disableBackup: typeof disableBackup;
disableRescue: typeof disableRescue;
powerControl: {
on(serverId: number): Promise<Action>;
powerOff(serverId: number): Promise<Action>;
reboot(serverId: number): Promise<Action>;
reset(serverId: number): Promise<Action>;
shutdown(serverId: number): Promise<Action>;
};
resetPassword: typeof resetPassword;
changeProtection: typeof changeProtection;
listActions: typeof getActions;
sshIntoServer: typeof sshIntoServer;
listServerType: (query?: GetServerTypeQuery) => Promise<GetServersResponse$1>;
getServerTypeById: typeof getServerTypeById;
};
locations: {
list: typeof getLocations;
getById: typeof getLocation;
};
security: {
getSSHKey: typeof getSSHKey;
listSSHKeys: typeof getSSHKeys;
};
};
export { hcloud };